Browse Source

[GDB] Handle kill and detach packets.

This commit also includes a test to ensure that single stepping works,
since continue, kill, detach, and single step all share code.
tags/v0.9.4
Stefan Hajnoczi 16 years ago
parent
commit
59b5465b30
3 changed files with 19 additions and 5 deletions
  1. 8
    5
      src/core/gdbstub.c
  2. 4
    0
      src/tests/gdbstub_test.S
  3. 7
    0
      src/tests/gdbstub_test.gdb

+ 8
- 5
src/core/gdbstub.c View File

235
 		case 'M':
235
 		case 'M':
236
 			gdbstub_write_mem ( stub );
236
 			gdbstub_write_mem ( stub );
237
 			break;
237
 			break;
238
-		case 'c':
239
-			gdbstub_continue ( stub, 0 );
240
-			break;
241
-		case 's':
242
-			gdbstub_continue ( stub, 1 );
238
+		case 'c': /* Continue */
239
+		case 'k': /* Kill */
240
+		case 's': /* Step */
241
+		case 'D': /* Detach */
242
+			gdbstub_continue ( stub, stub->payload [ 0 ] == 's' );
243
+			if ( stub->payload [ 0 ] == 'D' ) {
244
+				gdbstub_send_ok ( stub );
245
+			}
243
 			break;
246
 			break;
244
 		default:
247
 		default:
245
 			stub->len = 0;
248
 			stub->len = 0;

+ 4
- 0
src/tests/gdbstub_test.S View File

25
 	int	$3
25
 	int	$3
26
 	addl	$8, %esp
26
 	addl	$8, %esp
27
 
27
 
28
+	/* 5. Step test */
29
+	int	$3
30
+	nop
31
+
28
 1:
32
 1:
29
 	jmp	1b
33
 	jmp	1b

+ 7
- 0
src/tests/gdbstub_test.gdb View File

71
 	gpxe_assert ({char}($esp)) (char)0x99 "gpxe_test_mem_write char"
71
 	gpxe_assert ({char}($esp)) (char)0x99 "gpxe_test_mem_write char"
72
 end
72
 end
73
 
73
 
74
+define gpxe_test_step
75
+	c
76
+	si
77
+	gpxe_assert ({char}($eip-1)) (char)0x90 "gpxe_test_step" # nop = 0x90
78
+end
79
+
74
 gpxe_load_symbols
80
 gpxe_load_symbols
75
 gpxe_connect
81
 gpxe_connect
76
 gpxe_start_tests
82
 gpxe_start_tests
78
 gpxe_test_regs_write
84
 gpxe_test_regs_write
79
 gpxe_test_mem_read
85
 gpxe_test_mem_read
80
 gpxe_test_mem_write
86
 gpxe_test_mem_write
87
+gpxe_test_step

Loading…
Cancel
Save