Thanks Jim!
1.
I have used lm to check the loaded symbols and my code module is marked with private symbol loaded mark, looks like related PDB is loaded. Correct?
2.
My operation is like this, I am using WinDbg to set a breakpoint to method Main. Here is what I did.
0:000> !bpmd TestDebug.exe TestDebug.Program.foo
Adding pending breakpoints…
0:000> lm
start??? end??? module name
0000000000400000 0000000000408000?? TestDebug C (private pdb symbols)? D:\Visual Studio 2008\Projects\TestDebug\TestDebug\bin\Debug\TestDebug.pdb
0:000> g
(1b0.5c4): CLR exception - code e0434f4d (first chance)
(1b0.5c4): CLR exception - code e0434f4d (!!! second chance !!!)
KERNEL32!RaiseException+0x5c:
00000000`77d4dd10 4881c4c8000000? add??? rsp,0C8h
But when pressing g, and the program stops, then I pressed k to display the current stack. I found there is no my code in the stack. The seems the stop execution is not because of breakpoint (because no break point? hit information)? I am so confused. Any ideas?
namespace TestDebug
{
??? class Program
??? {
??? static void foo()
??? {
??? int a = 100;
??? throw new Exception (“Hello Exception Debug”);
??? }
???
??? static void Main(string args)
??? {
??? foo();
??? }
??? }
}
regards,
George
----- Original Message ----
From: Jim Donelson
To: Lin George
Sent: Wednesday, July 9, 2008 9:02:30 PM
Subject: Re: [windbg] display source code while debugging
Well, the most important thing is that the correct PDB file was loaded. All information comes from the PDB file.
The PDB file actually has the path to the source files, and if the source build tree is all still there as it was when built, it will work.
So first the symbol path must have the PDB file on it.
If ‘lm’ does not show that the pdb file was loaded for that module, nothing will work in this respect.
Once it is configured, windbg will just magically go to the source file. There is no other way to get it to work.
On Tue, Jul 8, 2008 at 9:15 PM, Lin George wrote:
Sure Jim, this is why I asked this question. My purpose is to find some “cool and lazy” way which could type a command in command window, and related source file is displayed, currently I have to use File –> Open Source File to open the related source file.
?
I set the source path by File –> Source Code Path, then input the path of the directory which contains the source codes. Is this correct way to setup source path? Do I need to do anything else in order to setup source path, e.g. reload something? 
?
?
regards,
George
----- Original Message ----
From: Jim Donelson
To: Kernel Debugging Interest List
Sent: Tuesday, July 8, 2008 7:06:04 PM
Subject: Re: [windbg] display source code while debugging
Did you set the source path?
On Tue, Jul 8, 2008 at 5:58 AM, Lin George wrote:
Hello everyone,
I have correctly set the source path in Windbg. After setting a breakpoint, how to display the related source files so that I can use them as the similar approach in Visual Studio 2008, e.g. using F10 to step next, using F11 to step in something like this.
I have tried ls command in WinDbg, but failed, error message is “No current source file”.
thanks in advance,
George
—
You are currently subscribed to windbg as: xxxxx@jimdonelson.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
— You are currently subscribed to windbg as: xxxxx@yahoo.com To unsubscribe send a blank email to xxxxx@lists.osr.com