Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Sérgio Durigan Júnior" <sergiodj@linux.vnet.ibm.com>
To: tromey@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/4] 'catch syscall' feature -- 	Architecture-independent part
Date: Fri, 07 Nov 2008 03:39:00 -0000	[thread overview]
Message-ID: <1226029103.32321.96.camel@miki> (raw)
In-Reply-To: <m3d4hbpe7s.fsf@fleche.redhat.com>

Hey Tom!

On Tue, 2008-11-04 at 10:56 -0700, Tom Tromey wrote:
> >>>>> "Sérgio" == Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com> writes:
> 
> Sérgio> +/* The maximum number of arguments the user can provide to
> Sérgio> +   the 'catch syscall' command.  */
> Sérgio> +#define MAX_CATCH_SYSCALL_ARGS 10
> 
> Do we need a maximum?  GNU style is not to have them.

I don't know if we need :-). I just decided to put it there :-P. But of
course I can take it off.

> 
> Sérgio> +    printf_filtered (_("'%s ()'"), syscall_name);
> 
> I don't think the '()' is needed here.

OK.

> Sérgio> +static void
> Sérgio> +print_mention_catch_syscall (struct breakpoint *b)
> Sérgio> +{
> Sérgio> +  if (b->syscall_to_be_caught != CATCHING_ANY_SYSCALL)
> Sérgio> +    printf_filtered (_("Catchpoint %d (syscall '%s ()')"),
> 
> Same here.

Roger that.

> Sérgio> +/* Splits the argument using space as delimiter.
> Sérgio> +   Returns the number of args.  */
> Sérgio> +static int
> Sérgio> +catch_syscall_split_args (char *arg, int *syscalls_numbers)
> 
> Sérgio> +      memset ((void *) cur_name, '\0', 128 * sizeof (char));
> 
> I don't think this is needed.
> Also, sizeof(char)==1 by definition.

Yeah, I know hehe. It just happens that I like to be "explicit", so
you'll likely find "sizeof (char)" in every code I make :-)... But
there's no problem for me to take it off.

> Sérgio> +      for (i = 0; out == 0; i++)
> Sérgio> +        {
> Sérgio> +          c = *arg_p;
> Sérgio> +          cur_name[i] = c;
> Sérgio> +          if (isspace (c) || c == '\0')
> Sérgio> +            {
> Sérgio> +              out = 1;
> Sérgio> +              cur_name[i] = '\0';
> 
> I'd say, remove "out", make it an infinite loop, and use a 'break' in
> the exit condition.

Right.

> Sérgio> +static void
> Sérgio> +catch_syscall_command_1 (char *arg, int from_tty, struct cmd_list_element *command)
> 
> I think you need a line break before the 'struct' here.

Forgot about that. Sorry.

> Sérgio> +      for (i = 0; i < nargs; i++)
> Sérgio> +        create_syscall_event_catchpoint (tempflag, syscalls_numbers[i],
> Sérgio> +                                         &catch_syscall_breakpoint_ops);
> 
> This makes a separate catchpoint for each argument to "catch syscall".
> 
> I think it would be more useful to make a single catchpoint.  A single
> catchpoint gives the user a way to set commands, conditions, etc, for
> a whole range of syscalls at once.  It is analogous, I think, to
> having a breakpoint with multiple locations.

I have a question right here, then. Is the "breakpoint with multiple
locations" implemented this way? I'm sorry for my ignorance on this :-(

> 
> What do you think of that?
> 
> It would mean some changes in the logic and some changes in the data
> structure -- but nothing too major.  Usually a catchpoint would have a
> small number of syscalls, so I'd say that just using a linked list
> would be fine.

I was talking to Thiago about this, and I don't know if we need this
*right now*, for this patch. I think it's good the way it is, and as you
said, it won't take much to modify things in order to make it work the
way you want :-). Also, currently the "catch syscall" command doesn't
allow the user to set commands, conditions, etc. So for now it's only
"catch syscall [name|number]".

What do you think?

> Sérgio> +/* Complete syscalls names.  Used by "catch syscall".  */
> Sérgio> +char **
> Sérgio> +catch_syscall_completer (char *text, char *word)
> Sérgio> +{
> Sérgio> +  const char **list =
> Sérgio> +    gdbarch_get_syscalls_names (current_gdbarch);
> Sérgio> +  return (list == NULL) ? NULL : complete_on_enum (list, text, word);
> Sérgio> +}
> 
> I think you should just put this in breakpoint.c and make it static.
> My reasoning is that it is likely that only this one particular
> command will need this completion function.

Right, I agree. Consider it done.

Thanks for your comments :-).

Regards,

-- 
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil


  parent reply	other threads:[~2008-11-07  3:39 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04  4:32 Sérgio Durigan Júnior
2008-11-04 16:17 ` Pedro Alves
2008-11-07  3:30   ` Sérgio Durigan Júnior
2008-11-07 12:12     ` Pedro Alves
2008-11-07 13:30       ` Daniel Jacobowitz
2008-11-08 15:35       ` Sérgio Durigan Júnior
2008-11-04 17:57 ` Tom Tromey
2008-11-04 21:55   ` Thiago Jung Bauermann
2008-11-04 22:33     ` Tom Tromey
2008-11-05 19:05       ` Tom Tromey
2008-11-05 19:13         ` Sérgio Durigan Júnior
2008-11-07  3:41         ` Sérgio Durigan Júnior
2008-11-07  3:39   ` Sérgio Durigan Júnior [this message]
2008-11-07 18:21     ` Tom Tromey
2008-11-04 21:13 ` Eli Zaretskii
2008-11-04 22:12   ` Thiago Jung Bauermann
2008-11-04 22:22     ` Eli Zaretskii
2008-11-04 22:35       ` Daniel Jacobowitz
2008-11-05  4:19         ` Eli Zaretskii
2008-11-05 13:34           ` Sérgio Durigan Júnior
2008-11-05 18:42             ` Eli Zaretskii
2008-11-08 19:31             ` Mark Kettenis
2008-11-05 14:55           ` Daniel Jacobowitz
2008-11-05 18:43             ` Eli Zaretskii
2008-11-05 18:59               ` Daniel Jacobowitz
2008-11-05 19:11                 ` Eli Zaretskii
2008-11-06 23:03               ` Mark Kettenis
2008-11-04 22:31     ` Pedro Alves
2008-11-05  4:10       ` Eli Zaretskii
2008-11-05 12:29         ` Pedro Alves
2008-11-05 18:38           ` Eli Zaretskii
2008-11-05 18:57             ` Pedro Alves
2008-11-05 19:10               ` Eli Zaretskii
2008-11-05 19:34                 ` Pedro Alves
2008-11-05 20:36                   ` Eli Zaretskii
2008-11-05 21:10                     ` Pedro Alves
2008-11-06  4:27                       ` Eli Zaretskii
2008-11-06 14:32                         ` Pedro Alves
2008-11-07  9:59                           ` Eli Zaretskii
2008-11-07 10:10                             ` Pedro Alves
2008-11-05 13:32         ` Mark Kettenis
  -- strict thread matches above, loose matches on Subject: below --
2008-09-30 18:12 Sérgio Durigan Júnior
2008-10-02 21:13 ` Joel Brobecker
2008-10-03  2:33   ` Sérgio Durigan Júnior
2008-10-03  6:07     ` Joel Brobecker
2008-10-03 17:52       ` Daniel Jacobowitz
2008-10-04 23:07         ` Sérgio Durigan Júnior
2008-10-04 23:04       ` Sérgio Durigan Júnior
2008-10-06 17:22         ` Joel Brobecker
2008-10-10 13:12           ` Daniel Jacobowitz
2008-10-10 15:28           ` Sérgio Durigan Júnior
2008-10-12  2:26           ` Sérgio Durigan Júnior
2008-10-15  5:40             ` Joel Brobecker
2008-10-16  3:35               ` Sérgio Durigan Júnior
2008-10-16 12:37                 ` Daniel Jacobowitz
2008-10-16 15:17                   ` Daniel Jacobowitz
2008-10-16 16:28                     ` Joel Brobecker

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=1226029103.32321.96.camel@miki \
    --to=sergiodj@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.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