This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/3] move the "main" data into the per-BFD object
- From: Doug Evans <dje at google dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Mon, 6 Jan 2014 10:22:59 -0800
- Subject: Re: [PATCH 3/3] move the "main" data into the per-BFD object
- Authentication-results: sourceware.org; auth=none
- References: <1389028297-16977-1-git-send-email-tromey at redhat dot com> <1389028297-16977-4-git-send-email-tromey at redhat dot com> <CADPb22T4fBYr_BEELyju=p8ORPbvBMQTvnrQim6KYcDT9n+SRg at mail dot gmail dot com> <87vbxxm1nh dot fsf at fleche dot redhat dot com>
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. :-)