shoelace源代码分析,bochs调试过程

第一个断点:

<bochs:1> b 0x10035   

<bochs:2> c
(0) Breakpoint 1, 0x10035 in ?? ()
Next at t=75292653
(0) [0x00010035] 1000:0035 (unk. ctxt): call 0x504                ; e8cc04
<bochs:3> s
Next at t=75292654
(0) [0x00010504] 1000:0504 (unk. ctxt): push bp                   ; 55

<bochs:4>

0x10035断点是shoemain()函数


第二个断点:

<bochs:7> b 0x105ac
<bochs:8> c
(0) Breakpoint 2, 0x105ac in ?? ()
Next at t=75293449
(0) [0x000105ac] 1000:05ac (unk. ctxt): push bp                   ; 55
<bochs:9>


0x105ac断点是runningshoe()函数


第三个断点:0x10168 migrate()函数

<bochs:8> b 0x10744
<bochs:9> c
(0) Breakpoint 2, 0x10744 in ?? ()
Next at t=75307873
(0) [0x00010744] 1000:0744 (unk. ctxt): call 0x168                ; e821fa
<bochs:10> s
Next at t=75307874
(0) [0x00010168] 1000:0168 (unk. ctxt): push bp                   ; 55
<bochs:11>


第四个断点,因为shoelace被移动到0x60000所以下断点的时候要加上0x60000。


<bochs:1> b 0x601dc
<bochs:2> c
(0) Breakpoint 1, 0x601dc in ?? ()
Next at t=75340737
(0) [0x000601dc] 6000:01dc (unk. ctxt): pop bp                    ; 5d
<bochs:3> u /10
000601dc: (                    ): pop bp                    ; 5d
000601dd: (                    ): retn                      ; c3
000601de: (                    ): iret                      ; cf

第五个断点:shoe()函数 0x60771

<bochs:8> u /15
00060747: (                    ): mov bx, dx                ; 89d3
00060749: (                    ): mov [ds:0x84e2], ax       ; a3e284
0006074c: (                    ): mov word ptr [ds:0x84e4], bx ; 891ee484
00060750: (                    ): mov bx, 0x771             ; bb7107
00060753: (                    ): push bx                   ; 53
00060754: (                    ): mov bx, 0x84d8            ; bbd884
00060757: (                    ): push bx                   ; 53
00060758: (                    ): push word ptr [ds:0x84de] ; ff36de84
0006075c: (                    ): push word ptr [ds:0x84dc] ; ff36dc84
00060760: (                    ): push word ptr [ds:0xaee0] ; ff36e0ae
00060764: (                    ): call 0x143                ; e8dcf9
00060767: (                    ): add sp, 0xa               ; 83c40a
0006076a: (                    ): lea sp, word ptr ss:[bp+0xfffc] ; 8d66fc
0006076d: (                    ): pop si                    ; 5e
0006076e: (                    ): pop di                    ; 5f
<bochs:9> b 0x60771
<bochs:10> c
(0) Breakpoint 2, 0x60771 in ?? ()
Next at t=75340769
(0) [0x00060771] 6000:0771 (unk. ctxt): push bp                   ; 55
<bochs:11>

shoelace源代码分析,bochs调试过程_第1张图片


第六个断点:0x6093b是shoecli( )函数,0xca7为loadbuilt()函数,0x407为函数startminix()函数


0006091e: (                    ): lea bx, word ptr ss:[bp+0xfe62] ; 8d9e62fe
00060922: (                    ): push bx                   ; 53
00060923: (                    ): call 0xca7                ; e88103
00060926: (                    ): inc sp                    ; 44
00060927: (                    ): inc sp                    ; 44
00060928: (                    ): test ax, ax               ; 85c0
0006092a: (                    ): jz 0x93b                  ; 740f
0006092c: (                    ): xor ax, ax                ; 31c0
0006092e: (                    ): push ax                   ; 50
0006092f: (                    ): xor ax, ax                ; 31c0
00060931: (                    ): push ax                   ; 50
00060932: (                    ): xor ax, ax                ; 31c0
00060934: (                    ): push ax                   ; 50
00060935: (                    ): call 0x407                ; e8cffa
00060938: (                    ): add sp, 0x6               ; 83c406
0006093b: (                    ): call 0x2658               ; e81a1d
0006093e: (                    ): lea sp, word ptr ss:[bp+0xfffc] ; 8d66fc
00060941: (                    ): pop si                    ; 5e
00060942: (                    ): pop di                    ; 5f
00060943: (                    ): pop bp                    ; 5d
00060944: (                    ): retn                      ; c3



<bochs:4> b 0x60900
<bochs:5> c
(0) Breakpoint 2, 0x60900 in ?? ()
Next at t=78034902
(0) [0x00060900] 6000:0900 (unk. ctxt): test ax, ax               ; 85c0

因为这时为0,所以进入0x60915打印

    printf("\nLoad Image\n");

shoelace源代码分析,bochs调试过程_第2张图片


<bochs:6> u /40 0x608e0
000608e0: (                    ): std                       ; fd
000608e1: (                    ): stc                       ; f9
000608e2: (                    ): mov al, byte ptr ss:[bp+0xfffb] ; 8a46fb
000608e5: (                    ): test al, al               ; 84c0
000608e7: (                    ): jz 0x93b                  ; 7452
000608e9: (                    ): mov bx, 0x8773            ; bb7387
000608ec: (                    ): push bx                   ; 53
000608ed: (                    ): call 0x7e30               ; e84075
000608f0: (                    ): inc sp                    ; 44
000608f1: (                    ): inc sp                    ; 44
000608f2: (                    ): xor ax, ax                ; 31c0
000608f4: (                    ): push ax                   ; 50
000608f5: (                    ): lea bx, word ptr ss:[bp+0xf9e2] ; 8d9ee2f9
000608f9: (                    ): push bx                   ; 53
000608fa: (                    ): call 0xcf7                ; e8fa03
000608fd: (                    ): add sp, 0x4               ; 83c404
00060900: (                    ): test ax, ax               ; 85c0
00060902: (                    ): jz 0x915                  ; 7411
00060904: (                    ): call 0x1c8e               ; e88713
00060907: (                    ): test ax, ax               ; 85c0
00060909: (                    ): jz 0x915                  ; 740a
0006090b: (                    ): lea bx, word ptr ss:[bp+0xf9e2] ; 8d9ee2f9
0006090f: (                    ): push bx                   ; 53
00060910: (                    ): call 0x2088               ; e87517
00060913: (                    ): inc sp                    ; 44
00060914: (                    ): inc sp                    ; 44

00060915: (                    ): mov bx, 0x8766            ; bb6687
00060918: (                    ): push bx                   ; 53
00060919: (                    ): call 0x7e30               ; e81475
0006091c: (                    ): inc sp                    ; 44
0006091d: (                    ): inc sp                    ; 44


0x7e30 为printf()函数地址




<bochs:8> info r
eax            0x0              0
ecx            0x12000a         1179658
edx            0xd80            3456
ebx            0x1              1
esp            0xdc50           0xdc50
ebp            0xe26e           0xe26e
esi            0x771            1905
edi            0x84d8           34008
eip            0x900            0x900
eflags         0x246            582
cs             0x6000           24576
ss             0x6000           24576
ds             0x6000           24576
es             0x6000           24576
fs             0x0              0
gs             0x0              0
<bochs:9> b 0x6091c
<bochs:10> c
(0) Breakpoint 3, 0x6091c in ?? ()
Next at t=78037286
(0) [0x0006091c] 6000:091c (unk. ctxt): inc sp                    ; 44


在0x6091c下断点:

图像

shoelace源代码分析,bochs调试过程_第3张图片

你可能感兴趣的:(调试,bochs,shoelace)