print call stack on abort
This commit is contained in:
parent
858fe603a5
commit
2d4fb39dac
|
@ -48,7 +48,7 @@ dump-call-stack:
|
|||
(draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *(ebx+4) 0xf 0xc)
|
||||
(draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 " " 0 0xc)
|
||||
(containing-function %edx *(ebx+4)) # => eax, ecx
|
||||
#? (draw-slice-wrapping-right-then-down-from-cursor-over-full-screen 0 %eax %ecx 0 0xc)
|
||||
(draw-slice-wrapping-right-then-down-from-cursor-over-full-screen 0 %eax %ecx 0 0xc)
|
||||
# loop update
|
||||
8b/-> *ebx 3/r32/ebx
|
||||
#
|
||||
|
@ -209,11 +209,18 @@ label-append: # labels: (addr stream {start-address, label-slice}), address: in
|
|||
56/push-esi
|
||||
# esi = labels
|
||||
8b/-> *(ebp+8) 6/r32/esi
|
||||
#? (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 %esi 7 0)
|
||||
# ecx = labels->write
|
||||
8b/-> *esi 1/r32/ecx
|
||||
# labels->data[labels->write] = address
|
||||
8b/-> *(ebp+0xc) 0/r32/eax
|
||||
89/<- *(esi+ecx+0xc) 0/r32/eax
|
||||
#? (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 %eax 7 0)
|
||||
#? 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
|
||||
#? (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 %eax 7 0)
|
||||
#? {
|
||||
#? eb/jump loop/disp8
|
||||
#? }
|
||||
# labels->data[labels->write+4] = start
|
||||
8b/-> *(ebp+0x10) 0/r32/eax
|
||||
89/<- *(esi+ecx+0x10) 0/r32/eax
|
||||
|
@ -240,12 +247,14 @@ containing-function: # labels: (addr stream {start-address, label-slice}), addr
|
|||
52/push-edx
|
||||
53/push-ebx
|
||||
56/push-esi
|
||||
#? (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *(ebp+0xc) 7 0)
|
||||
# esi = labels
|
||||
8b/-> *(ebp+8) 6/r32/esi
|
||||
#? (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 %esi 7 0)
|
||||
# var curr/ecx: (addr byte) = labels->data
|
||||
8b/-> *(esi+0xc) 1/r32/ecx
|
||||
8d/copy-address *(esi+0xc) 1/r32/ecx
|
||||
#? (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 %ecx 7 0)
|
||||
#? (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *ecx 7 0)
|
||||
# var max/edx: (addr byte) = labels->data + labels->write
|
||||
8b/-> *esi 2/r32/edx
|
||||
01/add-to %edx 1/r32/ecx
|
||||
|
@ -267,6 +276,7 @@ containing-function: # labels: (addr stream {start-address, label-slice}), addr
|
|||
8b/-> *ecx 0/r32/eax
|
||||
3b/compare 0/r32/eax *(ebp+0xc)
|
||||
0f 87/jump-if-addr> break/disp32
|
||||
#? (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "." 7 0)
|
||||
# if **(curr+4) not '$' or '@', save curr to previous-function-name
|
||||
{
|
||||
8b/-> *(ecx+4) 0/r32/eax
|
||||
|
@ -276,6 +286,7 @@ containing-function: # labels: (addr stream {start-address, label-slice}), addr
|
|||
74/jump-if-= break/disp8
|
||||
3d/compare-eax-and 0x40/imm32/@
|
||||
74/jump-if-= break/disp8
|
||||
#? (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "found" 7 0)
|
||||
8d/copy-address *(ecx+4) 3/r32/ebx
|
||||
}
|
||||
# loop update
|
||||
|
@ -283,8 +294,11 @@ containing-function: # labels: (addr stream {start-address, label-slice}), addr
|
|||
#
|
||||
e9/jump loop/disp32
|
||||
}
|
||||
#? (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 %ebx 7 0)
|
||||
8b/-> *ebx 0/r32/eax
|
||||
#? (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 %eax 7 0)
|
||||
8b/-> *(ebx+4) 1/r32/ecx
|
||||
#? (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 %ecx 7 0)
|
||||
$containing-function:end:
|
||||
# . restore registers
|
||||
5e/pop-to-esi
|
||||
|
@ -294,3 +308,42 @@ $containing-function:end:
|
|||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
# unlike variants in .mu files, this only supports ASCII
|
||||
draw-slice-wrapping-right-then-down-from-cursor-over-full-screen: # screen: (addr screen), start: (addr byte), end: (addr byte), color: int, background-color: int
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
# . save registers
|
||||
50/push-eax
|
||||
51/push-ecx
|
||||
52/push-edx
|
||||
# var curr/ecx: (addr byte) = start
|
||||
8b/-> *(ebp+0xc) 1/r32/ecx
|
||||
# edx = end
|
||||
8b/-> *(ebp+0x10) 2/r32/edx
|
||||
# eax = 0
|
||||
b8/copy-to-eax 0/imm32
|
||||
{
|
||||
# if (curr >= end) break
|
||||
39/compare %ecx 2/r32/edx
|
||||
73/jump-if-addr>= break/disp8
|
||||
# print *curr
|
||||
8a/byte-> *ecx 0/r32/eax
|
||||
#? (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen *(ebp+8) %eax *(ebp+0x14) *(ebp+0x18))
|
||||
(draw-grapheme-at-cursor *(ebp+8) %eax *(ebp+0x14) *(ebp+0x18))
|
||||
(move-cursor-rightward-and-downward *(ebp+8))
|
||||
#
|
||||
41/increment-ecx
|
||||
#
|
||||
eb/jump loop/disp8
|
||||
}
|
||||
$draw-slice-wrapping-right-then-down-from-cursor-over-full-screen:end:
|
||||
# . restore registers
|
||||
5a/pop-to-edx
|
||||
59/pop-to-ecx
|
||||
58/pop-to-eax
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
|
Loading…
Reference in New Issue