Define a source path substitution rule
set substitute-path from to
Define a source path substitution rule, and add it at the end of the current list of existing substitution rules. If a rule with the same from was already defined, then the old rule is also deleted.
For example, if the file /foo/bar/baz.c
was moved to /mnt/cross/baz.c
, then the command
1 | (gdb) set substitute-path /foo/bar /mnt/cross |
will tell GDB to replace /foo/bar
with /mnt/cross
, which will allow GDB to find the file baz.c even though it was moved.
In the case when more than one substitution rule have been defined, the rules are evaluated one by one in the order where they have been defined. The first one matching, if any, is selected to perform the substitution.
For instance, if we had entered the following commands:
1 | (gdb) set substitute-path /usr/src/include /mnt/include |
GDB would then rewrite /usr/src/include/defs.h
into /mnt/include/defs.h
by using the first rule. However, it would use the second rule to rewrite /usr/src/lib/foo.c
into /mnt/src/lib/foo.c
.
1 | (gdb) bt |
Print source lines
1 | (gdb) list |