Jump to content

  • Log In with Google      Sign In   
  • Create Account


Debugging (managed) DX11


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • This topic is locked This topic is locked
11 replies to this topic

#1 laztrezort   Members   -  Reputation: 950

Like
0Likes
Like

Posted 14 August 2012 - 10:19 PM

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?

Sponsor:

#2 JWalsh   Moderators   -  Reputation: 458

Like
0Likes
Like

Posted 14 August 2012 - 10:24 PM

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
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

#3 laztrezort   Members   -  Reputation: 950

Like
0Likes
Like

Posted 14 August 2012 - 10:42 PM

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.

#4 JWalsh   Moderators   -  Reputation: 458

Like
1Likes
Like

Posted 14 August 2012 - 11:06 PM

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
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

#5 Mike.Popoloski   Crossbones+   -  Reputation: 2807

Like
1Likes
Like

Posted 14 August 2012 - 11:11 PM

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.


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.

Edited by Mike.Popoloski, 14 August 2012 - 11:14 PM.

Mike Popoloski | Journal | SlimDX

#6 laztrezort   Members   -  Reputation: 950

Like
0Likes
Like

Posted 14 August 2012 - 11:28 PM

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.

#7 JWalsh   Moderators   -  Reputation: 458

Like
0Likes
Like

Posted 14 August 2012 - 11:41 PM

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
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

#8 laztrezort   Members   -  Reputation: 950

Like
0Likes
Like

Posted 15 August 2012 - 07:19 AM

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.

#9 Mike.Popoloski   Crossbones+   -  Reputation: 2807

Like
-4Likes
Like

Posted 15 August 2012 - 10:05 AM


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.


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

#10 JWalsh   Moderators   -  Reputation: 458

Like
0Likes
Like

Posted 15 August 2012 - 12:22 PM

<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
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

#11 Mike.Popoloski   Crossbones+   -  Reputation: 2807

Like
-5Likes
Like

Posted 15 August 2012 - 01:10 PM

<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


Wow, you certainly took that the wrong way. I'm sorry I didn't immediately defer to your obvious experience and blatant name-dropping. I thought we were trying to help the OP here, but it seems you were more interested in showing how advanced you are and how many cool connections you have. It amazes me how, in spite of how small the industry is, people still feel like it makes sense to treat others with disrespect. The OP was a beginner who wanted a specific thing (to see D3D debug spew) and you went off on a tangent to satisfy your own ego. I guess your perspective changes with age and experience. /sigh
Mike Popoloski | Journal | SlimDX

#12 MJP   Moderators   -  Reputation: 8778

Like
0Likes
Like

Posted 15 August 2012 - 04:49 PM

Well it seems this thread has taken an unfortunate turn. Posted Image Seeing as the OP has had his question answered, I think it's time to close this one up.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS