Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: "Sérgio Durigan Júnior" <sergiodj@linux.vnet.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
Date: Tue, 04 Nov 2008 18:41:00 -0000	[thread overview]
Message-ID: <m38wrzpc5w.fsf@fleche.redhat.com> (raw)
In-Reply-To: <1225773086.24532.55.camel@miki> (=?utf-8?Q?=22S=C3=A9rgio?=  Durigan =?utf-8?Q?J=C3=BAnior=22's?= message of "Tue\, 04 Nov 2008  02\:31\:26 -0200")

>>>>> "Sérgio" == Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com> writes:

Sérgio> This is the part which adds XML support for the "catch
Sérgio> syscall" feature.  I decided to put the architecture's XML
Sérgio> files here too, so that the architecture-independent part does
Sérgio> not grow too much.

Just a few nits from me...

Sérgio> +struct syscalls_info
Sérgio> +{
Sérgio> +  /* The number of syscalls in this system.  */
Sérgio> +
Sérgio> +  int number_of_syscalls;
Sérgio> +
Sérgio> +  /* The syscalls.  */
Sérgio> +
Sérgio> +  VEC(syscall_desc_p) *syscalls;
Sérgio> +};

I think number_of_syscalls is redundant here.  The VEC knows how many
elements it contains, so why not just use that?

Sérgio> +static void
Sérgio> +do_cleanup_fclose (void *file)
Sérgio> +{
Sérgio> +  fclose (file);
Sérgio> +}

There's a make_cleanup_fclose now.

Sérgio> +  <syscall name="" number="223"/>
[...]
Sérgio> +  for (i = 0; i < len; i++)
Sérgio> +    {
Sérgio> +      if (strcmp (attrs[i].name, "name") == 0)
Sérgio> +        name = attrs[i].value;
Sérgio> +      else if (strcmp (attrs[i].name, "number") == 0)
Sérgio> +        number = * (ULONGEST *) attrs[i].value;
Sérgio> +      else
Sérgio> +        internal_error (__FILE__, __LINE__,
Sérgio> +                        _("Unknown attribute name '%s'."), attrs[i].name);
Sérgio> +    }
Sérgio> +
Sérgio> +  syscall_create_syscall_desc (data->sysinfo, name, number);

This will make an entry with an empty name given the above XML
snippet.  But that doesn't seem helpful... if this triggers, won't it
print as an unnamed syscall?  It seems to me that it would be
preferable to skip nameless ones and just report them numerically, if
they occur.

Sérgio> +static const struct gdb_xml_attribute syscall_attr[] = {
Sérgio> +      { "number", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },

The indentation is wrong here and in other definitions like this.
It should be just 2 spaces.

Sérgio> +static struct syscalls_info *
Sérgio> +syscall_parse_xml (const char *document, xml_fetch_another fetcher,
Sérgio> +                   void *fetcher_baton)
Sérgio> +{
[...]
Sérgio> +  back_to = make_cleanup (null_cleanup, NULL);

I don't think you need to make a null cleanup here...

Sérgio> +  if (gdb_xml_parse (parser, document) == 0)
Sérgio> +    {
Sérgio> +      /* Parsed successfully.  */
Sérgio> +      discard_cleanups (result_cleanup);
Sérgio> +      do_cleanups (back_to);
Sérgio> +      return data.sysinfo;
Sérgio> +    }
Sérgio> +  else
Sérgio> +    {
Sérgio> +      warning (_("Could not load XML syscalls info; ignoring"));
Sérgio> +      do_cleanups (back_to);
Sérgio> +      return NULL;

... you can either just do_ or discard_ result_cleanup instead.

Tom


  parent reply	other threads:[~2008-11-04 18:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04  4:32 Sérgio Durigan Júnior
2008-11-04 13:36 ` Mark Kettenis
2008-11-04 13:47   ` Daniel Jacobowitz
2008-11-04 15:05     ` Sérgio Durigan Júnior
2008-11-04 15:13       ` Daniel Jacobowitz
2008-11-04 15:18         ` Sérgio Durigan Júnior
2008-11-04 15:06   ` Sérgio Durigan Júnior
2008-11-08 19:06     ` Mark Kettenis
2008-11-04 18:41 ` Tom Tromey [this message]
2008-11-07  3:46   ` Sérgio Durigan Júnior
2008-11-07 18:24     ` Tom Tromey
2008-11-04 21:20 ` Eli Zaretskii
2008-11-04 22:23   ` Daniel Jacobowitz
2008-11-04 22:27     ` Eli Zaretskii
2008-11-04 22:36       ` Daniel Jacobowitz
2008-11-05  1:02         ` Sérgio Durigan Júnior
2008-11-05  4:22         ` Eli Zaretskii
2008-11-05 14:57           ` Daniel Jacobowitz

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