The option -detailed-stack-trace (-dst) only makes sense (1) in the context of -exception-report (-er) or (2) if your program takes the dst information and does something with it. You'll see instructions if you run without -d:
- Code: Select all
...
An unhandled exception has occurred.
Cobra debugging tips:
To get file name and line number information for the stack frames, use:
cobra -debug foo.cobra
To get a post-mortem, HTML-formatted report with more details about your objects:
cobra -debug -exception-report foo.cobra
For even more information, try:
cobra -debug -exception-report -detailed-stack-trace foo.cobra
Or use the abbreviations:
cobra -d -er -dst foo.cobra
And the cobra -h for -dst mentions using -er too.
Why doesn't cobra.exe detect -dst without -er and warn you? Well you could take over the detailed stack trace information yourself as I do with the Cobra compiler. Check out wincomp.bat's contents:
Snapshot\cobra.exe -out:cobra-win.exe -compile -color -debug -dst -ert:yes -timeit -t:exe -ref:System.Windows.Forms -ref
:System.Drawing %* -files:files-to-compile-win.text
You can see there is a -dst but no -er (-ert is for -embed-run-time). However, if you look at files-to-compile-win.text, you'll see two extra files at the bottom compared to the normal files-to-compile.text:
CobraMain-ObjectExplorer-WinForms.cobra
ObjectExplorer-WinForms.cobra
The first is a specific "def main" that catches uncaught exceptions and creates an instance of ObjectExplorer defined in the second file.
I ended up preferring this technique over the HTML output of -exception-report/-er because -er churns out a bunch of uninteresting objects. Also, the ObjectExplorer is interactive and you can easily drill down on stack frames, args, locals, objects, collections, etc.
In short, add -er, or explore the GUI/ObjectExplorer way.
I've enhanced cobra -h to mention the GUI approach:
-detailed-stack-trace, -dstEnable a detailed stack trace which gives great postmortem information for uncaught exceptions, but slows execution. Works in combination with -exception-report, or see ObjectExplorer-WinForms.cobra and its doc string for ideas on how to present this information graphically.
-exception-report, -exc-rpt, -erTurn on an informative HTML report that will be generated if the program throws an uncaught exception. Also, see ObjectExplorer-WinForms.cobra and its doc string for an alternative, GUI approach.
Thanks for bringing this up.