This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [MI] -file-list-exec-source-files


On Mon, Feb 16, 2004 at 10:46:28AM -0500, Daniel Jacobowitz wrote:
> On Mon, Feb 16, 2004 at 10:33:29AM -0500, Bob Rossi wrote:
> > Here is the problem I am trying to solve.
> > 
> > Any front end needs to know the absolute path to the source files. From
> > what I can see, there are several ways of finding the absolute path.
> > In some cases, all of this info is needed.
> 
> > So, basically, I am making an assumption, if GDB can not find the
> > absolute path to the source file, the front end can not. Is this true?
> > Also, why should the front ends do it, if it can be done correctly in
> > one place?
> 
> Then why are you trying to return symtab->dirname at all?  Or have I
> misinterpreted you, and you were returning symtab->fullname?  I don't
> think symtab->dirname should be exposed in this interface.

Yes, please excuse me. I am only interested in returning the fullname to
the front end. I agree with you, symtab->dirname is only useful
internally in resolving the fullname.

> > As far as I know, most existing front ends use annotate level 1-2-3 to
> > figure out where the source file is. I just want to simplify this
> > process, so that front ends can easily get the absolute path to the
> > source file without having to run multiple commands, like the CLI.
> 
> This sounds like the front end is only ever interested in one source
> file at a time, so that would be a more efficient design than asking
> GDB to provide fullnames for every source file at once.

Here there is several points to make.

1. The front should be able to get the fullname for a single source.

-file-list-exec-source-file currently returns the fullname of the
currently executing file. Which btw, has already had it's symtab read
in. This is why symtab->dirname is set, and the fullname is accessible.

An parameter should be added to -file-list-exec-source-file. So it can be
invoked like "-file-list-exec-source-file foo.c"
With this new command, the user should get the fullname of a particular
source file, which means reading in the symtab, or modifying the psymtab
to have the dirname in it.

2. The user should be able to get all of the fullnames with
-file-list-exec-source-files?

Currently, -file-list-exec-source-files, prints all of the "filenames"
by looping through the symtabs and psymtabs. It knows the fullname to
most of the symtabs, and none of the psymtabs. So, for some files, it
prints the filename, along with the fullname, and for others it just
prints the filename.

If it just lists the "filename" and the front wants the "fullname", it
can use the "filename" as the parameter to -file-list-exec-source-file,
which will return the "fullname".

However, if the front end wants all of the fullnames, should we make it
send N commands to -file-list-exec-source-file, or should
-file-list-exec-source-files take an optional parameter to force it to
find all of the fullnames?

Basically, this means, GDB will give you all the "filenames" (keys) of
the current executable. Then, if you want the "fullname"(value), use the
"filename"(key) as an argument to -file-list-exec-source-file which will
return the "fullname"(value).

Hmmm, is this a little to confusing?

Thanks,
Bob Rossi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]