aboutsummaryrefslogtreecommitdiffstats
path: root/tools/debugger
diff options
context:
space:
mode:
authorach61@arcadians.cl.cam.ac.uk <ach61@arcadians.cl.cam.ac.uk>2005-07-17 14:16:21 +0000
committerach61@arcadians.cl.cam.ac.uk <ach61@arcadians.cl.cam.ac.uk>2005-07-17 14:16:21 +0000
commitc5fe655bd2bea321b637dd0e3c58302c174004c3 (patch)
treed9ffed6ef38b21c9c94fbf4c57e3de7b1b35928e /tools/debugger
parent25e97c409b25e0e6da8a7b0dcfd204cbb944c060 (diff)
downloadxen-c5fe655bd2bea321b637dd0e3c58302c174004c3.tar.gz
xen-c5fe655bd2bea321b637dd0e3c58302c174004c3.tar.bz2
xen-c5fe655bd2bea321b637dd0e3c58302c174004c3.zip
pdb: read/write registers for process target
Diffstat (limited to 'tools/debugger')
-rw-r--r--tools/debugger/pdb/PDB.ml55
-rw-r--r--tools/debugger/pdb/Process.ml2
-rw-r--r--tools/debugger/pdb/Process.mli2
-rw-r--r--tools/debugger/pdb/Util.ml9
-rw-r--r--tools/debugger/pdb/Xen_domain.ml2
-rw-r--r--tools/debugger/pdb/Xen_domain.mli2
-rw-r--r--tools/debugger/pdb/debugger.ml15
-rw-r--r--tools/debugger/pdb/linux-2.6-module/Makefile2
-rw-r--r--tools/debugger/pdb/linux-2.6-module/debug.c68
-rw-r--r--tools/debugger/pdb/linux-2.6-module/module.c11
-rw-r--r--tools/debugger/pdb/linux-2.6-module/pdb_module.h22
-rw-r--r--tools/debugger/pdb/pdb_caml_process.c154
-rw-r--r--tools/debugger/pdb/pdb_caml_xen.h15
-rw-r--r--tools/debugger/pdb/server.ml4
14 files changed, 218 insertions, 145 deletions
diff --git a/tools/debugger/pdb/PDB.ml b/tools/debugger/pdb/PDB.ml
index a840535479..6abddd750f 100644
--- a/tools/debugger/pdb/PDB.ml
+++ b/tools/debugger/pdb/PDB.ml
@@ -7,9 +7,12 @@
* @version 1
*)
+open Util
+
exception Unimplemented of string
exception Unknown_context of string
exception Unknown_domain
+exception Unknown_process
type context_t =
| Void
@@ -45,6 +48,31 @@ let find_context key =
let delete_context key =
Hashtbl.remove hash key
+
+(**
+ find_process : Locate the socket associated with the context(s)
+ matching a particular (domain, process id) pair. if there are multiple
+ contexts (there shouldn't be), then return the first one.
+ *)
+
+let find_process dom pid =
+ let find key ctx list =
+ match ctx with
+ | Process p ->
+ if (((Process.get_domain p) = dom) &&
+ ((Process.get_process p) = pid))
+ then
+ key :: list
+ else
+ list
+ | _ -> list
+ in
+ let sock_list = Hashtbl.fold find hash [] in
+ match sock_list with
+ | hd::tl -> hd
+ | [] -> raise Unknown_process
+
+
(**
find_domain : Locate the socket associated with the context(s)
matching a particular (domain, vcpu) pair. if there are multiple
@@ -98,10 +126,13 @@ let attach_debugger ctx =
begin
let xdom_sock = find_xen_domain_context (Process.get_domain p) in
let xdom_ctx = find_context xdom_sock in
- match xdom_ctx with
- | Xen_domain d ->
- Process.attach_debugger p d
- | _ -> failwith ("context has wrong xen domain type")
+ begin
+ match xdom_ctx with
+ | Xen_domain d ->
+ Process.attach_debugger p d
+ | _ -> failwith ("context has wrong xen domain type")
+ end;
+ raise No_reply
end
| _ -> raise (Unimplemented "attach debugger")
@@ -158,8 +189,8 @@ let add_context (key:Unix.file_descr) context params =
match params with
| dom::pid::_ ->
let p = Process(Process.new_context dom pid) in
- attach_debugger p;
- Hashtbl.replace hash key p
+ Hashtbl.replace hash key p;
+ attach_debugger p
| _ -> failwith "bogus parameters to process context"
end
| "xen domain"
@@ -188,13 +219,21 @@ let read_registers ctx =
match ctx with
| Void -> Intel.null_registers (* default for startup *)
| Domain d -> Domain.read_registers d
- | Process p -> Process.read_registers p
+ | Process p ->
+ begin
+ Process.read_registers p;
+ raise No_reply
+ end
| _ -> raise (Unimplemented "read registers")
let write_register ctx register value =
match ctx with
| Domain d -> Domain.write_register d register value
- | Process p -> Process.write_register p register value
+ | Process p ->
+ begin
+ Process.write_register p register value;
+ raise No_reply
+ end
| _ -> raise (Unimplemented "write register")
diff --git a/tools/debugger/pdb/Process.ml b/tools/debugger/pdb/Process.ml
index 943d816b24..aa686ebae4 100644
--- a/tools/debugger/pdb/Process.ml
+++ b/tools/debugger/pdb/Process.ml
@@ -54,7 +54,7 @@ let attach_debugger proc_ctx dom_ctx =
proc_ctx.ring <- Xen_domain.get_ring dom_ctx;
_attach_debugger proc_ctx
-external read_registers : context_t -> registers = "proc_read_registers"
+external read_registers : context_t -> unit = "proc_read_registers"
external write_register : context_t -> register -> int32 -> unit =
"proc_write_register"
external read_memory : context_t -> int32 -> int -> int list =
diff --git a/tools/debugger/pdb/Process.mli b/tools/debugger/pdb/Process.mli
index a32a814c70..065e933bce 100644
--- a/tools/debugger/pdb/Process.mli
+++ b/tools/debugger/pdb/Process.mli
@@ -27,7 +27,7 @@ val detach_debugger : context_t -> unit
val pause : context_t -> unit
-val read_registers : context_t -> registers
+val read_registers : context_t -> unit
val write_register : context_t -> register -> int32 -> unit
val read_memory : context_t -> int32 -> int -> int list
val write_memory : context_t -> int32 -> int list -> unit
diff --git a/tools/debugger/pdb/Util.ml b/tools/debugger/pdb/Util.ml
index f723630646..4024b3e3cb 100644
--- a/tools/debugger/pdb/Util.ml
+++ b/tools/debugger/pdb/Util.ml
@@ -154,3 +154,12 @@ let send_reply fd reply =
* BUG NEED TO LISTEN FOR REPLY +/- AND POSSIBLY RE-TRANSMIT
*)
+
+(** A few debugger commands such as step 's' and continue 'c' do
+ * not immediately return a response to the debugger. In these
+ * cases we raise No_reply instead.
+ * This is also used by some contexts (such as Linux processes)
+ * which utilize an asynchronous request / response protocol when
+ * communicating with their respective backends.
+ *)
+exception No_reply
diff --git a/tools/debugger/pdb/Xen_domain.ml b/tools/debugger/pdb/Xen_domain.ml
index aeb22307c4..876715a32f 100644
--- a/tools/debugger/pdb/Xen_domain.ml
+++ b/tools/debugger/pdb/Xen_domain.ml
@@ -40,4 +40,4 @@ let get_ring ctx =
let string_of_context ctx =
Printf.sprintf "{xen domain assist} domain: %d" ctx.domain
-external process_response : int32 -> unit = "process_handle_response"
+external process_response : int32 -> int * int * string = "process_handle_response"
diff --git a/tools/debugger/pdb/Xen_domain.mli b/tools/debugger/pdb/Xen_domain.mli
index ae334dcef5..29c1a446f6 100644
--- a/tools/debugger/pdb/Xen_domain.mli
+++ b/tools/debugger/pdb/Xen_domain.mli
@@ -21,5 +21,5 @@ val get_ring : context_t -> int32
val string_of_context : context_t -> string
-val process_response : int32 -> unit
+val process_response : int32 -> int * int * string
diff --git a/tools/debugger/pdb/debugger.ml b/tools/debugger/pdb/debugger.ml
index 4b2f53ad9b..bafef4de06 100644
--- a/tools/debugger/pdb/debugger.ml
+++ b/tools/debugger/pdb/debugger.ml
@@ -12,12 +12,6 @@ open PDB
open Util
open Str
-(** a few debugger commands such as step 's' and continue 'c' do
- * not immediately return a response to the debugger. in these
- * cases we raise No_reply instead.
- *)
-exception No_reply
-
let initialize_debugger () =
()
@@ -295,12 +289,17 @@ let process_xen_domain fd =
let channel = Evtchn.read fd in
let ctx = find_context fd in
+ let (dom, pid, str) =
begin
match ctx with
| Xen_domain d -> Xen_domain.process_response (Xen_domain.get_ring d)
| _ -> failwith ("process_xen_domain called without Xen_domain context")
- end;
-
+ end
+ in
+ let sock = PDB.find_process dom pid in
+ print_endline (Printf.sprintf "(linux) dom:%d pid:%d %s %s"
+ dom pid str (Util.get_connection_info sock));
+ Util.send_reply sock str;
Evtchn.unmask fd channel (* allow next virq *)
diff --git a/tools/debugger/pdb/linux-2.6-module/Makefile b/tools/debugger/pdb/linux-2.6-module/Makefile
index 77dd5f10ca..609596f6c9 100644
--- a/tools/debugger/pdb/linux-2.6-module/Makefile
+++ b/tools/debugger/pdb/linux-2.6-module/Makefile
@@ -1,4 +1,4 @@
-XEN_ROOT=../../../..
+XEN_ROOT = ../../../..
LINUX_DIR = linux-2.6.12-xenU
KDIR = $(XEN_ROOT)/$(LINUX_DIR)
diff --git a/tools/debugger/pdb/linux-2.6-module/debug.c b/tools/debugger/pdb/linux-2.6-module/debug.c
index 744be03b73..ba1825cc30 100644
--- a/tools/debugger/pdb/linux-2.6-module/debug.c
+++ b/tools/debugger/pdb/linux-2.6-module/debug.c
@@ -55,51 +55,71 @@ pdb_detach (int pid)
/*
* from linux-2.6.11/arch/i386/kernel/ptrace.c::getreg()
*/
-int
-pdb_read_register (int pid, pdb_op_rd_reg_p op, unsigned long *dest)
+
+static unsigned long
+_pdb_get_register (struct task_struct *target, int reg)
{
- int rc = 0;
- struct task_struct *target;
+ unsigned long result = ~0UL;
unsigned long offset;
unsigned char *stack = 0L;
- *dest = ~0UL;
-
- read_lock(&tasklist_lock);
- target = find_task_by_pid(pid);
- if (target)
- get_task_struct(target);
- read_unlock(&tasklist_lock);
-
- switch (op->reg)
+ switch (reg)
{
case FS:
- *dest = target->thread.fs;
+ result = target->thread.fs;
break;
case GS:
- *dest = target->thread.gs;
+ result = target->thread.gs;
break;
case DS:
case ES:
case SS:
case CS:
- *dest = 0xffff;
+ result = 0xffff;
/* fall through */
default:
- if (op->reg > GS)
- op->reg -= 2;
+ if (reg > GS)
+ reg -= 2;
- offset = op->reg * sizeof(long);
+ offset = reg * sizeof(long);
offset -= sizeof(struct pt_regs);
stack = (unsigned char *)target->thread.esp0;
stack += offset;
- *dest &= *((int *)stack);
+ result &= *((int *)stack);
}
- /*
- printk ("pdb read register: 0x%x %2d 0x%p 0x%lx\n",
- pid, op->reg, stack, *dest);
- */
+ return result;
+}
+
+int
+pdb_read_register (int pid, pdb_op_rd_regs_p op)
+{
+ int rc = 0;
+ struct task_struct *target;
+
+ read_lock(&tasklist_lock);
+ target = find_task_by_pid(pid);
+ if (target)
+ get_task_struct(target);
+ read_unlock(&tasklist_lock);
+
+ op->reg[ 0] = _pdb_get_register(target, LINUX_EAX);
+ op->reg[ 1] = _pdb_get_register(target, LINUX_ECX);
+ op->reg[ 2] = _pdb_get_register(target, LINUX_EDX);
+ op->reg[ 3] = _pdb_get_register(target, LINUX_EBX);
+ op->reg[ 4] = _pdb_get_register(target, LINUX_ESP);
+ op->reg[ 5] = _pdb_get_register(target, LINUX_EBP);
+ op->reg[ 6] = _pdb_get_register(target, LINUX_ESI);
+ op->reg[ 7] = _pdb_get_register(target, LINUX_EDI);
+ op->reg[ 8] = _pdb_get_register(target, LINUX_EIP);
+ op->reg[ 9] = _pdb_get_register(target, LINUX_EFL);
+
+ op->reg[10] = _pdb_get_register(target, LINUX_CS);
+ op->reg[11] = _pdb_get_register(target, LINUX_SS);
+ op->reg[12] = _pdb_get_register(target, LINUX_DS);
+ op->reg[13] = _pdb_get_register(target, LINUX_ES);
+ op->reg[14] = _pdb_get_register(target, LINUX_FS);
+ op->reg[15] = _pdb_get_register(target, LINUX_GS);
return rc;
}
diff --git a/tools/debugger/pdb/linux-2.6-module/module.c b/tools/debugger/pdb/linux-2.6-module/module.c
index 25273d321f..6da9df82f5 100644
--- a/tools/debugger/pdb/linux-2.6-module/module.c
+++ b/tools/debugger/pdb/linux-2.6-module/module.c
@@ -54,6 +54,10 @@ pdb_process_request (pdb_request_t *request)
{
pdb_response_t resp;
+ resp.operation = request->operation;
+ resp.domain = request->domain;
+ resp.process = request->process;
+
switch (request->operation)
{
case PDB_OPCODE_ATTACH :
@@ -64,9 +68,8 @@ pdb_process_request (pdb_request_t *request)
pdb_detach(request->process);
resp.status = PDB_RESPONSE_OKAY;
break;
- case PDB_OPCODE_RD_REG :
- pdb_read_register(request->process, &request->u.rd_reg,
- (unsigned long *)&resp.value);
+ case PDB_OPCODE_RD_REGS :
+ pdb_read_register(request->process, &resp.u.rd_regs);
resp.status = PDB_RESPONSE_OKAY;
break;
case PDB_OPCODE_WR_REG :
@@ -78,8 +81,6 @@ pdb_process_request (pdb_request_t *request)
resp.status = PDB_RESPONSE_ERROR;
}
- resp.operation = request->operation;
-
pdb_send_response (&resp);
return;
}
diff --git a/tools/debugger/pdb/linux-2.6-module/pdb_module.h b/tools/debugger/pdb/linux-2.6-module/pdb_module.h
index a9f566bade..0c11e6eab5 100644
--- a/tools/debugger/pdb/linux-2.6-module/pdb_module.h
+++ b/tools/debugger/pdb/linux-2.6-module/pdb_module.h
@@ -2,14 +2,16 @@
#ifndef __XEN_PDB_H_
#define __XEN_PDB_H_
+#include "../pdb_caml_xen.h"
+
#define PDB_OPCODE_ATTACH 1
#define PDB_OPCODE_DETACH 2
-#define PDB_OPCODE_RD_REG 3
-typedef struct pdb_op_rd_reg
+#define PDB_OPCODE_RD_REGS 3
+typedef struct pdb_op_rd_regs
{
- u32 reg;
-} pdb_op_rd_reg_t, *pdb_op_rd_reg_p;
+ u32 reg[GDB_REGISTER_FRAME_SIZE];
+} pdb_op_rd_regs_t, *pdb_op_rd_regs_p;
#define PDB_OPCODE_WR_REG 4
typedef struct pdb_op_wr_reg
@@ -25,8 +27,7 @@ typedef struct
u32 process;
union
{
- pdb_op_rd_reg_t rd_reg;
- pdb_op_wr_reg_t wr_reg;
+ pdb_op_wr_reg_t wr_reg;
} u;
} pdb_request_t, *pdb_request_p;
@@ -36,8 +37,13 @@ typedef struct
typedef struct {
u8 operation; /* copied from request */
+ u32 domain;
+ u32 process;
s16 status; /* PDB_RESPONSE_??? */
- u32 value;
+ union
+ {
+ pdb_op_rd_regs_t rd_regs;
+ } u;
} pdb_response_t, *pdb_response_p;
@@ -46,7 +52,7 @@ DEFINE_RING_TYPES(pdb, pdb_request_t, pdb_response_t);
int pdb_attach (int pid);
int pdb_detach (int pid);
-int pdb_read_register (int pid, pdb_op_rd_reg_p op, unsigned long *dest);
+int pdb_read_register (int pid, pdb_op_rd_regs_p op);
int pdb_write_register (int pid, pdb_op_wr_reg_p op);
diff --git a/tools/debugger/pdb/pdb_caml_process.c b/tools/debugger/pdb/pdb_caml_process.c
index 53a014b653..ad1c8bfb6d 100644
--- a/tools/debugger/pdb/pdb_caml_process.c
+++ b/tools/debugger/pdb/pdb_caml_process.c
@@ -66,49 +66,89 @@ send_request (pdb_front_ring_t *pdb_ring, int evtchn, pdb_request_t *request)
}
/*
- * read a response from a pdb domain backend.
+ * process_handle_response : int32 -> int * int * string
*
- * grabs the response off a ring.
+ * A backend domain has notified pdb (via an event channel)
+ * that a command has finished.
+ * We read the result from the channel and formulate a response
+ * as a single string. Also return the domain and process.
*/
-static void
-read_response (pdb_front_ring_t *pdb_ring, pdb_response_p response)
-{
- RING_IDX loop, rp;
-
- rp = pdb_ring->sring->rsp_prod;
- rmb(); /* Ensure we see queued responses up to 'rp'. */
-
- for ( loop = pdb_ring->rsp_cons; loop != rp; loop++ )
- {
- pdb_response_p resp;
- resp = RING_GET_RESPONSE(pdb_ring, loop);
- memcpy(response, resp, sizeof(pdb_response_t));
-
- /*
- printf ("got response %x %x %x\n", response->operation,
- response->status, response->value);
- */
- }
- pdb_ring->rsp_cons = loop;
+static inline unsigned int
+_flip (unsigned int orig)
+{
+ return (((orig << 24) & 0xff000000) | ((orig << 8) & 0x00ff0000) |
+ ((orig >> 8) & 0x0000ff00) | ((orig >> 24) & 0x000000ff));
}
-/*
- * process_handle_response : int32 -> unit
- */
-
value
process_handle_response (value ring)
{
CAMLparam1(ring);
+ CAMLlocal2(result, str);
+ RING_IDX rp;
+ pdb_response_p resp;
pdb_front_ring_t *my_ring = (pdb_front_ring_t *)Int32_val(ring);
- pdb_response_t resp;
+ char msg[2048];
+ int msglen;
- if ( my_ring )
- read_response(my_ring, &resp);
+ memset(msg, 0, sizeof(msg));
- CAMLreturn(Val_unit);
+ rp = my_ring->sring->rsp_prod;
+ rmb(); /* Ensure we see queued responses up to 'rp'. */
+
+ sprintf(msg, "OK");
+
+ /* for ( loop = my_ring->rsp_cons; loop != rp; loop++ ) */
+ if (my_ring->rsp_cons != rp)
+ {
+ resp = RING_GET_RESPONSE(my_ring, my_ring->rsp_cons);
+
+ switch (resp->operation)
+ {
+ case PDB_OPCODE_ATTACH :
+ case PDB_OPCODE_DETACH :
+ break;
+
+ case PDB_OPCODE_RD_REGS :
+ {
+ int loop;
+ pdb_op_rd_regs_p regs = &resp->u.rd_regs;
+
+ for (loop = 0; loop < GDB_REGISTER_FRAME_SIZE * 8; loop += 8)
+ {
+ sprintf(&msg[loop], "%08x", _flip(regs->reg[loop >> 3]));
+ }
+
+ break;
+ }
+
+ case PDB_OPCODE_WR_REG :
+ {
+ printf("(linux) wr regs\n");
+ /* should check the return status */
+ break;
+ }
+ default :
+ printf("(process) UNKNOWN MESSAGE TYPE IN RESPONSE\n");
+ break;
+ }
+
+ my_ring->rsp_cons++;
+ }
+ /* my_ring->rsp_cons = loop; */
+
+ msglen = strlen(msg);
+ result = caml_alloc(3,0);
+ str = alloc_string(msglen);
+ memmove(&Byte(str,0), msg, msglen);
+
+ Store_field(result, 0, Val_int(resp->domain));
+ Store_field(result, 1, Val_int(resp->process));
+ Store_field(result, 2, str);
+
+ CAMLreturn(result);
}
/*
@@ -120,28 +160,15 @@ proc_attach_debugger (value context)
CAMLparam1(context);
context_t ctx;
pdb_request_t req;
- pdb_response_t resp;
decode_context(&ctx, context);
- printf("(pdb) attach process [%d.%d] %d %p\n", ctx.domain, ctx.process,
- ctx.evtchn, ctx.ring);
- fflush(stdout);
-
req.operation = PDB_OPCODE_ATTACH;
req.domain = ctx.domain;
req.process = ctx.process;
send_request (ctx.ring, ctx.evtchn, &req);
- printf("awaiting response\n");
- fflush(stdout);
-
- read_response (ctx.ring, &resp);
-
- printf("response %d %d\n", resp.operation, resp.status);
- fflush(stdout);
-
CAMLreturn(Val_unit);
}
@@ -191,56 +218,25 @@ proc_pause_target (value context)
/*
- * proc_read_registers : context_t -> int32
+ * proc_read_registers : context_t -> unit
*/
value
proc_read_registers (value context)
{
CAMLparam1(context);
- CAMLlocal1(result);
-
- u32 regs[REGISTER_FRAME_SIZE];
pdb_request_t req;
context_t ctx;
- int loop;
decode_context(&ctx, context);
- req.operation = PDB_OPCODE_RD_REG;
+ req.operation = PDB_OPCODE_RD_REGS;
req.domain = ctx.domain;
req.process = ctx.process;
- for (loop = 0; loop < REGISTER_FRAME_SIZE; loop++)
- {
- pdb_response_t resp;
-
- req.u.rd_reg.reg = loop;
- send_request(ctx.ring, ctx.evtchn, &req);
- read_response(ctx.ring, &resp);
- regs[loop] = resp.value;
- }
-
- result = caml_alloc_tuple(16);
-
- Store_field(result, 0, caml_copy_int32(regs[LINUX_EAX]));
- Store_field(result, 1, caml_copy_int32(regs[LINUX_ECX]));
- Store_field(result, 2, caml_copy_int32(regs[LINUX_EDX]));
- Store_field(result, 3, caml_copy_int32(regs[LINUX_EBX]));
- Store_field(result, 4, caml_copy_int32(regs[LINUX_ESP]));
- Store_field(result, 5, caml_copy_int32(regs[LINUX_EBP]));
- Store_field(result, 6, caml_copy_int32(regs[LINUX_ESI]));
- Store_field(result, 7, caml_copy_int32(regs[LINUX_EDI]));
- Store_field(result, 8, caml_copy_int32(regs[LINUX_EIP]));
- Store_field(result, 9, caml_copy_int32(regs[LINUX_EFL]));
- Store_field(result, 10, caml_copy_int32(regs[LINUX_CS])); /* 16 */
- Store_field(result, 11, caml_copy_int32(regs[LINUX_SS])); /* 16 */
- Store_field(result, 12, caml_copy_int32(regs[LINUX_DS])); /* 16 */
- Store_field(result, 13, caml_copy_int32(regs[LINUX_ES])); /* 16 */
- Store_field(result, 14, caml_copy_int32(regs[LINUX_FS])); /* 16 */
- Store_field(result, 15, caml_copy_int32(regs[LINUX_GS])); /* 16 */
+ send_request (ctx.ring, ctx.evtchn, &req);
- CAMLreturn(result);
+ CAMLreturn(Val_unit);
}
@@ -257,7 +253,6 @@ proc_write_register (value context, value reg, value newval)
context_t ctx;
pdb_request_t req;
- pdb_response_t resp;
decode_context(&ctx, context);
@@ -290,7 +285,6 @@ proc_write_register (value context, value reg, value newval)
}
send_request(ctx.ring, ctx.evtchn, &req);
- read_response(ctx.ring, &resp);
CAMLreturn(Val_unit);
}
diff --git a/tools/debugger/pdb/pdb_caml_xen.h b/tools/debugger/pdb/pdb_caml_xen.h
index c4dcf5c717..c31ef8ed94 100644
--- a/tools/debugger/pdb/pdb_caml_xen.h
+++ b/tools/debugger/pdb/pdb_caml_xen.h
@@ -10,11 +10,12 @@
#ifndef _PDB_CAML_XEN_DEFINED_
#define _PDB_CAML_XEN_DEFINED_
-enum gdb_registers { GDB_EAX, GDB_ECX, GDB_EDX, GDB_EBX,
- GDB_ESP, GDB_EBP, GDB_ESI, GDB_EDI,
- GDB_EIP, GDB_EFL,
- GDB_CS, GDB_SS, GDB_DS, GDB_ES,
- GDB_FS, GDB_GS };
+enum gdb_registers { /* 32 */ GDB_EAX, GDB_ECX, GDB_EDX, GDB_EBX,
+ GDB_ESP, GDB_EBP, GDB_ESI, GDB_EDI,
+ GDB_EIP, GDB_EFL,
+ /* 16 */ GDB_CS, GDB_SS, GDB_DS, GDB_ES,
+ GDB_FS, GDB_GS };
+#define GDB_REGISTER_FRAME_SIZE 16
/* this order comes from linux-2.6.11/include/asm-i386/ptrace.h */
enum x86_registers { LINUX_EBX, LINUX_ECX, LINUX_EDX, LINUX_ESI, LINUX_EDI,
@@ -24,7 +25,11 @@ enum x86_registers { LINUX_EBX, LINUX_ECX, LINUX_EDX, LINUX_ESI, LINUX_EDI,
#define REGISTER_FRAME_SIZE 17
+/* hack: this is also included from the pdb linux module which
+ has PAGE_SIZE defined */
+#ifndef PAGE_SIZE
#define PAGE_SIZE 4096
+#endif
extern int xc_handle;
diff --git a/tools/debugger/pdb/server.ml b/tools/debugger/pdb/server.ml
index 01b4c2565d..b2f7f0be81 100644
--- a/tools/debugger/pdb/server.ml
+++ b/tools/debugger/pdb/server.ml
@@ -9,7 +9,7 @@
open Unix
open Buffer
-
+open Util
(**
* connection_t: The state for each connection.
@@ -98,7 +98,7 @@ let process_input conn sock =
(String.escaped reply));
Util.send_reply sock reply
with
- Debugger.No_reply ->
+ Util.No_reply ->
print_endline (Printf.sprintf "[%s] %s -> null"
(Util.get_connection_info sock)
(String.escaped command))