This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFAv2] Implement show | set may-call-functions [on|off]
- From: Pedro Alves <palves at redhat dot com>
- To: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>, gdb-patches at sourceware dot org
- Date: Sat, 27 Apr 2019 11:40:34 +0100
- Subject: Re: [RFAv2] Implement show | set may-call-functions [on|off]
- References: <20190426213450.22345-1-philippe.waroquiers@skynet.be>
On 4/26/19 10:34 PM, Philippe Waroquiers wrote:
> 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'.
>
Thanks. I like this version a lot better.
Some nits below. LGTM with those fixed.
>
> +* New commands
> +
> +set may-call-functions [on|off]
> +show may-call-functions
> + This controls whether GDB will attempt to call functions in
> + the program, such as with expressions in print command. It
"in print command" doesn't sound right to me.
Either "in print", or "in THE print command" would be good, I think.
> + defaults to on. Calling functions in the program being debugged
> + can have undesired side effects. It is now possible to forbid
> + such function calls. If function calls are forbidden, GDB will throw
> + an error when a command (such as print an expression) calls a function
"such as printING an expression" ? or (such as print EXPRESSION) if you
want to keep it short.
> + in the program.
> +
> *** Changes in GDB 8.3
>
> * GDB and GDBserver now support access to additional registers on
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 0733e1acfd..2e4affd6c4 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 @code{print}. It
in the @code{print} command.
> +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
> +are forbidden,
s/are forbidden/is forbidden/
(calling functions ... is forbidden)
> GDB will throw an error when a command (such as print
> +an expression) starts a function call in the program.
"such as printING an expression" ?
Or:
"such as print @var{expression}"
Thanks,
Pedro Alves