This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
pathmap or dir command on drugs
- To: gdb at sourceware dot cygnus dot com
- Subject: pathmap or dir command on drugs
- From: David Taylor <taylor at cygnus dot com>
- Date: Mon, 06 Nov 2000 16:25:13 -0500
It has been requested that GDB support the ability to move the source
tree used to build the program being debugged -- without having to
type in lots of directories for a really long dir command.
The idea is that there would be a command which would take two path
arguments and would arrange that whenever gdb was asked to list source
code, it would replace the 'from' prefix with the 'to' prefix before
opening the file.
So, if you had a source tree
/old/top/dir
sub/dir1/file1.c
subdir2/file2.c
sub3/dir3/file3.c
when you built your program, but you were now debugging on a different
system where it was mounted as
/new/top/dir
Then to tell gdb how to find the source code you wouldn't have to give
a dir command with all the subdirectories
/new/top/dir/sub/dir1
/new/top/dir/subdir2
/new/top/dir/sub3/dir3
you could instead just give one command which said that when presented
with
/old/top/dir
replace it with
/new/top/dir
The real value of such a mechanism is when there are many directories
it can save some typing.
If you had multiple trees, you could set up multiple mappings. If you
made a typo when typing in a pathmap, you could delete that one pathmap.
There seems to be at least two camps on what the interface should be:
One camp, by comparison with breakpoints and displays, is:
pathmap <from-prefix> <to-prefix>
show pathmaps <optional-list>
delete pathmaps <optional-list>
The other camp is
pathmap add <from-prefix> <to-prefix>
pathmap list <optional-list>
pathmap delete <optional-list>
By further analogy with breakpoints and displays, we could also have:
disable pathmaps <optional-list>
enable pathmaps <optional-list>
or
pathmap disable <optional-list>
pathmap enable <optional-list>
[Though I have yet to hear a convincing argument for the need to have
enable and disable options.]
So, is this functionality people would like to see gdb have? Is this
the form it should take? And what interface do people feel it should
have? -- one of the above? or something else altogether?
Other comments are also welcome.