ia64/xen-unstable

changeset 5771:09be5b1bdeb0

pdb: reconcile register manipulation between processes and domains
author ach61@arcadians.cl.cam.ac.uk
date Wed Jul 13 15:37:08 2005 +0000 (2005-07-13)
parents 57b2fa8bf11d
children 9d2ca2da280e
files tools/debugger/pdb/debugger.ml tools/debugger/pdb/pdb_caml_domain.c tools/debugger/pdb/pdb_caml_process.c tools/debugger/pdb/pdb_caml_xen.h
line diff
     1.1 --- a/tools/debugger/pdb/debugger.ml	Wed Jul 13 15:04:49 2005 +0000
     1.2 +++ b/tools/debugger/pdb/debugger.ml	Wed Jul 13 15:37:08 2005 +0000
     1.3 @@ -331,7 +331,7 @@ let process_xen_virq fd =
     1.4    let (dom, vcpu) = List.find find_pair dom_list in
     1.5    let vec = 3 in
     1.6    let sock = PDB.find_domain dom vcpu in
     1.7 -  print_endline (Printf.sprintf "handle bkpt d:%d ed:%d v:%d  %s" 
     1.8 +  print_endline (Printf.sprintf "handle bkpt dom:%d vcpu:%d vec:%d  %s" 
     1.9  		   dom vcpu vec (Util.get_connection_info sock));
    1.10    Util.send_reply sock "S05";
    1.11    Evtchn.unmask fd channel                                (* allow next virq *)
     2.1 --- a/tools/debugger/pdb/pdb_caml_domain.c	Wed Jul 13 15:04:49 2005 +0000
     2.2 +++ b/tools/debugger/pdb/pdb_caml_domain.c	Wed Jul 13 15:37:08 2005 +0000
     2.3 @@ -20,12 +20,6 @@
     2.4  
     2.5  #include "pdb_caml_xen.h"
     2.6  
     2.7 -/* this order comes from xen/include/public/arch-x86_32.h */
     2.8 -enum x86_registers { PDB_EBX, PDB_ECX, PDB_EDX, PDB_ESI, PDB_EDI,
     2.9 -                     PDB_EBP, PDB_EAX, PDB_Error_code, PDB_Entry_vector, 
    2.10 -                     PDB_EIP, PDB_CS, PDB_EFLAGS, PDB_ESP, PDB_SS,
    2.11 -                     PDB_ES, PDB_DS, PDB_FS, PDB_GS };
    2.12 -
    2.13  typedef struct
    2.14  {
    2.15      int domain;
    2.16 @@ -119,26 +113,25 @@ dom_write_register (value context, value
    2.17  
    2.18      switch (my_reg)
    2.19      {
    2.20 -    case PDB_EBX: regs->ebx = val; break;
    2.21 -    case PDB_ECX: regs->ecx = val; break;
    2.22 -    case PDB_EDX: regs->edx = val; break;
    2.23 -    case PDB_ESI: regs->esi = val; break;
    2.24 -    case PDB_EDI: regs->edi = val; break;
    2.25 +    case GDB_EAX: regs->eax = val; break;
    2.26 +    case GDB_ECX: regs->ecx = val; break;
    2.27 +    case GDB_EDX: regs->edx = val; break;
    2.28 +    case GDB_EBX: regs->ebx = val; break;
    2.29  
    2.30 -    case PDB_EBP: regs->ebp = val; break;
    2.31 -    case PDB_EAX: regs->eax = val; break;
    2.32 -    case PDB_Error_code: regs->error_code = val; break;
    2.33 -    case PDB_Entry_vector: regs->entry_vector = val; break;
    2.34 +    case GDB_ESP: regs->esp = val; break;
    2.35 +    case GDB_EBP: regs->ebp = val; break;
    2.36 +    case GDB_ESI: regs->esi = val; break;
    2.37 +    case GDB_EDI: regs->edi = val; break;
    2.38   
    2.39 -    case PDB_EIP: regs->eip = val; break;
    2.40 -    case PDB_CS:  regs->cs  = val; break;
    2.41 -    case PDB_EFLAGS: regs->eflags = val; break;
    2.42 -    case PDB_ESP: regs->esp = val; break;
    2.43 -    case PDB_SS:  regs->ss  = val; break;
    2.44 -    case PDB_ES:  regs->es  = val; break;
    2.45 -    case PDB_DS:  regs->ds  = val; break;
    2.46 -    case PDB_FS:  regs->fs  = val; break;
    2.47 -    case PDB_GS:  regs->gs  = val; break;
    2.48 +    case GDB_EIP: regs->eip = val; break;
    2.49 +    case GDB_EFL: regs->eflags = val; break;
    2.50 +
    2.51 +    case GDB_CS:  regs->cs  = val; break;
    2.52 +    case GDB_SS:  regs->ss  = val; break;
    2.53 +    case GDB_DS:  regs->ds  = val; break;
    2.54 +    case GDB_ES:  regs->es  = val; break;
    2.55 +    case GDB_FS:  regs->fs  = val; break;
    2.56 +    case GDB_GS:  regs->gs  = val; break;
    2.57      }
    2.58  
    2.59      if ( xendebug_write_registers(xc_handle, ctx.domain, ctx.vcpu, regs) )
    2.60 @@ -437,9 +430,10 @@ query_domain_stop (value unit)
    2.61          failwith("query domain stop");
    2.62      }
    2.63  
    2.64 -    printf ("QDS: %d\n", count);
    2.65 +    printf ("QDS [%d]: \n", count);
    2.66      for (loop = 0; loop < count; loop ++)
    2.67 -        printf ("  %d %d\n", loop, dom_list[loop]);
    2.68 +        printf (" %d", dom_list[loop]);
    2.69 +    printf ("\n");
    2.70  
    2.71      result = caml_alloc(2,0);
    2.72      if ( count > 0 )                                                  /* car */
     3.1 --- a/tools/debugger/pdb/pdb_caml_process.c	Wed Jul 13 15:04:49 2005 +0000
     3.2 +++ b/tools/debugger/pdb/pdb_caml_process.c	Wed Jul 13 15:37:08 2005 +0000
     3.3 @@ -22,13 +22,6 @@
     3.4  #include "pdb_module.h"
     3.5  #include "pdb_caml_xen.h"
     3.6  
     3.7 -/* this order comes from linux-2.6.11/include/asm-i386/ptrace.h */
     3.8 -enum x86_registers { LINUX_EBX, LINUX_ECX, LINUX_EDX, LINUX_ESI, LINUX_EDI,
     3.9 -                     LINUX_EBP, LINUX_EAX, LINUX_DS,  LINUX_ES,  LINUX_FS,
    3.10 -                     LINUX_GS,  LINUX_ORIG_EAX, LINUX_EIP, LINUX_CS, LINUX_EFL,
    3.11 -                     LINUX_ESP, LINUX_SS };
    3.12 -#define FRAME_SIZE 17
    3.13 -
    3.14  typedef struct
    3.15  {
    3.16      int domain;
    3.17 @@ -206,7 +199,7 @@ proc_read_registers (value context)
    3.18      CAMLparam1(context);
    3.19      CAMLlocal1(result);
    3.20  
    3.21 -    u32 regs[FRAME_SIZE];
    3.22 +    u32 regs[REGISTER_FRAME_SIZE];
    3.23  
    3.24      pdb_request_t req;
    3.25      context_t ctx;
    3.26 @@ -218,7 +211,7 @@ proc_read_registers (value context)
    3.27      req.domain  = ctx.domain;
    3.28      req.process = ctx.process;
    3.29  
    3.30 -    for (loop = 0; loop < FRAME_SIZE; loop++)
    3.31 +    for (loop = 0; loop < REGISTER_FRAME_SIZE; loop++)
    3.32      {
    3.33          pdb_response_t resp;
    3.34  
     4.1 --- a/tools/debugger/pdb/pdb_caml_xen.h	Wed Jul 13 15:04:49 2005 +0000
     4.2 +++ b/tools/debugger/pdb/pdb_caml_xen.h	Wed Jul 13 15:37:08 2005 +0000
     4.3 @@ -16,6 +16,14 @@ enum gdb_registers { GDB_EAX, GDB_ECX, G
     4.4                       GDB_CS,  GDB_SS,  GDB_DS,  GDB_ES,
     4.5                       GDB_FS,  GDB_GS };
     4.6  
     4.7 +/* this order comes from linux-2.6.11/include/asm-i386/ptrace.h */
     4.8 +enum x86_registers { LINUX_EBX, LINUX_ECX, LINUX_EDX, LINUX_ESI, LINUX_EDI,
     4.9 +                     LINUX_EBP, LINUX_EAX, LINUX_DS,  LINUX_ES,  LINUX_FS,
    4.10 +                     LINUX_GS,  LINUX_ORIG_EAX, LINUX_EIP, LINUX_CS, LINUX_EFL,
    4.11 +                     LINUX_ESP, LINUX_SS };
    4.12 +#define REGISTER_FRAME_SIZE 17
    4.13 +
    4.14 +
    4.15  #define PAGE_SIZE 4096
    4.16  
    4.17  extern int xc_handle;