Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFC/dwarf-2] Add support for included files
Date: Fri, 02 Jan 2004 14:18:00 -0000	[thread overview]
Message-ID: <20040102141802.GA28372@nevyn.them.org> (raw)
In-Reply-To: <20040102072500.GS826@gnat.com>

On Fri, Jan 02, 2004 at 08:25:00AM +0100, Joel Brobecker wrote:
> We have noticed that, if compiled with dwarf-2, GDB is unable to
> set a breakpoint inside hello.c using the file:lineno syntax:
> 
>         % gcc -gdwarf-2 foo.c -o foo
>         % gdb foo
>         (gdb) b hello.c:4
>         No source file named hello.c.
>         (gdb) list hello.c:4
>         No source file named hello.c.
> 
> However, we can set the breakpoint using the function name:
> 
>         (gdb) b say_hello
>         Breakpoint 1 at 0x804833e: file hello.c, line 4.
> 
> And then once this breakpoint is set, we can now insert the
> breakpoint using the source location:
> 
>         (gdb) b hello.c:4
>         Note: breakpoint 1 also set at pc 0x804833e.
>         Breakpoint 2 at 0x804833e: file hello.c, line 4.
>         (gdb) list hello.c:4
>         1       void
>         2       say_hello (void)
>         3       {
>         4         printf ("Hello world.\n");
>         5       }

Yes... I've noticed this several times recently.

> In Dwarf-2, the list of included files is linked to the line table.
> First, we have "Line Number Program Header" which contains the "file
> names" table. And then the program itself which uses the DW_LNS_set_file
> opcode to change from file to file. There is also the DW_LNE_defile_file
> opcode that can be used to define new files instead of using the "file
> names" table.

You keep saying that.  I don't think it means what you think it means
:)  (Hint: DW_LNE_define_file, not DW_LNE_defile_file.)

> Basically, I just copy/pasted the code from dwarf_decode_lines(),
> simplified it for partial symtab processing, and then called it
> right after the compilation unit psymtab has been built. Currently,
> the function scans the line number program, and records which files
> of the "file names" table have really been included in the line program
> (that's the "file_included" array).
> 
> Here is a patch against GDB 6.0 that I used as a proof of concept.
> It does not handle the case where the compiler uses DW_LNE_defile_file
> instead of the the "file names" table yet, but that will be taken care
> of.  Would that be an acceptable approach to suggest for inclusion?

Well, the question is whether this works well enough.  Things _are_ in
these files - DW_AT_decl_file points to them.  Do we need to also put
things into the proper psymtabs?

Otherwise the approach seems reasonable.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2004-01-02 14:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-02  7:25 Joel Brobecker
2004-01-02 14:18 ` Daniel Jacobowitz [this message]
2004-01-03 14:42   ` Joel Brobecker
2004-01-03 16:34     ` Eli Zaretskii
2004-01-03 17:47       ` Joel Brobecker
2004-01-02 14:45 ` Eli Zaretskii
2004-01-05 16:18 ` Andrew Cagney
2004-01-05 19:17   ` Joel Brobecker
2004-04-07 16:05 Jim Blandy
2004-04-13  5:20 ` Joel Brobecker
2004-04-14 19:10   ` Jim Blandy
2004-04-15 22:13     ` Joel Brobecker
2004-04-16  4:24       ` Jim Blandy
2004-04-16  4:28         ` Joel Brobecker
2004-04-16 23:08         ` Joel Brobecker
2004-04-29 23:32           ` Jim Blandy
2004-05-01  1:14             ` Joel Brobecker
2004-05-01  4:57               ` Jim Blandy
2004-05-03 16:25                 ` Joel Brobecker
2004-05-03 22:15 Andrew Pinski
2004-05-04  0:15 ` Joel Brobecker
2004-05-04  0:18   ` Andrew Pinski

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=20040102141802.GA28372@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@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