From bccd0dd2032230e7de132f82840d21a359927e2a Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Sat, 31 Oct 2009 06:00:13 +0000 Subject: [PATCH] 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. --- gdb/ChangeLog | 10 ++++ gdb/breakpoint.c | 12 +---- gdb/testsuite/ChangeLog | 7 +++ gdb/testsuite/gdb.base/catch-syscall.exp | 58 ++++++++++++++---------- gdb/xml-syscall.c | 44 +++++++----------- 5 files changed, 68 insertions(+), 63 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 345afc6242..a42baf7eef 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +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. + 2009-10-30 Vladimir Prus Fix breakpoint commands in MI. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index cf11f51d5e..6bf9262c33 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 = (int) strtol (cur_name, &endptr, 0); if (*endptr == '\0') - { - get_syscall_by_number (syscall_number, &s); - - if (s.name == 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/ChangeLog b/gdb/testsuite/ChangeLog index 70731946cb..56400cd6d9 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +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. + 2009-10-30 Vladimir Prus * gdb.mi/mi-break.exp (test_breakpoint_commands): Test diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp index 6798d043b6..b68aa8a65e 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 } +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 support (no datadir set)" + gdb_test "catch syscall" "warning: Could not load the syscall XML file.*warning: GDB will not be able to display syscall names nor to verify if.*any provided syscall numbers are valid.*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 do_syscall_tests {} { global gdb_prompt srcdir @@ -295,25 +314,6 @@ proc do_syscall_tests {} { if [runto_main] then { test_catch_syscall_restarting_inferior } } -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 support" - gdb_test "catch syscall" "warning: Could not open .*warning: Could not load the syscall XML file .*GDB will not be able to display syscall 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. - # 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 } @@ -426,12 +422,24 @@ proc fill_all_syscalls_numbers {} { # Start with a fresh gdb gdb_exit +set do_xml_test ![gdb_skip_xml_test] gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} # 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 +} # Restart gdb diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c index 15bfe6fa18..963ebcd236 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. - Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, - 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008 - Free Software Foundation, Inc. + Copyright (C) 2009 Free Software Foundation, Inc. This file is part of GDB. @@ -52,7 +50,7 @@ syscall_warn_user (void) void set_xml_syscall_file_name (const char *name) { - syscall_warn_user (); + return; } void @@ -80,7 +78,6 @@ get_syscall_names (void) return NULL; } - #else /* ! HAVE_LIBEXPAT */ /* Structure which describes a syscall. */ @@ -114,7 +111,7 @@ struct syscall_parsing_data /* Structure used to store information about the available syscalls in the system. */ -static const struct syscalls_info *_sysinfo = NULL; +static const struct syscalls_info *sysinfo = NULL; /* A flag to tell if we already initialized the structure above. */ static int have_initialized_sysinfo = 0; @@ -275,10 +272,7 @@ xml_init_syscalls_info (const char *filename) full_file = xml_fetch_content_from_file (filename, gdb_datadir); if (full_file == NULL) - { - warning (_("Could not open \"%s\""), filename); - return NULL; - } + return NULL; back_to = make_cleanup (xfree, full_file); @@ -300,27 +294,23 @@ init_sysinfo (void) /* Did we already try to initialize the structure? */ if (have_initialized_sysinfo) return; -/* if (xml_syscall_file == 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.")); */ - _sysinfo = xml_init_syscalls_info (xml_syscall_file); + sysinfo = xml_init_syscalls_info (xml_syscall_file); have_initialized_sysinfo = 1; - if (_sysinfo == NULL) + if (sysinfo == 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.")); } } @@ -408,7 +398,7 @@ get_syscall_by_number (int syscall_number, init_sysinfo (); s->number = syscall_number; - s->name = xml_get_syscall_name (_sysinfo, syscall_number); + s->name = xml_get_syscall_name (sysinfo, syscall_number); } void @@ -417,7 +407,7 @@ get_syscall_by_name (const char *syscall_name, { init_sysinfo (); - s->number = xml_get_syscall_number (_sysinfo, syscall_name); + s->number = xml_get_syscall_number (sysinfo, syscall_name); s->name = syscall_name; } @@ -426,7 +416,7 @@ get_syscall_names (void) { init_sysinfo (); - return xml_list_of_syscalls (_sysinfo); + return xml_list_of_syscalls (sysinfo); } #endif /* ! HAVE_LIBEXPAT */