bogus bkpt, using #line directives
Allen Hopkins
allenh@eecs.berkeley.edu
Thu Dec 2 17:43:00 GMT 2004
I'm using gdb (6.1.1) to debug applications that are
compiled from C++ code which is, in turn, generated from
special higher-level code (whose source files have ".mmm"
extensions).
I've inserted "#line" directives at each .cpp line that
claim that that line is really from the .mmm file it was
generated from.
Here's a snippet of code from P.cpp to talk about:
> #line 39 "/tmp/allenh/metro/examples/mgdb/P.mmm"
> try {
> #line 41 "/tmp/allenh/metro/examples/mgdb/P.mmm"
> port1->writeInt(this, w);
> #line 42 "/tmp/allenh/metro/examples/mgdb/P.mmm"
> w = w + 1;
> #line 42 "/tmp/allenh/metro/examples/mgdb/P.mmm"
> } catch (STUCK) {
> ...
A breakpoint set at line 42 ends up in a bogus place:
(gdb) b P.mmm:41
Breakpoint 6 at 0x805edde: file P.mmm, line 41.
(gdb) b P.mmm:42
Breakpoint 7 at 0x804d54a: file P.mmm, line 42.
(gdb) info b
Num Type Disp Enb Address What
6 breakpoint keep y 0x0805edde in P::thread() at
P.mmm:41
7 breakpoint keep y 0x0804d54a in ~node at P.mmm:42
The breakpoint at "~node" is just plain wrong. The
breakpoint is set correctly if the "#line" directives are
removed and the breakpoints are set on the actual .cpp line
numbers.
The program is very complex & I haven't yet been able to
make a simple test case to demonstrate this. I'm sort of
desperately hoping this looks familiar to somebody who can
offer me some hope, or suggestions. I'm left wondering if I
have to debug gdb, but I'd be in really unfamiliar territory.
-Allen
More information about the Gdb
mailing list