how to get the real mem addr

72 views
Skip to first unread message

liang fang

unread,
Apr 7, 2022, 9:11:27 PM4/7/22
to DynamoRIO Users

i'm using libmemtrace_simple.so to record the mem access,and i print the add in the test code like this:

void test(void)
{
char data = (char)malloc(100);
printf("data 0x%x\n", data);
}
the result in the code which show "data 0x20e55670." but in the memtrace.a.out.02859.0000.log it show 0x7f0a20e55670,why?how could i get the real addr?

besides. i want to capture the memaddr and  show the result as struct member?any example?

Derek Bruening

unread,
Apr 10, 2022, 2:24:52 PM4/10/22
to liang fang, DynamoRIO Users
The memtrace sample client is recording the addresses of loads and stores of machine instructions.  Your sample C code doesn't look like it stores or reads anything from the malloc area so I would not expect to see that address in the trace.  You might see the allocator storing into a header at a lower address.

If your goal is to see calls to malloc and other heap allocations, you could use the drmemtrace tracer which has function parameter and return address tracing.  You would pass -record_heap to the drcachesim tool: https://dynamorio.org/sec_drcachesim_funcs.html.

--
You received this message because you are subscribed to the Google Groups "DynamoRIO Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dynamorio-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dynamorio-users/55207cf8-3a40-4108-812f-f70a4483134an%40googlegroups.com.

liang fang

unread,
Apr 19, 2022, 1:33:56 PM4/19/22
to DynamoRIO Users
do you have cmd example for drmemory, i don't know how use it. 

Derek Bruening

unread,
Apr 20, 2022, 1:06:45 PM4/20/22
to liang fang, DynamoRIO Users
There was no mention of drmemory in my message so it seems rather a non sequitur to ask about it, but there is extensive documentation: did you read the docs?  https://drmemory.org/

liang fang

unread,
Apr 21, 2022, 12:43:20 AM4/21/22
to DynamoRIO Users
i have check the  https://drmemory.org/. no such memtrace document.

liang fang

unread,
Apr 21, 2022, 12:49:56 AM4/21/22
to DynamoRIO Users
while i using valgrind --tool=lacky to test, the mem addr is the same the app, but for memtrace_simple.so of dynamoRIO, the mem addr of "0x20e55670" in the app become 0x7f0a20e55670

Derek Bruening

unread,
Apr 21, 2022, 9:53:57 AM4/21/22
to liang fang, DynamoRIO Users
You are confusing the words: drmemory != drmemtrace

liang fang

unread,
Apr 24, 2022, 12:21:24 PM4/24/22
to DynamoRIO Users
i make a misstake, the bin is x86_64, the size of pointer is 8byte, it should output with  printf("data 0x%lx\n", data); it works now.
Reply all
Reply to author
Forward
0 new messages