From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79890 invoked by alias); 24 Apr 2019 06:53:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 79882 invoked by uid 89); 24 Apr 2019 06:53:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (209.51.188.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 Apr 2019 06:53:42 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51618) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJBmk-0006ZT-Hu; Wed, 24 Apr 2019 02:53:38 -0400 Received: from [176.228.60.248] (port=2058 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hJBmj-0000Yy-UG; Wed, 24 Apr 2019 02:53:38 -0400 Date: Wed, 24 Apr 2019 06:53:00 -0000 Message-Id: <83sgu73nde.fsf@gnu.org> From: Eli Zaretskii To: Philippe Waroquiers CC: gdb-patches@sourceware.org In-reply-to: <20190423215826.9936-1-philippe.waroquiers@skynet.be> (message from Philippe Waroquiers on Tue, 23 Apr 2019 23:58:26 +0200) Subject: Re: [RFA] Implement show | set can-call-inferior-functions [on|off] References: <20190423215826.9936-1-philippe.waroquiers@skynet.be> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00481.txt.bz2 > From: Philippe Waroquiers > Cc: Philippe Waroquiers > 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.