Debugging (managed) DX11

Started by
10 comments, last by MJP 11 years, 8 months ago
Learning DX11 through SharpDX, but the process is made rather painful by the fact that Visual Express appearently does not support unmanaged debugging.

Are there any workarounds, 3rd party tools, hacks etc. that anyone knows of to get around this, or am I just out of luck unless I bite the bullet and throw down $$$ for a full version of VS?
Advertisement

Visual Express appearently does not support unmanaged debugging.


Not sure what you mean by this. I've had no problem setting breakpoints, stepping through code, evaluating memory, callstacks, etc... What problems are you encountering?

Also, which language and version of Visual Studio Express are using - VS 2008, 2010, or 2012? If you can provide more information about the problems you're facing, I'm sure we can find a solution.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Sorry, to clarify I'm using Visual C# Express 2010 - which does not have the "unmanaged debugging/native code debugging" option available. This means that even if I set the debug mode (using DXcpl.exe) or the Debug flag in the device creation, exceptions (thrown from the unmanaged layer) are not providing useful debug information.
Hey Shane,

I see what you mean about not supporting mixed mode debugging. With the DX debug mode enabled, are you still seeing debug output in the output console? what do the exceptions look like that you're receiving?

Also, you may try installing Visual C++ 2010 Express edition. Having both on your machine may give you more options. When an exception is thrown, you may just try attaching with the Visual C++ Native debugger if you can.

And if all else fails, there is WinDBG. It's a difficult, somewhat cumbersome tool to learn to use (especially with managed code as it requires using the SOS extension), but is by far the most powerful debugger in the world. It is in fact the only good way to view the garbage collected heap for your application while running.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
The debug output from Direct3D goes through the system-wide debugging interface, so you can pick it up using the DebugView application. Just be sure to create your D3D11 device with the Debug create flag.

And if all else fails, there is WinDBG. It's a difficult, somewhat cumbersome tool to learn to use (especially with managed code as it requires using the SOS extension), but is by far the most powerful debugger in the world. It is in fact the only good way to view the garbage collected heap for your application while running.[/quote]

Using WinDbg here is overkill, and claiming that it's the "only good way to view the garbage collected heap" is a little ridiculous; there are plenty of excellent tools available that can visualize the GC heap in a much more intuitive fashion than WinDbg.
Mike Popoloski | Journal | SlimDX

With the DX debug mode enabled, are you still seeing debug output in the output console? what do the exceptions look like that you're receiving?


The only information it gives it an "HRESULT" value, "DXGI_ERROR_INVALID_CALL: Message Unknown", the rest of the exception data is default or unset. Output also gives no information. I get the stack trace up to the first managed call that produced the exception, of course.

Thanks Mike & JWalsh, I'll try these out and see what I can make work.

Using WinDbg here is overkill, and claiming that it's the "only good way to view the garbage collected heap" is a little ridiculous;


You don't really know if it's overkill. At this point we don't know what exactly he's trying to do. DebugView works great if he's just wanting to see the Debug messages, but if he wants to set breakpoints, step, make changes to memory, etc... he's back to needing a debugger.

My aim was to point out the WinDBG is better at debugging certain problems than Visual Studio (and other tools). It's all about using the right tool for the job. If you're not particularly fond of WinDBG's !DumpHeap or !EEHeap commands, that's cool. You're entitled to think my opinion is ridiculous.

But I say that WinDBG is the only good way because WinDBG has tons of support for working with the heap. Being able to see how much memory is in each generation, where the pages start and end, being able to see how many objects of each type are in the heap (and where), and cross-reference them to see how much memory is being used by each and in total. Additionally, you can evaluate the class table for each type, etc... Heck, you can even investigate the LOH. And that's not to speak of any of WinDBG's other great commands. !Analyze, DumpStack, EEStack, DO, GCRoot, etc... I never feel more in control of the run-time and what it's up to than when using WinDBG. If you know of another tools that gives you that, I'm more than happy to change my perspective.


