浏览代码

[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 年前
父节点
当前提交
59b5465b30
共有 3 个文件被更改,包括 19 次插入5 次删除
  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 查看文件

@@ -235,11 +235,14 @@ static void gdbstub_rx_packet ( struct gdbstub *stub ) {
235 235
 		case 'M':
236 236
 			gdbstub_write_mem ( stub );
237 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 246
 			break;
244 247
 		default:
245 248
 			stub->len = 0;

+ 4
- 0
src/tests/gdbstub_test.S 查看文件

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

+ 7
- 0
src/tests/gdbstub_test.gdb 查看文件

@@ -71,6 +71,12 @@ define gpxe_test_mem_write
71 71
 	gpxe_assert ({char}($esp)) (char)0x99 "gpxe_test_mem_write char"
72 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 80
 gpxe_load_symbols
75 81
 gpxe_connect
76 82
 gpxe_start_tests
@@ -78,3 +84,4 @@ gpxe_test_regs_read
78 84
 gpxe_test_regs_write
79 85
 gpxe_test_mem_read
80 86
 gpxe_test_mem_write
87
+gpxe_test_step

正在加载...
取消
保存