[PATCH v4] gdb/manual: Introduce location specs
Eli Zaretskii
eliz@gnu.org
Fri May 27 18:23:55 GMT 2022
> Date: Fri, 27 May 2022 18:51:14 +0100
> Cc: gdb-patches@sourceware.org
> From: Pedro Alves <pedro@palves.net>
>
> >> 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 thought that in GNU terminology, "file name" already included the directory?
> ISTR you saying that we shouldn't use "path" to describe directories sometime ago,
> for example. Maybe I'm misremembering it.
A file name includes the directory, but the directory doesn't have to
be in the absolute form, as you pointed out. So the directory
relative to which the file name is specified is part of the code
location, I think, because there could be file names in a program
which have the same name, but live in different subdirectories of a
source tree.
> The text I wrote in v4 purposely says "the source file the line belongs to"
> which avoids going into that detail.
Something to ponder, I guess.
> >> 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.
>
> I guess I don't know how that fits your idea of "100% identical" then.
I think it's important for describing what exactly happens during the
"resolution" of a location specification into code locations.
> I don't really understand what you're after, so I don't know what to comment
> further. I sounds like you are trying to say that a location spec can be
> exactly the same as a code location sometimes. While in my view, the found code
> locations will always have the attributes that match what the user specified,
> otherwise the locations wouldn't have been found. And I thought that that
> was already clear in, or obvious from, the text I wrote, and from the specific
> location spec format sections.
Yes, but note that the last revision of your patch says "resolves
into", not "matches". Which I think is a change for the better; I'm
trying to have a more accurate idea of what that "resolution" entails.
More information about the Gdb-patches
mailing list