diff options
author | Kamil Rytarowski <n54@gmx.com> | 2020-08-13 19:29:13 +0200 |
---|---|---|
committer | Kamil Rytarowski <n54@gmx.com> | 2020-08-14 00:10:06 +0200 |
commit | a6e6223e9a2f6ca77e064fbe8b326ac7fa205872 (patch) | |
tree | fccda1aacc4f32c154d438c0cf4fbd464a85fbd9 /gdb/nbsd-nat.c | |
parent | b31488a3449cd97297b0972c016016f1d4c60389 (diff) | |
download | gdb-a6e6223e9a2f6ca77e064fbe8b326ac7fa205872.zip gdb-a6e6223e9a2f6ca77e064fbe8b326ac7fa205872.tar.gz gdb-a6e6223e9a2f6ca77e064fbe8b326ac7fa205872.tar.bz2 |
gdb: Implement native dumpcore function for NetBSD
Define supports_dumpcore and dumpcore for NetBSD, that wraps
the ptrace(2) call with the PT_DUMPCORE operation.
gdb/ChangeLog:
* nbsd-nat.h (nbsd_nat_target::supports_dumpcore)
(nbsd_nat_target::dumpcore): New declarations.
* nbsd-nat.c (nbsd_nat_target::supports_dumpcore)
(nbsd_nat_target::dumpcore): New functions.
Diffstat (limited to 'gdb/nbsd-nat.c')
-rw-r--r-- | gdb/nbsd-nat.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/nbsd-nat.c b/gdb/nbsd-nat.c index 5b59f21..52c4d18 100644 --- a/gdb/nbsd-nat.c +++ b/gdb/nbsd-nat.c @@ -890,3 +890,23 @@ nbsd_nat_target::xfer_partial (enum target_object object, len, xfered_len); } } + +/* Implement the "supports_dumpcore" target_ops method. */ + +bool +nbsd_nat_target::supports_dumpcore () +{ + return true; +} + +/* Implement the "dumpcore" target_ops method. */ + +void +nbsd_nat_target::dumpcore (const char *filename) +{ + pid_t pid = inferior_ptid.pid (); + + if (ptrace (PT_DUMPCORE, pid, const_cast<char *>(filename), + strlen (filename)) == -1) + perror_with_name (("ptrace")); +} |