Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Gary Benson <gbenson@redhat.com>,
	bug-hurd@gnu.org,        thomas@codesourcery.com,
	gdb-patches@sourceware.org
Subject: Re: [PATCHv3,Hurd] Add hardware watch support
Date: Wed, 10 Sep 2014 23:23:00 -0000	[thread overview]
Message-ID: <87egvjawmn.fsf@redhat.com> (raw)
In-Reply-To: <20140910224919.GP3244@type.youpi.perso.aquilenet.fr> (Samuel	Thibault's message of "Thu, 11 Sep 2014 00:49:19 +0200")

On Wednesday, September 10 2014, Samuel Thibault wrote:

> 2014-09-06  Samuel Thibault  <samuel.thibault@ens-lyon.org>
>
> 	Add hardware watch support to gnu-i386 platform.
>
> 	* gdb/gdb/gnu-nat.c (inf_threads): New function.
> 	* gdb/gdb/gnu-nat.h (inf_threads_ftype): New type.
> 	(inf_threads): New declaration.
> 	* gdb/gdb/i386gnu-nat.c: Include "x86-nat.h" and "inf-child.h".
> 	[i386_DEBUG_STATE] (i386_gnu_dr_get, i386_gnu_dr_set,
> 	i386_gnu_dr_set_control_one, i386_gnu_dr_set_control,
> 	i386_gnu_dr_set_addr_one, i386_gnu_dr_set_addr, i386_gnu_dr_get_reg,
> 	i386_gnu_dr_get_addr, 386_gnu_dr_get_status, i386_gnu_dr_get_control):
> 	New functions
> 	(reg_addr): New structure.
> 	(_initialize_i386gnu_nat) [i386_DEBUG_STATE]: Initialize hardware i386
> 	debugging register hooks.

Thanks for the patch, Samuel.  What do you think of writing a message
explaining a bit more of this feature, for the sake of putting it in the
commit message?  Just thinking aloud here...

I only have comments about style and organization of the code.

> diff --git a/gdb/i386gnu-nat.c b/gdb/i386gnu-nat.c
> index 8fad871..5654e9a 100644
> --- a/gdb/i386gnu-nat.c
> +++ b/gdb/i386gnu-nat.c
[...]
> +static void i386_gnu_dr_set_control_one (struct proc *thread, void *arg)
> +{
> +  unsigned long *control = arg;
> +  struct i386_debug_state regs;
> +  i386_gnu_dr_get (&regs, thread);
> +  regs.dr[DR_CONTROL] = *control;
> +  i386_gnu_dr_set (&regs, thread);
> +}

This function needs a comment, and the organization is a little messy.
Could you put a newline after the declaration of the variables?

[...]
> +struct reg_addr {
> +  int regnum;
> +  CORE_ADDR addr;
> +};

This structure also needs a comment, and we put a comment on each struct
field as well.

> +static void i386_gnu_dr_set_addr_one (struct proc *thread, void *arg)
> +{
> +  struct reg_addr *reg_addr = arg;
> +  struct i386_debug_state regs;
> +  i386_gnu_dr_get (&regs, thread);
> +  regs.dr[reg_addr->regnum] = reg_addr->addr;
> +  i386_gnu_dr_set (&regs, thread);
> +}

Same comment from the function above: missing a comment, and newline
after var declaration.

Is it possible to submit a testcase for this as well?  WDYT?

Thanks,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


  reply	other threads:[~2014-09-10 23:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 22:49 Samuel Thibault
2014-09-10 23:23 ` Sergio Durigan Junior [this message]
2014-09-12 18:21   ` Samuel Thibault
2014-09-12 19:18     ` Sergio Durigan Junior
2014-09-12 16:51 ` Joel Brobecker
2014-09-12 18:24   ` Samuel Thibault
2014-09-12 17:56 ` Thomas Schwinge
2014-09-12 18:01   ` Samuel Thibault
2014-09-12 20:01     ` Joel Brobecker
2014-09-12 21:24       ` Samuel Thibault
2014-09-12 21:42         ` Sergio Durigan Junior
2014-09-15 13:50         ` Joel Brobecker
2014-09-12 18:25   ` Samuel Thibault
2014-09-15 22:08   ` Thomas Schwinge
2014-09-15 23:09     ` Samuel Thibault
2014-09-16  9:00       ` Thomas Schwinge
2014-09-16 23:17         ` Samuel Thibault
2014-09-16 23:29           ` Samuel Thibault

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=87egvjawmn.fsf@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=bug-hurd@gnu.org \
    --cc=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=thomas@codesourcery.com \
    /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