From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26054 invoked by alias); 3 Dec 2003 02:52:02 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 26020 invoked from network); 3 Dec 2003 02:52:01 -0000 Received: from unknown (HELO gateway.sf.frob.com) (64.81.54.130) by sources.redhat.com with SMTP; 3 Dec 2003 02:52:01 -0000 Received: from magilla.sf.frob.com (magilla.sf.frob.com [198.49.250.228]) by gateway.sf.frob.com (Postfix) with ESMTP id 5051D357B; Tue, 2 Dec 2003 18:52:00 -0800 (PST) Received: from magilla.sf.frob.com (localhost.localdomain [127.0.0.1]) by magilla.sf.frob.com (8.12.9/8.12.9) with ESMTP id hB32q0Hi021806; Tue, 2 Dec 2003 18:52:00 -0800 Received: (from roland@localhost) by magilla.sf.frob.com (8.12.9/8.12.9/Submit) id hB32pxHO021802; Tue, 2 Dec 2003 18:51:59 -0800 Date: Wed, 03 Dec 2003 02:52:00 -0000 Message-Id: <200312030251.hB32pxHO021802@magilla.sf.frob.com> From: Roland McGrath To: gdb-patches@sources.redhat.com Subject: [PATCH] fix error reporting for td_ta_event_addr calls X-Windows: it could happen to you. X-SW-Source: 2003-12/txt/msg00063.txt.bz2 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 * 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, ¬ify); 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 ¤t_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));