[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    valgrind/coregrind
From:       Nicholas Nethercote <njn25 () cam ! ac ! uk>
Date:       2004-09-13 15:19:34
Message-ID: 20040913151934.C0F9324FD () office ! kde ! org
[Download RAW message or body]

CVS commit by nethercote: 


Arch-abstraction:
- abstract out reg filling for core dumps


  M +18 -5     core.h   1.29
  M +11 -70    vg_signals.c   1.88


--- valgrind/coregrind/core.h  #1.28:1.29
@@ -1510,4 +1510,22 @@ extern UInt* VGA_(reg_addr_from_BB)  ( I
 extern UInt* VGA_(reg_addr_from_tst) ( Int reg, arch_thread_t* );
 
+// Pointercheck
+extern Bool VGA_(setup_pointercheck) ( void );
+
+// For attaching the debugger
+extern Int  VGA_(ptrace_setregs_from_BB)  ( Int pid );
+extern Int  VGA_(ptrace_setregs_from_tst) ( Int pid, arch_thread_t* arch );
+
+// Making coredumps
+extern void VGA_(fill_elfregs_from_BB)     ( struct user_regs_struct* regs );
+extern void VGA_(fill_elfregs_from_tst)    ( struct user_regs_struct* regs,
+                                             const arch_thread_t* arch );
+extern void VGA_(fill_elffpregs_from_BB)   ( elf_fpregset_t* fpu );
+extern void VGA_(fill_elffpregs_from_tst)  ( elf_fpregset_t* fpu,
+                                             const arch_thread_t* arch );
+extern void VGA_(fill_elffpxregs_from_BB)  ( elf_fpxregset_t* xfpu );
+extern void VGA_(fill_elffpxregs_from_tst) ( elf_fpxregset_t* xfpu,
+                                             const arch_thread_t* arch );
+
 // Signal stuff
 extern void VGA_(push_signal_frame) ( ThreadId tid, Addr esp_top_of_frame,
@@ -1517,10 +1535,5 @@ extern void VGA_(push_signal_frame) ( Th
 extern Int  VGA_(pop_signal_frame)  ( ThreadId tid );
 
-// Pointercheck
-extern Bool VGA_(setup_pointercheck) ( void );
 
-// For attaching the debugger
-extern Int  VGA_(ptrace_setregs_from_BB)  ( Int pid );
-extern Int  VGA_(ptrace_setregs_from_tst) ( Int pid, arch_thread_t* arch );
 
 /* ---------------------------------------------------------------------

--- valgrind/coregrind/vg_signals.c  #1.87:1.88
@@ -825,9 +825,6 @@ static void set_main_sigmask(void)
    ------------------------------------------------------------------ */
 
-
-
 /* Set up a stack frame (VgSigContext) for the client's signal
-   handler.  This includes the signal number and a bogus return
-   address.  */
+   handler. */
 static
 void vg_push_signal_frame ( ThreadId tid, const vki_ksiginfo_t *siginfo )
@@ -1167,41 +1164,7 @@ static void fill_prstatus(const ThreadSt
 
    if (VG_(is_running_thread)(tst->tid)) {
-      regs->eflags = VG_(baseBlock)[VGOFF_(m_eflags)];
-      regs->esp = VG_(baseBlock)[VGOFF_(m_esp)];
-      regs->eip = VG_(baseBlock)[VGOFF_(m_eip)];
-
-      regs->ebx = VG_(baseBlock)[VGOFF_(m_ebx)];
-      regs->ecx = VG_(baseBlock)[VGOFF_(m_ecx)];
-      regs->edx = VG_(baseBlock)[VGOFF_(m_edx)];
-      regs->esi = VG_(baseBlock)[VGOFF_(m_esi)];
-      regs->edi = VG_(baseBlock)[VGOFF_(m_edi)];
-      regs->ebp = VG_(baseBlock)[VGOFF_(m_ebp)];
-      regs->eax = VG_(baseBlock)[VGOFF_(m_eax)];
-
-      regs->cs = VG_(baseBlock)[VGOFF_(m_cs)];
-      regs->ds = VG_(baseBlock)[VGOFF_(m_ds)];
-      regs->ss = VG_(baseBlock)[VGOFF_(m_ss)];
-      regs->es = VG_(baseBlock)[VGOFF_(m_es)];
-      regs->fs = VG_(baseBlock)[VGOFF_(m_fs)];
-      regs->gs = VG_(baseBlock)[VGOFF_(m_gs)];
+      VGA_(fill_elfregs_from_BB)(regs);
    } else {
-      regs->eflags = tst->arch.m_eflags;
-      regs->esp = tst->arch.m_esp;
-      regs->eip = tst->arch.m_eip;
-
-      regs->ebx = tst->arch.m_ebx;
-      regs->ecx = tst->arch.m_ecx;
-      regs->edx = tst->arch.m_edx;
-      regs->esi = tst->arch.m_esi;
-      regs->edi = tst->arch.m_edi;
-      regs->ebp = tst->arch.m_ebp;
-      regs->eax = tst->arch.m_eax;
-
-      regs->cs = tst->arch.m_cs;
-      regs->ds = tst->arch.m_ds;
-      regs->ss = tst->arch.m_ss;
-      regs->es = tst->arch.m_es;
-      regs->fs = tst->arch.m_fs;
-      regs->gs = tst->arch.m_gs;
+      VGA_(fill_elfregs_from_tst)(regs, &tst->arch);
    }
 }
@@ -1209,38 +1172,16 @@ static void fill_prstatus(const ThreadSt
 static void fill_fpu(const ThreadState *tst, elf_fpregset_t *fpu)
 {
-   const Char *from;
-
-   if (VG_(is_running_thread)(tst->tid)) {
-      from = (const Char *)&VG_(baseBlock)[VGOFF_(m_ssestate)];
-   } else {
-      from = (const Char *)&tst->arch.m_sse;
-   }
-
-   if (VG_(have_ssestate)) {
-      UShort *to;
-      Int i;
-
-      /* This is what the kernel does */
-      VG_(memcpy)(fpu, from, 7*sizeof(long));
-   
-      to = (UShort *)&fpu->st_space[0];
-      from += 18 * sizeof(UShort);
-
-      for(i = 0; i < 8; i++, to += 5, from += 8) 
-         VG_(memcpy)(to, from, 5*sizeof(UShort));
-   } else
-      VG_(memcpy)(fpu, from, sizeof(*fpu));
+   if (VG_(is_running_thread)(tst->tid))
+      VGA_(fill_elffpregs_from_BB)(fpu);
+   else
+      VGA_(fill_elffpregs_from_tst)(fpu, &tst->arch);
 }
 
 static void fill_xfpu(const ThreadState *tst, elf_fpxregset_t *xfpu)
 {
-   UShort *from;
-
    if (VG_(is_running_thread)(tst->tid)) 
-      from = (UShort *)&VG_(baseBlock)[VGOFF_(m_ssestate)];
+      VGA_(fill_elffpxregs_from_BB)(xfpu);
    else 
-      from = (UShort *)tst->arch.m_sse;
-
-   VG_(memcpy)(xfpu, from, sizeof(*xfpu));
+      VGA_(fill_elffpxregs_from_tst)(xfpu, &tst->arch);
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic