Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)
Setting Variable Values During a Session
That certainly looks wrong, assuming len_lquote and len_rquote are meant to be the lengths
of lquote and rquote respectively. We can set them to better values using the p command,
since it can print the value of any expression―and that expression can include subroutine calls
and assignments.
((gdb)) p len_lquote=strlen(lquote)
$5 = 7
((gdb)) p len_rquote=strlen(rquote)
$6 = 9
Is that enough to fix the problem of using the new quotes with the m4 built-in defn? We
can allow m4 to continue executing with the c (continue) command, and then try the example
that caused trouble initially:
((gdb)) c
Continuing.
define(baz,defn(<QUOTE>foo<UNQUOTE>))
baz
0000
Success! The new quotes now work just as well as the default ones. The problem seems to have
been just the two typos defining the wrong lengths. We allow m4 to exit by giving it an EOF as
input:
C-d
Program exited normally.
The message `Program exited normally.' is from GDB; it indicates m4 has finished executing.
We can end our GDB session with the GDB quit command.
((gdb)) quit
18 A Sample GDB Session