stack trace in exception

Hello everyone,

Here is the !pe output from WinDbg when there is an exception. It shows exactly the function name where exception occurs.
My question is, how to show the line in the source code which triggers the exception?
Here is WinDbg output.
0:000> !pe
Exception object: 0000000002651ac0
Exception type: System.Exception
Message: Hello Exception Debug
InnerException:
StackTrace (generated):
??? SP??? IP??? Function
??? 000000000012EFF0 00000642801501F4 TestDebug!TestDebug.Program.foo()+0x64
??? 000000000012F030 000006428015014D TestDebug!TestDebug.Program.Main(System.String)+0x2d
StackTraceString:
HResult: 80131500

thanks in advance,
George

Hello everyone,

Here is the !pe output from WinDbg when there is an exception. It shows exactly the function name where exception occurs.
My question is, how to show the line in the source code which triggers the exception?
Here is WinDbg output.
0:000> !pe
Exception object: 0000000002651ac0
Exception type: System.Exception
Message: Hello Exception Debug
InnerException:
StackTrace (generated):
??? SP??? IP??? Function
??? 000000000012EFF0 00000642801501F4 TestDebug!TestDebug.Program.foo()+0x64
??? 000000000012F030 000006428015014D TestDebug!TestDebug.Program.Main(System.String)+0x2d
StackTraceString:
HResult: 80131500

thanks in advance,
George

I can tell you this. It will need the pdb file on the symbol path, or it
will never find the source line. C# does generate PDB files, and the pdb
file will have the path to the source file.
If things are set up right, you can click on the call stack and it will open
the source file and go to the line of code.
If you do an lm for that module, you will see if windbg loaded the pdb file
or not. If it did not, then it will not happen.
You can adjust the symbol path and use .reload for the module to see if it
was found and loaded.
You should also set the source path, but until the modules pdb is loaded, no
dice.

On Tue, Jul 8, 2008 at 10:44 PM, Lin George
wrote:

> Hello everyone,
>
> Here is the !pe output from WinDbg when there is an exception. It shows
> exactly the function name where exception occurs.
> My question is, how to show the line in the source code which triggers the
> exception?
> Here is WinDbg output.
> 0:000> !pe
> Exception object: 0000000002651ac0
> Exception type: System.Exception
> Message: Hello Exception Debug
> InnerException:
> StackTrace (generated):
> SP IP Function
> 000000000012EFF0 00000642801501F4
> TestDebug!TestDebug.Program.foo()+0x64
> 000000000012F030 000006428015014D
> TestDebug!TestDebug.Program.Main(System.String)+0x2d
> StackTraceString:
> HResult: 80131500
>
> thanks in advance,
> George
>
>
>
>
> —
> You are currently subscribed to windbg as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Along these lines, make sure you start off with

!sym noisy
.srcnoisy 1
.reload

This way after you break into the debugger it will show verbose info about all source and/or symbol loading problems.

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Jim Donelson
Sent: Wednesday, July 09, 2008 7:56 AM
To: Kernel Debugging Interest List
Subject: Re: [windbg] stack trace in exception

I can tell you this. It will need the pdb file on the symbol path, or it will never find the source line. C# does generate PDB files, and the pdb file will have the path to the source file.
If things are set up right, you can click on the call stack and it will open the source file and go to the line of code.
If you do an lm for that module, you will see if windbg loaded the pdb file or not. If it did not, then it will not happen.
You can adjust the symbol path and use .reload for the module to see if it was found and loaded.
You should also set the source path, but until the modules pdb is loaded, no dice.

On Tue, Jul 8, 2008 at 10:44 PM, Lin George wrote:
Hello everyone,

Here is the !pe output from WinDbg when there is an exception. It shows exactly the function name where exception occurs.
My question is, how to show the line in the source code which triggers the exception?
Here is WinDbg output.
0:000> !pe
Exception object: 0000000002651ac0
Exception type: System.Exception
Message: Hello Exception Debug
InnerException:
StackTrace (generated):
SP IP Function
000000000012EFF0 00000642801501F4 TestDebug!TestDebug.Program.foo()+0x64
000000000012F030 000006428015014D TestDebug!TestDebug.Program.Main(System.String)+0x2d
StackTraceString:
HResult: 80131500

