public inbox for rda@sourceware.org
 help / color / mirror / Atom feed
* RFA: Use td_symbol_list to request symbols if present
@ 2004-10-19 22:27 Jim Blandy
  2004-10-20 15:39 ` Kevin Buettner
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Blandy @ 2004-10-19 22:27 UTC (permalink / raw)
  To: rda


The presence of the td_symbol_list function in recent LinuxThreads and
NPTL libthread_db libraries means that RDA can reliably use the
current GDB remote protocol, unchanged, to satisfy all libthread_db
symbol lookups.

2004-10-19  Jim Blandy  <jimb@redhat.com>

	Use the libthread_db 'td_symbol_list' function to look up all the
	symbols libthread_db will need when invited to by GDB.
	* thread-db.c (add_symbol_to_list): Make 'name' argument const.
	(td_symbol_list_p): New libthread_db function pointer.
	(thread_db_dlopen): Initialize it.

Index: rda/unix/thread-db.c
===================================================================
RCS file: /cvs/src/src/rda/unix/thread-db.c,v
retrieving revision 1.6
diff -c -r1.6 thread-db.c
*** rda/unix/thread-db.c	19 Oct 2004 21:20:08 -0000	1.6
--- rda/unix/thread-db.c	19 Oct 2004 22:21:50 -0000
***************
*** 70,76 ****
     for those that have already been defined by the debugger. */
  
  static void
! add_symbol_to_list (char *name, paddr_t value, int defined_p)
  {
    struct symbol_cache *tmp;
  
--- 70,76 ----
     for those that have already been defined by the debugger. */
  
  static void
! add_symbol_to_list (const char *name, paddr_t value, int defined_p)
  {
    struct symbol_cache *tmp;
  
***************
*** 374,379 ****
--- 374,381 ----
  					  void *xregs);
  static td_err_e (*td_thr_event_enable_p) (const td_thrhandle_t *th, 
  					  int event);
+ static const char **(*td_symbol_list_p)  (void);
+ 
  
  /* Function: thread_db_state_str
     Convert a thread_db state code to a string.
***************
*** 825,830 ****
--- 827,833 ----
    td_thr_getxregsize_p  = dlsym (dlhandle, "td_thr_getxregsize");
    td_thr_getxregs_p     = dlsym (dlhandle, "td_thr_getxregs");
    td_thr_setxregs_p     = dlsym (dlhandle, "td_thr_setxregs");
+   td_symbol_list_p      = dlsym (dlhandle, "td_symbol_list");
  
    return 0;		/* success */
  }
***************
*** 2284,2297 ****
    else
      fprintf (stderr, "< ERROR attach: GDB will not read thread regs. >>>\n");
  
!   /* KLUDGE: Insert some magic symbols into the cached symbol list,
!      to be looked up later.  This is badly wrong -- we should be 
!      obtaining these values thru the thread_db interface.  Their names
!      should not be hard-coded here <sob>. */
!   add_symbol_to_list ("__pthread_sig_restart",   0, UNDEFINED);
!   add_symbol_to_list ("__pthread_sig_cancel",    0, UNDEFINED);
!   add_symbol_to_list ("__pthread_sig_debug",     0, UNDEFINED);
!   add_symbol_to_list ("__pthread_threads_debug", 0, UNDEFINED);
  
    /* Attempt to open the thread_db interface.  This attempt will 
       most likely fail (unles the child is statically linked). */
--- 2307,2334 ----
    else
      fprintf (stderr, "< ERROR attach: GDB will not read thread regs. >>>\n");
  
!   if (td_symbol_list_p)
!     {
!       /* Take all the symbol names libthread_db might try to look up
! 	 and place them in our cached symbol list, to be looked up
! 	 when invited by GDB.  */
!       const char **symbol_list = td_symbol_list_p ();
!       int i;
! 
!       for (i = 0; symbol_list[i]; i++)
! 	add_symbol_to_list (symbol_list[i], 0, UNDEFINED);
!     }
!   else
!     {
!       /* KLUDGE: Insert some magic symbols into the cached symbol list,
! 	 to be looked up later.  This is badly wrong -- we should be 
! 	 obtaining these values thru the thread_db interface.  Their names
! 	 should not be hard-coded here <sob>. */
!       add_symbol_to_list ("__pthread_sig_restart",   0, UNDEFINED);
!       add_symbol_to_list ("__pthread_sig_cancel",    0, UNDEFINED);
!       add_symbol_to_list ("__pthread_sig_debug",     0, UNDEFINED);
!       add_symbol_to_list ("__pthread_threads_debug", 0, UNDEFINED);
!     }
  
    /* Attempt to open the thread_db interface.  This attempt will 
       most likely fail (unles the child is statically linked). */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFA: Use td_symbol_list to request symbols if present
  2004-10-19 22:27 RFA: Use td_symbol_list to request symbols if present Jim Blandy
@ 2004-10-20 15:39 ` Kevin Buettner
  2004-10-20 19:29   ` Jim Blandy
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2004-10-20 15:39 UTC (permalink / raw)
  To: Jim Blandy; +Cc: rda

On 19 Oct 2004 17:25:56 -0500
Jim Blandy <jimb@redhat.com> wrote:

> The presence of the td_symbol_list function in recent LinuxThreads and
> NPTL libthread_db libraries means that RDA can reliably use the
> current GDB remote protocol, unchanged, to satisfy all libthread_db
> symbol lookups.
> 
> 2004-10-19  Jim Blandy  <jimb@redhat.com>
> 
> 	Use the libthread_db 'td_symbol_list' function to look up all the
> 	symbols libthread_db will need when invited to by GDB.
> 	* thread-db.c (add_symbol_to_list): Make 'name' argument const.
> 	(td_symbol_list_p): New libthread_db function pointer.
> 	(thread_db_dlopen): Initialize it.

Okay.

Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFA: Use td_symbol_list to request symbols if present
  2004-10-20 15:39 ` Kevin Buettner
