Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] auxv support via xfer_partial, for core files and /proc
@ 2004-01-21 10:45 Roland McGrath
  2004-01-21 15:48 ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Roland McGrath @ 2004-01-21 10:45 UTC (permalink / raw)
  To: gdb-patches

When you last heard from me about support for reading the aux vector, I had
suggested a new target_ops function and there had been discussion about
instead using target_query for this.  I was doing other things and not
following gdb in the interim, and now things look a little different.  
From reading the current mainline sources, I gather that in the new regime
the proper way to do this is via the to_xfer_partial hook.

This patch adds the TARGET_OBJECT_AUXV flavor for target_read_partial.
I've implemented reading support for core files (ELF core files or others
for which BFD delivers a ".auxv" section), and for native processes using
the /proc filesystem.  I've tested the /proc support on Linux and Solaris.

This patch also makes gcore emit an NT_AUXV note containing the
TARGET_OBJECT_AUXV data when it can be read from the target.  This is
consistent with kernel-generated core files from Linux and Solaris.
gcore is what I used to test the reading of /proc for live processes.

The Solaris machine I used for testing happened to be Solaris 9.  The
configure.in change was necessary to build the right support code on this
system.  AFAIK nothing has gone backwards since Solaris 8, so I am assuming
this was just an oversight.

May I commit this?


An unresolved question is adding remote protocol support for getting this
data.  I gather from reading remote_xfer_partial in remote.c that the
proper thing to do is something like a new packet "qAuxVector:<offset>"
where <offset> gives the hex-encoded byte offset at which to start and
return as much as you can.  I can easily add this to the remote.c code.  
I am less clear on where to put the implementation of the support in
gdbserver's code.  (I also don't know off hand how to test gdbserver should
I add something to it.)



Thanks,
Roland



2004-01-21  Roland McGrath  <roland@redhat.com>

	* configure.in (NEW_PROC_API): Also match solaris2.9 for this test.

	* procfs.c: Include <string.h> for str* decls, otherwise warnings.

	* sol-thread.c (sol_thread_xfer_partial): New function, replaces ...
	(sol_thread_xfer_memory): ... this, removed.
	(init_sol_thread_ops): Update hook initializer.
	(init_sol_core_ops): Likewise.

	* procfs.c (procfs_xfer_partial): New function.
	(init_procfs_ops): Use that for procfs_ops.to_xfer_partial.

	* linux-proc.c (procfs_xfer_auxv): New function.
	* config/nm-linux.h: Declare it.
	(NATIVE_XFER_AUXV): New macro, use that function.

	* procfs.c (procfs_make_note_section): If we can read
	TARGET_OBJECT_AUXV data, add an NT_AUXV note containing it.
	* linux-proc.c (linux_make_note_section): Likewise.

	* corelow.c (core_xfer_partial): New function.
	(init_core_ops): Use it for core_ops.to_xfer_partial.

	* target.h (enum target_object): Add TARGET_OBJECT_AUXV.
	* inftarg.c (child_xfer_partial): Support it using NATIVE_XFER_AUXV
	macro if that is defined.

Index: sol-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/sol-thread.c,v
retrieving revision 1.38
diff -b -p -u -r1.38 sol-thread.c
--- sol-thread.c	21 Sep 2003 01:26:45 -0000	1.38
+++ sol-thread.c	21 Jan 2004 10:33:23 -0000
@@ -717,16 +717,14 @@ sol_thread_prepare_to_store (void)
   procfs_ops.to_prepare_to_store ();
 }
 
-/* Transfer LEN bytes between GDB address MYADDR and target address
-   MEMADDR.  If DOWRITE is non-zero, transfer them to the target,
-   otherwise transfer them from the target.  TARGET is unused.
-
-   Returns the number of bytes transferred. */
-
-static int
-sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
-			struct mem_attrib *attrib,
-			struct target_ops *target)
+/* Perform partial transfers on OBJECT.  See target_read_partial
+   and target_write_partial for details of each variant.  One, and
+   only one, of readbuf or writebuf must be non-NULL.  */
+
+static LONGEST
+sol_thread_xfer_partial (struct target_ops *ops, enum target_object object,
+			  const char *annex, void *readbuf,
+			  const void *writebuf, ULONGEST offset, LONGEST len)
 {
   int retval;
   struct cleanup *old_chain;
@@ -739,11 +737,11 @@ sol_thread_xfer_memory (CORE_ADDR memadd
   /* Note: don't need to call switch_to_thread; we're just reading memory.  */
 
   if (target_has_execution)
-    retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len, 
-					dowrite, attrib, target);
+    retval = procfs_ops.to_xfer_partial (ops, object, annex,
+					 readbuf, writebuf, offset, len);
   else
-    retval = orig_core_ops.to_xfer_memory (memaddr, myaddr, len,
-					   dowrite, attrib, target);
+    retval = orig_core_ops.to_xfer_partial (ops, object, annex,
+					    readbuf, writebuf, offset, len);
 
   do_cleanups (old_chain);
 
@@ -1548,7 +1546,7 @@ init_sol_thread_ops (void)
   sol_thread_ops.to_fetch_registers = sol_thread_fetch_registers;
   sol_thread_ops.to_store_registers = sol_thread_store_registers;
   sol_thread_ops.to_prepare_to_store = sol_thread_prepare_to_store;
-  sol_thread_ops.to_xfer_memory = sol_thread_xfer_memory;
+  sol_thread_ops.to_xfer_partial = sol_thread_xfer_partial;
   sol_thread_ops.to_files_info = sol_thread_files_info;
   sol_thread_ops.to_insert_breakpoint = memory_insert_breakpoint;
   sol_thread_ops.to_remove_breakpoint = memory_remove_breakpoint;
@@ -1591,7 +1589,7 @@ init_sol_core_ops (void)
   sol_core_ops.to_attach = sol_thread_attach;
   sol_core_ops.to_detach = sol_core_detach;
   sol_core_ops.to_fetch_registers = sol_thread_fetch_registers;
-  sol_core_ops.to_xfer_memory = sol_thread_xfer_memory;
+  sol_core_ops.to_xfer_partial = sol_thread_xfer_partial;
   sol_core_ops.to_files_info = sol_core_files_info;
   sol_core_ops.to_insert_breakpoint = ignore;
   sol_core_ops.to_remove_breakpoint = ignore;
Index: procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.50
diff -b -p -u -r1.50 procfs.c
--- procfs.c	17 Jan 2004 18:24:15 -0000	1.50
+++ procfs.c	21 Jan 2004 10:33:24 -0000
@@ -45,6 +45,7 @@ Inc., 59 Temple Place - Suite 330, Bosto
 #include "gdb_wait.h"
 #include <signal.h>
 #include <ctype.h>
+#include <string.h>
 #include "gdb_assert.h"
 #include "inflow.h"
 
@@ -127,6 +128,11 @@ static ptid_t procfs_wait (ptid_t, struc
 static int procfs_xfer_memory (CORE_ADDR, char *, int, int,
 			       struct mem_attrib *attrib,
 			       struct target_ops *);
+static LONGEST procfs_xfer_partial (struct target_ops *ops,
+				    enum target_object object,
+				    const char *annex,
+				    void *readbuf, const void *writebuf,
+				    ULONGEST offset, LONGEST len);
 
 static int procfs_thread_alive (ptid_t);
 
@@ -164,6 +170,7 @@ init_procfs_ops (void)
   procfs_ops.to_prepare_to_store    = procfs_prepare_to_store;
   procfs_ops.to_fetch_registers     = procfs_fetch_registers;
   procfs_ops.to_store_registers     = procfs_store_registers;
+  procfs_ops.to_xfer_partial        = procfs_xfer_partial;
   procfs_ops.to_xfer_memory         = procfs_xfer_memory;
   procfs_ops.to_insert_breakpoint   =  memory_insert_breakpoint;
   procfs_ops.to_remove_breakpoint   =  memory_remove_breakpoint;
@@ -4267,6 +4274,61 @@ wait_again:
   return retval;
 }
 
+/* Perform a partial transfer to/from the specified object.  For
+   memory transfers, fall back to the old memory xfer functions.  */
+
+static LONGEST
+procfs_xfer_partial (struct target_ops *ops, enum target_object object,
+		     const char *annex, void *readbuf,
+		     const void *writebuf, ULONGEST offset, LONGEST len)
+{
+  switch (object)
+    {
+    case TARGET_OBJECT_MEMORY:
+      if (readbuf)
+	return (*ops->to_xfer_memory) (offset, readbuf, len, 0/*write*/,
+				       NULL, ops);
+      if (writebuf)
+	return (*ops->to_xfer_memory) (offset, readbuf, len, 1/*write*/,
+				       NULL, ops);
+      return -1;
+
+#ifdef NEW_PROC_API
+    case TARGET_OBJECT_AUXV:
+      if (readbuf)
+	{
+	  char pathname[MAX_PROC_NAME_SIZE];
+	  int fd;
+	  LONGEST n;
+
+	  sprintf (pathname, "/proc/%d/auxv", PIDGET (inferior_ptid));
+	  fd = open_with_retry (pathname, O_RDONLY);
+	  if (fd < 0)
+	    return -1;			/* XXX Call error here? */
+
+	  if (offset != (ULONGEST) 0
+	      && lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset)
+	    n = -1;
+	  else
+	    n = read (fd, readbuf, len);
+
+	  (void) close (fd);
+
+	  /* XXX Call error if n<0 ? */
+	  return n;
+	}
+      return -1;
+#endif
+
+    default:
+      if (ops->beneath != NULL)
+	return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
+					      readbuf, writebuf, offset, len);
+      return -1;
+    }
+}
+
+
 /* Transfer LEN bytes between GDB address MYADDR and target address
    MEMADDR.  If DOWRITE is non-zero, transfer them to the target,
    otherwise transfer them from the target.  TARGET is unused.
@@ -5849,6 +5911,8 @@ procfs_make_note_section (bfd *obfd, int
   char *note_data = NULL;
   char *inf_args;
   struct procfs_corefile_thread_data thread_args;
+  char *auxv;
+  int auxv_len, auxv_alloc;
 
   if (get_exec_file (0))
     {
@@ -5896,6 +5960,22 @@ procfs_make_note_section (bfd *obfd, int
     {
       note_data = thread_args.note_data;
     }
+
+  auxv_alloc = 512;
+  while (1)
+    {
+      auxv = xmalloc (auxv_alloc);
+      auxv_len = target_read_partial (&current_target, TARGET_OBJECT_AUXV,
+				      NULL, auxv, 0, auxv_alloc);
+      if (auxv_len < auxv_alloc)
+	break;
+      xfree (auxv);
+      auxv_alloc *= 2;
+    }
+  if (auxv_len > 0)
+    note_data = elfcore_write_note (obfd, note_data, note_size,
+				    "CORE", NT_AUXV, auxv, auxv_len);
+  xfree (auxv);
 
   make_cleanup (xfree, note_data);
   return note_data;
Index: linux-proc.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-proc.c,v
retrieving revision 1.20
diff -b -p -u -r1.20 linux-proc.c
--- linux-proc.c	1 Oct 2003 20:36:56 -0000	1.20
+++ linux-proc.c	21 Jan 2004 10:33:24 -0000
@@ -34,6 +34,7 @@
 #include "elf-bfd.h"		/* for elfcore_write_* */
 #include "cli/cli-decode.h"	/* for add_info */
 #include "gdb_string.h"
+#include "gdb_assert.h"
 
 #include <signal.h>
 
@@ -271,6 +272,8 @@ linux_make_note_section (bfd *obfd, int 
   char psargs[80] = { '\0' };
   char *note_data = NULL;
   ptid_t current_ptid = inferior_ptid;
+  char *auxv;
+  int auxv_len, auxv_alloc;
 
   if (get_exec_file (0))
     {
@@ -305,10 +308,62 @@ linux_make_note_section (bfd *obfd, int 
       note_data = thread_args.note_data;
     }
 
+  auxv_alloc = 512;
+  while (1)
+    {
+      auxv = xmalloc (auxv_alloc);
+      auxv_len = target_read_partial (&current_target, TARGET_OBJECT_AUXV,
+				      NULL, auxv, 0, auxv_alloc);
+      if (auxv_len < auxv_alloc)
+	break;
+      xfree (auxv);
+      auxv_alloc *= 2;
+    }
+  if (auxv_len > 0)
+    note_data = elfcore_write_note (obfd, note_data, note_size,
+				    "CORE", NT_AUXV, auxv, auxv_len);
+  xfree (auxv);
+
   make_cleanup (xfree, note_data);
   return note_data;
 }
 
+LONGEST
+procfs_xfer_auxv (struct target_ops *ops,
+		  int /* enum target_object */ object,
+		  const char *annex,
+		  void *readbuf,
+		  const void *writebuf,
+		  ULONGEST offset,
+		  LONGEST len)
+{
+  char pathname[MAXPATHLEN];
+  int fd;
+  LONGEST n;
+
+  gdb_assert (object == TARGET_OBJECT_AUXV);
+
+  /* Only handle reads.  */
+  if (writebuf != NULL)
+    return -1;
+
+  sprintf (pathname, "/proc/%d/auxv", PIDGET (inferior_ptid));
+  fd = open (pathname, O_RDONLY);
+  if (fd < 0)
+    return -1;			/* XXX Call error here? */
+
+  if (offset != (ULONGEST) 0
+      && lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset)
+    n = -1;
+  else
+    n = read (fd, readbuf, len);
+
+  (void) close (fd);
+
+  /* XXX Call error if n<0 ? */
+  return n;
+}
+
 /*
  * Function: linux_info_proc_cmd
  *
Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.33
diff -b -p -u -r1.33 corelow.c
--- corelow.c	6 Nov 2003 02:52:27 -0000	1.33
+++ corelow.c	21 Jan 2004 10:33:24 -0000
@@ -515,6 +515,63 @@ core_files_info (struct target_ops *t)
   print_section_info (t, core_bfd);
 }
 \f
+static LONGEST
+core_xfer_partial (struct target_ops *ops, enum target_object object,
+		   const char *annex, void *readbuf,
+		   const void *writebuf, ULONGEST offset, LONGEST len)
+{
+  switch (object)
+    {
+    case TARGET_OBJECT_MEMORY:
+      if (readbuf)
+	return (*ops->to_xfer_memory) (offset, readbuf, len, 0/*write*/,
+				       NULL, ops);
+      if (writebuf)
+	return (*ops->to_xfer_memory) (offset, readbuf, len, 1/*write*/,
+				       NULL, ops);
+      return -1;
+
+    case TARGET_OBJECT_AUXV:
+      if (readbuf)
+	{
+	  /* When the aux vector is stored in core file, BFD
+	     represents this with a fake section called ".auxv".  */
+
+	  sec_ptr section;
+	  bfd_size_type size;
+	  char *contents;
+
+	  section = bfd_get_section_by_name (core_bfd, ".auxv");
+	  if (section == NULL)
+	    return -1;
+
+	  size = bfd_section_size (core_bfd, section);
+	  if (offset >= size)
+	    return 0;
+	  size -= offset;
+	  if (size > len)
+	    size = len;
+	  if (size > 0 &&
+	      ! bfd_get_section_contents (core_bfd, section, readbuf,
+					  (file_ptr) offset, size))
+	    {
+	      warning ("Couldn't read NT_AUXV note in core file.");
+	      return -1;
+	    }
+
+	  return size;
+	}
+      return -1;
+
+    default:
+      if (ops->beneath != NULL)
+	return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
+					      readbuf, writebuf, offset, len);
+      return -1;
+    }
+}
+
+\f
 /* If mourn is being called in all the right places, this could be say
    `gdb internal error' (since generic_mourn calls breakpoint_init_inferior).  */
 
@@ -551,6 +608,7 @@ init_core_ops (void)
   core_ops.to_attach = find_default_attach;
   core_ops.to_detach = core_detach;
   core_ops.to_fetch_registers = get_core_registers;
+  core_ops.to_xfer_partial = core_xfer_partial;
   core_ops.to_xfer_memory = xfer_memory;
   core_ops.to_files_info = core_files_info;
   core_ops.to_insert_breakpoint = ignore;
Index: target.h
===================================================================
RCS file: /cvs/src/src/gdb/target.h,v
retrieving revision 1.55
diff -b -p -u -r1.55 target.h
--- target.h	17 Jan 2004 21:56:12 -0000	1.55
+++ target.h	21 Jan 2004 10:33:24 -0000
@@ -226,8 +226,10 @@ enum target_object
   TARGET_OBJECT_MEMORY,
   /* Kernel Unwind Table.  See "ia64-tdep.c".  */
   TARGET_OBJECT_UNWIND_TABLE,
-  /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC,
-     TARGET_OBJECT_AUXV, ...  */
+  /* Transfer auxilliary vector.  */
+  TARGET_OBJECT_AUXV,
+
+  /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC, ... */
 };
 
 extern LONGEST target_read_partial (struct target_ops *ops,
Index: inftarg.c
===================================================================
RCS file: /cvs/src/src/gdb/inftarg.c,v
retrieving revision 1.21
diff -b -p -u -r1.21 inftarg.c
--- inftarg.c	14 Nov 2003 20:49:23 -0000	1.21
+++ inftarg.c	21 Jan 2004 10:33:24 -0000
@@ -578,11 +578,12 @@ child_xfer_partial (struct target_ops *o
       return NATIVE_XFER_UNWIND_TABLE (ops, object, annex, readbuf, writebuf,
 				       offset, len);
 
-#if 0
     case TARGET_OBJECT_AUXV:
-      return native_xfer_auxv (PIDGET (inferior_ptid), readbuf, writebuf,
-			       offset, len);
+#ifndef NATIVE_XFER_AUXV
+#define NATIVE_XFER_AUXV(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1)
 #endif
+      return NATIVE_XFER_AUXV (ops, object, annex, readbuf, writebuf,
+			       offset, len);
 
     default:
       return -1;
Index: config/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/nm-linux.h,v
retrieving revision 1.19
diff -b -p -u -r1.19 nm-linux.h
--- config/nm-linux.h	17 Aug 2003 18:22:25 -0000	1.19
+++ config/nm-linux.h	21 Jan 2004 10:33:24 -0000
@@ -77,3 +77,12 @@ extern void lin_thread_get_thread_signal
 #define CHILD_POST_ATTACH
 #define CHILD_FOLLOW_FORK
 #define KILL_INFERIOR
+
+#define NATIVE_XFER_AUXV procfs_xfer_auxv
+extern LONGEST procfs_xfer_auxv (struct target_ops *ops,
+				 int /* enum target_object */ object,
+				 const char *annex,
+				 void *readbuf,
+				 const void *writebuf,
+				 ULONGEST offset,
+				 LONGEST len);


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

* Re: [PATCH] auxv support via xfer_partial, for core files and /proc
  2004-01-21 10:45 [PATCH] auxv support via xfer_partial, for core files and /proc Roland McGrath
@ 2004-01-21 15:48 ` Andrew Cagney
  2004-01-21 22:06   ` Roland McGrath
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2004-01-21 15:48 UTC (permalink / raw)
  To: Roland McGrath; +Cc: gdb-patches

Roland, FYI, there is already this patch:
http://sources.redhat.com/ml/gdb-patches/2003-11/msg00204.html

I'd not dropped it (got side tracked with 2g core files and a lack of a 
GNU/Linux box with auxv support) and now that they are both sorted I'll 
return to this.  Will need to compare code notes.

What you should definitly do is add yourself to the write-after-approval 
list (don't forget to the ChangeLog and to post the committed change).

Andrew


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

* Re: [PATCH] auxv support via xfer_partial, for core files and /proc
  2004-01-21 15:48 ` Andrew Cagney
@ 2004-01-21 22:06   ` Roland McGrath
  2004-01-21 22:13     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Roland McGrath @ 2004-01-21 22:06 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

> Roland, FYI, there is already this patch:
> http://sources.redhat.com/ml/gdb-patches/2003-11/msg00204.html

Thanks for the pointer.  I have some comments below comparing the two patches.

> What you should definitly do is add yourself to the write-after-approval 
> list (don't forget to the ChangeLog and to post the committed change).

Done.


Here are the notable differences between the two patches.


1. My patch includes the changes affecting gcore:

	* procfs.c (procfs_make_note_section): If we can read
	TARGET_OBJECT_AUXV data, add an NT_AUXV note containing it.
	* linux-proc.c (linux_make_note_section): Likewise.

   This is not something your patch tries to address.  I think we want those
   changes regardless of the implementation details for TARGET_OBJECT_AUXV.

2. Your patch defines the "info auxv" command for pretty-printing.
   That is a nice thing to have.  However, I would redo your implementation.
   As you've written it, `read_auxv_entry' will be called for each element
   of the vector and read the whole thing fresh each time.  On my 2.6
   kernel, that is 17 times open+pread+close instead of one.

3. My patch includes the reading support for core files:

	* corelow.c (core_xfer_partial): New function.
	(init_core_ops): Use it for core_ops.to_xfer_partial.

   This is something that could not be tested using my patch alone, but
   your "info auxv" command provides the way to test it.  (I did test that
   code, but by using other patches not yet submitted.)

4. You have a single implementation of native_xfer_auxv that presumes that
   /proc/PID/auxv is the thing to use on every potential native system.
   The systems we know of supporting auxv access (Linux and Solaris)
   do all use the same method.  But assuming this does not seem proper or
   consistent with how things are done in gdb.
   
   My patch implements /proc/PID/auxv reading in two places.  This is a bit
   of unsightly duplication, but consistent with the existing duplication
   of code between procfs.c and linux-proc.c.  For Linux, the
   implementation is via defining a macro in nm-linux.h that inftarg.c's
   generic xfer_partial function will use; that is consistent with the
   existing NATIVE_XFER_UNWIND_TABLE macro, and the status quo wherein
   Linux support does not have its own struct target_ops.  The procfs.c
   addition seems like the cleaner approach, defining to_xfer_partial for
   that target.  (That way it also works when using "target procfs", which
   seems proper.)  For Solaris that required the sol-thread.c addition so
   that it would pass down the call to procfs_ops in the same way it does
   for to_xfer_memory (i.e. twiddling inferior_ptid).

5. Your implementation uses pread unconditionally.  Mine doesn't bother to
   use pread even when it's available, and just uses lseek + read.  Full
   portability, including things like older glibcs running on newer
   kernels, requires using configure tests for pread.  I did not bother
   with that because in the real-world case, there will just be one read
   from offset 0 and so lseek won't even be called, just open+read+close.

6. My implementation does not try to support writing.  It would be trivial
   to do so if you think it's worthwhile.  I did not bother because no
   system actually supports changing this data, and I can't see a situation
   in which gdb might ever want to even if it were possible.


My inclination is to add the "info auxv" implementation to my patch,
and leave the other details as I did them.  Comments?


Thanks,
Roland



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

* Re: [PATCH] auxv support via xfer_partial, for core files and /proc
  2004-01-21 22:06   ` Roland McGrath
@ 2004-01-21 22:13     ` Daniel Jacobowitz
  2004-01-21 22:16       ` Roland McGrath
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2004-01-21 22:13 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Andrew Cagney, gdb-patches

On Wed, Jan 21, 2004 at 02:06:42PM -0800, Roland McGrath wrote:
> > Roland, FYI, there is already this patch:
> > http://sources.redhat.com/ml/gdb-patches/2003-11/msg00204.html
> 
> Thanks for the pointer.  I have some comments below comparing the two patches.
> 
> > What you should definitly do is add yourself to the write-after-approval 
> > list (don't forget to the ChangeLog and to post the committed change).
> 
> Done.
> 
> 
> Here are the notable differences between the two patches.
> 
> 
> 1. My patch includes the changes affecting gcore:
> 
> 	* procfs.c (procfs_make_note_section): If we can read
> 	TARGET_OBJECT_AUXV data, add an NT_AUXV note containing it.
> 	* linux-proc.c (linux_make_note_section): Likewise.
> 
>    This is not something your patch tries to address.  I think we want those
>    changes regardless of the implementation details for TARGET_OBJECT_AUXV.

This could be an independent patch, couldn't it?  In the interest of
progress, you may wish to submit it separately.  Of course it would
have to come after rather than before... so maybe not.

> 5. Your implementation uses pread unconditionally.  Mine doesn't bother to
>    use pread even when it's available, and just uses lseek + read.  Full
>    portability, including things like older glibcs running on newer
>    kernels, requires using configure tests for pread.  I did not bother
>    with that because in the real-world case, there will just be one read
>    from offset 0 and so lseek won't even be called, just open+read+close.

The configury is already there, FYI.  Grep for HAVE_PREAD64 in linux-proc.c.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: [PATCH] auxv support via xfer_partial, for core files and /proc
  2004-01-21 22:13     ` Daniel Jacobowitz
@ 2004-01-21 22:16       ` Roland McGrath
  0 siblings, 0 replies; 5+ messages in thread
From: Roland McGrath @ 2004-01-21 22:16 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Andrew Cagney, gdb-patches

> This could be an independent patch, couldn't it?  In the interest of
> progress, you may wish to submit it separately.  Of course it would
> have to come after rather than before... so maybe not.

Yes, yes, and yes (no).

> The configury is already there, FYI.  Grep for HAVE_PREAD64 in linux-proc.c.

I know.  When I said "didn't bother", I meant "didn't bother".  Ten more
lines of #ifdef-heavy splort in a function that only needs to be ten lines
total, to avoid an lseek call that won't ever be made in reality.


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

end of thread, other threads:[~2004-01-21 22:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-21 10:45 [PATCH] auxv support via xfer_partial, for core files and /proc Roland McGrath
2004-01-21 15:48 ` Andrew Cagney
2004-01-21 22:06   ` Roland McGrath
2004-01-21 22:13     ` Daniel Jacobowitz
2004-01-21 22:16       ` Roland McGrath

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