2009/11/6 Jeff Johnson <[email protected]>: > > On Nov 6, 2009, at 10:30 AM, Frank Lahm wrote: > >> 2009/11/6 Jeff Johnson <[email protected]>: >>> >>> On Nov 6, 2009, at 9:55 AM, Frank Lahm wrote: >>>> >>>> ==3960== Error: can not open cache simulation output file >>>> `/home/frank/callgrind.out.3473' >>>> >>> >>> The simplest hack-o-round is to create the file >>> before invoking callgrind, and ensure that it has >>> the permissions that the child requires to write the file. >>> >>> Use --callgrind-out-file to pass in the file to use. >>> >>> Here's is the silly wrapper I use with callgrind because >>> I can never remember the details: >>> >>> hth >> >> It might, but as far as I understand you workaround, the child will >> still write to the same file as the parent?! >> > > Yes. you will need to create the file, and ensure that > the file is writable by the child after root is dropped. > > The script I included shows how to use --callgrind-out-file, nothing more. > >> I can achieve the same easily in my situation, because after I start >> the main process and before any child forks I can easily chmod/chown >> the file so that the child can write to it. > > That will work. > >> I've tried that once, and indeed the client wrote its dump there once >> it exited. But: as soon as I also quit the parent, the parent wrote >> it's dump to the file, overwriting the stuff from the child. >> Afaik the processes ought to write to different files, right? >> > > I can't say when callgrind chooses to dump data. But there are ways > to turn off callgrind at specific points, which should flush at that point. > > Perhaps simplest is add a --debug option to _NOT_ drop root if/when > callgrind > is being used. > > Another approach would be to replace the child executable path with > a wrapper that reinvokes callgrind on the original (but renamed) executable > but specifies a different callgrind file path than the parent's. > > One of those diddle-ups should get you past the problem of dropping root > privs, > yet being able to use callgrind on the parent/child pair.
Ok, thanks! With some of that I will get allong. I'm only interested in the dump data of the child, so I don't care if the parents data is foobared. But I still don't understand why the processes dont write to their own file. I mean if the parent had pid 1 and child had pid, shouldn't they dump to callgrind.out.1 and callgrind.out.2 respectively in the first place? A bug? -Frank ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Valgrind-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/valgrind-users
