Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Are mixed debug formats in one exe supported?
@ 2004-03-23 22:40 Brian Ford
  2004-03-23 22:42 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Ford @ 2004-03-23 22:40 UTC (permalink / raw)
  To: gdb

I am trying to add DWARF2 support to PE/COFF for Cygwin/Mingw.  They
currently use stabs.

While testing, executables end up having mixed stabs/DWARF2 debugging
info if any system/gcc/previously compiled static libs are linked in.
The result causes gdb to SEGV while traversing the partial symbol tables
looking for symbol main.

The problem is that init_psymbol_list is called for the executable twice
due to mainline being set at dbxread.c:562, and again at
dwarf2read.c:1076.

So, the question.  Is this meant to work?  I assume the reason mainline is
used here is:

/* If we are reinitializing, or if we have never loaded syms yet, init */

Why does reinitializing not clean up after itself (ie. reset the
[global|static]_psymbols.size to 0)?  Is that a leak?

I'm going to keep digging, but since I have zero knowledge of gdb
internals, I thought I'd ask and save some time.  Thanks.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Are mixed debug formats in one exe supported?
  2004-03-23 22:40 Are mixed debug formats in one exe supported? Brian Ford
@ 2004-03-23 22:42 ` Daniel Jacobowitz
  2004-03-23 23:47   ` Brian Ford
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2004-03-23 22:42 UTC (permalink / raw)
  To: Brian Ford; +Cc: gdb

On Tue, Mar 23, 2004 at 02:41:01PM -0600, Brian Ford wrote:
> I am trying to add DWARF2 support to PE/COFF for Cygwin/Mingw.  They
> currently use stabs.
> 
> While testing, executables end up having mixed stabs/DWARF2 debugging
> info if any system/gcc/previously compiled static libs are linked in.
> The result causes gdb to SEGV while traversing the partial symbol tables
> looking for symbol main.
> 
> The problem is that init_psymbol_list is called for the executable twice
> due to mainline being set at dbxread.c:562, and again at
> dwarf2read.c:1076.
> 
> So, the question.  Is this meant to work?  I assume the reason mainline is
> used here is:
> 
> /* If we are reinitializing, or if we have never loaded syms yet, init */
> 
> Why does reinitializing not clean up after itself (ie. reset the
> [global|static]_psymbols.size to 0)?  Is that a leak?
> 
> I'm going to keep digging, but since I have zero knowledge of gdb
> internals, I thought I'd ask and save some time.  Thanks.

I can't answer any of the more detailed questions, but yes, this is
supposed to work.  It's easy to produce binaries with both stabs and
DWARF-2 on GNU/Linux, and it generally works OK.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Are mixed debug formats in one exe supported?
  2004-03-23 22:42 ` Daniel Jacobowitz
@ 2004-03-23 23:47   ` Brian Ford
  2004-03-24  7:12     ` Brian Ford
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Ford @ 2004-03-23 23:47 UTC (permalink / raw)
  To: gdb

BTW, please CC me as I'm not subscribed to the list.  Thanks.

On Tue, 23 Mar 2004, Daniel Jacobowitz wrote:

> On Tue, Mar 23, 2004 at 02:41:01PM -0600, Brian Ford wrote:
> > I am trying to add DWARF2 support to PE/COFF for Cygwin/Mingw.  They
> > currently use stabs.
> >
> > While testing, executables end up having mixed stabs/DWARF2 debugging
> > info if any system/gcc/previously compiled static libs are linked in.
> > The result causes gdb to SEGV while traversing the partial symbol tables
> > looking for symbol main.
> >
> > The problem is that init_psymbol_list is called for the executable twice
> > due to mainline being set at dbxread.c:562, and again at
> > dwarf2read.c:1076.
> >
> > So, the question.  Is this meant to work?  I assume the reason mainline is
> > used here is:
> >
> > /* If we are reinitializing, or if we have never loaded syms yet, init */
> >
> > Why does reinitializing not clean up after itself (ie. reset the
> > [global|static]_psymbols.size to 0)?  Is that a leak?
> >
> > I'm going to keep digging, but since I have zero knowledge of gdb
> > internals, I thought I'd ask and save some time.  Thanks.
>
> I can't answer any of the more detailed questions, but yes, this is
> supposed to work.  It's easy to produce binaries with both stabs and
> DWARF-2 on GNU/Linux, and it generally works OK.
>
I almost see why.  Can someone please tell me why this comment above
elfstab_build_psymtabs is true for the DWARF part?

   This ELF file has already been processed to get its minimal symbols,
   and any DWARF symbols that were in it.

ie. What gaurantees that DWARF is processed before stabs?  I can't see
that yet.  If I can understand that, I think I can easily fix my problem.

Thanks again.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Are mixed debug formats in one exe supported?
  2004-03-23 23:47   ` Brian Ford
