From: Julian Seward Date: Tue, 7 Feb 2006 20:56:41 +0000 (+0000) Subject: Synthesise and deliver SIGTRAP to clients when requested to do so by vex. X-Git-Tag: svn/VALGRIND_3_2_0~294 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd1dbcc10f76d0c2cc1b98dd75080c9eb89659b3;p=thirdparty%2Fvalgrind.git Synthesise and deliver SIGTRAP to clients when requested to do so by vex. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5617 --- diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index 4e91e624b7..1b62f1a692 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -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" ); diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index 9198482b85..079cdb38b0 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -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. diff --git a/coregrind/pub_core_signals.h b/coregrind/pub_core_signals.h index e96825345e..ddc601581f 100644 --- a/coregrind/pub_core_signals.h +++ b/coregrind/pub_core_signals.h @@ -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); diff --git a/include/vki-linux.h b/include/vki-linux.h index 5232596afc..2108e14a5f 100644 --- a/include/vki-linux.h +++ b/include/vki-linux.h @@ -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