Re: HOWTO Change debugging at run-time.
On Tue, 5 Apr 2005 11:19:03 -0700, ATS <ATS@discussions.microsoft.com>
wrote:
Thank Ivan and you too Oleg,
As you know I've been asking for this solution in several ways. I really
would like Microsoft to make this, but that has become a bitter discussion in
a different forum, sadly.
As for the NtOsKrnl.exe, I have never heard of that. And I thank you for the
info. I've been trying to figure ways of getting the debugger to recognize
debug info for a DLL at run time from two streams of thought.
(1) Do whatever it takes to make the Debugger recognize different debug
data. Which is how I've been seeking the answer here with you and Oleg.
(2) Change LoadLibrary to simply use memory instead of file I/O.
Obviously it sounds like approach (1) is DOA. What about approach (2). Could
theoretically LoadLibrary be changed to not use OpenFile/ReadFile, but memory
instead? Keeping the relationship it has to NtOsKrnl.exe the same. This would
REALLY solve this issue, as that way, we could pair the correct debug info to
the correct DLL. What things if any prevent one from taking Kernel32.dll
(where LoadLibrary lives), and overriding any file i/o to be memory? Could we
pay Microsoft to make a change to LoadLibrary to work from memory instead of
a file and point it to the debug info we desire?
We really need this.
I've been following this thread, and this is the third time I've tried
to help.
If your two DLLs have separate PDB files (left in the original build
locations), those PDB files should point to the correct source files
and VC++ should locate and open them correctly.
In your original post, you said:
Now imagine one last thing. At the time I go to LoadLibrary, I move the
"MyProgram.dll" I want to use to a shared directory "C:\TheSamePath". At this
point, there is no way the debugger can tell which source code to use as
MyProgram.dll is the same for both builds (except for the pragma), and the
path no MyProgram.dll is on is different from its build path.
I believe you are wrong. The DLL contains the full path to the PDB
(debug info), which in turn contains full paths to the source files.
VC++ should locate the correct source files fine.
I honestly still think the problem is with the way your project is set
up, rather than any deficiency in VC++. Verify that Configuration
Properties - Linker - Debuging - Generate Program Database File have
different paths for the PDBs in the two DLL projects.
Create a minimum solution containing three projects (two DLLs and an
EXE that loads them) and provide it. By doing this, you'll either
prove me wrong or learn what the problem is.
--
Phillip Crews aka Severian
Microsoft MVP, Windows SDK
Posting email address is real