((gdb)) p lquote

$1 = 0x35d40 "<QUOTE>" ((gdb)) p rquote

$2 = 0x35d50 "<UNQUOTE>"

1.9 Listing Source Code

lquote and rquote are indeed the new left and right quotes. To look at some context, we can display ten lines of source surrounding the current line with the l (list) command.

((gdb)) l

533xfree(rquote);

535lquote = (lq == nil *lq == '\0') ? def_lquote\

: xstrdup (lq);

536rquote = (rq == nil *rq == '\0') ? def_rquote\

: xstrdup (rq);

538len_lquote = strlen(rquote);

539len_rquote = strlen(lquote);

540}

542void

Let us step past the two lines that set len_lquote and len_rquote, and then examine the values of those variables.

((gdb)) n

539 len_rquote = strlen(lquote); ((gdb)) n

540 }

((gdb)) p len_lquote $3 = 9

((gdb)) p len_rquote $4 = 7

1.10 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:

22 A Sample GDB Session

Page 22
Image 22
HP gnu source-level debugger 5992-4701 manual Listing Source Code, Setting Variable Values During a Session