This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 2/4] Support 'info proc' for FreeBSD process core dumps.
- From: John Baldwin <jhb at freebsd dot org>
- To: Simon Marchi <simark at simark dot ca>
- Cc: gdb-patches at sourceware dot org, binutils at sourceware dot org
- Date: Wed, 03 Jan 2018 10:16:31 -0800
- Subject: Re: [PATCH 2/4] Support 'info proc' for FreeBSD process core dumps.
- Authentication-results: sourceware.org; auth=none
- References: <20171222220513.54983-1-jhb@FreeBSD.org> <20171222220513.54983-3-jhb@FreeBSD.org> <e24dec9d-458c-c8b9-cf9b-0a1dea2ed80f@simark.ca>
On Tuesday, December 26, 2017 08:56:51 PM Simon Marchi wrote:
> On 2017-12-22 05:05 PM, John Baldwin wrote:
> > - Command line arguments are obtained from the pr_psargs[] array
> > saved in the NT_PRPSINFO note.
> > - The 'cwd' and 'exe' values are obtained from the per-process file
> > descriptor table stored in the NT_PROCSTAT_FILES core note.
> > - 'mappings' is implemented by walking the array of VM map entries
> > stored in the NT_PROCSTAT_VMMAP core note.
> > - 'stat' and 'status' output is generated by outputting fields from
> > the first structure stored in the NT_PROCSTAT_PROC core note.
> >
> > diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
> > index f89b520c5f..454036dcac 100644
> > --- a/gdb/fbsd-tdep.c
> > +++ b/gdb/fbsd-tdep.c
> > + is not available from a core dump. Instead, the per-thread data
> > + structures contain the value of these fields for individual
> > + threads. */
> > +
> > +struct kinfo_proc_layout
>
> struct definitions should not be indented, they should look like:
>
> struct kinfo_proc_layout
> {
> int ki_layout;
> ...
> }
Fixed.
> > +
> > +struct kinfo_proc_layout kinfo_proc_layout_32 =
>
> I would suggest making these const.
Fixed.
> > +static void
> > +fbsd_print_sigset (const char *descr, unsigned char *sigset)
> > +{
> > + printf_filtered ("%s:\t", descr);
> > + for (int i = 0; i < _SIG_WORDS; i++)
>
> _SIG_WORDS seems to be FreeBSD-specific, so shouldn't be used in the tdep file,
> unless we redefine it.
Oops, yes. I added a local constant.
> > + printf_filtered ("Name:\t%.19s\n", descdata + kp->ki_comm);
> > + printf_filtered ("Pid:\t%s\n",
> > + pulongest(bfd_get_32 (core_bfd, descdata + kp->ki_pid)));
>
> Missing a few spaces before parentheses here and there.
Fixed.
> > + default:
> > + error (_("Not supported on this architecture."));
>
> If you mean "not supported for FreeBSD", I'm not sure architecture
> is the right word, since architecture usually refers to CPU architecture.
Mmm, yes. I think I was trying to say "not supported on this gdbarch"
in effect. However, the core target doesn't output any error if there
is no valid core_info_proc method, so perhaps it would be best to just
not output any error at all. This also matches linux-tdep.c which doesn't
output anything for an unsupported enum value.
> > diff --git a/gdb/fbsd-tdep.h b/gdb/fbsd-tdep.h
> > index ff2e207aae..0029e03d41 100644
> > --- a/gdb/fbsd-tdep.h
> > +++ b/gdb/fbsd-tdep.h
> > @@ -21,5 +21,6 @@
> > #define FBSD_TDEP_H
> >
> > extern void fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
> > +extern const char *fbsd_vm_map_entry_flags (int kve_flags, int kve_protection);
>
> Can you please add doc for this new function?
Fixed.
--
John Baldwin