summaryrefslogtreecommitdiff
path: root/exec
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-06-19 21:20:57 +0200
committerJustus Winter <justus@gnupg.org>2017-08-05 18:42:22 +0200
commit835b293d35a209d38047126443d41fa7090daa4c (patch)
tree5bf956895e6030f91cd618fb191b2151f6d25423 /exec
parentdc0b5a43224999223a246870912b0f292b1980e9 (diff)
Use our own variant of 'assert' and 'assert_perror'.
Our variants print stack traces on failures. This will make locating errors much easier.
Diffstat (limited to 'exec')
-rw-r--r--exec/elfcore.c14
-rw-r--r--exec/exec.c2
-rw-r--r--exec/hostarch.c2
-rw-r--r--exec/main.c14
-rw-r--r--exec/priv.h2
5 files changed, 17 insertions, 17 deletions
diff --git a/exec/elfcore.c b/exec/elfcore.c
index 3e4551e5..12ecf34f 100644
--- a/exec/elfcore.c
+++ b/exec/elfcore.c
@@ -40,7 +40,7 @@
#endif
#include <mach/thread_status.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#ifdef i386_THREAD_STATE
# define ELF_MACHINE EM_386
@@ -56,9 +56,9 @@ fetch_thread_regset (thread_t thread, prgregset_t *gregs)
prgregset_t gregs;
} *u = (void *) gregs;
mach_msg_type_number_t count = i386_THREAD_STATE_COUNT;
- assert (sizeof (struct i386_thread_state) < sizeof (prgregset_t));
- assert (offsetof (struct i386_thread_state, gs) == REG_GS * 4);
- assert (offsetof (struct i386_thread_state, eax) == REG_EAX * 4);
+ assert_backtrace (sizeof (struct i386_thread_state) < sizeof (prgregset_t));
+ assert_backtrace (offsetof (struct i386_thread_state, gs) == REG_GS * 4);
+ assert_backtrace (offsetof (struct i386_thread_state, eax) == REG_EAX * 4);
(void) thread_get_state (thread, i386_THREAD_STATE,
(thread_state_t) &u->state, &count);
@@ -82,7 +82,7 @@ fetch_thread_fpregset (thread_t thread, prfpregset_t *fpregs)
(thread_state_t) &st, &count);
if (err == 0 && st.initialized)
{
- assert (sizeof *fpregs >= sizeof st.hw_state);
+ assert_backtrace (sizeof *fpregs >= sizeof st.hw_state);
memcpy (fpregs, st.hw_state, sizeof st.hw_state);
}
}
@@ -96,7 +96,7 @@ static inline void
fetch_thread_regset (thread_t thread, prgregset_t *gregs)
{
mach_msg_type_number_t count = ALPHA_THREAD_STATE_COUNT;
- assert (sizeof (struct alpha_thread_state) <= sizeof (prgregset_t));
+ assert_backtrace (sizeof (struct alpha_thread_state) <= sizeof (prgregset_t));
(void) thread_get_state (thread, ALPHA_THREAD_STATE,
(thread_state_t) gregs, &count);
/* XXX
@@ -110,7 +110,7 @@ static inline void
fetch_thread_fpregset (thread_t thread, prfpregset_t *fpregs)
{
mach_msg_type_number_t count = ALPHA_FLOAT_STATE_COUNT;
- assert (sizeof (struct alpha_float_state) == sizeof *fpregs);
+ assert_backtrace (sizeof (struct alpha_float_state) == sizeof *fpregs);
(void) thread_get_state (thread, ALPHA_FLOAT_STATE,
(thread_state_t) fpregs, &count);
}
diff --git a/exec/exec.c b/exec/exec.c
index d6dd5d88..f5995ac5 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -368,7 +368,7 @@ map (struct execdata *e, off_t posn, size_t len)
char *buffer = map_buffer (e);
mach_msg_type_number_t nread = map_vsize (e);
- assert (e->file_data == NULL); /* Must be first or second case. */
+ assert_backtrace (e->file_data == NULL); /* Must be first or second case. */
/* Read as much as we can get into the buffer right now. */
e->error = io_read (e->file, &buffer, &nread, posn, round_page (len));
diff --git a/exec/hostarch.c b/exec/hostarch.c
index a5650279..363fda69 100644
--- a/exec/hostarch.c
+++ b/exec/hostarch.c
@@ -42,7 +42,7 @@ elf_machine_matches_host (ElfW(Half) e_machine)
(host_info_t) &hostinfo, &hostinfocnt);
if (err)
return err;
- assert (hostinfocnt == HOST_BASIC_INFO_COUNT);
+ assert_backtrace (hostinfocnt == HOST_BASIC_INFO_COUNT);
}
#define CACHE(test) ({ __label__ here; host_type = &&here; \
diff --git a/exec/main.c b/exec/main.c
index 2658df59..30b20da3 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -199,7 +199,7 @@ main (int argc, char **argv)
if (MACH_PORT_VALID (opt_device_master))
{
err = open_console (opt_device_master);
- assert_perror (err);
+ assert_perror_backtrace (err);
mach_port_deallocate (mach_task_self (), opt_device_master);
}
@@ -322,9 +322,9 @@ S_exec_init (struct trivfs_protid *protid,
mach_port_t right;
err = iohelp_create_empty_iouser (&user);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = trivfs_open (fsys, user, 0, MACH_PORT_NULL, &cred);
- assert_perror (err);
+ assert_perror_backtrace (err);
right = ports_get_send_right (cred);
proc_execdata_notify (procserver, right, MACH_MSG_TYPE_COPY_SEND);
@@ -332,10 +332,10 @@ S_exec_init (struct trivfs_protid *protid,
}
err = get_privileged_ports (&host_priv, &device_master);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = open_console (device_master);
- assert_perror (err);
+ assert_perror_backtrace (err);
mach_port_deallocate (mach_task_self (), device_master);
proc_register_version (procserver, host_priv, "exec", "", HURD_VERSION);
@@ -347,7 +347,7 @@ S_exec_init (struct trivfs_protid *protid,
/* Fall back to abusing the message port lookup. */
err = proc_getmsgport (procserver, HURD_PID_STARTUP, &startup);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
mach_port_deallocate (mach_task_self (), procserver);
@@ -355,7 +355,7 @@ S_exec_init (struct trivfs_protid *protid,
run once we call it. */
err = startup_essential_task (startup, mach_task_self (), MACH_PORT_NULL,
"exec", host_priv);
- assert_perror (err);
+ assert_perror_backtrace (err);
mach_port_deallocate (mach_task_self (), startup);
mach_port_deallocate (mach_task_self (), host_priv);
diff --git a/exec/priv.h b/exec/priv.h
index 733f35c0..be085803 100644
--- a/exec/priv.h
+++ b/exec/priv.h
@@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with the GNU Hurd; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>