From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7130 invoked by alias); 31 Oct 2009 06:02:26 -0000 Received: (qmail 6667 invoked by uid 22791); 31 Oct 2009 06:02:24 -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; Sat, 31 Oct 2009 06:02:19 +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 n9V6JRBS005204 for ; Sat, 31 Oct 2009 04:19:28 -0200 Received: from d24av04.br.ibm.com (d24av04.br.ibm.com [9.18.232.43]) by mailhub1.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n9V639AW700584 for ; Sat, 31 Oct 2009 04:03:09 -0200 Received: from d24av04.br.ibm.com (loopback [127.0.0.1]) by d24av04.br.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id n9V62FR1003011 for ; Sat, 31 Oct 2009 04:02:15 -0200 Received: from miki.localnet ([9.8.8.20]) by d24av04.br.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id n9V629T8002326 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 31 Oct 2009 04:02:14 -0200 From: =?iso-8859-1?q?S=E9rgio_Durigan_J=FAnior?= To: gdb-patches@sourceware.org Subject: Re: [RFC] Wording of "catch syscall " warning Date: Sat, 31 Oct 2009 06:02:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.30.4; KDE/4.3.2; i686; ; ) Cc: Doug Evans , tromey@redhat.com References: <20090925003107.87780843AC@ruffy.mtv.corp.google.com> <200910030019.48874.sergiodj@linux.vnet.ibm.com> In-Reply-To: <200910030019.48874.sergiodj@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200910310402.01971.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-10/txt/msg00704.txt.bz2 On Saturday 03 October 2009, S=E9rgio Durigan J=FAnior wrote: > On Monday 28 September 2009, Doug Evans wrote: > > 2009/9/26 S=E9rgio Durigan J=FAnior : > > > Ok, so here it is. This patch updates the testcase so that it doesn't > > > fail when GDB is built without expat support. Also, it removes the > > > unecessary warning from breakpoint.c, and updates that existing warni= ng > > > in xml-syscall.c in order to tell the user that GDB won't be able to > > > verify syscall numbers if no XML support is present. > > > > > > What do you think now? > > > > Thanks. > > It's fine with me. I've checked in this patch. If there is any problem, please tell me. Regards, --=20 S=E9rgio Durigan J=FAnior Linux on Power Toolchain - Software Engineer Linux Technology Center - LTC IBM Brazil gdb/ChangeLog: 2009-31-10 Sergio Durigan Junior * breakpoint.c (catch_syscall_split_args): Remove unecessary warning displayed when the user provided a syscall name and there is no XML support. * xml-syscall.c: Renamed `_sysinfo' to `sysinfo'. (set_xml_syscall_file_name): Remove syscall_warn_user. (xml_init_syscalls_info): Remove warning. (init_sysinfo): Update warnings. gdb/testsuite/ChangeLog: 2009-31-10 Sergio Durigan Junior * gdb.base/catch-syscall.exp: Adapt the testcase in order to accept the modified warnings for catch syscall. Verify if GDB was compiled with support for lib expat, and choose which tests to run depending on this. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index cf11f51..6bf9262 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -7804,17 +7804,7 @@ catch_syscall_split_args (char *arg) /* Check if the user provided a syscall name or a number. */ syscall_number =3D (int) strtol (cur_name, &endptr, 0); if (*endptr =3D=3D '\0') - { - get_syscall_by_number (syscall_number, &s); - - if (s.name =3D=3D NULL) - /* 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); - } + get_syscall_by_number (syscall_number, &s); else { /* We have a name. Let's check if it's valid and convert it diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp=20 b/gdb/testsuite/gdb.base/catch-syscall.exp index 6798d04..b68aa8a 100644 --- a/gdb/testsuite/gdb.base/catch-syscall.exp +++ b/gdb/testsuite/gdb.base/catch-syscall.exp @@ -252,6 +252,25 @@ proc test_catch_syscall_restarting_inferior {} { check_for_program_end } =20 +proc test_catch_syscall_fail_nodatadir {} { + global gdb_prompt + + # Sanitizing. + delete_breakpoints + + # Testing to see if we receive a warning when calling "catch syscall" + # without XML support (without datadir). + set thistest "Catch syscall displays a warning when there is no XML=20 support (no datadir set)" + gdb_test "catch syscall" "warning: Could not load the syscall XML=20 file.*warning: GDB will not be able to display syscall names nor to verify= =20 if.*any provided syscall numbers are valid.*Catchpoint .*(syscall).*"=20 $thistest + + # Since the catchpoint was set, we must check if it's present at + # "info breakpoints" + check_info_bp_any_syscall + + # Sanitizing. + delete_breakpoints +} + proc do_syscall_tests {} { global gdb_prompt srcdir =20 @@ -295,25 +314,6 @@ proc do_syscall_tests {} { if [runto_main] then { test_catch_syscall_restarting_inferior } } =20 -proc test_catch_syscall_fail_noxml {} { - global gdb_prompt - - # Sanitizing. - delete_breakpoints - - # Testing to see if we receive a warning when calling "catch syscall" - # without XML support. - set thistest "Catch syscall displays a warning when there is no XML=20 support" - gdb_test "catch syscall" "warning: Could not open .*warning: Could not= =20 load the syscall XML file .*GDB will not be able to display syscall=20 names.*Catchpoint .*(syscall).*" $thistest - - # Since the catchpoint was set, we must check if it's present at - # "info breakpoints" - check_info_bp_any_syscall - - # Sanitizing. - delete_breakpoints -} - proc test_catch_syscall_without_args_noxml {} { # We will need the syscall names even not using it # because we need to know know many syscalls are in @@ -386,11 +386,7 @@ proc do_syscall_tests_without_xml {} { # we want GDB to display only numbers, not names. So, let's # begin with the tests. =20 - # The first test is to see if GDB displays a warning when we - # try to catch syscalls without the XML support. - test_catch_syscall_fail_noxml - - # Now, let's test if we can catch syscalls without XML support. + # Let's test if we can catch syscalls without XML support. # We should succeed, but GDB is not supposed to print syscall names. if [runto_main] then { test_catch_syscall_without_args_noxml } =20 @@ -426,12 +422,24 @@ proc fill_all_syscalls_numbers {} { # Start with a fresh gdb =20 gdb_exit +set do_xml_test ![gdb_skip_xml_test] gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} =20 # Execute the tests, using XML support -do_syscall_tests +if $do_xml_test { + do_syscall_tests + + # Now, we have to see if GDB displays a warning when we + # don't set the data-directory but try to use catch syscall + # anyway. For that, we must restart GDB first. + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load ${binfile} + test_catch_syscall_fail_nodatadir +} =20 # Restart gdb =20 diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c index 15bfe6f..963ebcd 100644 --- a/gdb/xml-syscall.c +++ b/gdb/xml-syscall.c @@ -1,9 +1,7 @@ /* Functions that provide the mechanism to parse a syscall XML file and get its values. =20 - Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 199= 6, - 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008 - Free Software Foundation, Inc. + Copyright (C) 2009 Free Software Foundation, Inc. =20 This file is part of GDB. =20 @@ -52,7 +50,7 @@ syscall_warn_user (void) void set_xml_syscall_file_name (const char *name) { - syscall_warn_user (); + return; } =20 void @@ -80,7 +78,6 @@ get_syscall_names (void) return NULL; } =20 - #else /* ! HAVE_LIBEXPAT */ =20 /* Structure which describes a syscall. */ @@ -114,7 +111,7 @@ struct syscall_parsing_data =20 /* Structure used to store information about the available syscalls in the system. */ -static const struct syscalls_info *_sysinfo =3D NULL; +static const struct syscalls_info *sysinfo =3D NULL; =20 /* A flag to tell if we already initialized the structure above. */ static int have_initialized_sysinfo =3D 0; @@ -275,10 +272,7 @@ xml_init_syscalls_info (const char *filename) =20 full_file =3D xml_fetch_content_from_file (filename, gdb_datadir); if (full_file =3D=3D NULL) - { - warning (_("Could not open \"%s\""), filename); - return NULL; - } + return NULL; =20 back_to =3D make_cleanup (xfree, full_file); =20 @@ -300,27 +294,23 @@ init_sysinfo (void) /* Did we already try to initialize the structure? */ if (have_initialized_sysinfo) return; -/* if (xml_syscall_file =3D=3D NULL) - internal_error (__FILE__, __LINE__, - _("This architecture has not set the XML syscall file " - "name. This is a bug and should not happen; please " - "report it.")); */ =20 - _sysinfo =3D xml_init_syscalls_info (xml_syscall_file); + sysinfo =3D xml_init_syscalls_info (xml_syscall_file); =20 have_initialized_sysinfo =3D 1; =20 - if (_sysinfo =3D=3D NULL) + if (sysinfo =3D=3D NULL) { if (xml_syscall_file) - /* The initialization failed. Let's show a warning - message to the user (just this time) and leave. */ - warning (_("Could not load the syscall XML file `%s'.\n\ -GDB will not be able to display syscall names."), xml_syscall_file); + warning (_("\ +Could not load the syscall XML file `%s'."), xml_syscall_file); else - /* There's no file to open. Let's warn the user. */ - warning (_("There is no XML file to open.\n\ -GDB will not be able to display syscall names.")); + warning (_("\ +There is no XML file to open.")); + + warning (_("\ +GDB will not be able to display syscall names nor to verify if\n\ +any provided syscall numbers are valid.")); } } =20 @@ -408,7 +398,7 @@ get_syscall_by_number (int syscall_number, init_sysinfo (); =20 s->number =3D syscall_number; - s->name =3D xml_get_syscall_name (_sysinfo, syscall_number); + s->name =3D xml_get_syscall_name (sysinfo, syscall_number); } =20 void @@ -417,7 +407,7 @@ get_syscall_by_name (const char *syscall_name, { init_sysinfo (); =20 - s->number =3D xml_get_syscall_number (_sysinfo, syscall_name); + s->number =3D xml_get_syscall_number (sysinfo, syscall_name); s->name =3D syscall_name; } =20 @@ -426,7 +416,7 @@ get_syscall_names (void) { init_sysinfo (); =20 - return xml_list_of_syscalls (_sysinfo); + return xml_list_of_syscalls (sysinfo); } =20 #endif /* ! HAVE_LIBEXPAT */