From: "Sérgio Durigan Júnior" <sergiodj@linux.vnet.ibm.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Wording of "catch syscall <number>" warning
Date: Fri, 25 Sep 2009 01:57:00 -0000 [thread overview]
Message-ID: <200909242257.11714.sergiodj@linux.vnet.ibm.com> (raw)
In-Reply-To: <20090925003107.87780843AC@ruffy.mtv.corp.google.com>
Hi Doug,
On Thursday 24 September 2009, Doug Evans wrote:
> The current wording of this warning feels clumsy if syscall names
> are unavailable. It implies there are known syscalls, when there is not.
>
> I'll leave this for a few days and then check it in if there
> are no objections.
Thank you for this. I have one minor comment, though.
> + if (get_syscall_names () != NULL)
> + warning (_("The number '%d' does not represent a known syscall."),
> + syscall_number);
I agree with you, there should be warnings covering both cases. However, this
patch of yours made me think about performance, specially because you are
calling get_syscall_names every time you make this check, and I came up with
another patch. What do you think about it?
Regards,
--
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 811cdfb..1d35336 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7486,9 +7486,16 @@ catch_syscall_split_args (char *arg)
/* We can issue just a warning, but still create the catchpoint.
This is because, even not knowing the syscall name that
this number represents, we can still try to catch the syscall
- number. */
- warning (_("The number '%d' does not represent a known syscall."),
- syscall_number);
+ number. If system call names are unavailable, use a different
+ wording though. */
+ {
+ if (syscall_names_available_p ())
+ warning (_("The number '%d' does not represent a known syscall."),
+ syscall_number);
+ else
+ warning (_("Syscall names are unavailable, assuming '%d' is valid."),
+ syscall_number);
+ }
}
else
{
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
index 15bfe6f..86336b5 100644
--- a/gdb/xml-syscall.c
+++ b/gdb/xml-syscall.c
@@ -80,6 +80,11 @@ get_syscall_names (void)
return NULL;
}
+int
+syscall_names_available_p (void)
+{
+ return 0;
+}
#else /* ! HAVE_LIBEXPAT */
@@ -429,4 +434,10 @@ get_syscall_names (void)
return xml_list_of_syscalls (_sysinfo);
}
+int
+syscall_names_available_p (void)
+{
+ return _sysinfo == NULL ? 0 : 1;
+}
+
#endif /* ! HAVE_LIBEXPAT */
diff --git a/gdb/xml-syscall.h b/gdb/xml-syscall.h
index 00d3a54..326a856 100644
--- a/gdb/xml-syscall.h
+++ b/gdb/xml-syscall.h
@@ -47,4 +47,8 @@ void get_syscall_by_name (const char *syscall_name, struct
syscall *s);
const char **get_syscall_names (void);
+/* Function used to tell if syscalls names are available. Returns 1 if
+ they are, 0 otherwise. */
+int syscall_names_available_p (void);
+
#endif /* XML_SYSCALL_H */
next prev parent reply other threads:[~2009-09-25 1:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-25 0:31 Doug Evans
2009-09-25 1:49 ` Joel Brobecker
2009-09-25 2:02 ` Sérgio Durigan Júnior
2009-09-25 2:20 ` Joel Brobecker
2009-09-25 2:38 ` Sérgio Durigan Júnior
2009-09-25 5:35 ` Doug Evans
2009-09-25 15:30 ` Joel Brobecker
2009-09-25 15:45 ` Tom Tromey
2009-09-25 16:07 ` Joel Brobecker
2009-09-25 16:50 ` Sérgio Durigan Júnior
2009-09-25 1:57 ` Sérgio Durigan Júnior [this message]
2009-09-25 15:45 ` Tom Tromey
2009-09-25 16:50 ` Sérgio Durigan Júnior
2009-09-25 19:39 ` Sérgio Durigan Júnior
2009-09-25 20:15 ` Doug Evans
2009-09-26 19:18 ` Sérgio Durigan Júnior
2009-09-26 23:34 ` Sérgio Durigan Júnior
2009-09-28 5:09 ` Doug Evans
2009-10-03 3:19 ` Sérgio Durigan Júnior
2009-10-31 6:02 ` Sérgio Durigan Júnior
2009-09-25 23:00 ` Sérgio Durigan Júnior
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=200909242257.11714.sergiodj@linux.vnet.ibm.com \
--to=sergiodj@linux.vnet.ibm.com \
--cc=dje@google.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