From 835b293d35a209d38047126443d41fa7090daa4c Mon Sep 17 00:00:00 2001
From: Justus Winter <justus@gnupg.org>
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.
---
 term/devio.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

(limited to 'term/devio.c')

diff --git a/term/devio.c b/term/devio.c
index eedd7b87..60ee2217 100644
--- a/term/devio.c
+++ b/term/devio.c
@@ -43,7 +43,7 @@
 #undef EXTA
 #undef EXTB
 
-#include <assert.h>
+#include <assert-backtrace.h>
 #include <errno.h>
 #include <error.h>
 #include <string.h>
@@ -459,15 +459,15 @@ initial_open ()
 {
   error_t err;
 
-  assert (open_pending != FAKE);
+  assert_backtrace (open_pending != FAKE);
 
   /* Nothing to do */
   if (open_pending == INITIAL)
     return 0;
 
-  assert (phys_device == MACH_PORT_NULL);
-  assert (phys_reply == MACH_PORT_NULL);
-  assert (phys_reply_pi == 0);
+  assert_backtrace (phys_device == MACH_PORT_NULL);
+  assert_backtrace (phys_reply == MACH_PORT_NULL);
+  assert_backtrace (phys_reply_pi == 0);
 
   err = ports_create_port (phys_reply_class, term_bucket,
 			   sizeof (struct port_info), &phys_reply_pi);
@@ -516,7 +516,7 @@ devio_assert_dtr ()
 
   /* Schedule a fake open to wait for DTR, unless one is already
      happening. */
-  assert (open_pending != INITIAL);
+  assert_backtrace (open_pending != INITIAL);
   if (open_pending == FAKE)
     return 0;
 
@@ -544,7 +544,7 @@ device_open_reply (mach_port_t replyport,
 
   pthread_mutex_lock (&global_lock);
 
-  assert (open_pending != NOTPENDING);
+  assert_backtrace (open_pending != NOTPENDING);
 
   if (returncode != 0)
     {
@@ -564,9 +564,9 @@ device_open_reply (mach_port_t replyport,
     {
       /* Special handling for the first open */
 
-      assert (phys_device == MACH_PORT_NULL);
-      assert (phys_reply_writes == MACH_PORT_NULL);
-      assert (phys_reply_writes_pi == 0);
+      assert_backtrace (phys_device == MACH_PORT_NULL);
+      assert_backtrace (phys_reply_writes == MACH_PORT_NULL);
+      assert_backtrace (phys_reply_writes_pi == 0);
       phys_device = device;
       err = ports_create_port (phys_reply_class, term_bucket,
 			       sizeof (struct port_info),
-- 
cgit v1.2.3