On Tue, 2012-08-14 at 10:20 +0000, Adishesh wrote:
> Hi,
>
> I have used below program for testing. Below are the steps I have
> followed.
> Compile: gcc -g3 test_shm.c -o test_shm
> Create shared memory: ./test_shm –c
> Get shared memory without valgrind: ./test_shm –g ( this works fine)
> Get with valgrind: /usr/bin/valgrind --tool=memcheck --leak-check=full
> --track-origins=yes --log-file=/tmp/val_log /home/rtp99/test_shm –g
> With valgrind shmat command fails.
Can you try again after applying the attached patch ?
Thanks
Philippe
Index: coregrind/m_syswrap/syswrap-generic.c
===================================================================
--- coregrind/m_syswrap/syswrap-generic.c (revision 12872)
+++ coregrind/m_syswrap/syswrap-generic.c (working copy)
@@ -1700,7 +1700,7 @@
/* ------ */
static
-UInt get_shm_size ( Int shmid )
+SizeT get_shm_size ( Int shmid )
{
#ifdef __NR_shmctl
# ifdef VKI_IPC_64
@@ -1725,7 +1725,7 @@
if (sr_isError(__res))
return 0;
- return buf.shm_segsz;
+ return (SizeT) buf.shm_segsz;
}
UWord
@@ -1733,7 +1733,7 @@
UWord arg0, UWord arg1, UWord arg2 )
{
/* void *shmat(int shmid, const void *shmaddr, int shmflg); */
- UInt segmentSize = get_shm_size ( arg0 );
+ SizeT segmentSize = get_shm_size ( arg0 );
UWord tmp;
Bool ok;
if (arg1 == 0) {
@@ -1768,7 +1768,7 @@
UWord res,
UWord arg0, UWord arg1, UWord arg2 )
{
- UInt segmentSize = VG_PGROUNDUP(get_shm_size(arg0));
+ SizeT segmentSize = VG_PGROUNDUP(get_shm_size(arg0));
if ( segmentSize > 0 ) {
UInt prot = VKI_PROT_READ|VKI_PROT_WRITE;
Bool d;
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users