summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp
Commit message (Collapse)AuthorAgeFilesLines
* Use mi_clean_restart moreTom Tromey2023-01-261-5/+1
| | | | | | | | | This changes a number of MI tests to use mi_clean_restart rather than separate calls. This reduces the number of lines, which is nice, and also provides a nicer model to copy for future tests.
* Rename to allow_cplus_tests and allow_stl_testsTom Tromey2023-01-131-1/+1
| | | | | | | | | This changes skip_cplus_tests to invert the sense, and renames it to allow_cplus_tests. This one also converts skip_stl_tests to allow_stl_tests, as that was convenient to do at the same time.
* Use require !skip_cplus_testsTom Tromey2023-01-131-1/+1
| | | | | | | This changes some tests to use "require !skip_cplus_tests".
* Update copyright year range in header of all files managed by GDBJoel Brobecker2023-01-011-1/+1
| | | | | | | This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
* gdb/testsuite: fix "continue outside of loop" TCL errorsBruno Larsen2022-05-161-2/+2
| | | | | | | | | | | | | | Many test cases had a few lines in the beginning that look like: if { condition } { continue } Where conditions varied, but were mostly in the form of ![runto_main] or [skip_*_tests], making it quite clear that this code block was supposed to finish the test if it entered the code block. This generates TCL errors, as most of these tests are not inside loops. All cases on which this was an obvious mistake are changed in this patch.
* gdb/testsuite: resolve a duplicate test name in a gdb.mi testAndrew Burgess2022-04-031-1/+1
| | | | | | | | | | Solve two duplicate test names in the test script: gdb.mi/mi-catch-cpp-exceptions.exp by moving the call to restart_for_test inside the with_test_prefix block. There should be no difference in what is tested after this commit.
* Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker2022-01-011-1/+1
| | | | | | | | This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
* Update copyright year range in all GDB filesJoel Brobecker2021-01-011-1/+1
| | | | | | | | | This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
* Eliminate mi_run_to_main, introduce mi_clean_restartPedro Alves2020-10-131-7/+2
| | | | | | | | | | | | | | | | Since we now have mi_runto_main which is like runto_main, eliminate mi_run_to_main, in favor of a new MI clean_restart counterpart -- mi_clean_restart -- and mi_runto_main. This makes MI testcases look a bit more like CLI testcases. gdb/testsuite/ChangeLog: * lib/mi-support.exp (mi_clean_restart): New. (mi_run_to_main): Delete. All callers adjust to use mi_clean_restart / mi_runto_main. Change-Id: I34920bab4fea1f23fb752928c2969c1f6ad714b6
* Introduce mi_runto_mainPedro Alves2020-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds an mi_runto_main routine, very much like the runto_main CLI counterpart. Note there's already a mi_run_to_main (extra underscore in "run_to"), but unlike its intro comment says, that does more than the CLI's runto_main -- it also starts GDB. I would like to eliminate that other one by introducing a mi_clean_restart function instead. That is done later in the series. gdb/testsuite/ChangeLog: * lib/mi-support.exp (mi_runto_main): New proc. (mi_run_to_main): Use it. * gdb.mi/mi-catch-cpp-exceptions.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi-var-invalidate.exp: Likewise. * mi-var-list-children-invalid-grandchild.exp: Likewise. * gdb.mi/mi2-amd64-entry-value.exp: Likewise. * gdb.mi/new-ui-mi-sync.exp: Likewise. * gdb.mi/user-selected-context-sync.exp: Likewise. * gdb.opt/inline-cmds.exp: Likewise. * gdb.python/py-framefilter-mi.exp: Likewise. * gdb.python/py-mi.exp: Likewise. Change-Id: I2e49ca7b0b61cea57c1202e5dfa32417e6a4403d
* Update copyright year range in all GDB files.Joel Brobecker2020-01-011-1/+1
| | | | | | gdb/ChangeLog: Update copyright year range in all GDB files.
* [gdb/testsuite] Make skip_libstdcxx_probe_tests return 1 if trueTom de Vries2019-08-261-1/+1
| | | | | | | | | | | | | | | | | | | | | The tcl proc skip_libstdcxx_probe_tests currently returns 0 if the probe tests need to be skipped, while tcl interprets 0 as false rather than true, which is confusing. Fix this by making skip_libstdcxx_probe_tests return 1 if the probe tests need to be skipped. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-26 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Return 1 if probe * tests need to be skipped. * gdb.cp/exceptprint.exp: Update call to skip_libstdcxx_probe_tests. * gdb.mi/mi-catch-cpp-exceptions.exp: Update call to mi_skip_libstdcxx_probe_tests.
* [gdb/testsuite] Test skip_libstdcxx_probe_tests in mi-catch-cpp-exceptions.expTom de Vries2019-07-251-38/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | On a system without SDT probes in libstdc++, we run into: ... FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until \ breakpoint in main (unknown output after running) ... The test-case uses a regexp argument for the catch throw/rethrow/catch command, which is only supported on systems with SDT probes in libstdc++. Fix this by marking the portions of the test-case that use a regexp argument as unsupported on a system without SDT probes. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-25 Tom de Vries <tdevries@suse.de> PR testsuite/24830 * gdb.mi/mi-catch-cpp-exceptions.exp: Call mi_skip_libstdcxx_probe_tests, and skip unsupported tests. * lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Factor out of ... (skip_libstdcxx_probe_tests): ... here. * lib/mi-support.exp (mi_skip_libstdcxx_probe_tests): New proc.
* gdb: Remove a non-const reference parameterAndrew Burgess2019-07-171-21/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Non-const reference parameter should be avoided according to the GDB coding standard: https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Avoid_non-const_reference_parameters.2C_use_pointers_instead This commit updates the gdbarch method gdbarch_stap_adjust_register, and the one implementation i386_stap_adjust_register to avoid using a non-const reference parameter. I've also removed the kfail from the testsuite for bug 24541, as this issue is now resolved. gdb/ChangeLog: PR breakpoints/24541 * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh: Adjust return type and parameter types for 'stap_adjust_register'. (i386_stap_adjust_register): Adjust signature and return new register name. * stap-probe.c (stap_parse_register_operand): Adjust use of 'gdbarch_stap_adjust_register'. gdb/testsuite/ChangeLog: PR breakpoints/24541 * gdb.mi/mi-catch-cpp-exceptions.exp: Remove kfail due to 24541.
* "catch catch/throw/rethrow", breakpoint -> catchpointPedro Alves2019-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, with: (gdb) catch catch Catchpoint 1 (catch) (gdb) catch throw Catchpoint 2 (throw) (gdb) catch rethrow Catchpoint 3 (rethrow) You get: (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y 0x0000000000b122af exception catch 2 breakpoint keep y 0x0000000000b1288d exception throw 3 breakpoint keep y 0x0000000000b12931 exception rethrow I think it doesn't make much sense usability-wise, to show a catchpoint as a breakpoint. The fact that GDB sets a breakpoint at some magic address in the C++ run time is an implementation detail, IMO. And as seen in the previous patch, such a catchpoint can end up with more than one location/address even, so showing a single address isn't entirely accurate. This commit hides the addresses from view, and makes GDB show "catchpoint" for type as well: (gdb) info breakpoints Num Type Disp Enb Address What 1 catchpoint keep y exception catch 2 catchpoint keep y exception throw 3 catchpoint keep y exception rethrow This comment in the code seems telling: /* We need to reset 'type' in order for code in breakpoint.c to do the right thing. */ cp->type = bp_breakpoint; It kind of suggests that the reason catchpoints end up shown as breakpoints was that it was easier to implement them that way, rather than a desired property. This commit fixes things up to make it possible to have bp_catch breakpoints have software/hardware breakpoint locations, thus eliminating the need for that hack: - redo breakpoint_address_is_meaningful in terms of the location's type rather than breakpoint type. - teach bpstat_what about stepping over the catchpoint locations. - install a allocate_location method for "catch catch/throw/rethrow", one that forces the location type. Note that this also reverts the gdb hunk from: commit 2a8be20359dba9cc684fd3ffa222d985399f3b18 Commit: Tom Tromey <tom@tromey.com> CommitDate: Sat Oct 6 22:17:45 2018 -0600 Fix Python gdb.Breakpoint.location crash because now "catch throw" catchpoints hit the if (obj->bp->type != bp_breakpoint) Py_RETURN_NONE; check above, and, adjusts the testcase to no longer expect to see the catchpoint in the gdb.breakpoints() list. (Note: might make sense to do the same to Ada exception catchpoints.) gdb/ChangeLog: 2019-07-09 Pedro Alves <palves@redhat.com> * break-catch-throw.c (print_one_exception_catchpoint): Skip the "addr" field. (allocate_location_exception_catchpoint): New. (handle_gnu_v3_exceptions): Don't reset 'type' to bp_breakpoint. (initialize_throw_catchpoint_ops): Install allocate_location_exception_catchpoint as allocate_location method. * breakpoint.c (bpstat_what) <bp_catch>: Set action to BPSTAT_WHAT_SINGLE if not stopping and the location's type is not bp_loc_other. (breakpoint_address_is_meaningful): Delete. (bl_address_is_meaningful): New. (breakpoint_locations_match): Adjust comment. (bp_location_from_bp_type): New, factored out of... (bp_location::bp_location(breakpoint *)): ... this. (bp_location::bp_location(breakpoint *, bp_loc_type)): New, factored out of... (bp_location::bp_location(breakpoint *)): ... this. Reimplement. (bp_loc_is_permanent): Use bl_address_is_meaningful instead of breakpoint_address_is_meaningful. (bp_locations_compare): Adjust comment. (update_global_location_list): Use bl_address_is_meaningful instead of breakpoint_address_is_meaningful. * breakpoint.h (bp_location::bp_location(breakpoint *)): New explicit. (bp_location::bp_location(breakpoint *, bp_loc_type)): Declare. * python/py-breakpoint.c (bppy_get_location): No longer check whether location is null. gdb/doc/ChangeLog: 2019-07-09 Pedro Alves <palves@redhat.com> * gdb.texinfo (C++ Exception GDB/MI Catchpoint Commands): Adjust examples to show type=catchpoint instead of type=breakpoint and an address. gdb/testsuite/ChangeLog: 2019-07-09 Pedro Alves <palves@redhat.com> * gdb.cp/catch-multi-stdlib.exp: Adjust expected "info breakpoints" output. * gdb.cp/exception.exp: Adjust expected "info breakpoints" output. * gdb.python/py-breakpoint.exp: No longer expect that "catch throw" creates breakpoint. * gdb.mi/mi-catch-cpp-exceptions.exp (setup_catchpoint): Expect 'type="catchpoint"'.
* gdb/testsuite: Improve detection of bug gdb/24541Andrew Burgess2019-06-161-0/+3
| | | | | | | | | | | | | | | | In bug gdb/24686 a testsuite failure was reported, this failure was actually just another instance of bug gdb/24541, however, due to the non-deterministic nature of bug gdb/24541 the testsuite pattern that was intended to catch this bug failed. This commit adds a second pattern to help detect gdb/24541, which should change the FAIL reported in gdb/24686 into a KFAIL. gdb/testsuite/ChangeLog: PR gdb/24686 * gdb.mi/mi-catch-cpp-exceptions.exp: Add an extra pattern to improve detection of bug gdb/24541.
* gdb/mi: New commands to catch C++ exceptionsAndrew Burgess2019-06-151-0/+197
Adds some MI commands to catch C++ exceptions. The new commands are -catch-throw, -catch-rethrow, and -catch-catch, these all correspond to the CLI commands 'catch throw', 'catch rethrow', and 'catch catch'. Each MI command takes two optional arguments, '-t' has the effect of calling 'tcatch' instead of 'catch', for example: (gdb) -catch-throw -t Is the same as: (gdb) tcatch throw There is also a '-r REGEXP' argument that can supply a regexp to match against the exception type, so: (gdb) -catch-catch -r PATTERN Is the same as: (gdb) catch catch PATTERN The change in print_mention_exception_catchpoint might seem a little strange; changing the output from using ui_out::field_int and ui_out::text to using ui_out::message. The print_mention_exception_catchpoint is used as the 'print_mention' method for the exception catchpoint breakpoint object. Most of the other 'print_mention' methods (see breakpoint.c) use either printf_filtered, of ui_out::message. Using field_int was causing an unexpected field to be added to the MI output. Here's the output without the change in print_mention_exception_catchpoint: (gdb) -catch-throw ^done,bkptno="1",bkpt={number="1",type="breakpoint",disp="keep", enabled="y",addr="0x00000000004006c0", what="exception throw",catch-type="throw", thread-groups=["i1"],times="0"} Notice the breakpoint number appears in both the 'bkptno' field, and the 'number' field within the 'bkpt' tuple. Here's the output with the change in print_mention_exception_catchpoint: (gdb) -catch-throw ^done,bkpt={number="1",type="breakpoint",disp="keep", enabled="y",addr="0x00000000004006c0", what="exception throw",catch-type="throw", thread-groups=["i1"],times="0"} gdb/ChangeLog: * NEWS: Mention new MI commands. * break-catch-throw.c (enum exception_event_kind): Move to breakpoint.h. (print_mention_exception_catchpoint): Output text as a single message. (catch_exception_command_1): Rename to... (catch_exception_event): ...this, make non-static, update header command, and change some parameter types. (catch_catch_command): Update for changes to catch_exception_command_1. (catch_throw_command): Likewise. (catch_rethrow_command): Likewise. * breakpoint.c (enum exception_event_kind): Delete. * breakpoint.h (enum exception_event_kind): Moved here from break-catch-throw.c. (catch_exception_event): Declare. * mi/mi-cmd-catch.c (mi_cmd_catch_exception_event): New function. (mi_cmd_catch_throw): New function. (mi_cmd_catch_rethrow): New function. (mi_cmd_catch_catch): New function. * mi/mi-cmds.c (mi_cmds): Add 'catch-throw', 'catch-rethrow', and 'catch-catch' entries. * mi/mi-cmds.h (mi_cmd_catch_throw): Declare. (mi_cmd_catch_rethrow): Declare. (mi_cmd_catch_catch): Declare. gdb/doc/ChangeLog: * gdb.texinfo (GDB/MI Catchpoint Commands): Add menu entry to new node. (C++ Exception GDB/MI Catchpoint Commands): New node to describe new MI commands. gdb/testsuite/ChangeLog: * gdb.mi/mi-catch-cpp-exceptions.cc: New file. * gdb.mi/mi-catch-cpp-exceptions.exp: New file. * lib/mi-support.exp (mi_expect_stop): Handle 'exception-caught' as a stop reason.