Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit] Reduce target_thread_alive calls on GNU/Linux
@ 2007-05-07  0:49 Daniel Jacobowitz
  2007-05-07  7:27 ` Mark Kettenis
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-05-07  0:49 UTC (permalink / raw)
  To: gdb-patches

I discussed this FIXME with Mark Kettenis way back in October 2001.
The issue it's describing no longer exists, whatever it was - that's
trivially easy to see by following the indirect function call into
linux_nat_xfer_partial, which handles either LWPs or non-LWPs the
same, so we don't need to distinguish them here.  This chops the
number of ptrace operations for a memory read down quite a bit.

Tested x86_64-linux and committed.

-- 
Daniel Jacobowitz
CodeSourcery

2007-05-06  Daniel Jacobowitz  <dan@codesourcery.com>

	* linux-thread-db.c: Update some FIXME comments.
	(thread_db_xfer_partial): Delete.
	(init_thread_db_ops): Do not set to_xfer_partial.

Index: gdb/linux-thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
retrieving revision 1.26
diff -u -p -r1.26 linux-thread-db.c
--- gdb/linux-thread-db.c	5 Feb 2007 20:02:51 -0000	1.26
+++ gdb/linux-thread-db.c	6 May 2007 15:31:41 -0000
@@ -52,11 +52,6 @@
 /* If we're running on GNU/Linux, we must explicitly attach to any new
    threads.  */
 
-/* FIXME: There is certainly some room for improvements:
-   - Cache LWP ids.
-   - Bypass libthread_db when fetching or storing registers for
-   threads bound to a LWP.  */
-
 /* This module's target vector.  */
 static struct target_ops thread_db_ops;
 
@@ -486,9 +481,9 @@ enable_thread_event_reporting (void)
   td_event_addset (&events, TD_CREATE);
 
 #ifdef HAVE_GNU_LIBC_VERSION_H
-  /* FIXME: kettenis/2000-04-23: The event reporting facility is
-     broken for TD_DEATH events in glibc 2.1.3, so don't enable it for
-     now.  */
+  /* The event reporting facility is broken for TD_DEATH events in
+     glibc 2.1.3, so don't enable it we have glibc but a lower
+     version.  */
   libc_version = gnu_get_libc_version ();
   if (sscanf (libc_version, "%d.%d", &libc_major, &libc_minor) == 2
       && (libc_major > 2 || (libc_major == 2 && libc_minor > 1)))
@@ -926,31 +921,6 @@ thread_db_wait (ptid_t ptid, struct targ
   return ptid;
 }
 
-static LONGEST
-thread_db_xfer_partial (struct target_ops *ops, enum target_object object,
-			const char *annex, gdb_byte *readbuf,
-			const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
-{
-  struct cleanup *old_chain = save_inferior_ptid ();
-  LONGEST xfer;
-
-  if (is_thread (inferior_ptid))
-    {
-      /* FIXME: This seems to be necessary to make sure breakpoints
-         are removed.  */
-      if (!target_thread_alive (inferior_ptid))
-	inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid));
-      else
-	inferior_ptid = lwp_from_thread (inferior_ptid);
-    }
-
-  xfer = target_beneath->to_xfer_partial (ops, object, annex,
-					  readbuf, writebuf, offset, len);
-
-  do_cleanups (old_chain);
-  return xfer;
-}
-
 static void
 thread_db_kill (void)
 {
@@ -1146,7 +1116,6 @@ init_thread_db_ops (void)
   thread_db_ops.to_detach = thread_db_detach;
   thread_db_ops.to_resume = thread_db_resume;
   thread_db_ops.to_wait = thread_db_wait;
-  thread_db_ops.to_xfer_partial = thread_db_xfer_partial;
   thread_db_ops.to_kill = thread_db_kill;
   thread_db_ops.to_create_inferior = thread_db_create_inferior;
   thread_db_ops.to_post_startup_inferior = thread_db_post_startup_inferior;


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

* Re: [commit] Reduce target_thread_alive calls on GNU/Linux
  2007-05-07  0:49 [commit] Reduce target_thread_alive calls on GNU/Linux Daniel Jacobowitz
@ 2007-05-07  7:27 ` Mark Kettenis
  2007-05-11 17:43   ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2007-05-07  7:27 UTC (permalink / raw)
  To: drow; +Cc: gdb-patches

> Date: Sun, 6 May 2007 20:49:09 -0400
> From: Daniel Jacobowitz <drow@false.org>
> Index: gdb/linux-thread-db.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
> retrieving revision 1.26
> diff -u -p -r1.26 linux-thread-db.c
> --- gdb/linux-thread-db.c	5 Feb 2007 20:02:51 -0000	1.26
> +++ gdb/linux-thread-db.c	6 May 2007 15:31:41 -0000
> @@ -486,9 +481,9 @@ enable_thread_event_reporting (void)
>    td_event_addset (&events, TD_CREATE);
>  
>  #ifdef HAVE_GNU_LIBC_VERSION_H
> -  /* FIXME: kettenis/2000-04-23: The event reporting facility is
> -     broken for TD_DEATH events in glibc 2.1.3, so don't enable it for
> -     now.  */
> +  /* The event reporting facility is broken for TD_DEATH events in
> +     glibc 2.1.3, so don't enable it we have glibc but a lower
> +     version.  */
>    libc_version = gnu_get_libc_version ();
>    if (sscanf (libc_version, "%d.%d", &libc_major, &libc_minor) == 2
>        && (libc_major > 2 || (libc_major == 2 && libc_minor > 1)))

I think there is a missing "if" in that comment.

Mark


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

* Re: [commit] Reduce target_thread_alive calls on GNU/Linux
  2007-05-07  7:27 ` Mark Kettenis
@ 2007-05-11 17:43   ` Daniel Jacobowitz
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-05-11 17:43 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

On Mon, May 07, 2007 at 09:27:01AM +0200, Mark Kettenis wrote:
> I think there is a missing "if" in that comment.

Right you are.  Sorry about that; fixed as attached.

-- 
Daniel Jacobowitz
CodeSourcery

2007-05-11  Daniel Jacobowitz  <dan@codesourcery.com>

	* linux-thread-db.c (enable_thread_event_reporting): Fix comment
	typo.

Index: linux-thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
retrieving revision 1.27
diff -u -p -r1.27 linux-thread-db.c
--- linux-thread-db.c	7 May 2007 00:46:42 -0000	1.27
+++ linux-thread-db.c	11 May 2007 17:42:16 -0000
@@ -482,7 +482,7 @@ enable_thread_event_reporting (void)
 
 #ifdef HAVE_GNU_LIBC_VERSION_H
   /* The event reporting facility is broken for TD_DEATH events in
-     glibc 2.1.3, so don't enable it we have glibc but a lower
+     glibc 2.1.3, so don't enable it if we have glibc but a lower
      version.  */
   libc_version = gnu_get_libc_version ();
   if (sscanf (libc_version, "%d.%d", &libc_major, &libc_minor) == 2


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

end of thread, other threads:[~2007-05-11 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-07  0:49 [commit] Reduce target_thread_alive calls on GNU/Linux Daniel Jacobowitz
2007-05-07  7:27 ` Mark Kettenis
2007-05-11 17:43   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox