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 /libstore | |
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 'libstore')
-rw-r--r-- | libstore/argp.c | 4 | ||||
-rw-r--r-- | libstore/derive.c | 6 | ||||
-rw-r--r-- | libstore/device.c | 6 | ||||
-rw-r--r-- | libstore/memobj.c | 4 | ||||
-rw-r--r-- | libstore/part.c | 8 |
5 files changed, 14 insertions, 14 deletions
diff --git a/libstore/argp.c b/libstore/argp.c index 73146a8d..a9c7fbd6 100644 --- a/libstore/argp.c +++ b/libstore/argp.c @@ -19,7 +19,7 @@ 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ #include <string.h> -#include <assert.h> +#include <assert-backtrace.h> #include <hurd.h> #include <argp.h> #include <argz.h> @@ -217,7 +217,7 @@ store_parsed_open (const struct store_parsed *parsed, int flags, store_ileave_create (stores, num, parsed->interleave, flags, store); else if (parsed->layer) - assert (! parsed->layer); + assert_backtrace (! parsed->layer); else err = store_concat_create (stores, num, flags, store); } diff --git a/libstore/derive.c b/libstore/derive.c index a76fbe1c..be615b61 100644 --- a/libstore/derive.c +++ b/libstore/derive.c @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ -#include <assert.h> +#include <assert-backtrace.h> #include <sys/types.h> #include <mach.h> @@ -78,10 +78,10 @@ _store_derive (struct store *store) { while ((1 << store->log2_block_size) < bsize) store->log2_block_size++; - assert ((1 << store->log2_block_size) == bsize); + assert_backtrace ((1 << store->log2_block_size) == bsize); while ((bsize << store->log2_blocks_per_page) < vm_page_size) store->log2_blocks_per_page++; - assert ((bsize << store->log2_blocks_per_page) == vm_page_size); + assert_backtrace ((bsize << store->log2_blocks_per_page) == vm_page_size); } } diff --git a/libstore/device.c b/libstore/device.c index 3a72df48..b350bc7b 100644 --- a/libstore/device.c +++ b/libstore/device.c @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ -#include <assert.h> +#include <assert-backtrace.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -146,7 +146,7 @@ enforced (struct store *store) if (!err) { - assert (sizes_len == DEV_GET_RECORDS_COUNT); + assert_backtrace (sizes_len == DEV_GET_RECORDS_COUNT); if (sizes[DEV_GET_RECORDS_RECORD_SIZE] != store->block_size || (store->runs[0].length != @@ -165,7 +165,7 @@ enforced (struct store *store) if (err) return EINVAL; - assert (sizes_len == DEV_GET_SIZE_COUNT); + assert_backtrace (sizes_len == DEV_GET_SIZE_COUNT); if (sizes[DEV_GET_SIZE_RECORD_SIZE] != store->block_size || (store->runs[0].length != diff --git a/libstore/memobj.c b/libstore/memobj.c index 0849151a..ea2d7b9a 100644 --- a/libstore/memobj.c +++ b/libstore/memobj.c @@ -22,7 +22,7 @@ #include <hurd/sigpreempt.h> #include <sys/mman.h> #include <string.h> -#include <assert.h> +#include <assert-backtrace.h> /* Return a new store in STORE referring to the memory object MEMOBJ. @@ -101,7 +101,7 @@ memobj_memcpy (memory_object_t memobj, jmp_buf buf; void fault (int signo, long int sigcode, struct sigcontext *scp) { - assert (scp->sc_error == EKERN_MEMORY_ERROR); + assert_backtrace (scp->sc_error == EKERN_MEMORY_ERROR); err = EIO; to_copy -= sigcode - window; siglongjmp (buf, 1); diff --git a/libstore/part.c b/libstore/part.c index 0ef2bd4b..349d90f5 100644 --- a/libstore/part.c +++ b/libstore/part.c @@ -21,7 +21,7 @@ #include "store.h" #include <stdlib.h> #include <errno.h> -#include <assert.h> +#include <assert-backtrace.h> #include <pthread.h> #include <parted/parted.h> @@ -99,7 +99,7 @@ store_part_create (struct store *source, int index, int flags, goto out; } - assert (ped_device_open (dev) != 0); + assert_backtrace (ped_device_open (dev) != 0); disk = ped_disk_new (dev); if (! disk) @@ -116,7 +116,7 @@ store_part_create (struct store *source, int index, int flags, && part->type != 0 /* PED_PARTITION_PRIMARY */) continue; - assert (part->num); + assert_backtrace (part->num); if (part->num == index) break; } @@ -155,7 +155,7 @@ store_part_create (struct store *source, int index, int flags, } out_with_disk: - assert (ped_device_close (dev) != 0); + assert_backtrace (ped_device_close (dev) != 0); ped_disk_destroy (disk); out_with_dev: ped_device_destroy (dev); |