Re: [PATCH v4] gdb/manual: Introduce location specs

Eli Zaretskii via Gdb-patches
2022-05-27T17:31:28Z

> Date: Fri, 27 May 2022 18:11:04 +0100
> Cc: gdb-patches@sourceware.org
> From: Pedro Alves <pedro@palves.net>
>
> > . absolute file name of the source
> > . line number in the source file
> > . fully-qualified and prototyped function
> > . address
> > . inferior number
>
> Yes. Well, except "absolute" in the file name. The file names in the
> debug info aren't always absolute, they can be something like ../a/b/c/foo.c,
> and we may not be able to find the source file in the filesystem, so the
> path the debug info tells us is all we get.

Then the directory should also be part of the attributes, no?

> >> I am not sure what you
> >> mean by "100% identical". A spec can never the identical to the actual
> >> thing, the same way a cake recipe can never be identical to a cake, for
> >> they are things of different nature. It can only be that the actual
> >> thing complies with or follows the spec.
> >
> > I thought you just explained above that, when there's only one
> > inferior, the user can give a location spec which will resolve to a
> > code location that has exactly the same attributes as the spec? IOW,
> > in this case the "resolution" of the spec produces a "thing" that to
> > the user looks exactly the same as the input spec?
>
> When you specify a function name, you can't specify an address
> at the same time, for example. There's no format that allows that.
> So if you specify a function, you end up with code location that has
> an address, but you didn't specify the address. Conversely, when you
> specify an address, gdb finds the source/line for the address if available,
> as well as the function.

That's understood, and it not important for what I have in mind. The
important point is that the user can potentially specify every
attribute of a code location, even if some combinations cannot be
used.

> And then GDB knows more about the code locations than that set of attributes,
> of course. GDB knows the architecture of the instruction the location points
> at, for example.

Is that exposed to the user somewhere? I'm only interested in what is
shown to the user and/or what has user-level consequences. Internal
attributes that the user doesn't have to know about are out of scope
of this issue.

Thanks.