This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/5] Support 'info proc files' on live FreeBSD processes.


On 2018-09-10 19:30, John Baldwin wrote:
On 9/8/18 4:00 PM, Simon Marchi wrote:
On 2018-09-08 01:36 AM, John Baldwin wrote:
This walks the list of struct kinfo_file objects returned by a call to
kinfo_getfile outputting a description of each open file descriptor.

LGTM.

It would be nice to share the printing of the information between core
and live process, so that we can't forget to change one if we change the other. But if there are some subtle differences between both loops that
would make sharing more annoying than anything, I don't mind.

I've followed the same approach I used for 'info proc mappings' which is
to use shared helper routines as much as possible.

What I could perhaps do to share code is add new TARGET_FREEBSD_<foo>
target objects, but this would entail reworking the code quite a bit I
think. It would mean that I would need a way to let a gdbarch hook into the core target's xfer_partial method more generically (right now there is
a hook just for siginfo, but I think we'd want a hook for arbitrary
objects). I would then rewrite the info proc bits in fbsd-tdep.c in terms
of fetching target objects and always parsing them in the core dump
format. I think there were a few things in some of the other 'info proc'
methods that weren't quite as straightforward as for the 'files' and
'mappings' case though.

I was thinking more about how to share the code that formats and print one entry. Let's say you realize later that a column needs to be wider, you have to remember to update both the live and core versions. Not really a big deal though.

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]