diff options
-rw-r--r-- | gdb/nbsd-nat.c | 20 | ||||
-rw-r--r-- | gdb/nbsd-nat.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/gdb/nbsd-nat.c b/gdb/nbsd-nat.c index 5b59f2130d7..52c4d185695 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")); +} diff --git a/gdb/nbsd-nat.h b/gdb/nbsd-nat.h index 665a71a0f78..b09d5b1e3bb 100644 --- a/gdb/nbsd-nat.h +++ b/gdb/nbsd-nat.h @@ -55,6 +55,8 @@ struct nbsd_nat_target : public inf_ptrace_target const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) override; + bool supports_dumpcore () override; + void dumpcore (const char *filename) override; }; #endif /* nbsd-nat.h */ |