bcc
bcc copied to clipboard
Show Throw location for unhandled exception in debugger
An issue that has existed since vanilla BlitzMax is the fact that Try blocks "destroy" the stack trace for unhandled exceptions.
When this code is compiled and run in debug mode, the debugger correctly shows where the exception occurred:
SuperStrict
Framework BRL.StandardIO
F
Function F()
Throw "ex" ' debugger stops here
End Function
But if the exception was thrown inside a Try statement, then it only shows the outermost Try
, making debugging impossible:
SuperStrict
Framework BRL.StandardIO
Try ' debugger stops here
F
Catch _:Int[]
End Try
Function F()
Throw "ex"
End Function
This seems like a difficult issue to fix, since by the time the program realizes that the exception is unhandled and calls bbOnDebugUnhandledEx
, it has already left the scope/block/function it was originally thrown in. Maybe there could be a way to detect this as soon as the exception is being thrown and immediately call bbOnDebugUnhandledEx
from there? (problematic, because Finally blocks should run first) Or maybe some way to store the stack trace alongside the thrown exception?