]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Synthesise and deliver SIGTRAP to clients when requested to do so by vex.
authorJulian Seward <jseward@acm.org>
Tue, 7 Feb 2006 20:56:41 +0000 (20:56 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 7 Feb 2006 20:56:41 +0000 (20:56 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5617

coregrind/m_scheduler/scheduler.c
coregrind/m_signals.c
coregrind/pub_core_signals.h
include/vki-linux.h

index 4e91e624b7e7f238c2c78f8a126c14fd02986f00..1b62f1a692d87f1817ed4e8ae62b0e808100b44c 100644 (file)
@@ -950,6 +950,10 @@ VgSchedReturnCode VG_(scheduler) ( ThreadId tid )
          break;
       }
 
+      case VEX_TRC_JMP_TRAP:
+         VG_(synth_sigtrap)(tid);
+         break;
+
       case VEX_TRC_JMP_NODECODE:
 #define M(a) VG_(message)(Vg_UserMsg, a);
    M("Your program just tried to execute an instruction that Valgrind" );
index 9198482b85ed343c595f7b9202fcaa275156f0f3..079cdb38b0369f02ceda2bacad70d0610808f093 100644 (file)
@@ -1352,6 +1352,20 @@ void VG_(synth_sigill)(ThreadId tid, Addr addr)
    deliver_signal(tid, &info);
 }
 
+// Synthesise a SIGTRAP.
+void VG_(synth_sigtrap)(ThreadId tid)
+{
+   vki_siginfo_t info;
+
+   vg_assert(VG_(threads)[tid].status == VgTs_Runnable);
+
+   info.si_signo = VKI_SIGTRAP;
+   info.si_code = VKI_TRAP_TRACE; /* jrs: no idea what this should be */
+
+   resume_scheduler(tid);
+   deliver_signal(tid, &info);
+}
+
 /* Make a signal pending for a thread, for later delivery.
    VG_(poll_signals) will arrange for it to be delivered at the right
    time. 
index e96825345e0c6a755a336cd75264d419c226c570..ddc601581f90e4eb9566315a76f4c73e494f50b5 100644 (file)
@@ -72,6 +72,7 @@ extern void VG_(synth_fault)        (ThreadId tid);
 extern void VG_(synth_fault_mapping)(ThreadId tid, Addr addr);
 extern void VG_(synth_fault_perms)  (ThreadId tid, Addr addr);
 extern void VG_(synth_sigill)       (ThreadId tid, Addr addr);
+extern void VG_(synth_sigtrap)      (ThreadId tid);
 
 /* Extend the stack to cover addr, if possible */
 extern Bool VG_(extend_stack)(Addr addr, UInt maxsize);
index 5232596afcde50b0c1e41f7dc9eddf9cca523112..2108e14a5f35a83c54a324254d84492c94d3ae38 100644 (file)
@@ -429,6 +429,12 @@ typedef struct vki_siginfo {
 #define VKI_BUS_ADRERR (__VKI_SI_FAULT|2)      /* non-existant physical address */
 #define VKI_BUS_OBJERR (__VKI_SI_FAULT|3)      /* object specific hardware error */
 
+/*
+ * SIGTRAP si_codes
+ */
+#define VKI_TRAP_BRKPT      (__VKI_SI_FAULT|1)  /* process breakpoint */
+#define VKI_TRAP_TRACE      (__VKI_SI_FAULT|2)  /* process trace trap */
+
 /*
  * This works because the alignment is ok on all current architectures
  * but we leave open this being overridden in the future