Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] gdb: support for eBPF
Date: Mon, 06 Jul 2020 16:50:28 +0200	[thread overview]
Message-ID: <87o8osn1e3.fsf@oracle.com> (raw)
In-Reply-To: <20200703113913.GU2737@embecosm.com> (Andrew Burgess's message of "Fri, 3 Jul 2020 12:39:13 +0100")



Hi Andrew.
Thanks for the review.

    > +\f
    > +static unsigned int ebpf_debug_flag = 0;
    > +
    > +static void ATTRIBUTE_PRINTF (1, 2)
    > +ebpf_debug (const char *fmt, ...)
    > +{
    > +  if (ebpf_debug_flag)
    > +    {
    > +       va_list args;
    > +
    > +       va_start (args, fmt);
    > +       printf_unfiltered ("eBPF: ");
    > +       vprintf_unfiltered (fmt, args);
    > +       va_end (args);
    > +    }
    > +}
    
    Every top level item function, variable, struct, etc, should have a
    comment on it, you've mostly done this, but there's a few places where
    these are missing, I'll not point them all out.

Ok, I will add the missing descriptive comments.

    You might want to consider changing this into a real debug flag so
    that there's a 'set debug ebpf' option.  For RISC-V I went one further
    and added sub-flags like 'set debug riscv unwinders'.  Not a
    requirement I think, but maybe worth considering.

Ok.

    > +/* Implement the "unwind_pc" gdbarch method.  */
    > +
    > +static CORE_ADDR
    > +ebpf_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
    > +{
    > +  return frame_unwind_register_unsigned (next_frame,
    > +					 gdbarch_pc_regnum (gdbarch));
    > +}
    
    Given the implementation I think you shouldn't need this function,
    default_unwind_pc should do just fine for you.

Ok, will remove it.

    > +/* Return PC of first real instruction of the function starting at
    > +   START_PC.  */
    > +
    > +static CORE_ADDR
    > +ebpf_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
    > +{
    > +  ebpf_debug ("Skipping prologue: start_pc=%s\n",
    > +	      paddress (gdbarch, start_pc));
    > +  /* XXX */
    
    You've got these 'XXX' comments though out.  I think they mean
    different things in different places.  I think these should either be
    removed, or converted into real text.  In some places you might want
    to consider making use of 'internal_error (....)' so GDB will given
    some indication that you've run into an area what needs implementing,
    in other cases, just expanding the comment to indicate that the
    current code isn't final will be the correct thing to do.

Yeah, these comments are definitely too terse :)
Will fix in a subsequent version of the patches.

Thanks!


  reply	other threads:[~2020-07-06 14:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03 10:37 [PATCH 0/2] eBPF support Jose E. Marchesi
2020-07-03 10:37 ` [PATCH 1/2] gdb: support for eBPF Jose E. Marchesi
2020-07-03 11:39   ` Andrew Burgess
2020-07-06 14:50     ` Jose E. Marchesi [this message]
2020-07-03 11:49   ` Eli Zaretskii
2020-07-06 14:51     ` Jose E. Marchesi

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=87o8osn1e3.fsf@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /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