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: [RFA 3/3] Windows-specific iterate_over_objfiles_in_search_order


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?]


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