aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
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/doc
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/doc')
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo22
2 files changed, 27 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index ba15232..3efed67 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2019-04-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+
+ * gdb.texinfo (Calling): Document the new
+ set|show may-call-functions.
+
2019-04-22 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Reverse Execution): Mention and xref process record
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 0733e1a..cf8333d 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18693,6 +18693,28 @@ the default C@t{++} exception handler and the inferior terminated.
Show the current setting of stack unwinding in the functions called by
@value{GDBN}.
+@item set may-call-functions
+@kindex set may-call-functions
+@cindex disabling calling functions in the program
+@cindex calling functions in the program, disabling
+Set permission to call functions in the program.
+This controls whether @value{GDBN} will attempt to call functions in
+the program, such as with expressions in the @code{print} command. It
+defaults to @code{on}.
+
+To call a function in the program, @value{GDBN} has to temporarily
+modify the state of the inferior. This has potentially undesired side
+effects. Also, having @value{GDBN} call nested functions is likely to
+be erroneous and may even crash the program being debugged. You can
+avoid such hazards by forbidding @value{GDBN} from calling functions
+in the program being debugged. If calling functions in the program
+is forbidden, GDB will throw an error when a command (such as printing
+an expression) starts a function call in the program.
+
+@item show may-call-functions
+@kindex show may-call-functions
+Show permission to call functions in the program.
+
@end table
@subsection Calling functions with no debug info