Subversion Repositories Kolibri OS

Rev

Rev 6344 | Rev 7677 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6344 Rev 7675
Line 13... Line 13...
13
        dd      i_param
13
        dd      i_param
14
        dd      0
14
        dd      0
Line 15... Line 15...
15
 
15
 
Line 16... Line 16...
16
;-----------------------------------------------------------------------------
16
;-----------------------------------------------------------------------------
17
 
17
 
18
REG_MODE_CPU equ 1
18
REG_MODE_CPU = 1
19
REG_MODE_MMX equ 2
19
REG_MODE_MMX = 2
Line 20... Line 20...
20
REG_MODE_SSE equ 3
20
REG_MODE_SSE = 3
Line 21... Line 21...
21
REG_MODE_AVX equ 4
21
REG_MODE_AVX = 4
Line 198... Line 198...
198
        and     [symbols], 0
198
        and     [symbols], 0
199
        and     [num_symbols], 0
199
        and     [num_symbols], 0
Line 200... Line 200...
200
 
200
 
201
; TODO: make it local
201
; TODO: make it local
202
do_reload:
-
 
203
        ;push    18
-
 
204
        ;pop     eax
-
 
205
        ;push    7
-
 
206
        ;pop     ebx
202
do_reload:
207
        mcall    18, 7
203
        mcall   18, 7
208
        mov     [dbgwnd], eax
204
        mov     [dbgwnd], eax
209
        xchg    ecx, eax
-
 
210
        ;push    70
-
 
211
        ;pop     eax
-
 
212
        ;mov     ebx, fn70_load_block
205
        xchg    ecx, eax
213
        mcall    70, fn70_load_block
206
        mcall   70, fn70_load_block
214
        test    eax, eax
207
        test    eax, eax
Line 215... Line 208...
215
        jns     .load_ok
208
        jns     .load_ok
Line 234... Line 227...
234
        jmp     draw_messages
227
        jmp     draw_messages
Line 235... Line 228...
235
 
228
 
236
    .load_ok:
229
    .load_ok:
237
        mov     [debuggee_pid], eax
230
        mov     [debuggee_pid], eax
238
        mov     [bSuspended], 1
-
 
239
        mov     eax, 5
231
        mov     [bSuspended], 1
240
        mov     ebx, 20
-
 
Line 241... Line 232...
241
        int     0x40
232
        mcall   5, 20
242
 
233
 
243
        push    ecx
234
        push    ecx
244
        call    get_context
235
        call    get_context
245
        mov     edi, oldcontext
236
        mov     edi, oldcontext
Line 246... Line 237...
246
        mov     ecx, (ctx_end-context)/4
237
        mov     ecx, (ctx_end-context)/4
247
        rep movsd
238
        rep movsd
248
 
-
 
249
    ; activate debugger window
-
 
250
        pop     ecx
-
 
251
        ;mov     bl, 3
239
 
252
        ;push    18
240
    ; activate debugger window
253
        ;pop     eax
241
        pop     ecx
254
        mcall    18, 3
242
        mcall   18, 3
255
        call    redraw_title
243
        call    redraw_title
Line 385... Line 373...
385
        pop     esi
373
        pop     esi
386
        call    put_message_nodraw
374
        call    put_message_nodraw
387
        mov     esi, aPacked2
375
        mov     esi, aPacked2
388
        call    put_message
376
        call    put_message
389
        call    hide_cursor
377
        call    hide_cursor
390
        ;push    40
-
 
391
        ;pop     eax
-
 
392
        ;push    7
-
 
393
        ;pop     ebx
-
 
394
        mcall    40, 7
378
        mcall   40, EVM_REDRAW or EVM_KEY or EVM_BUTTON
Line 395... Line 379...
395
 
379
 
396
    .wait:
-
 
397
        ;push    10
-
 
398
        ;pop     eax
380
    .wait:
399
        mcall    10
381
        mcall   10
400
        dec     eax
382
        dec     eax
401
        jz      .redraw
383
        jz      .redraw
402
        dec     eax
