diff options
author | Justus Winter <justus@gnupg.org> | 2017-06-19 21:20:57 +0200 |
---|---|---|
committer | Justus Winter <justus@gnupg.org> | 2017-08-05 18:42:22 +0200 |
commit | 835b293d35a209d38047126443d41fa7090daa4c (patch) | |
tree | 5bf956895e6030f91cd618fb191b2151f6d25423 /mach-defpager | |
parent | dc0b5a43224999223a246870912b0f292b1980e9 (diff) | |
download | hurd-835b293d35a209d38047126443d41fa7090daa4c.tar.gz hurd-835b293d35a209d38047126443d41fa7090daa4c.tar.bz2 hurd-835b293d35a209d38047126443d41fa7090daa4c.zip |
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 'mach-defpager')
-rw-r--r-- | mach-defpager/Makefile | 2 | ||||
-rw-r--r-- | mach-defpager/default_pager.c | 42 | ||||
-rw-r--r-- | mach-defpager/setup.c | 16 |
3 files changed, 30 insertions, 30 deletions
diff --git a/mach-defpager/Makefile b/mach-defpager/Makefile index 3b8ce58e..9bf394e7 100644 --- a/mach-defpager/Makefile +++ b/mach-defpager/Makefile @@ -29,7 +29,7 @@ OBJS := $(SRCS:.c=.o) \ memory_object default_pager memory_object_default exc) \ default_pager_replyUser.o -HURDLIBS:= ihash +HURDLIBS:= ihash shouldbeinlibc LDLIBS:= -lpthread include ../Makeconf diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c index aafa2cf3..d2220c5a 100644 --- a/mach-defpager/default_pager.c +++ b/mach-defpager/default_pager.c @@ -50,7 +50,7 @@ #include "kalloc.h" #include "default_pager.h" -#include <assert.h> +#include <assert-backtrace.h> #include <errno.h> #include <stdio.h> #include <string.h> @@ -1137,7 +1137,7 @@ void pager_release_offset(pager, offset) pthread_mutex_lock(&pager->lock); /* XXX lock_read */ - assert (pager->map); + assert_backtrace (pager->map); if (INDIRECT_PAGEMAP(pager->size)) { dp_map_t mapptr; @@ -2164,7 +2164,7 @@ void pager_port_check_request(ds, pager_request) mach_port_delta_t delta; kern_return_t kr; - assert(ds->pager_request == pager_request); + assert_backtrace (ds->pager_request == pager_request); if (++ds->request_refs > default_pager_max_urefs) { delta = 1 - ds->request_refs; @@ -2249,10 +2249,10 @@ seqnos_memory_object_create(old_pager, seqno, new_pager, new_size, { default_pager_t ds; - assert(old_pager == default_pager_default_port); - assert(MACH_PORT_VALID(new_pager_request)); - assert(MACH_PORT_VALID(new_pager_name)); - assert(new_page_size == vm_page_size); + assert_backtrace (old_pager == default_pager_default_port); + assert_backtrace (MACH_PORT_VALID(new_pager_request)); + assert_backtrace (MACH_PORT_VALID(new_pager_name)); + assert_backtrace (new_page_size == vm_page_size); ds = pager_port_alloc(new_size); @@ -2293,9 +2293,9 @@ seqnos_memory_object_init(ds, seqno, pager_request, pager_name, kern_return_t kr; static char here[] = "%sinit"; - assert(MACH_PORT_VALID(pager_request)); - assert(MACH_PORT_VALID(pager_name)); - assert(pager_page_size == vm_page_size); + assert_backtrace (MACH_PORT_VALID(pager_request)); + assert_backtrace (MACH_PORT_VALID(pager_name)); + assert_backtrace (pager_page_size == vm_page_size); if (ds == DEFAULT_PAGER_NULL) panic(here, my_name); @@ -2371,7 +2371,7 @@ ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_lock: <%p>[s:%d,r:%d, pager_request = ds->pager_request; ds->pager_request = MACH_PORT_NULL; ds->request_refs = 0; - assert(ds->pager_name == pager_name); + assert_backtrace (ds->pager_name == pager_name); ds->pager_name = MACH_PORT_NULL; ds->name_refs = 0; ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_unlock: <%p>[s:%d,r:%d,w:%d,l:%d]\n", @@ -2660,8 +2660,8 @@ seqnos_memory_object_data_return(ds, seqno, pager_request, vm_size_t limit = ds->dpager.byte_limit; pager_port_unlock(ds); if ((limit != round_page(limit)) && (trunc_page(limit) == offset)) { - assert(trunc_page(limit) == offset); - assert(data_cnt == vm_page_size); + assert_backtrace (trunc_page(limit) == offset); + assert_backtrace (data_cnt == vm_page_size); vm_offset_t tail = addr + limit - trunc_page(limit); vm_size_t tail_size = round_page(limit) - limit; @@ -2807,16 +2807,16 @@ boolean_t default_pager_notify_server(in, out) return FALSE; } - assert(ds != DEFAULT_PAGER_NULL); + assert_backtrace (ds != DEFAULT_PAGER_NULL); - assert(n->not_header.msgh_size == sizeof *n); - assert(n->not_header.msgh_remote_port == MACH_PORT_NULL); + assert_backtrace (n->not_header.msgh_size == sizeof *n); + assert_backtrace (n->not_header.msgh_remote_port == MACH_PORT_NULL); - assert(n->not_type.msgt_name == MACH_MSG_TYPE_INTEGER_32); - assert(n->not_type.msgt_size == 32); - assert(n->not_type.msgt_number == 1); - assert(n->not_type.msgt_inline); - assert(! n->not_type.msgt_longform); + assert_backtrace (n->not_type.msgt_name == MACH_MSG_TYPE_INTEGER_32); + assert_backtrace (n->not_type.msgt_size == 32); + assert_backtrace (n->not_type.msgt_number == 1); + assert_backtrace (n->not_type.msgt_inline); + assert_backtrace (! n->not_type.msgt_longform); default_pager_no_senders(ds, n->not_header.msgh_seqno, n->not_count); diff --git a/mach-defpager/setup.c b/mach-defpager/setup.c index e4ec8d96..94685c0e 100644 --- a/mach-defpager/setup.c +++ b/mach-defpager/setup.c @@ -20,7 +20,7 @@ #include <errno.h> #include <stddef.h> -#include <assert.h> +#include <assert-backtrace.h> #include <mach.h> #include <string.h> #include <strings.h> @@ -115,12 +115,12 @@ page_read_file_direct (struct file_direct *fdp, char *page; mach_msg_type_number_t nread; - assert (page_aligned (offset)); - assert (size == vm_page_size); + assert_backtrace (page_aligned (offset)); + assert_backtrace (size == vm_page_size); offset >>= fdp->bshift; - assert (offset + (size >> fdp->bshift) <= fdp->fd_size); + assert_backtrace (offset + (size >> fdp->bshift) <= fdp->fd_size); /* Find the run containing the beginning of the page. */ for (r = fdp->runs; offset > r->length; ++r) @@ -179,12 +179,12 @@ page_write_file_direct(struct file_direct *fdp, error_t err; int wrote; - assert (page_aligned (offset)); - assert (size == vm_page_size); + assert_backtrace (page_aligned (offset)); + assert_backtrace (size == vm_page_size); offset >>= fdp->bshift; - assert (offset + (size >> fdp->bshift) <= fdp->fd_size); + assert_backtrace (offset + (size >> fdp->bshift) <= fdp->fd_size); /* Find the run containing the beginning of the page. */ for (r = fdp->runs; offset > r->length; ++r) @@ -251,7 +251,7 @@ add_paging_file(master_device_port, file_name, linux_signature) natural_t count; char *devname = file_name; - assert (linux_signature == 0); + assert_backtrace (linux_signature == 0); if (!strncmp (file_name, "/dev/", 5)) devname += 5; |