[Help] There is the problem.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Help] There is the problem.

Wuweijia

HI:

    I ran the valgrind with sh cmd. There is no output. That is why?

    

 

Run the valgrind cmd:   valgrind --xml=yes --xml-file=./r.xml sh -c ./test0

 

The output as below:

fd=4, errno=0

va=0x2800

0

 

There is no xml file generated;

 

The code (tes0) as below:

#include <stdio.h>

#include <stdlib.h>

#include<fcntl.h>

#include <sys/types.h>

#include<sys/mman.h>

#include<unistd.h>

#include<string.h>

 

#define ALLOC_SIZE 1024  * 10

 

int main(int argc, char ** argv) {

        int fd = open("./test.log", O_RDWR );

        int errno = 0;

        int tmp = 0;

        printf("fd=%d, errno=%d\n", fd, errno);

        while(1) {

                void * va = mmap(NULL, ALLOC_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);

                printf("va=%p\n");

                tmp = *((int *)va + 5);

                printf("%d\n", tmp);

                munmap(va, ALLOC_SIZE);

                usleep(1000 * 100);

                break;

        }

 

        close(fd);

        return 0;

}

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Help] There is the problem.

Alex Bligh

> On 1 Apr 2017, at 12:22, Wuweijia <[hidden email]> wrote:
>
>     I ran the valgrind with sh cmd. There is no output. That is why?
>      
>  
> Run the valgrind cmd:   valgrind --xml=yes --xml-file=./r.xml sh -c ./test0

You're running valgrind on sh, not on test0. Is that intentional?

--
Alex Bligh





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

答复: [Help] There is the problem.

Wuweijia
no, I ran the valgrind on sh, but sh call applicant test0; test0 is the external tools

-----邮件原件-----
发件人: Alex Bligh [mailto:[hidden email]]
发送时间: 2017年4月2日 23:13
收件人: Wuweijia <[hidden email]>
抄送: Alex Bligh <[hidden email]>; [hidden email]; Fanbohao <[hidden email]>
主题: Re: [Valgrind-users] [Help] There is the problem.


> On 1 Apr 2017, at 12:22, Wuweijia <[hidden email]> wrote:
>
>     I ran the valgrind with sh cmd. There is no output. That is why?
>      
>  
> Run the valgrind cmd:   valgrind --xml=yes --xml-file=./r.xml sh -c ./test0

You're running valgrind on sh, not on test0. Is that intentional?

--
Alex Bligh




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 答复: [Help] There is the problem.

Philippe Waroquiers
With the below command, valgrind will only analyse the shell sh.
If you want to analyse what is launched by the shell, then you have
to give the option --trace-children=yes

Philippe

     

On Wed, 2017-04-05 at 01:08 +0000, Wuweijia wrote:

> no, I ran the valgrind on sh, but sh call applicant test0; test0 is the external tools
>
> -----邮件原件-----
> 发件人: Alex Bligh [mailto:[hidden email]]
> 发送时间: 2017年4月2日 23:13
> 收件人: Wuweijia <[hidden email]>
> 抄送: Alex Bligh <[hidden email]>; [hidden email]; Fanbohao <[hidden email]>
> 主题: Re: [Valgrind-users] [Help] There is the problem.
>
>
> > On 1 Apr 2017, at 12:22, Wuweijia <[hidden email]> wrote:
> >
> >     I ran the valgrind with sh cmd. There is no output. That is why?
> >      
> >  
> > Run the valgrind cmd:   valgrind --xml=yes --xml-file=./r.xml sh -c ./test0
>
> You're running valgrind on sh, not on test0. Is that intentional?
>
> --
> Alex Bligh
>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Valgrind-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/valgrind-users



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
Loading...