there are plenty of excellent tools available that can visualize the GC heap in a much more intuitive fashion than WinDbg.


I honestly haven't ever seen one, but would love some recommendations. I'm always interested in learning about new tools. Mark's tools are fantastic.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
For now, as I'm just learning the API by trial-and-error, all I'm interested in is seeing the debug information. Tried out DebugView - works great for what I need.

Thanks again for the quick replies.

[quote name='Mike.Popoloski' timestamp='1345007515' post='4969736']
Using WinDbg here is overkill, and claiming that it's the "only good way to view the garbage collected heap" is a little ridiculous;


You don't really know if it's overkill. At this point we don't know what exactly he's trying to do. DebugView works great if he's just wanting to see the Debug messages, but if he wants to set breakpoints, step, make changes to memory, etc... he's back to needing a debugger.

My aim was to point out the WinDBG is better at debugging certain problems than Visual Studio (and other tools). It's all about using the right tool for the job. If you're not particularly fond of WinDBG's !DumpHeap or !EEHeap commands, that's cool. You're entitled to think my opinion is ridiculous.

But I say that WinDBG is the only good way because WinDBG has tons of support for working with the heap. Being able to see how much memory is in each generation, where the pages start and end, being able to see how many objects of each type are in the heap (and where), and cross-reference them to see how much memory is being used by each and in total. Additionally, you can evaluate the class table for each type, etc... Heck, you can even investigate the LOH. And that's not to speak of any of WinDBG's other great commands. !Analyze, DumpStack, EEStack, DO, GCRoot, etc... I never feel more in control of the run-time and what it's up to than when using WinDBG. If you know of another tools that gives you that, I'm more than happy to change my perspective.


there are plenty of excellent tools available that can visualize the GC heap in a much more intuitive fashion than WinDbg.


I honestly haven't ever seen one, but would love some recommendations. I'm always interested in learning about new tools. Mark's tools are fantastic.
[/quote]

What is this, an advertisement for WinDbg? I know what it does, I don't need you to start throwing random commands at me. I'm glad you get some weird orgasmic glow when using it, but that doesn't mean you should go around claiming it's the *only* tool that's any good. Some people choose tools based on more than the "feel" it gives you.

Suggesting that a beginner who is just trying to learn D3D11 and wants debug spew to drop the Visual Studio debugger in favor of WinDbg is, as I said before, ridiculous. I'm not sure why you think that using DebugView precludes the ability to set breakpoints and step through in Visual Studio, but that's patently wrong.

As for other tools, the CLR memory profiler gives you a comprehensive overview of the GC heap, but to be honest most of that information is rarely ever useful. The primary reason I've found to view the GC heap is tracking down object leaks and their associated retention graphs, and for that the ANTS or jetBrains memory profilers are far more valuable by providing a targeted view without all that extra useless information. If you haven't used any of them, it might be worth it to give them a try.
Mike Popoloski | Journal | SlimDX
<br />What is this, an advertisement for WinDbg? I know what it does, I don't need you to start throwing random commands at me.<br />


No. It's not an advertisement. It was my validation for why I think WinDbg is the best tool for doing low-level debugging of .NET. It was no more an advertisement than your mentioning ANTS or dotTrace. The commands weren't for you, I wrongly assumed you were an expert at WinDbg and didn't need them. The commands are for any readers who want to research why WinDbg is so powerful.

<br />I'm glad you get some weird orgasmic glow when using it...<br />


It amazes me how, in spite of how small the industry is, people still feel like it makes sense to treat others with disrespect. Rather than being a douche, why not say "interesting... you seem to feel this tool is very powerful, and you work closely with some of the original .NET developers, perhaps there's something I may be missing." But instead, you jump right to "that's ridiculous". I guess your perspective changes with age and experience. /sigh
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

This topic is closed to new replies.

Advertisement