Skip to content

Commit 91f6278

Browse files
author
sewardj
committed
Handle emulation-warnings emitted by Vex-generated code.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3152 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent c54ee50 commit 91f6278

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

coregrind/core_asm.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,23 @@
3737
/* This file is included in all Valgrind source files, including
3838
assembly ones. */
3939

40+
4041
/* Magic values that the guest state might be set to when returning to the
4142
dispatcher. The only other legitimate value is to point to the
4243
start of the thread's VEX guest state. These also are return values from
4344
VG_(run_innerloop) to the scheduler.
4445
*/
45-
/* Defines values for JMP_SYSCALL, JMP_CLIENTREQ and JMP_YIELD */
46+
/* Defines values for JMP_EMWARN, JMP_SYSCALL, JMP_CLIENTREQ and
47+
JMP_YIELD */
4648
#include "libvex_trc_values.h"
4749

48-
/* and some more of our own ... */
50+
/* And some more of our own. These must not have the same values as
51+
those from libvex_trc_values.h. */
4952
#define VG_TRC_INNER_FASTMISS 31 /* TRC only; means fast-cache miss. */
5053
#define VG_TRC_INNER_COUNTERZERO 29 /* TRC only; means bb ctr == 0 */
5154
#define VG_TRC_UNRESUMABLE_SIGNAL 37 /* TRC only; got sigsegv/sigbus */
5255

56+
5357
/* Constants for the fast translation lookup cache. */
5458
#define VG_TT_FAST_BITS 15
5559
#define VG_TT_FAST_SIZE (1 << VG_TT_FAST_BITS)

coregrind/vg_scheduler.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,20 @@ VgSchedReturnCode do_scheduler ( Int* exitcode, ThreadId* last_run_tid )
900900
continue; /* with this thread */
901901
}
902902

903+
if (trc == VEX_TRC_JMP_EMWARN) {
904+
VexEmWarn ew
905+
= (VexEmWarn)VG_(threads)[tid].arch.vex.guest_EMWARN;
906+
HChar* what
907+
= (ew < 0 || ew >= EmWarn_NUMBER)
908+
? "unknown (?!)"
909+
: LibVEX_EmWarn_string(ew);
910+
VG_(message)( Vg_UserMsg,
911+
"Emulation warning: unsupported action:");
912+
VG_(message)( Vg_UserMsg, " %s", what);
913+
VG_(pp_ExeContext) ( VG_(get_ExeContext) ( tid ) );
914+
continue; /* with this thread */
915+
}
916+
903917
if (trc == VEX_TRC_JMP_CLIENTREQ) {
904918
UWord* args = (UWord*)(CLREQ_ARGS(VG_(threads)[tid].arch));
905919
UWord reqno = args[0];
@@ -908,7 +922,7 @@ VgSchedReturnCode do_scheduler ( Int* exitcode, ThreadId* last_run_tid )
908922
/* Are we really absolutely totally quitting? */
909923
if (reqno == VG_USERREQ__LIBC_FREERES_DONE) {
910924
if (0 || VG_(clo_trace_syscalls) || VG_(clo_trace_sched)) {
911-
VG_(message)(Vg_DebugMsg,
925+
VG_(message)(Vg_DebugMsg,
912926
"__libc_freeres() done; really quitting!");
913927
}
914928
return VgSrc_ExitSyscall;
@@ -923,7 +937,7 @@ VgSchedReturnCode do_scheduler ( Int* exitcode, ThreadId* last_run_tid )
923937
continue; /* with this thread */
924938
else
925939
goto stage1;
926-
}
940+
}
927941

928942
if (trc == VEX_TRC_JMP_SYSCALL) {
929943
/* Do a syscall for the vthread tid. This could cause it

0 commit comments

Comments
 (0)