This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 3/3] Windows-specific iterate_over_objfiles_in_search_order
- From: Doug Evans <dje at google dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 3 Jun 2012 21:55:02 -0700
- Subject: Re: [RFA 3/3] Windows-specific iterate_over_objfiles_in_search_order
- References: <1338496603-5423-1-git-send-email-brobecker@adacore.com> <1338496603-5423-4-git-send-email-brobecker@adacore.com>
On Thu, May 31, 2012 at 1:36 PM, Joel Brobecker <brobecker@adacore.com> wrote:
> This patch sets the windows target to use their own version of
> the iterate_over_objfiles_in_search_order gdbarch method, in
> order to make global symbol searches sensitive to the current
> objfile.
>
> gdb/ChangeLog:
>
> ? ? ? ?* windows-tdep.h (windows_iterate_over_objfiles_in_search_order):
> ? ? ? ?Add declaration.
> ? ? ? ?* windows-tdep.c: #include "objfiles.h".
> ? ? ? ?(windows_iterate_over_objfiles_in_search_order): New function.
> ? ? ? ?* amd64-windows-tdep.c (amd64_windows_init_abi): Set
> ? ? ? ?iterate_over_objfiles_in_search_order gdbarch method to
> ? ? ? ?windows_iterate_over_objfiles_in_search_order.
> ? ? ? ?* i386-cygwin-tdep.c (i386_cygwin_init_abi): Likewise.
>[...]
>+/* Implement the "iterate_over_objfiles_in_search_order" gdbarch
>+ method. It searches all objfiles, starting with CURRENT_OBJFILE
>+ first (if not NULL).
>+
>+ On Windows, the system behaves a little differently when two
>+ objfiles each define a global symbol using the same name, compared
>+ to other platforms such as GNU/Linux for instance. On GNU/Linux,
>+ all instances of the symbol effectively get merged into a single
>+ one, but on Windows, they remain distinct.
>+
>+ As a result, it usually makes sense to start global symbol searches
>+ with the current objfile before expanding it to all other objfiles.
>+ This helps for instance when a user debugs some code in a DLL that
>+ refers to a global variable defined inside that DLL. When trying
>+ to print the value of that global variable, it would be unhelpful
>+ to print the value of another global variable defined with the same
>+ name, but in a different DLL. */
GDB's notion of a global symbol isn't a perfect match for ELF's notion.
I'm wondering if there are examples where we'd want this for ELF too.
[And are there examples where we don't want this for ELF?]