384
        dec     eax
Line 408... Line 390...
408
        call    draw_window
390
        call    draw_window
409
        call    hide_cursor
391
        call    hide_cursor
410
        jmp     .wait
392
        jmp     .wait
Line 411... Line 393...
411
 
393
 
412
    .key:
-
 
413
        mov     al, 2
394
    .key:
414
        mcall
395
        mcall   2
415
        cmp     ah, 'y'
396
        cmp     ah, 'y'
416
        jz      .yes
397
        jz      .yes
417
        cmp     ah, 'Y'
398
        cmp     ah, 'Y'
418
        jz      .yes
399
        jz      .yes
Line 422... Line 403...
422
        jz      .no
403
        jz      .no
423
        cmp     ah, 'N'
404
        cmp     ah, 'N'
424
        jnz     .wait
405
        jnz     .wait
Line 425... Line 406...
425
 
406
 
426
    .no:
-
 
427
        ;push    40
-
 
428
        ;pop     eax
-
 
429
        ;mov     ebx, 0x107
407
    .no:
430
        mcall    40, 0x107
408
        mcall   40, EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_DEBUG
431
        call    draw_cursor
409
        call    draw_cursor
432
        mov     esi, aN_str
410
        mov     esi, aN_str
Line 433... Line 411...
433
        jmp     put_message
411
        jmp     put_message
434
 
-
 
435
    .yes:
-
 
436
        ;push    40
-
 
437
        ;pop     eax
412
 
438
        ;mov     ebx, 0x107
413
    .yes:
439
        mcall    40, 0x107
414
        mcall   40, EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_DEBUG
440
        call    draw_cursor
415
        call    draw_cursor
441
        mov     esi, aY_str
416
        mov     esi, aY_str
442
        call    put_message
417
        call    put_message
Line 535... Line 510...
535
 
510
 
536
;-----------------------------------------------------------------------------
511
;-----------------------------------------------------------------------------
Line 537... Line 512...
537
;                        Terminate process event
512
;                        Terminate process event
538
 
-
 
539
OnTerminate:
-
 
540
        ;mov     ecx, [debuggee_pid]
-
 
541
        ;push    8
-
 
542
        ;pop     ebx
-
 
543
        ;push    69
513
 
544
        ;pop     eax
514
OnTerminate:
545
        mcall    69, 8, [debuggee_pid]
515
        mcall   69, 8, [debuggee_pid]
546
        ret
516
        ret
Line 556... Line 526...
556
        call    draw_dump.redraw
526
        call    draw_dump.redraw
557
        call    update_disasm_eip
527
        call    update_disasm_eip
558
        ret
528
        ret
Line 559... Line 529...
559
 
529
 
560
OnSuspend:
-
 
561
        ;mov     ecx, [debuggee_pid]
-
 
562
        ;push    4
-
 
563
        ;pop     ebx
-
 
564
        ;push    69
-
 
565
        ;pop     eax
530
OnSuspend:
566
        mcall    69, 4, [debuggee_pid]
531
        mcall   69, 4, [debuggee_pid]
567
        call    AfterSuspend
532
        call    AfterSuspend
568
        mov     esi, aSuspended
533
        mov     esi, aSuspended
Line 569... Line 534...
569
        jmp     put_message
534
        jmp     put_message
570
 
535
 
Line 571... Line 536...
571
;-----------------------------------------------------------------------------
536
;-----------------------------------------------------------------------------
572
;                        Resume process event
-
 
573
 
-
 
574
DoResume:
-
 
575
        ;mov     ecx, [debuggee_pid]
-
 
576
        ;push    5
-
 
577
        ;pop     ebx
537
;                        Resume process event
578
        ;push    69
538
 
579
        ;pop     eax
539
DoResume:
Line 580... Line 540...
580
        mcall    69, 5, [debuggee_pid]
540
        mcall   69, 5, [debuggee_pid]
Line 786... Line 746...
786
 
746
 
787
    ; TODO: fix for useful name
747
    ; TODO: fix for useful name
