* bogus bkpt, using #line directives
@ 2004-12-02 17:43 Allen Hopkins
2004-12-02 20:58 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: Allen Hopkins @ 2004-12-02 17:43 UTC (permalink / raw)
To: gdb
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: bogus bkpt, using #line directives
2004-12-02 17:43 bogus bkpt, using #line directives Allen Hopkins
@ 2004-12-02 20:58 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2004-12-02 20:58 UTC (permalink / raw)
To: Allen Hopkins; +Cc: gdb
On Thu, Dec 02, 2004 at 09:43:25AM -0800, Allen Hopkins wrote:
> 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.
Start by debugging GCC's generated line table. If you're using
DWARF-2, you can print it with readelf -wl. Does it put line markers
in sensible places?
--
Daniel Jacobowitz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-12-02 20:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-02 17:43 bogus bkpt, using #line directives Allen Hopkins
2004-12-02 20:58 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox