Newbie questions

Just trying to use mdbg for the first time - in a controlled environment, but I'd love to be able to ship it out to customers as a first gap debugging tool for us when there's a problem. Beauty since it is so small!

I have successfully loaded a VB.NET app, with many dlls (compiled debug) on a machine which does not have VS2005 or the SDK installed. I set breakpoints, and start stepping, and I feel I'm in a quasi assembler mode which makes sense. I see 'local_0', etc. I see parameters when stepping into routines with names.

When I try to set the source path to a temporary directory where I tossed in the source code, it just gives me path not found messages. How do I make the link to the source for the routine? Is there a way to look at Private variables for the entire class, not just locals?

I'm using the mdbg that came with the VS2005 SDK.

TIA

[893 byte] By [brucef] at [2008-1-12]
# 1

Bruce -
"How do I make the link to the source for the routine? "
How are you setting the source-path? I just tried using the VS2005 SDK version of Mdbg, I could launch an app and then use the "path" command to set the source path after the fact (in this case, the exe is in c:\test, but I moved the source fiel to c:\test\t):

mdbg> run c:\test\anon.exe
STOP: Breakpoint Hit
located at line 9 in anon.cs
[p#:0, t#:0] mdbg> sh 10
Error: Source file 'c:\test\anon.cs' not available.
[p#:0, t#:0] mdbg> pa
path:
[p#:0, t#:0] mdbg> path c:\test\t
Path set to: c:\test\t
6
7 delegate int FP(int a, int b);
8 static void Main()
9:*{
10 Debugger.Log(0, "cat", "Hi!");
11 Console.WriteLine("Hi!");
[p#:0, t#:0] mdbg>

Another issue may be that the source-path is set properly, but it can't find PDBs. PDBs associated source files with a IL (the program). You can see if the PDBs are loaded via the "list" command.


[p#:0, t#:0] mdbg> list mod
Loaded Modules:
:0 mscorlib.dll#0 (no symbols loaded)
:1 anon.exe#0

For more about PDBs, see: http://blogs.msdn.com/jmstall/archive/2005/08/25/pdb2xml.aspx

"Is there a way to look at Private variables for the entire class, not just locals?"
Yes, you can inspect everything. Mdbg is just a sample application demostrating how to write a debugger, and so it doesn't expose this all in a pretty syntax the way Visual Studio does.
(More discussion on that here: http://blogs.msdn.com/jmstall/archive/2006/07/21/resolving_functions.aspx)
Check out Mdbg's "print" command. MDbg uses C# syntax. The source code for all the Mdbg commands is in mdbgcommands.cs in the sample.

For example, if m_int is a static field of class 'Foo' (where Foo includes the namespace / nested class), you can view it via:

[p#:0, t#:0] mdbg> print Foo.m_int
Foo.m_int=4

I hope that helps!

Mike
http://blogs.msdn.com/jmstall

MikeStall-MSFT at 2007-8-30 > top of Msdn Tech,.NET Development,Building Development and Diagnostic Tools for .Net...
# 2

Thanks for the quick response. I'm finally back after travels plus vacation.

I compiled the app for debug, so have the .pdb files in the same directory as the app (toolbox.main.exe)

mdbg toolbox.main.exe

run toolbox.main.exe

STOP: Breakpoint Hit

located at line 76 in 17d14f5c-a337-4978-8281-53493378c1071.vb

list mod

Loaded Modules:

:0 mscorlib.dll#0 (no symbols loaded)

:1 toolbox.main.exe#0

:2 Microsoft.VisualBasic.dll#0 (no symbols loaded)

:3 System.Windows.Forms.dll#0 (no symbols loaded)

sh 10

Error: Source file '17d14f5c-a337-4978-8281-53493378c1071.vb' not available

So...

Any idea why my file names are mangled? If I set the source to the directory where the files are, there is no difference.

Thanks!

brucef at 2007-8-30 > top of Msdn Tech,.NET Development,Building Development and Diagnostic Tools for .Net...
# 3

I did finally figure it out.

1. Have to have the .pdb files in the same directory

2. Set path to source file using Path command

3. Things don't show up till you hit a valid breakpoint. (Was debugging VB, but mdbg is case sensitive, so my breakpoints were 'unbound' and stayed that way.

brucef at 2007-8-30 > top of Msdn Tech,.NET Development,Building Development and Diagnostic Tools for .Net...

.NET Development

Site Classified