thanks in advance,
George


You are currently subscribed to windbg as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

— You are currently subscribed to windbg as: xxxxx@r1soft.com To unsubscribe send a blank email to xxxxx@lists.osr.com

Thanks Jim,
I think I have correctly setup symbol and source path. Do you mean in View -> Call Stack, then double click the method in the call stack will show source? If yes, in View –> Call Stack, there is no my own code. Any ideas? Could you reproduce it?
My code is very simple, here is my code.
using System;
using System.Collections.Generic;
using System.Text;
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: Kernel Debugging Interest List
Sent: Wednesday, July 9, 2008 8:55:59 PM
Subject: Re: [windbg] stack trace in exception

I can tell you this. It will need the pdb file on the symbol path, or it will never find the source line. C# does generate PDB files, and the pdb file will have the path to the source file.
If things are set up right, you can click on the call stack and it will open the source file and go to the line of code.
If you do an lm for that module, you will see if windbg loaded the pdb file or not. If it did not, then it will not happen.
You can adjust the symbol path and use .reload for the module to see if it was found and loaded.
You should also set the source path, but until the modules pdb is loaded, no dice.

On Tue, Jul 8, 2008 at 10:44 PM, Lin George wrote:

Hello everyone,

Here is the !pe output from WinDbg when there is an exception. It shows exactly the function name where exception occurs.
My question is, how to show the line in the source code which triggers the exception?
Here is WinDbg output.
0:000> !pe
Exception object: 0000000002651ac0
Exception type: System.Exception
Message: Hello Exception Debug
InnerException:
StackTrace (generated):
??? SP??? IP??? Function
??? 000000000012EFF0 00000642801501F4 TestDebug!TestDebug.Program.foo()+0x64
??? 000000000012F030 000006428015014D TestDebug!TestDebug.Program.Main(System.String)+0x2d
StackTraceString:
HResult: 80131500

thanks in advance,
George


You are currently subscribed to windbg as: unknown lmsubst tag argument: ‘’
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

Thanks Zach,
I have tried but all information I can get is, the debugger is trying to find source code for thread.c, but failed – when there is 1st chance exception happens. Anyway, here is my code. It is simple, could you reproduce my problem, which is the call stack with source code line number could not be displayed?
using System;
using System.Collections.Generic;
using System.Text;
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: Zach Turner
To: Kernel Debugging Interest List
Sent: Wednesday, July 9, 2008 11:16:29 PM
Subject: RE: [windbg] stack trace in exception

Along these lines, make sure you start off with

!sym noisy
.srcnoisy 1
.reload

This way after you break into the debugger it will show verbose info about all source and/or symbol loading problems.

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Jim Donelson
Sent: Wednesday, July 09, 2008 7:56 AM
To: Kernel Debugging Interest List
Subject: Re: [windbg] stack trace in exception

I can tell you this. It will need the pdb file on the symbol path, or it will never find the source line. C# does generate PDB files, and the pdb file will have the path to the source file.
If things are set up right, you can click on the call stack and it will open the source file and go to the line of code.
If you do an lm for that module, you will see if windbg loaded the pdb file or not. If it did not, then it will not happen.
You can adjust the symbol path and use .reload for the module to see if it was found and loaded.
You should also set the source path, but until the modules pdb is loaded, no dice.

On Tue, Jul 8, 2008 at 10:44 PM, Lin George wrote:
Hello everyone,

Here is the !pe output from WinDbg when there is an exception. It shows exactly the function name where exception occurs.
My question is, how to show the line in the source code which triggers the exception?
Here is WinDbg output.
0:000> !pe
Exception object: 0000000002651ac0
Exception type: System.Exception
Message: Hello Exception Debug
InnerException:
StackTrace (generated):
? ? SP? ? ? ? ? ? ? IP? ? ? ? ? ? ? Function
? ? 000000000012EFF0 00000642801501F4 TestDebug!TestDebug.Program.foo()+0x64
? ? 000000000012F030 000006428015014D TestDebug!TestDebug.Program.Main(System.String)+0x2d
StackTraceString:
HResult: 80131500

thanks in advance,
George


You are currently subscribed to windbg as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

— You are currently subscribed to windbg as: xxxxx@r1soft.com To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to windbg as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com