[Dwarf-workgroup] Re: [Dwarf-discuss] DWARF Issue 050808.2&body=Re: <ahref=http://dwarf.freestandards.org/ShowIssue.php

Jim Blandy jimb
Fri Feb 24 15:57:39 GMT 2006


Folks, this is a collegial discussion.  Let's save sarcasm for people
who are actually ill-intentioned; I don't think we have any such here.

This originally seemed like a straightforward problem to me, so like
Daniel I was disappointed that there was as much discussion as there
has been (even as I contributed to expanding the discussion).

But I think it's more subtle than we first realized:

- We have the issue of the name of the Fortran ENTRY tag; while the
spec is clear what the tag refers to, it's also true that 'entry
point' has different well-recognized meanings in nearby areas, so it's
not a good name.  I don't think renaming the tag is worth it, but I
also think DW_TAG_alternate_entry_point would have been better.

- There's the question of making sure the information is practical to
generate.  In cases where the entry point is only chosen after most of
the compilation is finished, it's not reasonable to expect the linker
to go through and re-jigger the main function's CU's Dwarf info to add
a new die or attribute.

- Ron brings up a bunch of good questions about what we really mean by
'entry point' anyway.

In light of all that, I think Michael's suggestion that we back off
and explain how debuggers actually use the information is reasonable.

GDB uses the main name to decide where to end backtraces.  GDB has
options to show the entire backtrace, including the entry point
function provided by the system run-time files (like crt0.s), but by
default it restricts the backtrace to the user's own code; main's is
the bottom frame on the stack.

It used to do this simply by looking for a function named "main", but
this doesn't work well for languages other than C and C++.  I believe
N_MAIN was added for Java.

GDB also uses the main name for its 'start' command, which basically
starts the program and lets it run to the beginning of 'main'.  This
has the same problems as the previous application: for Java, it's
clear what you'd like the 'start' command to do, but GDB doesn't have
enough information to dope it out on its own.

GDB uses it to select a default start position for the 'list' command,
which lists source code: if you start up GDB and type 'list', you'll
get the code for 'main'.  Again, in Java, it's clear what GDB ought to
do, but it doesn't have enough information to do it.

Some C++ implementations actually have 'main' call an internal
function '__main', which does all the C++ constructors needed at
startup time.  GDB uses the 'main' name to recognize these calls and
skip over them transparently.  This seems like a questionable use, to
me; I don't think Dwarf should go out of its way to make sure this
works.



More information about the Dwarf-discuss mailing list