Re: [PATCH] Generate NT_PROCSTAT_{AUXV,VMMAP} in FreeBSD coredumps

Simon Ser
2018-07-11T16:40:07Z

On July 11, 2018 5:16 PM, John Baldwin <jhb@FreeBSD.org> wrote:
> You can't use a sysctl like this in a tdep.c file. fbsd-tdep.c runs on
> any OS, (so for example you could be running gdb with a FreeBSD binary
> on Linux or OS X against a debug server (gdbserver or lldb-server or some
> such) running on a remote FreeBSD host (or VM) and use 'gcore' on the
> debugging host to generate a local core file.

Ah, that's what I feared when choosing this approach.

> Native code that would only run on a FreeBSD host would live in fbsd-nat.c,
> and when I have thought about handling other procstat notes in FreeBSD cores
> I've mostly thought about adding some kind of hook that fbsd-tdep.c would
> invoke to write extra core notes and setting that hook only for native
> targets in fbsd-nat.c for the native gdbarchs.
>
> Your previous patch for AUXV still works because the target_foo function
> you called previously will talk to either the debug server or the
> native target to fetch the AUXV data, so I think your previous patch
> for NT_PROCSTAT_AUXV is a better approach for that note.

Hmm, I need those other notes too. Would it be possible to add some
FreeBSD-specific TARGET_OBJECT_* constants? If not, could you explain
how one would add this hook?

Thanks,

Simon