[PATCH] gdb: Implement native dumpcore function

John Baldwin jhb@FreeBSD.org
Mon Jul 27 15:47:42 GMT 2020


On 7/27/20 7:43 AM, Kamil Rytarowski wrote:
> Add new API for systems with native kernel support for dumping
> a process on demand. Wire it into the gdb's gcore functionality.
> 
> Define supports_native_dumpcore and native_dumpcore for NetBSD,
> that wraps the ptrace(2) call with the PT_DUMPCORE operation.
> 
> gdb/ChangeLog:
> 
>        * target.h (supports_native_dumpcore, native_dumpcore): New
>        function declarations.
>        * target.c (supports_native_dumpcore, native_dumpcore): New
>        functions.
>        * target-delegates.c: Rebuild.
>        * nbsd-nat.h (nbsd_nat_target::supports_native_dumpcore)
>        (nbsd_nat_target::native_dumpcore): New declarations.
>        * nbsd-nat.c (nbsd_nat_target::supports_native_dumpcore)
>        (nbsd_nat_target::native_dumpcore): New functions.
>        * gcore.c (gcore_command): Use target_supports_native_dumpcore ()
>        and target_native_dumpcore ().

One suggestion I would have is to do this as a 2-patch series with the
first patch introducing the new target hook and using it in gcore and
the second patch adding the implementation for the NetBSD native target.

I also wonder if the new target hook requires "native" in the name, it
could perhaps just be "target_supports_dumpcore" and "target_dumpcore"?

-- 
John Baldwin


More information about the Gdb-patches mailing list