[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using gdb with emacs

From: Tom Tromey
Subject: Re: Using gdb with emacs
Date: 10 Sep 2001 21:11:13 -0600

>>>>> "Eli" == Eli Zaretskii <eliz@is.elta.co.il> writes:

Eli> It can't.  I didn't assume you have many files with the same
Eli> basename.

The problem doesn't really occur if every file has a unique name, due
to how the gdb `break' command searches for files.

Eli>    (gdb) break ../mauve/gnu/testlet/java/text/DateFormat/Test.java:85
Eli> and it would have worked, right?

Yes, that would have worked.

Eli> What you, in effect, want is for GUD to support relative file
Eli> names which are not relative to the default directory of the
Eli> buffer from which you set the breakpoint.

Actually, that isn't what I want.  I want it to work without any extra
interaction by me.  One way would be for both gdb and Emacs to agree
that using absolute paths will work.

Eli> AFAIK, there's no easy way this information can come from GDB
Eli> itself, so we should probably burden the user with supplying it.

I dislike this solution.  It means more work for me, the user, when
clearly more work isn't required -- Emacs knows the absolute path, and
gdb can (in theory) already find it via the paths specified to `dir'.

For instance, gdb already knows that
`../mauve/gnu/testlet/java/text/DateFormat/Test.java' is a file in my
program.  It gets this information, verbatim, from the debug info.

If I type `break
/blah/blah/mauve/gnu/testlet/java/text/DateFormat/Test.java:57', gdb
could very easily go down the list of directories as set by `dir', and
for each one go through each file in the executable, concatenate and
normalize, and then see if the answer is right.

For instance, if the directory list is `/one:/blah/blah, then gdb could
first try:

which normalizes to (I assume no symlinks, but gdb need not -- it
could use realpath):

If that fails then gdb would try:

which normalizes to:
-- the right answer.

This might be expensive, so probably it should only be done if the
argument to `break' is an absolute path.  Or maybe caching would be

One reason I think this is important is that even the worst IDE can
let the user do this without a lot of fuss.  I think it shouldn't be a
problem for Emacs+gdb to handle it too.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]