Hi,

I'm writing a new tool that will generate a data dependency graph(on
x86 Ubuntu). As the first step, I have modified the 'instrument' function
inside  'none' tool so that you write to a shadow memory for each 'store'
statement as follows.

....
case Ist_Store:{
         di = unsafeIRDirty_0_N( 2, "write_sm",VG_(fnptr_to_fnentry)(
&write_sm), mkIRExprVec_2(s->Ist.Store.addr,s->Ist.Store.data) );
                addStmtToIRSB( sbOut, IRStmt_Dirty(di) );
addStmtToIRSB( sbOut, s );
         break;
}
.....

//where 'write_sm' is as follows.

void write_sm(Addr a, UInt v){

UInt high=a>>16;
UInt low=a & 0x0000ffff;
 Spage *p=primary_map[high];

if(!p){
 p = VG_(am_shadow_alloc)(sizeof(Spage));
}
p->data[low]=v;
}


//where the structures I use for shadow memory is as follows

typedef
struct {
 UInt data[65536];
 }
Spage;

static Spage* primary_map[65536];
static Spage default_map;
Int i=0;

static void init_sm (void){
VG_(printf)("Init ");
 VG_(printf)( "\n");
for(i=0;i<65536;i++){
default_map.data[i]=0;
 }
for(i=0;i<65536;i++){
primary_map[i]=&default_map;
 }
}

I get the following error when I try to run this with a small program that
adds two numbers.

u...@ubuntu:~$ ./cs510/bin/valgrind --tool=none --run-libc-freeres=no
 /home/user/term_project/valgrindnew/valgrindnew/a.out
Init
==22420== Nulgrind, the minimal Valgrind tool
==22420== Copyright (C) 2002-2009, and GNU GPL'd, by Nicholas Nethercote.
==22420== Using Valgrind-3.6.0.SVN and LibVEX; rerun with -h for copyright
info
==22420== Command: /home/user/term_project/valgrindnew/valgrindnew/a.out
==22420==

vex: priv/host_x86_isel.c:530 (doHelperCall): Assertion
`typeOfIRExpr(env->type_env, args[i]) == Ity_I32' failed.
vex storage: T total 555424 bytes allocated
vex storage: P total 360 bytes allocated

valgrind: the 'impossible' happened:
   LibVEX called failure_exit().
==22420==    at 0x38077EA5: report_and_quit (m_libcassert.c:191)
==22420==    by 0x38077F06: panic (m_libcassert.c:275)
==22420==    by 0x38077F5D: vgPlain_core_panic_at (m_libcassert.c:280)
==22420==    by 0x38077F78: vgPlain_core_panic (m_libcassert.c:285)
==22420==    by 0x38017F96: failure_exit (m_translate.c:674)
==22420==    by 0x3809B9A3: vex_assert_fail (main_util.c:230)
==22420==    by 0x380FD30E: doHelperCall (host_x86_isel.c:530)
==22420==    by 0x38103FD5: iselSB_X86 (host_x86_isel.c:3829)
==22420==    by 0x3809A380: LibVEX_Translate (main_main.c:598)
==22420==    by 0x38015691: vgPlain_translate (m_translate.c:1518)
==22420==    by 0x3803C2C1: vgPlain_scheduler (scheduler.c:857)
==22420==    by 0x38069AA4: run_a_thread_NORETURN (syswrap-linux.c:94)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==22420==    at 0x4000DB9: ??? (in /lib/ld-2.10.1.so)
==22420==    by 0x4000856: ??? (in /lib/ld-2.10.1.so)


And I'm unable to figure whats wrong by looking at this. Suggestions on
debugging are highly appreciated.

Thanks.
-- 
Indika
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to