From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id VMWQIt7RkWJd0ggAWB0awg (envelope-from ) for ; Sat, 28 May 2022 03:40:14 -0400 Received: by simark.ca (Postfix, from userid 112) id 78B1B1E221; Sat, 28 May 2022 03:40:14 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=EX1rr2By; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E9D1F1E00D for ; Sat, 28 May 2022 03:40:12 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 385153856DC2 for ; Sat, 28 May 2022 07:40:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 385153856DC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1653723612; bh=0mgkn+tcucpBqRHMGAdyRjH4By1iQWEYjb7iaU3uKk0=; h=Date:To:In-Reply-To:Subject:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=EX1rr2By6MXPNGw44h5km+irFmFycXG3kShnwYlACgFLxEDyOe8i+SZrVQIVimjnG hnPp6EqfXp6pUA4wwXLJYNnAs8SLQOzRdDwegc+TIDie18AXtIUv2GgBDg+HUuAZcD fjcLN4nMVBBYn7T0YwW++E6hEWGPk5fNa1P0Bxto= Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 227A1385742C for ; Sat, 28 May 2022 07:39:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 227A1385742C Received: from fencepost.gnu.org ([2001:470:142:3::e]:53228) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nur39-0004Jr-BV; Sat, 28 May 2022 03:39:51 -0400 Received: from [87.69.77.57] (port=3228 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nur38-0007eC-R7; Sat, 28 May 2022 03:39:51 -0400 Date: Sat, 28 May 2022 10:39:48 +0300 Message-Id: <838rqmm7gb.fsf@gnu.org> To: Pedro Alves In-Reply-To: <20220526194250.2310460-1-pedro@palves.net> (message from Pedro Alves on Thu, 26 May 2022 20:42:50 +0100) Subject: Re: [PATCH v4] gdb/manual: Introduce location specs References: <20220526194250.2310460-1-pedro@palves.net> X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Eli Zaretskii via Gdb-patches Reply-To: Eli Zaretskii Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > From: Pedro Alves > Date: Thu, 26 May 2022 20:42:50 +0100 > > gdb/doc/gdb.texinfo | 419 +++++++++++++++++++++++++------------------- > gdb/doc/guile.texi | 2 +- > gdb/doc/python.texi | 5 +- > 3 files changed, 246 insertions(+), 180 deletions(-) Thanks, my comments are below. > +@item break @var{locspec} > +Set a breakpoint at all the code locations in your program the given > +@var{locspec} resolves to. I find the style that puts "resolves to" last awkward and hard to read. I suggest a slight rewording: Set a breakpoint at all the code locations in your program that are the result of resolving the given @var{locspec}. > +a line number, an address of an instruction, and more. @xref{Location > +Specifications}, for the various forms of @var{locspec}. The > +breakpoint will stop your program just before it executes the > +instruction at the address of any of the breakpoint's locations. ^^^^^^^^^^^^^^^^^^^^^^ "breakpoint's code locations" > A breakpoint with multiple locations is displayed in the breakpoint ^^^^^^^^^ "code locations" > table using several rows---one header row, followed by one row for > each breakpoint location. The header row has @samp{} in the ^^^^^^^^^^^^^^^^^^^ "code location of the breakpoint" > +address column. Each breakpoint location row contains the actual ^^^^^^^^^^^^^^^^^^^ "code location" > +address, source file, source line and function of its code location. > +The number column for a breakpoint location is of the form ^^^^^^^^^^^^^^^^^^^ "code location" > @kindex set breakpoint pending > @kindex show breakpoint pending > @table @code > @item set breakpoint pending auto > -This is the default behavior. When @value{GDBN} cannot find the breakpoint > -location, it queries you whether a pending breakpoint should be created. > +This is the default behavior. When @value{GDBN} cannot resolve the > +location spec, it should create a pending breakpoint without > +confirmation. > > @item set breakpoint pending on > -This indicates that an unrecognized breakpoint location should automatically > -result in a pending breakpoint being created. > +This indicates that when @value{GDBN} cannot resolve the location > +spec, it should create a pending breakpoint without confirmation. These two option's values seem to have an identical description. Is that intentional? I think the first of the two is a copy/paste error. Btw, is the "cannot resolve the location spec" situation and its reasons described somewhere? The text in this section seems to indicate this is described in "Location Specifications", but I don't think I see it there. > The settings above only affect the @code{break} command and its > -variants. Once breakpoint is set, it will be automatically updated > +variants. Once a breakpoint is set, it will be automatically updated > as shared libraries are loaded and unloaded. Does this mean the resolution process of an unresolved location spec is retried each time a shared library is loaded? If so, I think we should say it here explicitly. > -@item clear @var{location} > -Delete any breakpoints set at the specified @var{location}. > -@xref{Specify Location}, for the various forms of @var{location}; the > -most useful ones are listed below: > +@item clear @var{locspec} > +Delete breakpoints with code locations that match @var{locspec}. ^^^^^^^^^^^^^^^^^^^^^^^^ "that are the result of resolving @var{locspec}" > +@item dprintf @var{locspec},@var{template},@var{expression}[,@var{expression}@dots{}] > +Whenever execution reaches a code location in your program that > +matches @var{locspec}, print the values of one or more Likewise here (and elsewhere): I don't think we should talk about "matching a location spec", but about "resolution of a location spec". "Matching" implies something that we don't really do here. > Print lines from @var{first} to @var{last}. Both arguments are > -locations. When a @code{list} command has two locations, and the > -source file of the second location is omitted, this refers to > -the same source file as the first location. > +location specs. When a @code{list} command has two location specs, > +and the source file of the second location spec is omitted, this > +refers to the same source file as the first location spec. If either > +@var{first} or @var{last} resolve to more than one source line in the > +program, then the list command will show the list of resolved source > +lines and does not proceed with the source code listing. ^^^^^^^^^^^^^^^^ "will not proceed", to be consistent with "will show". > +Likewise, if @var{last} resolves to more than one source line in the > +program, then the list command will print the list of resolved source > +lines and does not proceed with the source code listing. Same here. > + > @item list @var{first}, > Print lines starting with @var{first}. > > @@ -9041,17 +9038,75 @@ Print lines just before the lines last printed. > As described in the preceding table. > @end table > > -@node Specify Location > -@section Specifying a Location > +@node Location Specifications > +@section Location Specifications > @cindex specifying location > -@cindex location > +@cindex location spec > +@cindex locspec > @cindex source location > +@cindex code location > > Several @value{GDBN} commands accept arguments that specify a location > -of your program's code. Since @value{GDBN} is a source-level > -debugger, a location usually specifies some line in the source code. > -Locations may be specified using three different formats: > -linespec locations, explicit locations, or address locations. > +or locations of your program's code. Since @value{GDBN} is a > +source-level debugger, a location specification usually indicates some > +line in the source code, but it can also indicate a function name, an > +address, a label, and more. > + > +A concrete code location in your program is uniquely identifiable by a > +set of logical attributes. Typically, a line number, the source file > +the line belongs to, the fully-qualified and prototyped function it is > +defined in, and an instruction address. Because each inferior has its > +own address space, also an inferior number. > + > +On the other hand, a @dfn{location specification} (a.k.a.@: location > +spec) "location spec" should be in @dfn here the first time it is used. > +Here are examples of typical situations that result in a location spec > +matching multiple concrete code locations in your program: Should we also enumerate some situations where a location spec cannot be completely resolved? The text talks about that possibility, but only in passing, with no details or practical examples. > +Addresses cannot be specified with a location spec (@pxref{Location > +Specifications}). I think they can, but only if using one particular form of a location spec, the *ADDR one. Or am I missing something? > +register other than the program counter. If @var{locspec} resolves to > +an address in a different function from the one currently executing, the > +results may be bizarre if the two functions expect different patterns > +of arguments or of local variables. For this reason, the @code{jump} > +command requests confirmation if the specified line is not in the > +function currently executing. ^^^^ "line" or "code location"? > +@item break-range @var{start-locspec}, @var{end-locspec} > +Set a breakpoint for an address range given by @var{start-locspec} and > +@var{end-locspec}, which are location specs. @xref{Location > +Specifications}, for a list of all the possible forms of location > +specs. If either @var{start-locspec} or @var{end-locspec} resolve to > +multiple addresses in the program, then the command aborts with an > +error without creating a breakpoint. The breakpoint will stop > +execution of the inferior whenever it executes an instruction at any > +address within the specified range, including @var{start-locspec} and > +@var{end-locspec}. This deviates from the usual practice elsewhere, and talks about location specs resolving into _addresses_ and not code locations. is that intentional and necessary? > -If @var{location} cannot be parsed (for example if it > +If @var{locspec} cannot be parsed (for example if it > refers to unknown files or functions), create a pending > breakpoint. Without this flag, @value{GDBN} will report ^^ Two spaces between sentences. (Yes, a mistake in the original text.) > @smallexample > - -exec-jump @var{location} > + -exec-jump @var{locspec} > @end smallexample > > Resumes execution of the inferior program at the location specified by > -parameter. @xref{Specify Location}, for a description of the > -different forms of @var{location}. > +the parameter. @xref{Location Specifications}, for a description of ^^^^^^^^^^^^^ I think this should be "@var{locspec}". > +Executes the inferior until the address @var{locspec} resolves to. If This is highly ambiguous: "until" here could be interpreted as referring to "resolves" instead of to "address". Suggest to rephrase: Executes the inferior until it reaches the address to which @var{locspec} resolves. > +there is no argument, the inferior executes until a source line > +greater than the current one is reached. Suggest to get rid of the passive tense with "...until it reaches a source line greater than the current line."