|
From: Vadim A. <av...@gm...> - 2008-10-06 17:09:02
|
Hi!
I'm a student of the Moscow State University, faculty of computational
mathematics and cybernetics. Now I'm working on valgrind's tool, which can
help to decompile programs. I want to analyze variables' values to
understand, which types these variables have (also I want to analyze
pointers, and I think, that I can do it. The main difference between simple
variables and pointers - their values. Pointers have very specific values).
But I have some troubles with valgrind's core. I can't understand, how to
get variables' values correctly. I'm trying to work with it by follow code:
VG_(track_pre_mem_read) (fb_pre_mem_read);
VG_(track_pre_mem_write) (fb_pre_mem_write);
VG_(track_post_mem_write) (fb_post_mem_write);
void fb_post_mem_write(CorePart part, ThreadId tid, Addr a, SizeT size)
{
if (size == 4)
VG_(message)(Vg_DebugMsg, "post_mem_write %u %d %u\n\r", (unsigned
int)size, *((int*)a), a);
}
void fb_pre_mem_write(CorePart part, ThreadId tid, Addr a, SizeT size)
{
if (size == 4)
VG_(message)(Vg_DebugMsg, "pre_mem_write %u %d %u\n\r", (unsigned
int)size, *((int*)a), a);
}
void fb_pre_mem_read(CorePart part, ThreadId tid, Char* s, Addr a, SizeT
size) {
if (size == 4) {
VG_(message)(Vg_DebugMsg, "%d", (int)*s);
VG_(message)(Vg_DebugMsg, "pre_mem_read %u %d %u\n\r", (unsigned
int)size, *((int*)a), a);
}
}
But I can't understand, why it doesn't work.
Values, which are printed by these code aren't values of my program, which
i'm analyzing.
Can you help me?
P.S. Also I tried to work with registers by VG_(track_pre_reg_read) and
VG_(track_post_reg_write), but I also had only strange values on them...
--
Best regards,
Antonov Vadim
mailto: av...@gm...
mobile: +79099933666
|