@ 2004-10-20 19:29   ` Jim Blandy
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Blandy @ 2004-10-20 19:29 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: rda

Kevin Buettner <kevinb@redhat.com> writes:

> On 19 Oct 2004 17:25:56 -0500
> Jim Blandy <jimb@redhat.com> wrote:
> 
> > The presence of the td_symbol_list function in recent LinuxThreads and
> > NPTL libthread_db libraries means that RDA can reliably use the
> > current GDB remote protocol, unchanged, to satisfy all libthread_db
> > symbol lookups.
> > 
> > 2004-10-19  Jim Blandy  <jimb@redhat.com>
> > 
> > 	Use the libthread_db 'td_symbol_list' function to look up all the
> > 	symbols libthread_db will need when invited to by GDB.
> > 	* thread-db.c (add_symbol_to_list): Make 'name' argument const.
> > 	(td_symbol_list_p): New libthread_db function pointer.
> > 	(thread_db_dlopen): Initialize it.
> 
> Okay.

Committed, thanks.  I fixed the ChangeLog entry:

2004-10-20  Jim Blandy  <jimb@redhat.com>

	Use the libthread_db 'td_symbol_list' function to look up all the
	symbols libthread_db will need when invited to by GDB.
	* thread-db.c (add_symbol_to_list): Make 'name' argument const.
	(td_symbol_list_p): New libthread_db function pointer.
	(thread_db_dlopen): Initialize it.
	(thread_db_attach): Use td_symbol_list to pre-load our symbol
	cache with the names of all the symbols libthread_db will ever
	request.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-10-20 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-19 22:27 RFA: Use td_symbol_list to request symbols if present Jim Blandy
2004-10-20 15:39 ` Kevin Buettner
2004-10-20 19:29   ` Jim Blandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).