788
    .4:
748
    .4:
789
        call    get_dump
749
        call    get_dump
790
        pop     eax
750
        pop     eax
791
    ; int3 command generates exception 0D, #GP
751
    ; int3 command generates exception 0x0D, #GP
792
        push    eax
752
        push    eax
793
        cmp     al, 0Dh
753
        cmp     al, 0x0D
794
        jnz     .notdbg
754
        jnz     .notdbg
795
    ; check for 0xCC byte at eip
755
    ; check for 0xCC byte at eip
796
        push    0
756
        push    0
797
        mcall   69, 6, [debuggee_pid], 1, [_eip], esp
757
        mcall   69, 6, [debuggee_pid], 1, [_eip], esp
Line 934... Line 894...
934
        cmp     byte [edi+5], 0xCD
894
        cmp     byte [edi+5], 0xCD
935
        jz      .int
895
        jz      .int
Line 936... Line 896...
936
 
896
 
937
     @@:
897
     @@:
938
        push    0
-
 
939
        ;push    69
-
 
940
        ;pop     eax
-
 
941
        ;push    6
-
 
942
        ;pop     ebx
-
 
943
        ;mov     ecx, [debuggee_pid]
-
 
944
        ;push    3
-
 
945
        ;pop     edx
-
 
946
        ;mov     edi, esp
-
 
947
        ;mov     esi, [_eip]
898
        push    0
948
        mcall    69, 6, [debuggee_pid], 3, [_eip], esp
899
        mcall    69, 6, [debuggee_pid], 3, [_eip], esp
949
        cmp     eax, edx
900
        cmp     eax, edx
950
        pop     eax
901
        pop     eax
951
        jnz     .doit
902
        jnz     .doit
Line 967... Line 918...
967
        ret
918
        ret
Line 968... Line 919...
968
 
919
 
969
    ; return address is [ebp-4]
920
    ; return address is [ebp-4]
970
    .sysenter:
921
    .sysenter:
971
        push    0
-
 
972
        ;push    69
-
 
973
        ;pop     eax
922
        push    0
974
        inc     edx     ; read 4 bytes
923
        inc     edx     ; read 4 bytes
975
        mov     esi, [_ebp]
924
        mov     esi, [_ebp]
976
        sub     esi, 4
925
        sub     esi, 4
977
        mcall    69
926
        mcall   69
Line 1141... Line 1090...
1141
        mov     al, [edi+5]
1090
        mov     al, [edi+5]
1142
        clc
1091
        clc
1143
        ret
1092
        ret
Line 1144... Line 1093...
1144
 
1093
 
1145
    .nobreak:
-
 
1146
        ;push    69
-
 
1147
        ;pop     eax
-
 
1148
        ;push    6
-
 
1149
        ;pop     ebx
-
 
1150
        ;mov     ecx, [debuggee_pid]
1094
    .nobreak:
1151
        xor     edx, edx
1095
        xor     edx, edx
1152
        push    edx
1096
        push    edx
1153
        inc     edx
1097
        inc     edx
1154
        mov     edi, esp
1098
        mov     edi, esp
Line 1396... Line 1340...
1396
        xor     ecx, ecx
1340
        xor     ecx, ecx
Line 1397... Line 1341...
1397
 
1341
 
1398
    .l1:
1342
    .l1:
1399
        cmp     [drx_break+ecx*4], 0
1343
        cmp     [drx_break+ecx*4], 0
1400
        jnz     .l2
-
 
1401
        ;push    69
-
 
1402
        ;pop     eax
1344
        jnz     .l2
1403
        push    ecx
1345
        push    ecx
1404
        mov     dl, cl
-
 
1405
        ;mov     ecx, [debuggee_pid]
1346
        mov     dl, cl
1406
        mov     esi, ebp
-
 
1407
        ;push    9
-
 
1408
        ;pop     ebx
1347
        mov     esi, ebp
1409
        mcall    69, 9, [debuggee_pid]
1348
        mcall   69, 9, [debuggee_pid]
1410
        test    eax, eax
1349
        test    eax, eax
1411
        jz      .ok
1350
        jz      .ok
Line 1673... Line 1612...
1673
        jnz     .ret
1612
        jnz     .ret
1674
        or      byte [edi-1], 2
1613
        or      byte [edi-1], 2
1675
        test    byte [edi-1], 8
1614
        test    byte [edi-1], 8
1676
        jnz     .dr
1615
        jnz     .dr
1677
        push    esi
1616
        push    esi
1678
        ;push    7
-
 
1679
        ;pop     ebx
-
 
1680
        ;push    69
-
 
1681
        ;pop     eax
-
 
1682
        ;mov     ecx, [debuggee_pid]
-
 
1683
        ;xor     edx, edx
-
 
1684
        ;inc     edx
-
 
1685
        ;mov     esi, [edi-5]
-
 
1686
        mcall    69, 7, [debuggee_pid], 1, [edi-5]
1617
        mcall   69, 7, [debuggee_pid], 1, [edi-5]
1687
        pop     esi
1618
        pop     esi
Line 1688... Line 1619...
1688
 
1619
 
1689
    .ret:
1620
    .ret:
Line 1690... Line 1621...
1690
        ret
1621
        ret
1691
 
1622
 
1692
    .dr:
1623
    .dr:
1693
        mov     dl, [edi]
1624
        mov     dl, [edi]
1694
        shr     dl, 6
-
 
1695
        mov     dh, 80h
-
 
1696
        ;push    69
-
 
1697
        ;pop     eax
-
 
1698
        ;push    9
-
 
1699
        ;pop     ebx
1625
        shr     dl, 6
1700
        ;mov     ecx, [debuggee_pid]
1626
        mov     dh, 80h
Line 1701... Line 1627...
1701
        mcall    69, 9, [debuggee_pid]
1627
        mcall   69, 9, [debuggee_pid]
1702
        ret
1628
        ret
Line 1715... Line 1641...
1715
        test    byte [edi-1], 2
1641
        test    byte [edi-1], 2
1716
        jz      .ret
1642
        jz      .ret
1717
        and     byte [edi-1], not 2
1643
        and     byte [edi-1], not 2
1718
        test    byte [edi-1], 8
1644
        test    byte [edi-1], 8
1719
        jnz     .dr
1645
        jnz     .dr
1720
        ;push    6
-
 
1721
        ;pop     ebx
-
 
1722
        ;push    69
-
 
1723
        ;pop     eax
-
 
1724
        ;mov     esi, [edi-5]
-
 
1725
        ;mov     ecx, [debuggee_pid]
-
 
1726
        ;xor     edx, edx
-
 
1727
        ;inc     edx
-
 
1728
        mcall    69, 6, [debuggee_pid], 1, [edi-5]
1646
        mcall   69, 6, [debuggee_pid], 1, [edi-5]
1729
        dec     eax
1647
        dec     eax
1730
        jnz     .err
1648
        jnz     .err
1731
        ;mov     al, 69
-
 
1732
        push    0xCC
1649
        push    0xCC
1733
        mov     edi, esp
1650
        mov     edi, esp
1734
        inc     ebx
1651
        inc     ebx
1735
        mcall    69
1652
        mcall   69
1736
        pop     eax
1653
        pop     eax
Line 1745... Line 1662...
1745
        call    put_message
1662
        call    put_message
1746
        pop     esi
1663
        pop     esi
1747
        ret
1664
        ret
Line 1748... Line 1665...
1748
 
1665
 
1749
    .dr:
-
 
1750
        ;push    9
-
 
1751
        ;pop     ebx
-
 
1752
        ;push    69
-
 
1753
        ;pop     eax
1666
    .dr:
1754
        mov     esi, [edi-5]
-
 
1755
        ;mov     ecx, [debuggee_pid]
1667
        mov     esi, [edi-5]
1756
        mov     dl, [edi]
1668
        mov     dl, [edi]
1757
        shr     dl, 6
1669
        shr     dl, 6
1758
        mov     dh, [edi]
1670
        mov     dh, [edi]
1759
        and     dh, 0xF
1671
        and     dh, 0xF
Line 1849... Line 1761...
1849
        mov     dx, 1111b*256
1761
        mov     dx, 1111b*256
1850
        push    0xC
1762
        push    0xC
1851
        pop     esi
1763
        pop     esi
Line 1852... Line 1764...
1852
 
1764
 
1853
    @@:
-
 
1854
        ;push    69
-
 
1855
        ;pop     eax
1765
    @@:
1856
        mcall    69
1766
        mcall   69
1857
        test    eax, eax
1767
        test    eax, eax
1858
        jz      .breakok
1768
        jz      .breakok
1859
        inc     edx
1769
        inc     edx
Line 1863... Line 1773...
1863
    .breakok:
1773
    .breakok:
1864
        call    GoOn
1774
        call    GoOn
Line 1865... Line 1775...
1865
 
1775
 
1866
    ; now wait for event
1776
    ; now wait for event
1867
    .wait:
-
 
1868
        ;push    10
-
 
1869
        ;pop     eax
1777
    .wait:
1870
        mcall    10
1778
        mcall   10
1871
        dec     eax
1779
        dec     eax
1872
        jz      .redraw
1780
        jz      .redraw
1873
        dec     eax
1781
        dec     eax
Line 1894... Line 1802...
1894
    .x1:
1802
    .x1:
1895
        push    edx esi
1803
        push    edx esi
1896
        call    put_message
1804
        call    put_message
1897
        pop     esi edx
1805
        pop     esi edx
1898
        or      dh, 80h
1806
        or      dh, 80h
1899
        ;push    69
-
 
1900
        ;pop     eax
-
 
1901
        ;push    9
-
 
1902
        ;pop     ebx
-
 
1903
        ;mov     ecx, [debuggee_pid]
-
 
1904
        mcall    69, 9, [debuggee_pid]
1807
        mcall   69, 9, [debuggee_pid]
1905
        cmp     esi, aUnpacked
1808
        cmp     esi, aUnpacked
1906
        jnz     OnSuspend
1809
        jnz     OnSuspend
1907
        jmp     AfterSuspend
1810
        jmp     AfterSuspend
Line 1918... Line 1821...
1918
        mov     esi, aInterrupted
1821
        mov     esi, aInterrupted
1919
        push    edx
1822
        push    edx
1920
        call    put_message
1823
        call    put_message
1921
        pop     edx
1824
        pop     edx
1922
        or      dh, 80h
1825
        or      dh, 80h
1923
        ;push    69
-
 
1924
        ;pop     eax
-
 
1925
        ;push    9
-
 
1926
        ;pop     ebx
-
 
1927
        ;mov     ecx, [debuggee_pid]
-
 
1928
        mcall    69, 9, [debuggee_pid]
1826
        mcall   69, 9, [debuggee_pid]
1929
        jmp     debugmsg
1827
        jmp     debugmsg
Line 1930... Line 1828...
1930
 
1828
 
1931
    .our:
1829
    .our:
1932
        and     [dbgbuflen], 0
1830
        and     [dbgbuflen], 0
1933
        push    edx
1831
        push    edx
1934
        call    get_context
1832
        call    get_context
1935
        push    eax
-
 
1936
        ;mov     al, 69
-
 
1937
        ;mov     bl, 6
-
 
1938
        ;mov     ecx, [debuggee_pid]
-
 
1939
        ;mov     edi, esp
-
 
1940
        ;push    4
-
 
1941
        ;pop     edx
-
 
1942
        ;push    0xC
-
 
1943
        ;pop     esi
1833
        push    eax
1944
        mcall    69, 6, [debuggee_pid], 4, 0xC, esp
1834
        mcall   69, 6, [debuggee_pid], 4, 0xC, esp
1945
        pop     eax
1835
        pop     eax
1946
        pop     edx
1836
        pop     edx
1947
        cmp     eax, [_eip]
1837
        cmp     eax, [_eip]