When I tried to see what are the directories gdb try to search for source files, I used show directories
, it output a variable:
(gdb) show directories
Source directories searched: $cdir:$cwd
But how can I show value of the two variables: cdir
and cwd
? Tried show
or p
didn't work.
how can I show value of the two variables:
cdir
andcwd
The $cdir
stands for compilation directory (if one is recorded) and is specific to the current source file.
The command info source
should show you info for current source file, including the compilation directory:
Starting program: /tmp/a.out
Temporary breakpoint 1, main (argc=1, argv=0x7fffffffdcb8) at t.c:3
3 return 0;
(gdb) info source
Current source file is t.c
Compilation directory is /tmp <<<=== this is $cdir
Located in /tmp/t.c
Contains 4 lines.
Source language is c.
Producer is GNU C11 7.3.0 -mtune=generic -march=x86-64 -g.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.
The $cwd
stands for current working directory, which you can examine with the pwd
command:
(gdb) pwd
Working directory /tmp.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With