added System>>backtrace

This commit is contained in:
hyunghwan.chung
2019-07-12 07:24:37 +00:00
parent 18e186677e
commit 3e506cbcfb
8 changed files with 47 additions and 45 deletions

View File

@ -69,21 +69,7 @@ TODO: can i convert 'thisProcess primError' to a relevant exception?
//thisContext unwindTo: nil return: nil.
//thisContext unwindTo: (Processor activeProcess initialContext) return: nil.
// TOOD: IMPROVE THIS EXPERIMENTAL BACKTRACE... MOVE THIS TO System>>backtrace and skip the first method context for backtrace itself.
System logNl: "== BACKTRACE ==".
ctx := thisContext.
while (ctx notNil)
{
if (ctx class == MethodContext)
{
System logNl: (" " & ctx method owner name & ">>" & ctx method name &
" (" & ctx method sourceFile & " " & (ctx method ipSourceLine: (ctx pc)) asString & ")").
// TODO: get location of the current pc and include it... (ctx method sourceLine: ctx pc) asString dump.
}.
// TODO: include blockcontext???
ctx := ctx sender.
}.
System logNl: "== END OF BACKTRACE ==".
System backtrace.
thisContext unwindTo: (thisProcess initialContext) return: nil.
("### EXCEPTION NOT HANDLED(Exception) #### " & self class name & " - " & self messageText) dump.
@ -540,17 +526,7 @@ extend Apex
| class_name ctx |
class_name := if (self class == Class) { self name } else { self class name }.
// TOOD: IMPROVE THIS EXPERIMENTAL BACKTRACE...
System logNl: "== BACKTRACE ==".
ctx := thisContext.
while (ctx notNil)
{
if (ctx class == MethodContext) { System logNl: (" " & ctx method owner name & ">>" & ctx method name) }.
// TODO: include blockcontext???
ctx := ctx sender.
}.
System logNl: "== END OF BACKTRACE ==".
System backtrace.
NoSuchMessageException signal: (message_name & " not understood by " & class_name).
}