Why this simple case hang

42 views
Skip to first unread message

haitao wang

unread,
Jan 30, 2024, 11:39:12 AMJan 30
to Dr. Memory Users
I'm a newbie to drmemory and I tried this simple test case,
which includes a invalid store.

------------------------------ mem_test.c --------
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>

int main(int argc, char * argv[])
{
    int  * p=(int*)malloc(100*sizeof(int));

    p[100]=1;

     free(p);

    return 0;

}
--------------------------------------
however, when I tried drmory by this command

drmemory -- ./mem_test

It get stuck in a deadloop. 

while valgrind can work perfect and detect the error correctly.

Is there anything wrong in my test?  and any suggestion?

Thanks,

Haitao




Derek Bruening

unread,
Jan 31, 2024, 10:47:32 AMJan 31
to drmemor...@googlegroups.com
You didn't provide important details like what version of drmemory, what OS version, what architecture, compilation command, etc.
It seems to work fine when I try it:

$ bin64/drmemory -- ~/dr/test/drmem-user

~~Dr.M~~ Dr. Memory version 2.6.0

~~Dr.M~~ 

~~Dr.M~~ Error #1: UNADDRESSABLE ACCESS beyond heap bounds: writing 0x00007f7129800330-0x00007f7129800334 4 byte(s)

~~Dr.M~~ # 0 main      

~~Dr.M~~ Note: @0:00:00.344 in thread 2898892

~~Dr.M~~ Note: refers to 0 byte(s) beyond last valid byte in prior malloc

~~Dr.M~~ Note: prev lower malloc:  0x00007f71298001a0-0x00007f7129800330

~~Dr.M~~ Note: instruction: mov    $0x00000001 -> (%rax)


--

---
You received this message because you are subscribed to the Google Groups "Dr. Memory Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drmemory-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drmemory-users/d4b5b9ab-96f0-4c4b-a048-27bb684f6c4an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages