diff options
author | Kamil Rytarowski <n54@gmx.com> | 2020-07-28 17:29:35 +0200 |
---|---|---|
committer | Kamil Rytarowski <n54@gmx.com> | 2020-08-14 00:09:42 +0200 |
commit | b31488a3449cd97297b0972c016016f1d4c60389 (patch) | |
tree | a9707af272eb93896d792df09298e32c57cbcc45 /gdb/gcore.c | |
parent | 002a3166d359a759b6cddfe4571d1da5b4f96dce (diff) | |
download | gdb-b31488a3449cd97297b0972c016016f1d4c60389.zip gdb-b31488a3449cd97297b0972c016016f1d4c60389.tar.gz gdb-b31488a3449cd97297b0972c016016f1d4c60389.tar.bz2 |
gdb: Implement native dumpcore function
Add new API for systems with native kernel support for dumping
a process on demand. Wire it into the gdb's gcore functionality.
gdb/ChangeLog:
* target.h (supports_dumpcore, dumpcore): New
function declarations.
* target.c (supports_dumpcore, dumpcore): New
functions.
* target-delegates.c: Rebuild.
* gcore.c (gcore_command): Use target_supports_dumpcore ()
and target_dumpcore ().
Diffstat (limited to 'gdb/gcore.c')
-rw-r--r-- | gdb/gcore.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/gdb/gcore.c b/gdb/gcore.c index 7b653fb..d0e36b1 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -145,17 +145,22 @@ gcore_command (const char *args, int from_tty) "Opening corefile '%s' for output.\n", corefilename.get ()); - /* Open the output file. */ - gdb_bfd_ref_ptr obfd (create_gcore_bfd (corefilename.get ())); + if (target_supports_dumpcore ()) + target_dumpcore (corefilename.get ()); + else + { + /* Open the output file. */ + gdb_bfd_ref_ptr obfd (create_gcore_bfd (corefilename.get ())); - /* Arrange to unlink the file on failure. */ - gdb::unlinker unlink_file (corefilename.get ()); + /* Arrange to unlink the file on failure. */ + gdb::unlinker unlink_file (corefilename.get ()); - /* Call worker function. */ - write_gcore_file (obfd.get ()); + /* Call worker function. */ + write_gcore_file (obfd.get ()); - /* Succeeded. */ - unlink_file.keep (); + /* Succeeded. */ + unlink_file.keep (); + } fprintf_filtered (gdb_stdout, "Saved corefile %s\n", corefilename.get ()); } |