From: Eli Zaretskii <eliz@gnu.org>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Implement show | set can-call-inferior-functions [on|off]
Date: Wed, 24 Apr 2019 06:53:00 -0000 [thread overview]
Message-ID: <83sgu73nde.fsf@gnu.org> (raw)
In-Reply-To: <20190423215826.9936-1-philippe.waroquiers@skynet.be> (message from Philippe Waroquiers on Tue, 23 Apr 2019 23:58:26 +0200)
> From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Date: Tue, 23 Apr 2019 23:58:26 +0200
>
> 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.
Thanks, I think this is useful functionality.
However, I question the wisdom of erroring out when an attempt is made
to call inferior functions when that's disabled. If this inferior
call is part of some script, the script will error out at that point,
which might not be what the user wants. Erroring out is justified
when the inferior function was called interactively, though. Can we
come up with something more useful for the scripting use case? Like
perhaps 'call' should display a warning and do nothing, 'print' should
just display a warning, and otherwise the inferior would always return
zero? Or maybe this should be subject to some additional knob?
> +set can-call-inferior-functions [on|off]
> +show can-call-inferior-functions
> + Control whether GDB is allowed to do inferior function calls.
> + Inferior function calls are e.g. needed to evaluate and print
> + some expressions. Such inferior function calls can have undesired
> + side effects. It is now possible to forbid such inferior function
> + calls.
> + By default, GDB is allowed to do inferior function calls.
I think this should tell what happens if the function is called when
inferior calls are not allowed.
> +@item set can-call-inferior-functions
> +@kindex set can-call-inferior-functions
> +@cindex disabling inferior function calls.
Index entries should not end with a period.
Also, I think an additional index entry here will be useful:
@cindex inferior function calls, disabling
> + add_setshow_boolean_cmd ("can-call-inferior-functions", no_class,
> + &can_call_inferior_functions_p, _("\
> +Set debugger's willingness to call inferior functions."), _("\
> +Show debugger's willingness to call inferior functions."), _("\
> +To call an inferior function, GDB has to temporarily modify the state\n\
> +of the inferior. This has potentially undesired side effects.\n\
> +Also, having GDB calling nested functions is likely to be erroneous\n\
> +and may even crash the program being debugged.\n\
> +You can avoid such hazards by forbidding GDB to do inferior functions calls.\n\
> +The default is to allow inferior function calls."),
I think this doc string is too detailed, you in effect copied here
everything that we have in the manual, which is too much. I suggest
to leave out the rationale for disabling the inferior calls, and
describe just the effects. I do think this should say what happens
with calls when they are disallowed.
Thanks, the documentation parts are OK once the above nits are taken
care of.
next prev parent reply other threads:[~2019-04-24 6:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 21:58 Philippe Waroquiers
2019-04-24 6:53 ` Eli Zaretskii [this message]
2019-04-24 21:25 ` Philippe Waroquiers
2019-04-25 6:12 ` Eli Zaretskii
2019-04-25 13:15 ` Tom Tromey
2019-04-25 19:44 ` Pedro Alves
2019-04-25 17:17 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83sgu73nde.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=philippe.waroquiers@skynet.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox