This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DWARF2 PE/COFF port and parsing ?


On Tue, 20 May 2003 16:14:32 -0500 (CDT), Brian Ford <ford@vss.fsi.com> said:

> I'm still slowly trying to add DWARF2 support for PE/COFF targets.  I have
> the following problem that confuses me and I was hoping for some expert
> guidance about how to proceed.  gdb's symbol table code is completely
> foreign to me.

> If I load an executable into gdb that contains one object file with DWARF2
> information (all the rest stabs), I get a segfault here:

> 1431              if (!do_linear_search
> 1432                  && (SYMBOL_LANGUAGE (*center) == language_java))
> 1433                {
> 1434                  do_linear_search = 1;
> 1435                }

The above code really should be deleted from the function in question,
but never mind that; at least it's being a useful canary in the coal
mine.

> (gdb) p *center
> $1 = (struct partial_symbol *) 0x20

That's bad: 0x20 doesn't look like an address.  So the partial symbol
table in question is screwed up.  Unfortunately, by the time you hit
this bug, we've long since built the partial symbol tables.

For an example of building a partial symbol table, see
dwarf2read.c:dwarf2_build_psymtabs_hard.  It gets created with
start_psymtab_common, then some fields get set, then a function gets
called (scan_partial_symbols, in this case) that eventually translates
into a bunch of calls to add_psymbol_to_list to add the actual partial
symbols, then the number of global and static symbols get set, then
sort_pst_symbols gets called.  From your symptoms, maybe the number of
global and/or static symbols got set wrong (or not at all) somewhere.

What does "p *pst" say?  Unfortunately, the bug may have occurred when
another psymtab was being generated: all the psymtabs within one
objfile share one data structure, so an error when generating one
psymtab may corrupt another psymtab's data.  (Sigh.  Partial symbol
tables are a mess.)

If this doesn't help, maybe you could give some more details about
exactly how you've been tinkering with the readers.

David Carlton
carlton@math.stanford.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]