Changeset 9145


Ignore:
Timestamp:
Apr 13, 2008, 4:25:18 AM (12 years ago)
Author:
rme
Message:

Include lispdcmd.h for print_lisp_object prototype.

bit_for_regnum: new function

show_lisp_register: consult node_regs_mask when printing values of lisp regs

debug_lisp_registers, debug_show_registers, debug_show_fpu: additions for
32-bit x86

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ia32/lisp-kernel/lisp-debug.c

    r8372 r9145  
    2020#include "area.h"
    2121#include "Threads.h"
     22#include "lispdcmd.h"
    2223#include <ctype.h>
    2324#include <stdio.h>
     
    119120#endif
    120121
     122#ifdef X8632
     123int bit_for_regnum(int r)
     124{
     125  switch (r) {
     126  case REG_EAX: return 1<<0;
     127  case REG_ECX: return 1<<1;
     128  case REG_EDX: return 1<<2;
     129  case REG_EBX: return 1<<3;
     130  case REG_ESP: return 1<<4;
     131  case REG_EBP: return 1<<5;
     132  case REG_ESI: return 1<<6;
     133  case REG_EDI: return 1<<7;
     134  }
     135}
     136#endif
     137
    121138void
    122139show_lisp_register(ExceptionInformation *xp, char *label, int r)
     
    128145  fprintf(stderr, "r%02d (%s) = %s\n", r, label, print_lisp_object(val));
    129146#endif
    130 #ifdef X86
     147#ifdef X8664
    131148  fprintf(stderr, "%%%s (%s) = %s\n",Iregnames[r], label, print_lisp_object(val));
     149#endif
     150#ifdef X8632
     151  {
     152    TCR *tcr = get_tcr(false);
     153    char *s;
     154
     155    if (tcr && (tcr->node_regs_mask & bit_for_regnum(r)) == 0)
     156      s = "marked as unboxed";
     157    else
     158      s = print_lisp_object(val);
     159
     160    fprintf(stderr, "%%%s (%s) = %s\n",Iregnames[r], label, s);
     161  }
    132162#endif
    133163
     
    406436  }
    407437#endif
     438
     439#ifdef X8632
     440  show_lisp_register(xp, "arg_z", Iarg_z);
     441  show_lisp_register(xp, "arg_y", Iarg_y);
     442  fprintf(stderr,"------\n");
     443  show_lisp_register(xp, "fn", Ifn);
     444  fprintf(stderr,"------\n");
     445  show_lisp_register(xp, "temp0", Itemp0);
     446  show_lisp_register(xp, "temp1", Itemp1);
     447  fprintf(stderr,"------\n");
     448  if (tag_of(xpGPR(xp,Inargs)) == tag_fixnum) {
     449    fprintf(stderr,"%%edx (nargs) = %d (maybe)\n", unbox_fixnum(xpGPR(xp,Inargs)));
     450  }
     451#endif
     452 
    408453  return debug_continue;
    409454}
     
    601646
    602647#ifdef X8632
    603   fprintf(stderr, "%%eax = 0x%08X  %%ebx = 0x%08X\n  %%ecx = 0x%08X  %%edx = 0x%08X\n",
    604           xpGPR(xp, REG_EAX), xpGPR(xp, REG_EBX), xpGPR(xp, REG_ECX), xpGPR(xp, REG_EDX));
    605   fprintf(stderr, "%%edi = 0x%08X  %%esi = 0x%08X\n  %%ebp = 0x%08X  %%esp = 0x%08X\n",
    606           xpGPR(xp, REG_EDI), xpGPR(xp, REG_ESI), xpGPR(xp, REG_EBP), xpGPR(xp, REG_ESP));
    607   fprintf(stderr, "%%eip = 0x%08X  %%eflags = 0x%08X\n",
    608           xpGPR(xp, REG_EIP), xpGPR(xp, REG_EFL));
     648  fprintf(stderr, "%%eax = 0x%08X\n", xpGPR(xp, REG_EAX));
     649  fprintf(stderr, "%%ecx = 0x%08X\n", xpGPR(xp, REG_ECX));
     650  fprintf(stderr, "%%edx = 0x%08X\n", xpGPR(xp, REG_EDX));
     651  fprintf(stderr, "%%ebx = 0x%08X\n", xpGPR(xp, REG_EBX));
     652  fprintf(stderr, "%%esp = 0x%08X\n", xpGPR(xp, REG_ESP));
     653  fprintf(stderr, "%%ebp = 0x%08X\n", xpGPR(xp, REG_EBP));
     654  fprintf(stderr, "%%esi = 0x%08X\n", xpGPR(xp, REG_ESI));
     655  fprintf(stderr, "%%edi = 0x%08X\n", xpGPR(xp, REG_EDI));
     656  fprintf(stderr, "%%eip = 0x%08X\n", xpGPR(xp, REG_EIP));
     657  fprintf(stderr, "%%eflags = 0x%08X\n", xpGPR(xp, REG_EFL));
    609658#endif
    610659
     
    660709          );
    661710#endif 
     711#ifdef X8632
     712#ifdef DARWIN
     713  struct xmm {
     714    char fpdata[8];
     715  };
     716  struct xmm *xmmp = (struct xmm *)(xpFPRvector(xp));
     717
     718  for (i = 0; i < 8; i++, xmmp++) {
     719    float *sp = (float *)xmmp;
     720    dp = (double *)xmmp;
     721    np = (int *)xmmp;
     722    fprintf(stderr, "f%1d: 0x%08x (%e), 0x%08x%08x (%e)\n", i, *np,
     723            (double)(*sp), np[1], np[0], *dp);
     724  }
     725  fprintf(stderr, "mxcsr = 0x%08x\n", UC_MCONTEXT(xp)->__fs.__fpu_mxcsr);
     726#endif
     727#endif
     728
    662729  return debug_continue;
    663730}
     
    909976  fprintf(stderr, "? for help\n");
    910977  while (state == debug_continue) {
    911     fprintf(stderr, "[%d] OpenMCL kernel debugger: ", main_thread_pid);
     978    fprintf(stderr, "[%d] CCL kernel debugger: ", main_thread_pid);
    912979    state = apply_debug_command(xp, readc(), info, why);
    913980  }
Note: See TracChangeset for help on using the changeset viewer.