I have some managed code that calls to a method inside some native DLL(i have the appropriate symbol files).
Sometimes, that native method throws an exception which I ca
This isn't as slick as displaying the native call stack when you catch the exception, but if you are trying to track down a specific problem on a user's computer and the user is reasonably savvy you can have them run your app under WinDbg. It will break when the native exception is thrown and the call stack can be viewed.
Another possibility is to use stackwalker. It's free and is available here: http://www.codeproject.com/KB/threads/StackWalker.aspx If you know the top-level native call, you can wrap that with a __try/__catch and use stackwalker to dump the stack to a log file. Presumably you could also catch the exception, get the call stack using stackwalker, add the callstack to the exception (as a string), and then rethrow the exception to your .NET code. The .NET code could then get the callstack out of your exception.
Obtaining a native stack trace is quite difficult. By the time it passes through the .NET/native translation layer, the native stack trace has already been lost.
So, you need to capture it while still in native code, and this is also quite difficult. Take a look at John Robbins' work for proper native stack tracing; the latest publicly-available version of his SUPERASSERT that I could find is from MSJ, Feb 1999.