From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26300 invoked by alias); 25 Nov 2003 23:39:46 -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 26293 invoked from network); 25 Nov 2003 23:39:46 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 25 Nov 2003 23:39:46 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 898D22B8F; Tue, 25 Nov 2003 18:39:42 -0500 (EST) Message-ID: <3FC3E83E.6090805@redhat.com> Date: Tue, 25 Nov 2003 23:39:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Roland McGrath , Michael Snyder Cc: gdb-patches@sources.redhat.com Subject: Re: [rfa/threads] Convert thread event descriptors to code addrs References: <200311252300.hAPN016N015872@magilla.sf.frob.com> Content-Type: multipart/mixed; boundary="------------080106070605020108090001" X-SW-Source: 2003-11/txt/msg00587.txt.bz2 This is a multi-part message in MIME format. --------------080106070605020108090001 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 599 In the light of roland's comments, I've checked in the attached variation on the original patch. It still does the conversion but in GDB's libthread_db caller (enable_thread_event_reporting) and not in libthread_db's symbol lookup callee (ps_pglobal_lookup). This way, libthread_db is free to search for either: .__nptl_create_event: the start address __nptl_create_event: the descriptor (the original change would have restricted searches to just the start address - not a problem now but we never know) and at the same time ensure that GDB sets breakpoints at the address it needs. Andrew --------------080106070605020108090001 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 2358 2003-11-25 Andrew Cagney * thread-db.c (enable_thread_event): New function. Ensure that BP is a code address. (enable_thread_event_reporting): Use enable_thread_event. Index: ./gdb/thread-db.c =================================================================== RCS file: /cvs/src/src/gdb/thread-db.c,v retrieving revision 1.34 diff -u -r1.34 thread-db.c --- ./gdb/thread-db.c 4 Sep 2003 21:03:37 -0000 1.34 +++ ./gdb/thread-db.c 25 Nov 2003 23:28:49 -0000 @@ -465,6 +465,26 @@ return 1; } +static int +enable_thread_event (td_thragent_t *thread_agent, int event, CORE_ADDR *bp) +{ + td_notify_t notify; + int err; + + /* Get the breakpoint address for thread EVENT. */ + err = td_ta_event_addr_p (thread_agent, event, ¬ify); + if (err != TD_OK) + return 0; + + /* Set up the breakpoint. */ + (*bp) = gdbarch_convert_from_func_ptr_addr (current_gdbarch, + (CORE_ADDR) notify.u.bptaddr, + ¤t_target); + create_thread_event_breakpoint ((*bp)); + + return 1; +} + static void enable_thread_event_reporting (void) { @@ -498,32 +518,24 @@ /* Delete previous thread event breakpoints, if any. */ remove_thread_event_breakpoints (); + td_create_bp_addr = 0; + td_death_bp_addr = 0; - /* Get address for thread creation breakpoint. */ - err = td_ta_event_addr_p (thread_agent, TD_CREATE, ¬ify); - if (err != TD_OK) + /* Set up the thread creation event. */ + if (!enable_thread_event (thread_agent, TD_CREATE, &td_create_bp_addr)) { warning ("Unable to get location for thread creation breakpoint: %s", thread_db_err_str (err)); return; } - /* Set up the breakpoint. */ - td_create_bp_addr = (CORE_ADDR) notify.u.bptaddr; - create_thread_event_breakpoint (td_create_bp_addr); - - /* Get address for thread death breakpoint. */ - err = td_ta_event_addr_p (thread_agent, TD_DEATH, ¬ify); - if (err != TD_OK) + /* Set up the thread death event. */ + if (!enable_thread_event (thread_agent, TD_DEATH, &td_death_bp_addr)) { warning ("Unable to get location for thread death breakpoint: %s", thread_db_err_str (err)); return; } - - /* Set up the breakpoint. */ - td_death_bp_addr = (CORE_ADDR) notify.u.bptaddr; - create_thread_event_breakpoint (td_death_bp_addr); } static void --------------080106070605020108090001--