ia64/xen-unstable

changeset 2097:9f870bc86d69

bitkeeper revision 1.1108.1.44 (411354999nduqdyeTZj322J-xHX8zw)

Add support for detaching and resuming. It isn't obvious that
these are useful things to do in what is nominally a post-mortem
debugger, but do it anyway.
author sos22@donkeykong.cl.cam.ac.uk
date Fri Aug 06 09:51:21 2004 +0000 (2004-08-06)
parents d200c22469e2
children 7731e79b4f83
files xen/arch/x86/xdb.c
line diff
     1.1 --- a/xen/arch/x86/xdb.c	Fri Aug 06 09:50:14 2004 +0000
     1.2 +++ b/xen/arch/x86/xdb.c	Fri Aug 06 09:51:21 2004 +0000
     1.3 @@ -14,6 +14,7 @@
     1.4  struct xendbg_context {
     1.5  	int serhnd;
     1.6  	u8 reply_csum;
     1.7 +	int currently_attached:1;
     1.8  };
     1.9  
    1.10  static void
    1.11 @@ -250,9 +251,20 @@ process_command(char *received_packet, s
    1.12  			break;
    1.13  		case 'D':
    1.14  			resume = 1;
    1.15 +			ctx->currently_attached = 0;
    1.16  			retry = xendbg_send_reply("", ctx);
    1.17  			break;
    1.18  		case 'c': /* Resume at current address */
    1.19 +			ctx->currently_attached = 1;
    1.20 +			resume = 1;
    1.21 +			retry = 0;
    1.22 +			break;
    1.23 +		case 'Z': /* We need to claim to support these or gdb
    1.24 +			     won't let you continue the process. */
    1.25 +		case 'z':
    1.26 +			retry = xendbg_send_reply("OK", ctx);
    1.27 +			break;
    1.28 +
    1.29  		case 's': /* Single step */
    1.30  		case '?':
    1.31  			retry = xendbg_send_reply("S01", ctx);
    1.32 @@ -306,6 +318,13 @@ void
    1.33  	   interrupts while we're here. */
    1.34  	local_irq_save(flags);
    1.35  
    1.36 +	/* If gdb is already attached, tell it we've stopped again. */
    1.37 +	if (xdb_ctx.currently_attached) {
    1.38 +		do {
    1.39 +			r = xendbg_send_reply("S01", &xdb_ctx);
    1.40 +		} while (r != 0);
    1.41 +	}
    1.42 +
    1.43  	while (resume == 0) {
    1.44  		r = receive_command(recv_buf, &xdb_ctx);
    1.45  		if (r < 0) {