Reputation: 9521
Here is the source file fragment:
#define TEST 34
#define PRINT_CONCAT(a, b) \
printf("%d\n", a##b)
Compiling with GCC
and linking this source file into a binary with flags -ggdb3 -O3
and running the app with gdb
shows up the following behavior:
(gdb) p TEST
$3 = 34
(gdb) p PRINT_CONCAT
No symbol "PRINT_CONCAT" in current context.
Is there a way to make gdb expand function macros in any way?
Upvotes: 4
Views: 368
Reputation: 9521
It turned to be as easy as macro expand
(gdb) macro expand PRINT_CONCAT(2, 4)
expands to: printf("%d\n", 24)
-ggdb3
is not even required, -g3
is enough. -g2
does not seem to include the desired information.
Upvotes: 3