Stack traces: Difference between revisions
Content deleted Content added
→{{header|Groovy}}: new solution |
|||
Line 901: | Line 901: | ||
Fatal error: exception Division_by_zero |
Fatal error: exception Division_by_zero |
||
Raised at file "test.ml", line 4, characters 10-17 |
Raised at file "test.ml", line 4, characters 10-17 |
||
=={{header|OxygenBasic}}== |
|||
<lang oxygenbasic> |
|||
'32bit x86 |
|||
static string Report |
|||
macro ReportStack(n) |
|||
'=================== |
|||
' |
|||
scope |
|||
' |
|||
static sys stack[0X100],stackptr,e |
|||
' |
|||
'CAPTURE IMAGE OF UP TO 256 ENTRIES |
|||
' |
|||
' |
|||
mov eax,n |
|||
cmp eax,0x100 |
|||
( |
|||
jle exit |
|||
mov eax,0x100 'UPPER LIMIT |
|||
) |
|||
mov e,eax |
|||
mov stackptr,esp |
|||
lea edx,stack |
|||
mov ecx,e |
|||
mov esi,esp |
|||
( |
|||
mov eax,[esi] |
|||
mov [edx],eax |
|||
add esi,4 |
|||
add edx,4 |
|||
dec ecx |
|||
jg repeat |
|||
) |
|||
sys i |
|||
string cr=chr(13)+chr(10), tab=chr(9) |
|||
' |
|||
for i=1 to e |
|||
report+=hex(stackptr+(i-1)*4,8) tab hex(i-1,2) tab hex(stack[i],8) cr |
|||
next |
|||
' |
|||
end scope |
|||
' |
|||
end macro |
|||
'==== |
|||
'TEST |
|||
'==== |
|||
function foo() |
|||
'============= |
|||
push 0x44556677 |
|||
push 0x33445566 |
|||
push 0x22334455 |
|||
push 0x11223344 |
|||
ReportStack(8) |
|||
end function |
|||
Report+="Trace inside foo |
|||
" |
|||
foo() |
|||
print report |
|||
'putfile "s.txt",Report |
|||
/* |
|||
RESULT: |
|||
Trace inside foo |
|||
0017FE00 00 11223344 |
|||
0017FE04 01 22334455 |
|||
0017FE08 02 33445566 |
|||
0017FE0C 03 44556677 |
|||
0017FE10 04 005EAB1C |
|||
0017FE14 05 0017FE40 |
|||
0017FE18 06 10002D5F |
|||
0017FE1C 07 00000000 |
|||
*/ |
|||
</lang> |
|||
=={{header|Oz}}== |
=={{header|Oz}}== |