From 835b293d35a209d38047126443d41fa7090daa4c Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 19 Jun 2017 21:20:57 +0200 Subject: Use our own variant of 'assert' and 'assert_perror'. Our variants print stack traces on failures. This will make locating errors much easier. --- trans/streamio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'trans/streamio.c') diff --git a/trans/streamio.c b/trans/streamio.c index 5539c8ea..f276ad6b 100644 --- a/trans/streamio.c +++ b/trans/streamio.c @@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include -#include +#include #include #include #include @@ -74,11 +74,11 @@ static inline struct buffer * create_buffer (size_t size) { struct buffer *new = malloc (sizeof (struct buffer) + size); - assert (new); + assert_backtrace (new); new->head = new->tail = new->buf; new->size = size; new->wait = malloc (sizeof (pthread_cond_t)); - assert (new->wait); + assert_backtrace (new->wait); pthread_cond_init (new->wait, NULL); return new; } @@ -862,12 +862,12 @@ device_open_reply (mach_port_t reply, int returncode, mach_port_t device) } else if (err == 0) { - assert (sizes_len == DEV_GET_SIZE_COUNT); + assert_backtrace (sizes_len == DEV_GET_SIZE_COUNT); dev_blksize = sizes[DEV_GET_SIZE_RECORD_SIZE]; dev_size = sizes[DEV_GET_SIZE_DEVICE_SIZE]; - assert (dev_blksize && dev_blksize <= IO_INBAND_MAX); + assert_backtrace (dev_blksize && dev_blksize <= IO_INBAND_MAX); } else { @@ -990,7 +990,7 @@ dev_read (size_t amount, void **buf, size_t *len, int nowait) vm_allocate (mach_task_self (), (vm_address_t *)buf, max, 1); *len = buffer_read (input_buffer, *buf, max); - assert (*len == max); + assert_backtrace (*len == max); err = start_input (nowait); return err; @@ -1057,7 +1057,7 @@ start_output (int nowait) { int size; - assert (output_buffer); + assert_backtrace (output_buffer); size = buffer_size (output_buffer); -- cgit v1.2.3