From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19895 invoked by alias); 25 Sep 2009 01:57:32 -0000 Received: (qmail 19876 invoked by uid 22791); 25 Sep 2009 01:57:31 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from e24smtp02.br.ibm.com (HELO e24smtp02.br.ibm.com) (32.104.18.86) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Sep 2009 01:57:25 +0000 Received: from mailhub1.br.ibm.com (mailhub1.br.ibm.com [9.18.232.109]) by e24smtp02.br.ibm.com (8.14.3/8.13.1) with ESMTP id n8P28ie9029506 for ; Thu, 24 Sep 2009 23:08:44 -0300 Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by mailhub1.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n8P1w1Yx1356256 for ; Thu, 24 Sep 2009 22:58:01 -0300 Received: from d24av05.br.ibm.com (loopback [127.0.0.1]) by d24av05.br.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id n8P1vLuh003340 for ; Thu, 24 Sep 2009 22:57:21 -0300 Received: from miki.localnet ([9.8.14.114]) by d24av05.br.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id n8P1vF4x002900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 24 Sep 2009 22:57:21 -0300 From: =?iso-8859-1?q?S=E9rgio_Durigan_J=FAnior?= To: Doug Evans Subject: Re: [RFC] Wording of "catch syscall " warning Date: Fri, 25 Sep 2009 01:57:00 -0000 User-Agent: KMail/1.12.1 (Linux/2.6.30.4; KDE/4.3.1; i686; ; ) Cc: gdb-patches@sourceware.org References: <20090925003107.87780843AC@ruffy.mtv.corp.google.com> In-Reply-To: <20090925003107.87780843AC@ruffy.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200909242257.11714.sergiodj@linux.vnet.ibm.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00772.txt.bz2 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. >=20 > 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 () !=3D 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, t= his=20 patch of yours made me think about performance, specially because you are=20 calling get_syscall_names every time you make this check, and I came up wit= h=20 another patch. What do you think about it?=20 Regards, --=20 S=E9rgio Durigan J=FAnior 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; } =20 +int +syscall_names_available_p (void) +{ + return 0; +} =20 #else /* ! HAVE_LIBEXPAT */ =20 @@ -429,4 +434,10 @@ get_syscall_names (void) return xml_list_of_syscalls (_sysinfo); } =20 +int +syscall_names_available_p (void) +{ + return _sysinfo =3D=3D 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, struc= t=20 syscall *s); =20 const char **get_syscall_names (void); =20 +/* 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 */