|
@@ -0,0 +1,80 @@
|
|
1
|
+#!/usr/bin/gdb -x
|
|
2
|
+# Test suite for GDB remote debugging
|
|
3
|
+# Run:
|
|
4
|
+# make bin/gpxe.hd.tmp
|
|
5
|
+# make
|
|
6
|
+# tests/gdbstub_test.gdb
|
|
7
|
+
|
|
8
|
+define gpxe_load_symbols
|
|
9
|
+ file bin/gpxe.hd.tmp
|
|
10
|
+end
|
|
11
|
+
|
|
12
|
+define gpxe_connect
|
|
13
|
+ target remote localhost:4444
|
|
14
|
+end
|
|
15
|
+
|
|
16
|
+define gpxe_assert
|
|
17
|
+ if $arg0 != $arg1
|
|
18
|
+ echo FAIL $arg2\n
|
|
19
|
+ else
|
|
20
|
+ echo PASS $arg2\n
|
|
21
|
+ end
|
|
22
|
+end
|
|
23
|
+
|
|
24
|
+define gpxe_start_tests
|
|
25
|
+ jump gdbstub_test
|
|
26
|
+end
|
|
27
|
+
|
|
28
|
+define gpxe_test_regs_read
|
|
29
|
+ gpxe_assert $eax 0xea010203 "gpxe_test_regs_read eax"
|
|
30
|
+ gpxe_assert $ebx 0xeb040506 "gpxe_test_regs_read ebx"
|
|
31
|
+ gpxe_assert $ecx 0xec070809 "gpxe_test_regs_read ecx"
|
|
32
|
+ gpxe_assert $edx 0xed0a0b0c "gpxe_test_regs_read edx"
|
|
33
|
+ gpxe_assert $esi 0x510d0e0f "gpxe_test_regs_read esi"
|
|
34
|
+ gpxe_assert $edi 0xd1102030 "gpxe_test_regs_read edi"
|
|
35
|
+end
|
|
36
|
+
|
|
37
|
+define gpxe_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
|
+ gpxe_assert $eax 0xea112233 "gpxe_test_regs_write eax"
|
|
46
|
+ gpxe_assert $ebx 0xeb445566 "gpxe_test_regs_write ebx"
|
|
47
|
+ gpxe_assert $ecx 0xec778899 "gpxe_test_regs_write ecx"
|
|
48
|
+ gpxe_assert $edx 0xedaabbcc "gpxe_test_regs_write edx"
|
|
49
|
+ gpxe_assert $esi 0x51ddeeff "gpxe_test_regs_write esi"
|
|
50
|
+ gpxe_assert $edi 0xd1010203 "gpxe_test_regs_write edi"
|
|
51
|
+
|
|
52
|
+ # This assumes segment selectors are always 0x10 or 0x8 (for code).
|
|
53
|
+ gpxe_assert $cs 0x08 "gpxe_test_regs_write cs"
|
|
54
|
+ gpxe_assert $ds 0x10 "gpxe_test_regs_write ds"
|
|
55
|
+end
|
|
56
|
+
|
|
57
|
+define gpxe_test_mem_read
|
|
58
|
+ c
|
|
59
|
+ gpxe_assert ({int}($esp+4)) 0x11223344 "gpxe_test_mem_read int"
|
|
60
|
+ gpxe_assert ({short}($esp+2)) 0x5566 "gpxe_test_mem_read short"
|
|
61
|
+ gpxe_assert ({char}($esp)) 0x77 "gpxe_test_mem_read char"
|
|
62
|
+end
|
|
63
|
+
|
|
64
|
+define gpxe_test_mem_write
|
|
65
|
+ set ({int}($esp+4)) = 0xaabbccdd
|
|
66
|
+ set ({short}($esp+2)) = 0xeeff
|
|
67
|
+ set ({char}($esp)) = 0x99
|
|
68
|
+ c
|
|
69
|
+ gpxe_assert ({int}($esp+4)) 0xaabbccdd "gpxe_test_mem_write int"
|
|
70
|
+ gpxe_assert ({short}($esp+2)) (short)0xeeff "gpxe_test_mem_write short"
|
|
71
|
+ gpxe_assert ({char}($esp)) (char)0x99 "gpxe_test_mem_write char"
|
|
72
|
+end
|
|
73
|
+
|
|
74
|
+gpxe_load_symbols
|
|
75
|
+gpxe_connect
|
|
76
|
+gpxe_start_tests
|
|
77
|
+gpxe_test_regs_read
|
|
78
|
+gpxe_test_regs_write
|
|
79
|
+gpxe_test_mem_read
|
|
80
|
+gpxe_test_mem_write
|