Re: [RFA/windows] Spurious "dll not found" error messages on x64-windows.

Joel Brobecker
2010-02-11T11:22:14Z

[-- Attachment #1: Type: text/plain, Size: 1516 bytes --]

> Sorry but, I don't think this right. What's the point of issuing the
> error after inferior startup? I think it's only during startup that
> something like this would be useful.
>
> I think making the error a complaint makes more sense.

Sure. I am not sure when DLLs are unloaded most... I was thinking
more about the case where a user does a LoadLibrary/FreeLibrary.

Regardless, here is a version that transforms the error into a complaint.
So far, complaints appears to be used only for symbol file events.
It's a tiny bit of a strech to include our complaint in that category,
but I think that creating a different category for that might be
a bit overkill. I don't mind doing so, however. I chose the simpler
approach for now, which gives us the following complaint when they
are activated:

[New Thread 94404.0x222a8]
During symbol reading, dll starting at 0x77a60000 not found..
During symbol reading, dll starting at 0x77650000 not found..
[...]

The "During symbol reading" is where the complaint category comes
in play.

Note that the module description in complaints.h says:

Definitions for complaint handling during symbol reading in GDB.

But I don't see why this couldn't be used for other purposes (and
hence why we couldn't create new categories if necessary).

gdb/ChangeLog:

* windows-nat.c: Add include of complaints.h.
(handle_unload_dll): Change dll-not-found error into a complaint.

Tested on x86_64-windows with an x86-windows toolchain.

--
Joel

[-- Attachment #2: unloaded-dll-not-found.diff --]
[-- Type: text/x-diff, Size: 1146 bytes --]

--- windows-nat.c.orig 2010-02-11 12:09:23.911442400 +0100
+++ windows-nat.c 2010-02-11 11:22:29.060598600 +0100
@@ -64,6 +64,7 @@
#include "windows-tdep.h"
#include "windows-nat.h"
#include "i386-nat.h"
+#include "complaints.h"

#define AdjustTokenPrivileges dyn_AdjustTokenPrivileges
#define DebugActiveProcessStop dyn_DebugActiveProcessStop
@@ -783,8 +784,15 @@ handle_unload_dll (void *dummy)
return 1;
}

- error (_("Error: dll starting at %s not found."),
- host_address_to_string (lpBaseOfDll));
+ /* We did not find any DLL that was previously loaded at this address,
+ so register a complaint. We do not report an error, because we have
+ observed that this may be happening under some circumstances. For
+ instance, running 32bit applications on x64 Windows causes us to receive
+ 4 mysterious UNLOAD_DLL_DEBUG_EVENTs during the startup phase (these
+ events are apparently caused by the WOW layer, the interface between
+ 32bit and 64bit worlds). */
+ complaint (&symfile_complaints, _("dll starting at %s not found."),
+ host_address_to_string (lpBaseOfDll));

return 0;
}