Re: Getting a stack trace from a running application



Fernando Rodriguez wrote:

Dear fellow dinosaurs,

Some customers are complaining that my VB6 app raises a GPF on exiting. Unfortunately, the only infromation they can provide is a memory address, which is pretty useless as it doesn't tell me if my main exe is the culprit or if it's some dll or ocx or whatever.

I managed to catch that and other exceptions using SetUnhandledExceptionFilter() (see http://urlmini.us?i=1099) , but I still have no idea where the exception is comming from. Is there a way to get a stack trace up to the offending function and module?

Even better, is there any pre-built solution for this? Free or commercial.

Thanks in advance!



Hi Fernando,

If you can reproduce the error on your computer, you could run the program in the VS (VC++) debugger and catch the error in there. If you compile the the program with debug information (check the Compile options), the debugger will show the responsible line of your code that caused the error.
I use this method of tracking down bugs that happen only in the compiled version. Usually they stem from the optimizations I have selected for the compiler.

If the error happens only on the users' computers, then you might want to check Matthew Curland's book and debug code:
"Advanced Visual Basic 6: Power Techniques for Everyday Programs"
Author: Matthew Curland
Published by: Addison-Wesley, July 2000
ISBN: 0-201-70712-8
http://www.PowerVB.com
On the CD, accompanying the book he has several modules (.bas) that let you get source code location of the error from the memory address of the error. he discusses the debugging in Chapter 11 of his book.
You still have to compile with Create Symbolic Debug Info option checked. You can create a debug version of your program using this modules and ask the user to run it. When an error happens you could display the information you get from the stack (using the debug modules) and display it for the user or save it into a file.

Regards,

Stoil
.



Relevant Pages

  • Re: Debug vs. Release
    ... it is usually very difficult for the debugger to ... won't be performed for the "debug" build. ... Another optimisation is with memory management. ... safety-critical code a suppress errors aproach isn't acceptable. ...
    (comp.lang.c)
  • Re: How do I check if app is running in Visual Studio or via executing exe file?
    ... Attaching a debugger does not place the assembly into "debug" mode. ... this compile time constant. ...
    (microsoft.public.dotnet.languages.csharp)
  • copy file to debugger
    ... How can I copy a file to the debugger? ... Normally when I compile, the compiler copies the file to the debugger to the ... location, on the emulator, manually.. ... emulator, along with my executable, every time I debug. ...
    (microsoft.public.pocketpc.developer)
  • Re: "regulars" do not use debuggers
    ... debugger, it's a question of whether using a debugger is a better ... you need to do in order to debug your code is apply your brain to the ... symptoms of the failure, and you'll be able to deduce the cause. ... on the data memory  000000000000000000000000000000000000000000000000000 ...
    (comp.lang.c)
  • Re: Declaring a Constructor in an Interface?
    ... OK, it's a debug thing. ... I get the same results as you when I run in the debugger. ... Compile for Release mode and run outside the debugger, ... I'm not quite sure why building for Debug mode is doing this, ...
    (microsoft.public.dotnet.languages.csharp)