From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56390 invoked by alias); 27 Apr 2019 10:40:39 -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 56379 invoked by uid 89); 27 Apr 2019 10:40:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: mail-wr1-f42.google.com Received: from mail-wr1-f42.google.com (HELO mail-wr1-f42.google.com) (209.85.221.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 27 Apr 2019 10:40:38 +0000 Received: by mail-wr1-f42.google.com with SMTP id g3so8011531wrx.9 for ; Sat, 27 Apr 2019 03:40:37 -0700 (PDT) Return-Path: Received: from [192.168.1.36] ([62.28.162.51]) by smtp.gmail.com with ESMTPSA id o8sm1766953wra.4.2019.04.27.03.40.34 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sat, 27 Apr 2019 03:40:35 -0700 (PDT) Subject: Re: [RFAv2] Implement show | set may-call-functions [on|off] To: Philippe Waroquiers , gdb-patches@sourceware.org References: <20190426213450.22345-1-philippe.waroquiers@skynet.be> From: Pedro Alves Message-ID: <2c5a4158-8e42-8e01-82d0-7ea3b5f732f1@redhat.com> Date: Sat, 27 Apr 2019 10:40:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190426213450.22345-1-philippe.waroquiers@skynet.be> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-04/txt/msg00589.txt.bz2 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