This is the mail archive of the gdb-patches@sourceware.org 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: [PATCH 3/3] move the "main" data into the per-BFD object


On Mon, Jan 6, 2014 at 10:00 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> Seems like there ought to be an invariant that there is only one
> Doug> main name.  I ask because it's not clear this invariant is
> Doug> enforced (or if it is it's too subtle) and thus what if this loop
> Doug> finds the wrong one?
>
> I agree there's some room for improvement, but I don't think this series
> makes the code worse in any notable way.  There is no such invariant
> today and I don't know how it would be enforced.  I think the new code,
> if anything, is slightly more likely to get the correct answer, due to
> walking the objfiles in load order, rather than reverse order.  For the
> DWARF reader at least this only even triggers for Fortran anyway (gdb
> doesn't handle DW_AT_main_subprogram yet), which I think implies a lower
> exposure to possible difficulties.

Sure.
Can I ask for a comment in the code explaining why things are the way they are.
E.g., the new code may be more correct, but relying on an implicit
"walking the objfiles in load order, rather than reverse order" is a
teensy bit on the subtle side. (btw, is it written down anywhere that
ALL_OBJFILES traverses files in load order? If there is such an
invariant, it would be good for future readers to know).
I can't promise to remember this discussion when I'm in the code 6
months from now. :-)


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