[PATCH 2/4] Support 'info proc' for FreeBSD process core dumps.

John Baldwin jhb@freebsd.org
Wed Jan 3 19:05:00 GMT 2018


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



More information about the Binutils mailing list