[PATCH v4] gdb/manual: Introduce location specs
Eli Zaretskii
eliz@gnu.org
Fri May 27 19:34:09 GMT 2022
> Date: Fri, 27 May 2022 20:17:21 +0100
> Cc: gdb-patches@sourceware.org
> From: Pedro Alves <pedro@palves.net>
>
> >> You start with e.g., just one attribute, like "-function func". This
> >> makes GDB iterate over all the functions is knows about, finding the
> >> ones that are called "func". This matches "func(int)", "A::func()",
> >> "func(long)", etc. GDB collects the PC and source file and line number of
> >> those functions too along the wa. If you did "break -function func", then
> >> you end up with a breakpoint with multiple code locations, one
> >> for each function matched.
> >>
> >> Or you start with "a/file.c:100". This makes GDB iterate over all source
> >> files it knows about, and then for each that has a file name that ends
> >> with "a/file.c", like e.g., "src/program/a/file.c" and "somelib/a/file.c"
> >> it searches for line 100, collecting the PC and function name of the
> >> location. If you did "break a/file.c:100", you end up with a breakpoint with
> >> multiple locations, one per resolved location. If you did
> >> "list a/file.c:100", GDB lists the source for around each of the locations.
> >> Etc.
> >>
> >> Or you start with "*0x1000". Conceptually it's the same. GDB finds the code
> >> locations that match that, resolves that to a location with
> >> PC/function/source/line, and then the command does what it wants with it.
> >
> > Is this supposed to confirm my understanding, or to refute it? I
> > think it confirms it.
>
> I didn't understand what you meant by "attribute can be filled in
> more than one way", so I explained how it works. If you start with my example
> for "-function func" example from above, what does "attribute is filled in more
> than one way" mean in that example?
It means that each of the following attributes of code location can
have more than one value that satisfies the location spec:
. function prototype
. possibly file name
. line number
. code address
More information about the Gdb-patches
mailing list