[Gambas-user] Issue 93 in gambas: Error backtrace not always correct
gambas at ...2524...
gambas at ...2524...
Tue Aug 30 23:16:47 CEST 2011
Status: New
Owner: ----
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Any Arch-Any
Desktop-Any GUI-Any
New issue 93 by emil.len... at ...626...: Error backtrace not always correct
http://code.google.com/p/gambas/issues/detail?id=93
1) Describe the problem.
The backtrace that can be obtained by Error.Backtrace does not always
contain the correct backtrace. That backtrace seems to be the current stack
(not as it looked liked when the error occurred), but the frames with a
greater depth than the current depth are not popped off (so if no functions
are called between the error and the Error.Backtrace, everything will be
ok).
See example below.
2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):
Version: TRUNK
Revision: r4063
Operating system: Linux
Architecture: x86_64
3) Provide a little project that reproduces the bug or the crash.
Public Sub PrintBacktrace()
Dim s As String
For Each s In Error.Backtrace
Print s
Next
End
Public Sub PrintErr()
Print "An error occurred: "; Error.Text
PrintBacktrace() 'Line 9
End
Public Function Divide(a As Integer, b As Integer) As Integer
Return a / b 'Line 12
End
Public Sub run()
Print Divide(1, 0) 'Line 15
End
Public Sub Main()
run() 'Line 18
Catch
PrintErr() 'Line 20
End
This will print:
An error occurred: Division by zero
MMain.Divide.12
MMain.PrintErr.9
MMain.Main.20
While it should be:
An error occurred: Division by zero
MMain.Divide.12
MMain.run.15
MMain.Main.18
The current backtrace-information (stack) should be copied when an error
occurs, not during Error.Backtrace, like it is currently.
4) If your project needs a database, try to provide it, or part of it.
5) Explain clearly how to reproduce the bug or the crash.
Run the example.
6) By doing that carefully, you have done 50% of the bug fix job!
More information about the User
mailing list