]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: rename unwindonsignal to unwind-on-signal users/aburgess/bp-inferior-calls
authorAndrew Burgess <aburgess@redhat.com>
Wed, 18 Jan 2023 12:09:05 +0000 (12:09 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Wed, 25 Jan 2023 15:48:58 +0000 (15:48 +0000)
We now have unwind-on-timeout and unwind-on-terminating-exception, and
then the odd one out unwindonsignal.

I'm not a great fan of these squashed together command names, so in
this commit I propose renaming this to unwind-on-signal.

Obviously I've added the hidden alias unwindonsignal so any existing
GDB scripts will keep working.

There's one test that I've extended to test the alias works, but in
most of the other test scripts I've changed over to use the new name.

The docs are updated to reference the new name.

13 files changed:
gdb/NEWS
gdb/doc/gdb.texinfo
gdb/infcall.c
gdb/testsuite/gdb.base/callfuncs.exp
gdb/testsuite/gdb.base/infcall-failure.exp
gdb/testsuite/gdb.base/unwindonsignal.exp
gdb/testsuite/gdb.compile/compile-cplus.exp
gdb/testsuite/gdb.compile/compile.exp
gdb/testsuite/gdb.cp/gdb2495.exp
gdb/testsuite/gdb.fortran/function-calls.exp
gdb/testsuite/gdb.mi/mi-syn-frame.exp
gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
gdb/testsuite/gdb.threads/thread-unwindonsignal.exp

index 0e8a0dc80ff8c4d4253102bd2584be8cd625528d..3ba8c819266b37f733f9fe759b53608ef09c8078 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -44,6 +44,17 @@ show unwind-on-timeout
   dummy frame that was added for the inferior call, and restoring the
   inferior state to how it was before the inferior call started.
 
+set unwind-on-signal on|off
+show unwind-on-signal
+  These new commands replaces the existing set/show unwindonsignal.  The
+  old command is maintained as an alias.
+
+* Changed commands
+
+set unwindonsignal on|off
+show unwindonsignal
+  These commands are now aliases for the new set/show unwind-on-signal.
+
 * MI changes
 
 ** mi now reports 'no-history' as a stop reason when hitting the end of the
index 9e6f240bfce871ca19748c294fb201ee68772589..00226080943b342c9bed120ba7e832afe3b5856d 100644 (file)
@@ -20707,7 +20707,7 @@ value history.
 It is possible for the function you call via the @code{print} or
 @code{call} command to generate a signal (e.g., if there's a bug in
 the function, or if you passed it incorrect arguments).  What happens
-in that case is controlled by the @code{set unwindonsignal} command.
+in that case is controlled by the @code{set unwind-on-signal} command.
 
 Similarly, with a C@t{++} program it is possible for the function you
 call via the @code{print} or @code{call} command to generate an
@@ -20720,7 +20720,8 @@ in that case is controlled by the
 @code{set unwind-on-terminating-exception} command.
 
 @table @code
-@item set unwindonsignal
+@item set unwind-on-signal
+@kindex set unwind-on-signal
 @kindex set unwindonsignal
 @cindex unwind stack in called functions
 @cindex call dummy stack unwinding
@@ -20731,11 +20732,18 @@ the context to what it was before the call.  If set to off (the
 default), @value{GDBN} stops in the frame where the signal was
 received.
 
-@item show unwindonsignal
+The command @code{set unwindonsignal} is an alias for this command,
+and is maintained for backward compatibility.
+
+@item show unwind-on-signal
+@kindex show unwind-on-signal
 @kindex show unwindonsignal
 Show the current setting of stack unwinding in the functions called by
 @value{GDBN}.
 
+The command @code{show unwindonsignal} is an alias for this command,
+and is maintained for backward compatibility.
+
 @item set unwind-on-terminating-exception
 @kindex set unwind-on-terminating-exception
 @cindex unwind stack in called functions with unhandled exceptions
@@ -20798,7 +20806,7 @@ call by typing the interrupt character (often @kbd{Ctrl-c}).
 
 If a called function is interrupted for any reason, and the stack is
 not unwound (due to @code{set unwind-on-terminating-exception on},
-@code{set unwind-on-timeout}, or @code{set unwindonsignal on}), then
+@code{set unwind-on-timeout}, or @code{set unwind-on-signal on}), then
 the dummy-frame, created by @value{GDBN} to facilitate the call to the
 program function, will be visible in the backtrace, for example frame
 @code{#3} in the following backtrace:
index b934026931c431f882100752a507aabcb8549051..7bd8b7bc346b11570b757bbb418be07611e078a5 100644 (file)
@@ -1678,7 +1678,7 @@ When the function is done executing, GDB will silently stop."),
              error (_("\
 The program being debugged was signaled while in a function called from GDB.\n\
 GDB has restored the context to what it was before the call.\n\
-To change this behavior use \"set unwindonsignal off\".\n\
+To change this behavior use \"set unwind-on-signal off\".\n\
 Evaluation of the expression containing the function\n\
 (%s) will be abandoned."),
                     name.c_str ());
@@ -1696,7 +1696,7 @@ Evaluation of the expression containing the function\n\
              error (_("\
 The program being debugged was signaled while in a function called from GDB.\n\
 GDB remains in the frame where the signal was received.\n\
-To change this behavior use \"set unwindonsignal on\".\n\
+To change this behavior use \"set unwind-on-signal on\".\n\
 Evaluation of the expression containing the function\n\
 (%s) will be abandoned.\n\
 When the function is done executing, GDB will silently stop."),
@@ -1828,17 +1828,22 @@ The default is to perform the conversion."),
                           show_coerce_float_to_double_p,
                           &setlist, &showlist);
 
-  add_setshow_boolean_cmd ("unwindonsignal", no_class,
-                          &unwind_on_signal_p, _("\
+  set_show_commands setshow_unwind_on_signal_cmds
+    = add_setshow_boolean_cmd ("unwind-on-signal", no_class,
+                              &unwind_on_signal_p, _("\
 Set unwinding of stack if a signal is received while in a call dummy."), _("\
 Show unwinding of stack if a signal is received while in a call dummy."), _("\
-The unwindonsignal lets the user determine what gdb should do if a signal\n\
+The unwind-on-signal lets the user determine what gdb should do if a signal\n\
 is received while in a function called from gdb (call dummy).  If set, gdb\n\
 unwinds the stack and restore the context to what as it was before the call.\n\
 The default is to stop in the frame where the signal was received."),
-                          NULL,
-                          show_unwind_on_signal_p,
-                          &setlist, &showlist);
+                              NULL,
+                              show_unwind_on_signal_p,
+                              &setlist, &showlist);
+  add_alias_cmd ("unwindonsignal", setshow_unwind_on_signal_cmds.set,
+                no_class, 1, &setlist);
+  add_alias_cmd ("unwindonsignal", setshow_unwind_on_signal_cmds.show,
+                no_class, 1, &showlist);
 
   add_setshow_boolean_cmd ("unwind-on-terminating-exception", no_class,
                           &unwind_on_terminating_exception_p, _("\
index df67c772e419086b4fdd76a8d9fdfbc0891ff09b..da994789d88abf4a7325af618fdfbfa4b0668ea1 100644 (file)
@@ -49,7 +49,7 @@ proc do_function_calls {prototypes} {
 
     # If any of these calls segv we don't want to affect subsequent tests.
     # E.g., we want to ensure register values are restored.
-    gdb_test_no_output "set unwindonsignal on"
+    gdb_test_no_output "set unwind-on-signal on"
 
     gdb_test "p t_char_values(0,0)" " = 0"
     gdb_test "p t_char_values('a','b')" " = 1"
@@ -240,7 +240,7 @@ proc do_function_calls {prototypes} {
        "call inferior func with struct - returns char *"
 
     # Restore default value.
-    gdb_test_no_output "set unwindonsignal off"
+    gdb_test_no_output "set unwind-on-signal off"
 }
 
 # Procedure to get current content of all registers.
index 8fa2c407fc57e97011b3b9b677a989585aa44fac..cf50a3baf0aea8ef8fef459ab69985835751748f 100644 (file)
@@ -137,7 +137,7 @@ proc_with_prefix run_cond_hits_segfault_test { async_p non_stop_p } {
             "Error in testing condition for breakpoint ${bp_1_num}:" \
             "The program being debugged was signaled while in a function called from GDB\\." \
             "GDB remains in the frame where the signal was received\\." \
-            "To change this behavior use \"set unwindonsignal on\"\\." \
+            "To change this behavior use \"set unwind-on-signal on\"\\." \
             "Evaluation of the expression containing the function" \
             "\\(func_segfault\\) will be abandoned\\." \
             "When the function is done executing, GDB will silently stop\\."]
@@ -165,7 +165,7 @@ proc_with_prefix run_call_hits_segfault_test { async_p non_stop_p } {
             "${::decimal}\\s+\[^\r\n\]+Segfault here\[^\r\n\]+" \
             "The program being debugged was signaled while in a function called from GDB\\." \
             "GDB remains in the frame where the signal was received\\." \
-            "To change this behavior use \"set unwindonsignal on\"\\." \
+            "To change this behavior use \"set unwind-on-signal on\"\\." \
             "Evaluation of the expression containing the function" \
             "\\(func_segfault\\) will be abandoned\\." \
             "When the function is done executing, GDB will silently stop\\."]
index 8470634e5023ffb29ecfdfd385f4a774241a3943..41a4de8b4725e24d068b1ed34e8e7090529423d5 100644 (file)
@@ -40,35 +40,51 @@ gdb_test "break stop_here" "Breakpoint \[0-9\]* at .*"
 gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, stop_here.*" \
     "continue to breakpoint at stop_here"
 
-# Turn on unwindonsignal.
-gdb_test_no_output "set unwindonsignal on" \
-       "setting unwindonsignal"
+# Turn on unwind-on-signal.
+gdb_test_no_output "set unwind-on-signal on" \
+       "setting unwind-on-signal"
 
-gdb_test "show unwindonsignal" \
+gdb_test "show unwind-on-signal" \
        "Unwinding of stack .* is on." \
-       "showing unwindonsignal"
+       "showing unwind-on-signal"
+
+# For backward compatibility we maintain a 'unwindonsignal' alias for
+# 'unwind-on-signal', check it now.
+gdb_test "show unwindonsignal" \
+    "Unwinding of stack .* is on\\." \
+    "showing unwindonsignal alias"
+
+gdb_test_no_output "set unwindonsignal off" \
+    "setting unwindonsignal alias to off"
+
+gdb_test "show unwind-on-signal" \
+    "Unwinding of stack .* is off\\." \
+    "showing unwind-on-signal after setting via alias"
+
+gdb_test_no_output "set unwindonsignal on" \
+    "setting unwindonsignal alias to on"
 
 # Call function (causing the program to get a signal), and see if gdb handles
 # it properly.
 if {[gdb_test "call gen_signal ()"  \
         "\[\r\n\]*The program being debugged was signaled.*" \
-        "unwindonsignal, inferior function call signaled"] != 0} {
+        "inferior function call signaled"] != 0} {
     return 0
 }
 
 # Verify the stack got unwound.
 gdb_test "bt" \
     "#0 *\[x0-9a-f in\]*stop_here \\(.*\\) at .*#1 *\[x0-9a-f in\]*main \\(.*\\) at .*" \
-       "unwindonsignal, stack unwound"
+       "stack unwound"
 
 # Verify the dummy frame got removed from dummy_frame_stack.
 gdb_test_multiple "maint print dummy-frames" \
-       "unwindonsignal, dummy frame removed" {
+       "unwind-on-signal, dummy frame removed" {
     -re "\[\r\n\]*.*stack=.*code=.*\[\r\n\]+$gdb_prompt $" {
-       fail "unwindonsignal, dummy frame removed"
+       fail $gdb_test_name
     }
     -re "\[\r\n\]+$gdb_prompt $" {
-       pass "unwindonsignal, dummy frame removed"
+       pass $gdb_test_name
     }
 }
 
index 0b7cb59727ac3a3d069f8d7b9d692d0605fc8ca5..4960e03408edf523a2bb1ea89f98b80f51881d53 100644 (file)
@@ -129,7 +129,7 @@ gdb_test "return" "\r\n#0  main .*" "return" \
         "Make _gdb_expr\\(__gdb_regs\\*\\) return now\\? \\(y or n\\) " "y"
 gdb_test "info sym $infcall_pc" "\r\nNo symbol matches .*" "info sym not found"
 
-gdb_test_no_output "set unwindonsignal on"
+gdb_test_no_output "set unwind-on-signal on"
 gdb_test "compile code *(volatile int *) 0 = 0;" \
     "The program being debugged was signaled while in a function called from GDB\\.\r\nGDB has restored the context to what it was before the call\\.\r\n.*" \
     "compile code segfault second"
index 9fdd36719aea8dcf3cf2d416ce00c521c14e4ff7..a9717088c052922017abb5d417ba31e0558ba47a 100644 (file)
@@ -159,7 +159,7 @@ gdb_test "return" "\r\n#0  main .*" "return" \
         "Make _gdb_expr return now\\? \\(y or n\\) " "y"
 gdb_test "info sym $infcall_pc" "\r\nNo symbol matches .*" "info sym not found"
 
-gdb_test_no_output "set unwindonsignal on"
+gdb_test_no_output "set unwind-on-signal on"
 gdb_test "compile code *(volatile int *) 0 = 0;" \
     "The program being debugged was signaled while in a function called from GDB\\.\r\nGDB has restored the context to what it was before the call\\.\r\n.*" \
     "compile code segfault second"
index 0cb8bdd0ada05c68436ba96fa4d23db4eb543e4a..af94d959d83a6cdc93a6972514fdbee1e7fffa49 100644 (file)
@@ -104,29 +104,29 @@ if {![runto_main]} {
 # behaviour; it should not.  Test both on and off states.
 
 # Turn on unwind on signal behaviour.
-gdb_test_no_output "set unwindonsignal on"
+gdb_test_no_output "set unwind-on-signal on"
 
 # Check that it is turned on.
-gdb_test "show unwindonsignal" \
+gdb_test "show unwind-on-signal" \
     "signal is received while in a call dummy is on.*" \
     "turn on unwind on signal"
 
 # Check to see if new behaviour interferes with
 # normal signal handling in inferior function calls.
 gdb_test "p exceptions.raise_signal(1)" \
-    "To change this behavior use \"set unwindonsignal off\".*" \
-    "check for unwindonsignal off message"
+    "To change this behavior use \"set unwind-on-signal off\".*" \
+    "check for unwind-on-signal off message"
 
 # And reverse - turn off again.
-gdb_test_no_output "set unwindonsignal off"
+gdb_test_no_output "set unwind-on-signal off"
 
 # Check that it is actually turned off.
-gdb_test "show unwindonsignal" \
+gdb_test "show unwind-on-signal" \
     "signal is received while in a call dummy is off.*" \
     "turn off unwind on signal"
 
 # Check to see if new behaviour interferes with
 # normal signal handling in inferior function calls.
 gdb_test "p exceptions.raise_signal(1)" \
-    "To change this behavior use \"set unwindonsignal on\".*" \
-    "check for unwindonsignal on message"
+    "To change this behavior use \"set unwind-on-signal on\".*" \
+    "check for unwind-on-signal on message"
index f9a1efc241f3db5f9cddfe38e614fff03906e6d6..c4d1f232576e8e791938b1adbfeebe9fe60f42dd 100644 (file)
@@ -44,7 +44,7 @@ if {![runto [gdb_get_line_number "post_init"]]} {
 }
 
 # Use inspired by gdb.base/callfuncs.exp.
-gdb_test_no_output "set unwindonsignal on"
+gdb_test_no_output "set unwind-on-signal on"
 
 # Baseline: function and subroutine call with no arguments.
 gdb_test "p no_arg()" " = .TRUE."
index 409fac623a7c90ac762aa64a7c88bf8177ec094b..f65d57028a5afede9531291cea1403bec8beb8c0 100644 (file)
@@ -97,7 +97,7 @@ mi_gdb_test "409-stack-list-frames 0 0" \
 # 
 
 mi_gdb_test "410-data-evaluate-expression bar()" \
-  ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \
+  ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwind-on-signal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \
   "call inferior function which raises exception"
 
 mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"}.*\\\]" "backtrace from inferior function at exception"
index 8d94d24f9b3a6da281e01ced894845644f78e831..402d8f7de6931fc6acda97c29a3bbeade10f723b 100644 (file)
@@ -174,7 +174,7 @@ proc_with_prefix run_bp_cond_segfaults { target_async target_non_stop } {
             "Error in testing condition for breakpoint ${bp_1_num}:" \
             "The program being debugged was signaled while in a function called from GDB\\." \
             "GDB remains in the frame where the signal was received\\." \
-            "To change this behavior use \"set unwindonsignal on\"\\." \
+            "To change this behavior use \"set unwind-on-signal on\"\\." \
             "Evaluation of the expression containing the function" \
             "\\(function_that_segfaults\\) will be abandoned\\." \
             "When the function is done executing, GDB will silently stop\\."]
index 0b08723fffadedbbc33655efcf5b8d396f834d62..2fa210c506f8e6aacb75e83b6dbb90fadcb0318d 100644 (file)
@@ -13,7 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test use of unwindonsignal when a hand function call that gets interrupted
+# Test use of unwind-on-signal when a hand function call that gets interrupted
 # by a signal in another thread.
 
 set NR_THREADS 4
@@ -52,12 +52,12 @@ gdb_test "continue" \
 # We want the main thread (hand_call_with_signal) and
 # thread 1 (sigabrt_handler) to both run.
 
-# Do turn on unwindonsignal.
+# Do turn on unwind-on-signal.
 # We want to test gdb handling of the current thread changing when
 # unwindonsignal is in effect.
-gdb_test_no_output "set unwindonsignal on" \
+gdb_test_no_output "set unwind-on-signal on" \
        "setting unwindonsignal"
-gdb_test "show unwindonsignal" \
+gdb_test "show unwind-on-signal" \
        "Unwinding of stack .* is on." \
        "showing unwindonsignal"