@ 2004-03-24  7:12     ` Brian Ford
  2004-03-24  9:25       ` Brian Ford
  2004-03-24 10:29       ` Daniel Jacobowitz
  0 siblings, 2 replies; 6+ messages in thread
From: Brian Ford @ 2004-03-24  7:12 UTC (permalink / raw)
  To: gdb

On Tue, 23 Mar 2004, Brian Ford wrote:

> BTW, please CC me as I'm not subscribed to the list.  Thanks.
>
> On Tue, 23 Mar 2004, Daniel Jacobowitz wrote:
>
> > On Tue, Mar 23, 2004 at 02:41:01PM -0600, Brian Ford wrote:
> > > I am trying to add DWARF2 support to PE/COFF for Cygwin/Mingw.  They
> > > currently use stabs.
> > >
> > > While testing, executables end up having mixed stabs/DWARF2 debugging
> > > info if any system/gcc/previously compiled static libs are linked in.
> > > The result causes gdb to SEGV while traversing the partial symbol tables
> > > looking for symbol main.
> > >
> > > The problem is that init_psymbol_list is called for the executable twice
> > > due to mainline being set at dbxread.c:562, and again at
> > > dwarf2read.c:1076.
> > >
> > > So, the question.  Is this meant to work?  I assume the reason mainline is
> > > used here is:
> > >
> > > /* If we are reinitializing, or if we have never loaded syms yet, init */
> > >
> > > Why does reinitializing not clean up after itself (ie. reset the
> > > [global|static]_psymbols.size to 0)?  Is that a leak?
> > >
> > > I'm going to keep digging, but since I have zero knowledge of gdb
> > > internals, I thought I'd ask and save some time.  Thanks.
> >
> > I can't answer any of the more detailed questions, but yes, this is
> > supposed to work.  It's easy to produce binaries with both stabs and
> > DWARF-2 on GNU/Linux, and it generally works OK.
> >
> I almost see why.  Can someone please tell me why this comment above
> elfstab_build_psymtabs is true for the DWARF part?
>
>    This ELF file has already been processed to get its minimal symbols,
>    and any DWARF symbols that were in it.
>
> ie. What gaurantees that DWARF is processed before stabs?  I can't see
> that yet.  If I can understand that, I think I can easily fix my problem.
>
> Thanks again.
>
Sorry to follow up my own post, but I'm now even more confused.

From what I can see, the order (for elf) is gauranteed to be ECOFF, stabs,
DWARF2, DWARF, DWARF2 frame info.  So, that comment just looks wrong.  And, I
still don't understand why it works on Linux.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Are mixed debug formats in one exe supported?
  2004-03-24  7:12     ` Brian Ford
@ 2004-03-24  9:25       ` Brian Ford
  2004-03-24 10:29       ` Daniel Jacobowitz
  1 sibling, 0 replies; 6+ messages in thread
From: Brian Ford @ 2004-03-24  9:25 UTC (permalink / raw)
  To: gdb

On Tue, 23 Mar 2004, Brian Ford wrote:

> On Tue, 23 Mar 2004, Brian Ford wrote:
>
> > I almost see why.  Can someone please tell me why this comment above
> > elfstab_build_psymtabs is true for the DWARF part?
> >
> >    This ELF file has already been processed to get its minimal symbols,
> >    and any DWARF symbols that were in it.
> >
> > ie. What gaurantees that DWARF is processed before stabs?  I can't see
> > that yet.  If I can understand that, I think I can easily fix my problem.
> >
> > Thanks again.
> >
> Sorry to follow up my own post, but I'm now even more confused.
>
> From what I can see, the order (for elf) is gauranteed to be ECOFF, stabs,
> DWARF2, DWARF, DWARF2 frame info.  So, that comment just looks wrong.  And, I
> still don't understand why it works on Linux.
>
Ugh..., found it.

  /* If we are reinitializing, or if we have never loaded syms yet,
     set table to empty.  MAINLINE is cleared so that *_read_psymtab
     functions do not all also re-initialize the psymbol table. */
  if (mainline)
    {
      init_psymbol_list (objfile, 0);
      mainline = 0;
    }
Sorry for the noise.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Are mixed debug formats in one exe supported?
  2004-03-24  7:12     ` Brian Ford
  2004-03-24  9:25       ` Brian Ford
@ 2004-03-24 10:29       ` Daniel Jacobowitz
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2004-03-24 10:29 UTC (permalink / raw)
  To: Brian Ford; +Cc: gdb

On Tue, Mar 23, 2004 at 05:44:10PM -0600, Brian Ford wrote:
> On Tue, 23 Mar 2004, Brian Ford wrote:
> > I almost see why.  Can someone please tell me why this comment above
> > elfstab_build_psymtabs is true for the DWARF part?
> >
> >    This ELF file has already been processed to get its minimal symbols,
> >    and any DWARF symbols that were in it.
> >
> > ie. What gaurantees that DWARF is processed before stabs?  I can't see
> > that yet.  If I can understand that, I think I can easily fix my problem.
> >
> > Thanks again.
> >
> Sorry to follow up my own post, but I'm now even more confused.
> 
> >From what I can see, the order (for elf) is gauranteed to be ECOFF, stabs,
> DWARF2, DWARF, DWARF2 frame info.  So, that comment just looks wrong.  And, I
> still don't understand why it works on Linux.

The order shouldn't even matter at all.  Neither the stabs nor dwarf
code will add the ELF minimal symbols, and then stabs will add some and
dwarf the others.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-03-23 23:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-23 22:40 Are mixed debug formats in one exe supported? Brian Ford
2004-03-23 22:42 ` Daniel Jacobowitz
2004-03-23 23:47   ` Brian Ford
2004-03-24  7:12     ` Brian Ford
2004-03-24  9:25       ` Brian Ford
2004-03-24 10:29       ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox