diff options
author | Michael Snyder <msnyder@vmware.com> | 2002-01-09 00:37:02 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2002-01-09 00:37:02 +0000 |
commit | be4d1333163c056f725fbbb96b400ce3d22802a7 (patch) | |
tree | b20c9b67c29126bd6eb838a22fa55c87a8eaf629 /gdb/target.h | |
parent | 30070dac97fea15a420b3f3930b5a20535279ea7 (diff) | |
download | gdb-be4d1333163c056f725fbbb96b400ce3d22802a7.zip gdb-be4d1333163c056f725fbbb96b400ce3d22802a7.tar.gz gdb-be4d1333163c056f725fbbb96b400ce3d22802a7.tar.bz2 |
2002-01-03 Michael Snyder <msnyder@redhat.com>
Implement a "generate-core-file" command in gdb, save target state.
* gcore.c: New file. Implement new command 'generate-core-file'.
Save a corefile image of the current state of the inferior.
* linux-proc.c: Add linux-specific code for saving corefiles.
* target.h (struct target_ops): Add new target vectors for saving
corefiles; to_find_memory_regions and to_make_corefile_notes.
(target_find_memory_regions): New macro.
(target_make_corefile_notes): New macro.
* target.c (update_current_target): Inherit new target methods.
(dummy_find_memory_regions): New place-holder method.
(dummy_make_corefile_notes): New place-holder method.
(init_dummy_target): Initialize new dummy target vectors.
* exec.c (exec_set_find_memory_regions): New function.
Allow the exec_ops vector for memory regions to be taken over.
(exec_make_note_section): New function, target vector method.
* defs.h (exec_set_find_memory_regions): Export prototype.
* procfs.c (proc_find_memory_regions): New function, corefile method.
(procfs_make_note_section): New function, corefile method.
(init_procfs_ops): Set new target vector pointers.
(find_memory_regions_callback): New function.
(procfs_do_thread_registers): New function.
(procfs_corefile_thread_callback): New function.
* sol-thread.c (sol_find_memory_regions): New function.
(sol_make_note_section): New function.
(init_sol_thread_ops): Initialize new target vectors.
* inftarg.c (inftarg_set_find_memory_regions): New function.
Allow to_find_memory_regions vector to be taken over.
(inftarg_set_make_corefile_notes): New function.
Allow to_make_corefile_notes vector to be taken over.
* thread-db.c (thread_db_new_objfile): Don't activate thread-db
interface layer if not target_has_execution (may be a corefile).
* config/i386/linux.mh: Add gcore.o to NATDEPFILES.
* config/sparc/sun4sol2.mh: Ditto.
* config/alpha/alpha-linux.mh: Ditto.
* config/arm/linux.mh: Ditto.
* config/i386/x86-64linux.mh: Ditto.
* config/ia64/linux.mh: Ditto.
* config/m68k/linux.mh: Ditto.
* config/mips/linux.mh: Ditto.
* config/powerpc/linux.mh: Ditto.
* config/sparc/linux.mh: Ditto.
Diffstat (limited to 'gdb/target.h')
-rw-r--r-- | gdb/target.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gdb/target.h b/gdb/target.h index 18635d2..3d17bec 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1,6 +1,6 @@ /* Interface between GDB and target environments, including files and processes Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 Free Software Foundation, Inc. + 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by John Gilmore. This file is part of GDB. @@ -313,6 +313,12 @@ struct target_ops void (*to_async) (void (*cb) (enum inferior_event_type, void *context), void *context); int to_async_mask_value; + int (*to_find_memory_regions) (int (*) (CORE_ADDR, + unsigned long, + int, int, int, + void *), + void *); + char * (*to_make_corefile_notes) (bfd *, int *); int to_magic; /* Need sub-structure for target machine related rather than comm related? */ @@ -999,6 +1005,23 @@ extern void (*target_new_objfile_hook) (struct objfile *); #define target_pid_to_exec_file(pid) \ (current_target.to_pid_to_exec_file) (pid) +/* + * Iterator function for target memory regions. + * Calls a callback function once for each memory region 'mapped' + * in the child process. Defined as a simple macro rather than + * as a function macro so that it can be tested for nullity. + */ + +#define target_find_memory_regions(FUNC, DATA) \ + (current_target.to_find_memory_regions) (FUNC, DATA) + +/* + * Compose corefile .note section. + */ + +#define target_make_corefile_notes(BFD, SIZE_P) \ + (current_target.to_make_corefile_notes) (BFD, SIZE_P) + /* Hook to call target-dependent code after reading in a new symbol table. */ #ifndef TARGET_SYMFILE_POSTREAD |