public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: John Baldwin <jhb@freebsd.org>
To: Simon Marchi <simark@simark.ca>
Cc: gdb-patches@sourceware.org, binutils@sourceware.org
Subject: Re: [PATCH 2/4] Support 'info proc' for FreeBSD process core dumps.
Date: Wed, 03 Jan 2018 19:05:00 -0000	[thread overview]
Message-ID: <2227931.gyrPRxzbqy@ralph.baldwin.cx> (raw)
In-Reply-To: <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

  reply	other threads:[~2018-01-03 19:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 22:05 [PATCH 0/4] Support for 'info proc' on FreeBSD cores and native John Baldwin
2017-12-22 22:05 ` [PATCH 1/4] Create psuedo sections for FreeBSD NT_PROCSTAT_(PROC|FILES|VMMAP) notes John Baldwin
2017-12-27  1:18   ` Simon Marchi
2018-01-02 11:49   ` Nick Clifton
2017-12-22 22:05 ` [PATCH 2/4] Support 'info proc' for FreeBSD process core dumps John Baldwin
2017-12-27  1:56   ` Simon Marchi
2018-01-03 19:05     ` John Baldwin [this message]
2017-12-22 22:05 ` [PATCH 3/4] Support 'info proc' for native FreeBSD processes John Baldwin
2017-12-27  2:23   ` Simon Marchi
2018-01-03 19:05     ` John Baldwin
2018-01-03 19:13       ` Simon Marchi
2018-01-03 21:56         ` John Baldwin
2017-12-22 22:13 ` [PATCH 4/4] Document support for 'info proc' on FreeBSD John Baldwin
2017-12-23  8:46   ` Eli Zaretskii
2017-12-27  1:53 ` [PATCH 0/4] Support for 'info proc' on FreeBSD cores and native Simon Marchi
2018-01-03 19:05   ` John Baldwin
2018-01-03 19:15     ` Simon Marchi
2018-01-03 23:39       ` John Baldwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2227931.gyrPRxzbqy@ralph.baldwin.cx \
    --to=jhb@freebsd.org \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).