From: Eli Zaretskii via Gdb-patches <gdb-patches@sourceware.org>
To: Pedro Alves <pedro@palves.net>
Cc: gdb-patches@sourceware.org
Subject: Re: [pushed v5] gdb/manual: Introduce location specs
Date: Mon, 30 May 2022 19:15:06 +0300 [thread overview]
Message-ID: <837d63j8tx.fsf@gnu.org> (raw)
In-Reply-To: <6914f754-4e33-5aa1-4ea6-dca9504e8bfe@palves.net> (message from Pedro Alves on Mon, 30 May 2022 15:44:59 +0100)
> Date: Mon, 30 May 2022 15:44:59 +0100
> Cc: gdb-patches@sourceware.org
> From: Pedro Alves <pedro@palves.net>
>
> >> -@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}"
>
> That wouldn't actually be correct for this command. For example:
>
> (top-gdb) b gdb.c:29
> Breakpoint 4 at 0x555555641091: file /home/pedro/gdb/binutils-gdb/src/gdb/gdb.c, line 29.
> (top-gdb) b *0x555555641092
> Breakpoint 5 at 0x555555641092: file /home/pedro/gdb/binutils-gdb/src/gdb/gdb.c, line 29.
> (top-gdb) info breakpoints
> Num Type Disp Enb Address What
> 4 breakpoint keep y 0x0000555555641091 in main(int, char**) at /home/pedro/gdb/binutils-gdb/src/gdb/gdb.c:29
> 5 breakpoint keep y 0x0000555555641092 in main(int, char**) at /home/pedro/gdb/binutils-gdb/src/gdb/gdb.c:29
>
> "gdb.c:29" resolves to address 0x0000555555641091, as can be seen when breakpoint 4 was
> created. However, this:
>
> (top-gdb) clear gdb.c:29
> Deleted breakpoints 4 5
>
> ... also deletes breakpoint 5. GDB deleted it because its code location also matches
> the user input.
But then "matches locspec" is also inaccurate, and for the same
reason: they are two equivalent ways of describing the same process of
arriving at a code location from a location spec, or at least that's
how the text used them until now.
> This is explained just a bit below, here:
>
> @item clear @var{linenum}
> @itemx clear @var{filename}:@var{linenum}
> Delete any breakpoints set at or within the code of the specified
> @var{linenum} of the specified @var{filename}.
> @end table
>
> Key here are "or within the code", and talking about the _specified_
> linenum/filename, not the resolved line/filename.
Then we need some change of text to the same effect where "clear
LOCSPEC" is described, right?
> >> +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.
>
> I've added these examples under the multi-location examples:
>
> +And here are examples of typical situations that result in a location
> +spec matching no code locations in your program at all:
> +
> +@itemize @bullet
> +@item
> +The location spec specifies a function name, and there are no
> +functions in the program with that name.
> +
> +@item
> +The location spec specifies a source file name, and there are no
> +source files in the program with that name.
> +
> +@item
> +The location spec specifies both a source file name and a source line
> +number, and even though there are source files in the program that
> +match the file name, none of those files has the specified line
> +number.
> +@end itemize
Shouldn't this mention explicitly the frequent situation where the
location specifies something in a yet-unloaded shared library?
> >> +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"?
>
> I think it should say "jump address" here instead of "specified line", as this is
> not about a line the user input in the spec, but rather what address the locspec
> resolved to.
So perhaps it's better to say "if @var{locapsec} resolves to an
address that is not in the currently executing function".
> /* See if we are trying to jump to another function. */
> fn = get_frame_function (get_current_frame ());
> sfn = find_pc_function (sal.pc);
> if (fn != NULL && sfn != fn)
> {
> if (!query (_("Line %d is not in `%s'. Jump anyway? "), sal.line,
> fn->print_name ()))
> {
> error (_("Not confirmed."));
>
> The query talks about "Line", but the check isn't comparing lines, this
> query will trigger even if you try to jump to a function without line info.
> That query's text should be fixed too, IMO.
Yes.
> >> +@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?
>
> Yes, it is intentional here, because the command is exactly about breaking
> on any address that falls within an address range.
Then I think this needs some additional text explaining that, or
qualifying the "location resolves to address" part.
Thanks.
next prev parent reply other threads:[~2022-05-30 16:16 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-26 19:42 [PATCH v4] " Pedro Alves
2022-05-27 14:16 ` Eli Zaretskii via Gdb-patches
2022-05-27 15:04 ` Pedro Alves
2022-05-27 15:52 ` Eli Zaretskii via Gdb-patches
2022-05-27 17:11 ` Pedro Alves
2022-05-27 17:31 ` Eli Zaretskii via Gdb-patches
2022-05-27 17:51 ` Pedro Alves
2022-05-27 18:23 ` Eli Zaretskii via Gdb-patches
2022-05-27 18:42 ` Pedro Alves
2022-05-27 18:50 ` Pedro Alves
2022-05-27 19:00 ` Eli Zaretskii via Gdb-patches
2022-05-27 19:30 ` Pedro Alves
2022-05-28 7:43 ` Eli Zaretskii via Gdb-patches
2022-05-30 14:38 ` Pedro Alves
2022-05-27 18:55 ` Eli Zaretskii via Gdb-patches
2022-05-27 19:05 ` Pedro Alves
2022-05-27 19:14 ` Eli Zaretskii via Gdb-patches
2022-05-27 19:17 ` Pedro Alves
2022-05-27 19:34 ` Eli Zaretskii via Gdb-patches
2022-05-27 19:38 ` Pedro Alves
2022-05-28 7:39 ` Eli Zaretskii via Gdb-patches
2022-05-30 14:44 ` [pushed v5] " Pedro Alves
2022-05-30 16:15 ` Eli Zaretskii via Gdb-patches [this message]
2022-05-31 11:05 ` [PATCH] Improve clear command's documentation Pedro Alves
2022-05-31 12:36 ` Eli Zaretskii via Gdb-patches
2022-05-31 13:04 ` Pedro Alves
2022-05-31 13:42 ` Eli Zaretskii via Gdb-patches
2022-05-31 14:47 ` Pedro Alves
2022-05-31 16:06 ` Eli Zaretskii via Gdb-patches
2022-05-31 11:13 ` [PATCH] Explicitly mention yet-unloaded shared libraries in location spec examples Pedro Alves
2022-05-31 11:47 ` Eli Zaretskii via Gdb-patches
2022-05-31 11:17 ` [pushed v5] gdb/manual: Introduce location specs Pedro Alves
2022-05-31 11:31 ` [PATCH] Improve break-range's documentation Pedro Alves
2022-05-31 11:55 ` Eli Zaretskii via Gdb-patches
2022-05-31 12:03 ` Pedro Alves
2022-05-31 12:09 ` Eli Zaretskii via Gdb-patches
2022-06-01 17:17 ` RTe: Location Specs (Was: [pushed v5] gdb/manual: Introduce location specs) Eli Zaretskii via Gdb-patches
2022-06-02 11:10 ` Pedro Alves
2022-06-02 11:49 ` Eli Zaretskii via Gdb-patches
2022-06-02 12:40 ` Pedro Alves
2022-06-02 12:56 ` Eli Zaretskii via Gdb-patches
2022-06-02 13:44 ` Pedro Alves
2022-06-02 16:37 ` Eli Zaretskii via Gdb-patches
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=837d63j8tx.fsf@gnu.org \
--to=gdb-patches@sourceware.org \
--cc=eliz@gnu.org \
--cc=pedro@palves.net \
/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