[PATCH] fix error reporting for td_ta_event_addr calls

Roland McGrath roland@redhat.com
Wed Dec 3 02:52:00 GMT 2003


As it stands, if the libthread_db function td_ta_event_addr fails,
gdb will report "warning: Unable to get location for thread creation
breakpoint: generic 'call succeeded'", having discarded the actual error
code from the function.  This patch fixes that.

Approved to commit?


Thanks,
Roland


2003-12-02  Roland McGrath  <roland@redhat.com>

	* thread-db.c (enable_thread_event): Change return type to
	td_err_e.  Return TD_OK or error code.
	(enable_thread_event_reporting): Update callers.

--- thread-db.c.~1.35.~	2003-11-25 18:34:21.000000000 -0800
+++ thread-db.c	2003-12-02 18:09:55.000000000 -0800
@@ -465,16 +465,16 @@ thread_db_load (void)
   return 1;
 }
 
-static int
+static td_err_e
 enable_thread_event (td_thragent_t *thread_agent, int event, CORE_ADDR *bp)
 {
   td_notify_t notify;
-  int err;
+  td_err_e err;
 
   /* Get the breakpoint address for thread EVENT.  */
   err = td_ta_event_addr_p (thread_agent, event, &notify);
   if (err != TD_OK)
-    return 0;
+    return err;
 
   /* Set up the breakpoint.  */
   (*bp) = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
@@ -482,7 +482,7 @@ enable_thread_event (td_thragent_t *thre
 					      &current_target);
   create_thread_event_breakpoint ((*bp));
 
-  return 1;
+  return TD_OK;
 }
 
 static void
@@ -522,7 +522,8 @@ enable_thread_event_reporting (void)
   td_death_bp_addr = 0;
 
   /* Set up the thread creation event.  */
-  if (!enable_thread_event (thread_agent, TD_CREATE, &td_create_bp_addr))
+  err = enable_thread_event (thread_agent, TD_CREATE, &td_create_bp_addr);
+  if (err != TD_OK)
     {
       warning ("Unable to get location for thread creation breakpoint: %s",
 	       thread_db_err_str (err));
@@ -530,7 +531,8 @@ enable_thread_event_reporting (void)
     }
 
   /* Set up the thread death event.  */
-  if (!enable_thread_event (thread_agent, TD_DEATH, &td_death_bp_addr))
+  err = enable_thread_event (thread_agent, TD_DEATH, &td_death_bp_addr);
+  if (err != TD_OK)
     {
       warning ("Unable to get location for thread death breakpoint: %s",
 	       thread_db_err_str (err));



More information about the Gdb-patches mailing list