aboutsummaryrefslogtreecommitdiff
path: root/console
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 /console
parentdc0b5a43224999223a246870912b0f292b1980e9 (diff)
downloadhurd-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 'console')
-rw-r--r--console/console.c10
-rw-r--r--console/display.c14
-rw-r--r--console/pager.c10
3 files changed, 17 insertions, 17 deletions
diff --git a/console/console.c b/console/console.c
index 9c5869dd..94de0049 100644
--- a/console/console.c
+++ b/console/console.c
@@ -459,7 +459,7 @@ void
netfs_node_norefs (struct node *np)
{
/* The root node does never go away. */
- assert (!np->nn->cons && np->nn->vcons);
+ assert_backtrace (!np->nn->cons && np->nn->vcons);
free (np->nn);
free (np);
@@ -654,7 +654,7 @@ netfs_attempt_lookup (struct iouser *user, struct node *dir,
/* This is a virtual console directory node. */
vcons_t vcons = dir->nn->vcons;
int ref_vcons = 0;
- assert (dir == vcons->dir_node);
+ assert_backtrace (dir == vcons->dir_node);
if (!strcmp (name, "console"))
{
@@ -1057,7 +1057,7 @@ netfs_attempt_set_size (struct iouser *cred, struct node *np, off_t size)
|| np == vcons->disp_node)
return EOPNOTSUPP;
- assert (np == vcons->cons_node || np == vcons->inpt_node);
+ assert_backtrace (np == vcons->cons_node || np == vcons->inpt_node);
return 0;
}
@@ -1140,7 +1140,7 @@ netfs_attempt_read (struct iouser *cred, struct node *np,
{
/* Pass display content to caller. */
ssize_t amt = *len;
- assert (np == vcons->disp_node);
+ assert_backtrace (np == vcons->disp_node);
if (offset + amt > np->nn_stat.st_size)
amt = np->nn_stat.st_size - offset;
@@ -1187,7 +1187,7 @@ netfs_attempt_write (struct iouser *cred, struct node *np,
int amt;
/* The input driver is writing to the input device. Feed the
data into the input queue. */
- assert (np == vcons->inpt_node);
+ assert_backtrace (np == vcons->inpt_node);
amt = input_enqueue (vcons->input,
/* cred->po->openstat & O_NONBLOCK */ 1,
diff --git a/console/display.c b/console/display.c
index ed5571e6..20914955 100644
--- a/console/display.c
+++ b/console/display.c
@@ -26,7 +26,7 @@
#include <iconv.h>
#include <argp.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <error.h>
#include <pthread.h>
@@ -325,7 +325,7 @@ do_mach_notify_port_deleted (struct port_info *pi, mach_port_t name)
{
/* As we cancel the dead-name notification before deallocating the
port, this should not happen. */
- assert (0);
+ assert_backtrace (0);
}
/* We request dead name notifications for the user ports. */
@@ -376,7 +376,7 @@ do_mach_notify_dead_name (struct port_info *pi, mach_port_t dead_name)
error_t
do_mach_notify_port_destroyed (struct port_info *pi, mach_port_t rights)
{
- assert (0);
+ assert_backtrace (0);
}
error_t
@@ -409,7 +409,7 @@ do_mach_notify_msg_accepted (struct port_info *pi, mach_port_t send)
case. */
if (!send)
{
- assert(0);
+ assert_backtrace (0);
return 0;
}
@@ -424,7 +424,7 @@ do_mach_notify_msg_accepted (struct port_info *pi, mach_port_t send)
here. */
if (! *preq)
{
- assert(0);
+ assert_backtrace (0);
pthread_mutex_unlock (&display->lock);
return 0;
}
@@ -526,7 +526,7 @@ display_notice_changes (display_t display, mach_port_t notify)
pthread_mutex_unlock (&display->lock);
return err;
}
- assert (old == MACH_PORT_NULL);
+ assert_backtrace (old == MACH_PORT_NULL);
req->port = notify;
req->pending = 0;
@@ -1820,7 +1820,7 @@ display_output_some (display_t display, char **buffer, size_t *length)
#define UNICODE_REPLACEMENT_CHARACTER ((wchar_t) 0xfffd)
if (saved_err == EILSEQ)
{
- assert (*length);
+ assert_backtrace (*length);
(*length)--;
(*buffer)++;
display_output_one (display, UNICODE_REPLACEMENT_CHARACTER);
diff --git a/console/pager.c b/console/pager.c
index d60935a1..a18d4d13 100644
--- a/console/pager.c
+++ b/console/pager.c
@@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <error.h>
#include <stdio.h>
@@ -80,7 +80,7 @@ error_t
pager_write_page (struct user_pager_info *upi, vm_offset_t page,
vm_address_t buf)
{
- assert (upi->memobj_pages[page / vm_page_size] == (vm_address_t) NULL);
+ assert_backtrace (upi->memobj_pages[page / vm_page_size] == (vm_address_t) NULL);
upi->memobj_pages[page / vm_page_size] = buf;
return 0;
}
@@ -90,7 +90,7 @@ error_t
pager_unlock_page (struct user_pager_info *pager,
vm_offset_t address)
{
- assert (!"unlocking requested on unlocked page");
+ assert_backtrace (!"unlocking requested on unlocked page");
return 0;
}
@@ -99,7 +99,7 @@ void
pager_notify_evict (struct user_pager_info *pager,
vm_offset_t page)
{
- assert (!"unrequested notification on eviction");
+ assert_backtrace (!"unrequested notification on eviction");
}
@@ -207,7 +207,7 @@ user_pager_get_filemap (struct user_pager *user_pager, vm_prot_t prot)
/* Add a reference for each call, the caller will deallocate it. */
err = mach_port_mod_refs (mach_task_self (), user_pager->memobj,
MACH_PORT_RIGHT_SEND, +1);
- assert_perror (err);
+ assert_perror_backtrace (err);
return user_pager->memobj;
}