[PATCH v2] Fix WOW64 process system DLL paths

Hannes Domani ssbssa@yahoo.de
Thu Mar 26 21:01:40 GMT 2020


 Am Donnerstag, 26. März 2020, 21:57:00 MEZ hat Simon Marchi <simark@simark.ca> Folgendes geschrieben:

> On 2020-03-26 4:48 p.m., Hannes Domani via Gdb-patches wrote:
>
> >  Am Donnerstag, 26. März 2020, 21:39:27 MEZ hat Christian Biesinger <cbiesinger@google.com> Folgendes geschrieben:
> >
> >> On Thu, Mar 26, 2020 at 3:35 PM Hannes Domani via Gdb-patches
> >>
> >> <gdb-patches@sourceware.org> wrote:
> >>>
> >>>   Am Donnerstag, 26. März 2020, 20:26:14 MEZ hat Eli Zaretskii <eliz@gnu.org> Folgendes geschrieben:
> >>>
> >>>>> Date: Wed, 25 Mar 2020 14:35:51 +0000 (UTC)
> >>>>
> >>>>> From: Hannes Domani via Gdb-patches <gdb-patches@sourceware.org>
> >>>>>
> >>>>>>> But I figured my way with GetSystemWow64Directory is simpler.
> >>>>>>>
> >>>>>>>
> >>>>>>> Is the v2 OK to commit?
> >>>>>>
> >>>>>> Yes, thanks.
> >>>>>
> >>>>> Pushed, thanks.
> >>>>
> >>>>
> >>>> It looks like the same problem exists in the 32-bit Windows build of
> >>>> GDB, when it runs on 64-bit Windows 10: "info sharedlibrary" shows
> >>>> C:\Windows\system32 instead of C:\Windows\SysWOW64 (it doesn't happen
> >>>> on 64-bit Windows 7, for example).  So I guess the code which replaces
> >>>> the former with the latter should also be in the 32-bit build, not
> >>>> just "#ifdef __x86_64__".
> >>>
> >>> Yes, for me (on Win7) it also happens with the same dlls in the 32-bit gdb
> >>> as with the 64-bit gdb.
> >>> But it shouldn't matter, since for 32-bit gdb all C:\Windows\system32 paths
> >>> are automatically redirected[1] to C:\Windows\SysWOW64 anyways.
> >>>
> >>> [1] https://docs.microsoft.com/en-us/windows/win32/winprog64/file-system-redirector
> >>
> >>
> >> Even so, it's probably less confusing for the user if what GDB
> >> displays actually matches reality?
> >
> > I guess you are right.
> > I will prepare a patch for this.
>
>
> Let's say a 32 bit GDB is debugging a 64 bit program.  GDB gets the list of loaded libraries, which
> contains c:\windows\system32\foo.dll.  When GDB opens it, to read the contents of the library, will
> it open and read c:\windows\system32\foo.dll (which is the one really loaded in the 64-bit process)
> or will it open and read c:\windows\syswow64\foo.dll?

You can't debug a 64-bit program with a 32-bit gdb, it's only possible
the other way around.

But if it were possible, it would read c:\windows\syswow64\foo.dll.


More information about the Gdb-patches mailing list