aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>2019-04-23 23:43:24 +0200
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>2019-04-27 13:12:42 +0200
commit136afab8c7d8a8a91dbf38e79be4f9dc4125d552 (patch)
tree2d6f40d947a3fa3a627cf6b7d0b360f4174d10de /gdb/testsuite
parenta45328b93bdd5399da8a9e56817e445cc2068edd (diff)
downloadgdb-136afab8c7d8a8a91dbf38e79be4f9dc4125d552.zip
gdb-136afab8c7d8a8a91dbf38e79be4f9dc4125d552.tar.gz
gdb-136afab8c7d8a8a91dbf38e79be4f9dc4125d552.tar.bz2
Implement show | set may-call-functions [on|off]
Inferior function calls are powerful but might lead to undesired results such as crashes when calling nested functions (frequently used in particular in Ada). This implements a GDB setting to disable calling inferior functions. Note: the idea is that if/when the 'slash command' patch is pushed, that this setting can be changed e.g. by using the shortcut /c. This is version 2 of the patch. It handles all the received comments, mostly replace 'can-call' by 'may-call', and avoid using 'inferior function call' in factor of 'calling function in the program'. 2019-04-26 Philippe Waroquiers <philippe.waroquiers@skynet.be> gdb/ChangeLog * NEWS: Mention the new set|show may-call-functions. * infcall.c (may_call_functions_p): New variable. (show_may_call_functions_p): New function. (call_function_by_hand_dummy): Throws an error if not may-call-functions. (_initialize_infcall): Call add_setshow_boolean_cmd for may-call-functions. gdb/testsuite/ChangeLog * gdb.base/callexit.exp: Test may-call-functions off. gdb/doc/ChangeLog * gdb.texinfo (Calling): Document the new set|show may-call-functions.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/callexit.exp7
2 files changed, 11 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9b0725a..e814093 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2019-04-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+
+ * gdb.base/callexit.exp: Test may-call-functions off.
+
2019-04-25 Keith Seitz <keiths@redhat.com>
PR c++/24367
diff --git a/gdb/testsuite/gdb.base/callexit.exp b/gdb/testsuite/gdb.base/callexit.exp
index b6d9ae3..9a32d3d 100644
--- a/gdb/testsuite/gdb.base/callexit.exp
+++ b/gdb/testsuite/gdb.base/callexit.exp
@@ -37,6 +37,13 @@ if { ![runto_main] } {
return 0
}
+# Verify set may-call-functions behaviour.
+gdb_test_no_output "set may-call-functions off"
+gdb_test "call callexit()" \
+ "Cannot call functions in the program: may-call-functions is off." \
+ "inferior function call refused in off state"
+gdb_test_no_output "set may-call-functions on"
+
# Call function (causing the program to exit), and see if gdb handles
# it properly.
gdb_test "call callexit()" \