tags:

views:

290

answers:

3

Hello everyone,

I am debugging a crash dump and I am clear at which address the process crashes. The source code is written in C#. My question is any quick way to find the matched source code related to the crash address?

thanks in advance, George

A: 

Any decent IDE that includes a debugger will do this automatically. Otherwise, you typically need to build your project with debugging information (debug symbols) enabled (which isn't recommended for production, as it makes your program bigger and easier to reverse engineer), and debugger commands like where or trace will list the program lines you're at.

Lee B
Thanks Lee B, I am debugging a crash dump. Could you show me how to find related line of source code in this case? Your reply is more about how to find during debugging a process other than debugging a dump?
George2
BTW: in Visual Studio any ways to setup symbol path? I previously only setup symbol path in Windbg, not in Visual Studio before.
George2
Ah, apologies. For crash dumps, it's really down to the debugger in question, and its manual. However, the basic idea is that you just load the debugger, and choose (or type) the command to load the dump. It should just find the code from there. If not, you may also need to specify a source dir.
Lee B
Basic ("pdb-only") symbols will not impact your executable code, and you don't have to distribute them. (Full debug symbols are a different matter.)
Richard
I setup symbol path (where PDB is), so you mean it is not enough and I need to setup source code path?
George2
Symbol path in vS: Tools | Options | Debugger | Symbols.
Richard
Richard, I have setup PDB path correctly in symbol path, do I still need to setup source path? If yes, after setup, which command should be used to display related C# source code?
George2
Thanks Richard, but how to setup source path in VSTS?
George2
A: 

You need the symbol files (.pdb) from the build.

Also enable use of MS' symbol server so VS and WinDBG will automatically get the correct symbol files.

Richard
in Visual Studio any ways to setup symbol path? I previously only setup symbol path in Windbg, not in Visual Studio before.
George2
Symbol path setting is my Windbg is setup correctly, and I know the machine address, which command should be used to display the related source code? :-)
George2
A: 

this blog is a mine of useful information on crash dump analysis.

Here's where it starts on debugging a managed app's crash dump it is worth noting that it refers back to previous articles and assumes you have read and understood them. It also assumes you a slightly familiar with Son of Strike, an incredibly useful but somewhat arcane debugging extension for working with managed code.

ShuggyCoUk
I stuied and the information is very helpful. But I can not find how to find related managed source code related to a specific machine address. Any ideas or comments?
George2
The managed source code should not be the one causing the crash (barring a JIT bug) You should have a partially completed stack frame on the basis of what you ahve already. this must be added to with further symbols as available (say MS public ones) but ultimately the functions at the...
ShuggyCoUk
...top of the stack may be third party dlls to which you have no symbols... at least you then have an idea whoose code misbehaved
ShuggyCoUk
What do you mean "The managed source code should not be the one causing the crash"? From analyze -v it is in my own managed method and the exception is NullReferenceException. So, I suspect somehting wrong (e.g. reference a NULL) pointer in my code. And I want to find it out. Any ideas?
George2
Ah right - a null reference exception shouldn't trigger a crash dump (unless you do it yourself in code) just a stack trace...Just include the pdb files and when the error happens you will get the exact line number
ShuggyCoUk