* DWARF-2 and constructors/destructors @ 2001-12-05 19:53 Daniel Jacobowitz 2001-12-05 20:01 ` Daniel Jacobowitz 2001-12-06 10:39 ` Jason Merrill 0 siblings, 2 replies; 4+ messages in thread From: Daniel Jacobowitz @ 2001-12-05 19:53 UTC (permalink / raw) To: gcc; +Cc: Daniel Berlin Suppose you want to call a (non-virtual) method in C++, from something with Dwarf-2 info. The only way to get the mangled name from the debug info is DW_AT_MIPS_linkage_name. This isn't, of course, present for constructors/destructors, since the entry in the class definition is for the abstract version. Is it reasonable for the debugger to have to mangle this itself? The constructor arguments can be arbitrarily complex. Should there be references in the debug information to the base and complete constructors anywhere? -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DWARF-2 and constructors/destructors 2001-12-05 19:53 DWARF-2 and constructors/destructors Daniel Jacobowitz @ 2001-12-05 20:01 ` Daniel Jacobowitz 2001-12-05 20:25 ` Daniel Berlin 2001-12-06 10:39 ` Jason Merrill 1 sibling, 1 reply; 4+ messages in thread From: Daniel Jacobowitz @ 2001-12-05 20:01 UTC (permalink / raw) To: gcc, Daniel Berlin On Wed, Dec 05, 2001 at 10:52:46PM -0500, Daniel Jacobowitz wrote: > Suppose you want to call a (non-virtual) method in C++, from something > with Dwarf-2 info. The only way to get the mangled name from the debug > info is DW_AT_MIPS_linkage_name. This isn't, of course, present for > constructors/destructors, since the entry in the class definition is > for the abstract version. > > Is it reasonable for the debugger to have to mangle this itself? The > constructor arguments can be arbitrarily complex. Should there be > references in the debug information to the base and complete > constructors anywhere? And I see, in a rather memorable rant, Daniel Berlin saying that DW_AT_MIPS_linkage_name is "a hack" (certainly), "not necessary, and we're trying to make it go away anyway." Dan, would you mind enlightening me on how to cope without it without having a full mangler for every supported C++ ABI attached to the Dwarf-2 reader? As far as I'm concerned, GDB has no business ever mangling a single string. Debug info should provide everything that we need. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DWARF-2 and constructors/destructors 2001-12-05 20:01 ` Daniel Jacobowitz @ 2001-12-05 20:25 ` Daniel Berlin 0 siblings, 0 replies; 4+ messages in thread From: Daniel Berlin @ 2001-12-05 20:25 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gcc On Wed, 5 Dec 2001, Daniel Jacobowitz wrote: > On Wed, Dec 05, 2001 at 10:52:46PM -0500, Daniel Jacobowitz wrote: > > Suppose you want to call a (non-virtual) method in C++, from something > > with Dwarf-2 info. The only way to get the mangled name from the debug > > info is DW_AT_MIPS_linkage_name. This isn't, of course, present for > > constructors/destructors, since the entry in the class definition is > > for the abstract version. > > > > Is it reasonable for the debugger to have to mangle this itself? The > > constructor arguments can be arbitrarily complex. Should there be > > references in the debug information to the base and complete > > constructors anywhere? > > And I see, in a rather memorable rant, Daniel Berlin saying that > DW_AT_MIPS_linkage_name is "a hack" (certainly), "not necessary, and > we're trying to make it go away anyway." Yes, with which Jason Merrill agreed, IIRC. In fact, he first convinced me. :) I'm just more vitriolic by a small margin. > Dan, would you mind > enlightening me on how to cope without it without having a full mangler > for every supported C++ ABI attached to the Dwarf-2 reader? Sure. What exactly do you need mangled names for? All the methods have real names anyway. We already demangle them anyway when we lookup symbols, remember. If you mean for calling constructors, it's abi specific. Find all the matching constructors, which will be a small number, demangle them, and pick the right one for your purposes. The demangler actually marks what type of constructor/deconstructor it is, the info is just not propagated to somewhere where gdb sees it (in cp-demangle.c, it's stored in the demangling_t structure, but we only hand back the string). > > As far as I'm concerned, GDB has no business ever mangling a single > string. Bingo. > Debug info should provide everything that we need. Yes, it should. Now go look at check_method_stub and gdb_mangle_name, and try to avoid hurling. > > -- > Daniel Jacobowitz Carnegie Mellon University > MontaVista Software Debian GNU/Linux Developer > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DWARF-2 and constructors/destructors 2001-12-05 19:53 DWARF-2 and constructors/destructors Daniel Jacobowitz 2001-12-05 20:01 ` Daniel Jacobowitz @ 2001-12-06 10:39 ` Jason Merrill 1 sibling, 0 replies; 4+ messages in thread From: Jason Merrill @ 2001-12-06 10:39 UTC (permalink / raw) To: gcc; +Cc: Daniel Berlin >>>>> "Daniel" == Daniel Jacobowitz <dmj+@andrew.cmu.edu> writes: > Suppose you want to call a (non-virtual) method in C++, from something > with Dwarf-2 info. The only way to get the mangled name from the debug > info is DW_AT_MIPS_linkage_name. As Dan Berlin points out, The mangled name is already in the symbol table, if there's actually a definition of the method. Why does it need to be in the debug info as well? To call a non-virtual function, we're only interested in its address. The debug information doesn't enter into it. This applies to all functions, of course, not just ctors/dtors. The DW_AT_MIPS_linkage_name stuff was a hack to make dwarf2 work with the existing stabs-oriented code with minimal effort; it would save a lot of space if we could get rid of it. Jason ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-12-06 18:18 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2001-12-05 19:53 DWARF-2 and constructors/destructors Daniel Jacobowitz 2001-12-05 20:01 ` Daniel Jacobowitz 2001-12-05 20:25 ` Daniel Berlin 2001-12-06 10:39 ` Jason Merrill
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).