diff options
author | Roland McGrath <roland@gnu.org> | 2004-02-01 22:35:13 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2004-02-01 22:35:13 +0000 |
commit | 4e73f23d286f84c0c80f6302baaae5d92a1fe031 (patch) | |
tree | 92a099f1d43ab66f63bd620f5993f11cc2cba4b6 /gdb | |
parent | 2146d243ceefcaebcbaccba56c59808164306072 (diff) | |
download | gdb-4e73f23d286f84c0c80f6302baaae5d92a1fe031.zip gdb-4e73f23d286f84c0c80f6302baaae5d92a1fe031.tar.gz gdb-4e73f23d286f84c0c80f6302baaae5d92a1fe031.tar.bz2 |
2004-01-28 Roland McGrath <roland@redhat.com>
* procfs.c (procfs_xfer_partial): New function.
(init_procfs_ops): Use that for procfs_ops.to_xfer_partial.
* Makefile.in (procfs.o): Add $(auxv_h) dep.
* 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/procfs.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c index 58ebf97..f73f729 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -48,6 +48,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gdb_string.h" #include "gdb_assert.h" #include "inflow.h" +#include "auxv.h" /* * PROCFS.C @@ -128,6 +129,11 @@ static ptid_t procfs_wait (ptid_t, struct target_waitstatus *); 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); @@ -165,6 +171,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; @@ -4268,6 +4275,40 @@ 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: + return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf, + offset, len); +#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. @@ -5850,6 +5891,8 @@ procfs_make_note_section (bfd *obfd, int *note_size) char *note_data = NULL; char *inf_args; struct procfs_corefile_thread_data thread_args; + char *auxv; + int auxv_len; if (get_exec_file (0)) { @@ -5898,6 +5941,14 @@ procfs_make_note_section (bfd *obfd, int *note_size) note_data = thread_args.note_data; } + auxv_len = target_auxv_read (¤t_target, &auxv); + 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; } |