Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Roland McGrath <roland@redhat.com>, Michael Snyder <msnyder@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfa/threads] Convert thread event descriptors to code addrs
Date: Tue, 25 Nov 2003 23:39:00 -0000	[thread overview]
Message-ID: <3FC3E83E.6090805@redhat.com> (raw)
In-Reply-To: <200311252300.hAPN016N015872@magilla.sf.frob.com>

[-- Attachment #1: Type: text/plain, Size: 599 bytes --]

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

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2358 bytes --]

2003-11-25  Andrew Cagney  <cagney@redhat.com>

	* 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, &notify);
+  if (err != TD_OK)
+    return 0;
+
+  /* Set up the breakpoint.  */
+  (*bp) = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+					      (CORE_ADDR) notify.u.bptaddr,
+					      &current_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, &notify);
-  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, &notify);
-  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

  reply	other threads:[~2003-11-25 23:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-25 21:13 Andrew Cagney
2003-11-25 22:02 ` Michael Snyder
2003-11-25 22:27 ` Roland McGrath
2003-11-25 22:46   ` Andrew Cagney
2003-11-25 23:00     ` Roland McGrath
2003-11-25 23:39       ` Andrew Cagney [this message]
2003-11-26  4:26         ` Daniel Jacobowitz
2003-12-01 15:56           ` Andrew Cagney
2003-12-01 16:01             ` Daniel Jacobowitz
2003-12-03  4:09               ` Andrew Cagney
2003-11-25 23:00     ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3FC3E83E.6090805@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=msnyder@redhat.com \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox