Annotation of qemu/roms/ipxe/src/tests/gdbstub_test.gdb, revision 1.1.1.1

1.1       root        1: #!/usr/bin/gdb -x
                      2: # Test suite for GDB remote debugging
                      3: # Run:
                      4: #   make bin/ipxe.hd.tmp
                      5: #   make
                      6: #   gdb
                      7: #   (gdb) target remote :TCPPORT
                      8: #   OR
                      9: #   (gdb) target remote udp:IP:UDPPORT
                     10: #   (gdb) source tests/gdbstub_test.gdb
                     11: 
                     12: define ipxe_load_symbols
                     13:        file bin/ipxe.hd.tmp
                     14: end
                     15: 
                     16: define ipxe_assert
                     17:        if $arg0 != $arg1
                     18:                echo FAIL $arg2\n
                     19:        else
                     20:                echo PASS $arg2\n
                     21:        end
                     22: end
                     23: 
                     24: define ipxe_start_tests
                     25:        jump gdbstub_test
                     26: end
                     27: 
                     28: define ipxe_test_regs_read
                     29:        ipxe_assert $eax 0xea010203 "ipxe_test_regs_read eax"
                     30:        ipxe_assert $ebx 0xeb040506 "ipxe_test_regs_read ebx"
                     31:        ipxe_assert $ecx 0xec070809 "ipxe_test_regs_read ecx"
                     32:        ipxe_assert $edx 0xed0a0b0c "ipxe_test_regs_read edx"
                     33:        ipxe_assert $esi 0x510d0e0f "ipxe_test_regs_read esi"
                     34:        ipxe_assert $edi 0xd1102030 "ipxe_test_regs_read edi"
                     35: end
                     36: 
                     37: define ipxe_test_regs_write
                     38:        set $eax = 0xea112233
                     39:        set $ebx = 0xeb445566
                     40:        set $ecx = 0xec778899
                     41:        set $edx = 0xedaabbcc
                     42:        set $esi = 0x51ddeeff
                     43:        set $edi = 0xd1010203
                     44:        c
                     45:        ipxe_assert $eax 0xea112233 "ipxe_test_regs_write eax"
                     46:        ipxe_assert $ebx 0xeb445566 "ipxe_test_regs_write ebx"
                     47:        ipxe_assert $ecx 0xec778899 "ipxe_test_regs_write ecx"
                     48:        ipxe_assert $edx 0xedaabbcc "ipxe_test_regs_write edx"
                     49:        ipxe_assert $esi 0x51ddeeff "ipxe_test_regs_write esi"
                     50:        ipxe_assert $edi 0xd1010203 "ipxe_test_regs_write edi"
                     51: 
                     52:        # This assumes segment selectors are always 0x10 or 0x8 (for code).
                     53:        ipxe_assert $cs 0x08 "ipxe_test_regs_write cs"
                     54:        ipxe_assert $ds 0x10 "ipxe_test_regs_write ds"
                     55: end
                     56: 
                     57: define ipxe_test_mem_read
                     58:        c
                     59:        ipxe_assert ({int}($esp+4)) 0x11223344 "ipxe_test_mem_read int"
                     60:        ipxe_assert ({short}($esp+2)) 0x5566 "ipxe_test_mem_read short"
                     61:        ipxe_assert ({char}($esp)) 0x77 "ipxe_test_mem_read char"
                     62: end
                     63: 
                     64: define ipxe_test_mem_write
                     65:        set ({int}($esp+4)) = 0xaabbccdd
                     66:        set ({short}($esp+2)) = 0xeeff
                     67:        set ({char}($esp)) = 0x99
                     68:        c
                     69:        ipxe_assert ({int}($esp+4)) 0xaabbccdd "ipxe_test_mem_write int"
                     70:        ipxe_assert ({short}($esp+2)) (short)0xeeff "ipxe_test_mem_write short"
                     71:        ipxe_assert ({char}($esp)) (char)0x99 "ipxe_test_mem_write char"
                     72: end
                     73: 
                     74: define ipxe_test_step
                     75:        c
                     76:        si
                     77:        ipxe_assert ({char}($eip-1)) (char)0x90 "ipxe_test_step" # nop = 0x90
                     78: end
                     79: 
                     80: define ipxe_test_awatch
                     81:        awatch watch_me
                     82: 
                     83:        c
                     84:        ipxe_assert $ecx 0x600d0000 "ipxe_test_awatch read"
                     85:        if $ecx == 0x600d0000
                     86:                c
                     87:        end
                     88: 
                     89:        c
                     90:        ipxe_assert $ecx 0x600d0001 "ipxe_test_awatch write"
                     91:        if $ecx == 0x600d0001
                     92:                c
                     93:        end
                     94: 
                     95:        delete
                     96: end
                     97: 
                     98: define ipxe_test_watch
                     99:        watch watch_me
                    100:        c
                    101:        ipxe_assert $ecx 0x600d0002 "ipxe_test_watch"
                    102:        if $ecx == 0x600d0002
                    103:                c
                    104:        end
                    105:        delete
                    106: end
                    107: 
                    108: ipxe_load_symbols
                    109: ipxe_start_tests
                    110: ipxe_test_regs_read
                    111: ipxe_test_regs_write
                    112: ipxe_test_mem_read
                    113: ipxe_test_mem_write
                    114: ipxe_test_step
                    115: ipxe_test_awatch
                    116: ipxe_test_watch

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.