Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Allen Hopkins <allenh@eecs.berkeley.edu>
To: gdb <gdb@sources.redhat.com>
Subject: bogus bkpt, using #line directives
Date: Thu, 02 Dec 2004 17:43:00 -0000	[thread overview]
Message-ID: <41AF543D.9060804@eecs.berkeley.edu> (raw)

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


             reply	other threads:[~2004-12-02 17:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-02 17:43 Allen Hopkins [this message]
2004-12-02 20:58 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41AF543D.9060804@eecs.berkeley.edu \
    --to=allenh@eecs.berkeley.edu \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox