|
From: Mike C. <tu...@gm...> - 2010-09-17 14:36:32
|
I've tried several times over the years to use the callgrind options --dump-before, --dump-after, --zero-before, etc., with a C++ program, and I've never been able to get these dumps to happen. Are these implemented? I've tried using the function names as they appear in kcachegrind and I've tried using the mangled names as they appear in 'nm -a' output, both with and without the leading underscore, but it never seems to work. Any hints? Mike P.S. Could someone change the mailing list info page to note that non-subscribers cannot post to this list? |
|
From: Josef W. <Jos...@gm...> - 2010-09-18 05:59:00
|
On Friday 17 September 2010, Mike Coleman wrote: > I've tried several times over the years to use the callgrind options > --dump-before, --dump-after, --zero-before, etc., with a C++ program, > and I've never been able to get these dumps to happen. > > Are these implemented? I've tried using the function names as they > appear in kcachegrind and I've tried using the mangled names as they > appear in 'nm -a' output, both with and without the leading > underscore, but it never seems to work. Hmm. They should work... With C++, the full signature is part of the function name. It is easier to use wildcards, e.g. "--dump-after=foo*" to trigger a dump whenever a function starting with "foo" is left. Josef > > Any hints? > > Mike > > > P.S. Could someone change the mailing list info page to note that > non-subscribers cannot post to this list? > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |
|
From: Mike C. <tu...@gm...> - 2010-09-25 15:09:31
|
On Sat, Sep 18, 2010 at 12:58 AM, Josef Weidendorfer <Jos...@gm...> wrote: > On Friday 17 September 2010, Mike Coleman wrote: >> I've tried several times over the years to use the callgrind options >> --dump-before, --dump-after, --zero-before, etc., with a C++ program, >> and I've never been able to get these dumps to happen. >> >> Are these implemented? I've tried using the function names as they >> appear in kcachegrind and I've tried using the mangled names as they >> appear in 'nm -a' output, both with and without the leading >> underscore, but it never seems to work. > > Hmm. They should work... > > With C++, the full signature is part of the function name. > It is easier to use wildcards, e.g. "--dump-after=foo*" to trigger > a dump whenever a function starting with "foo" is left. Hadn't seen the wildcard thing documented anywhere. That should make life simpler, though I still couldn't get it to fire. If I just say "--dump-after=*f*" (quoted from the shell, of course), would you expect that to fire? I'm a little unclear on whether this works with (say) template class functions in namespaces, etc. Has anyone ever actually seen this work? Googling doesn't turn up much. Mike |
|
From: Josef W. <Jos...@gm...> - 2010-09-27 18:58:36
|
On Saturday 25 September 2010, Mike Coleman wrote:
> > With C++, the full signature is part of the function name.
> > It is easier to use wildcards, e.g. "--dump-after=foo*" to trigger
> > a dump whenever a function starting with "foo" is left.
>
> Hadn't seen the wildcard thing documented anywhere.
Ooops.
This should get a top priority on my TODO list. Thanks for pointing out.
It works like shell globbing, with wildcards "*" (0 or more unknown chars)
and "?" (exactly one unknown char).
> That should make
> life simpler, though I still couldn't get it to fire. If I just say
> "--dump-after=*f*" (quoted from the shell, of course), would you
> expect that to fire?
Yes. Quoting should not even be needed, as you probably do not have a
file starting with "--dump-after=".
E.g. running
valgrind --tool=callgrind --dump-after=*f* ls
gives me tons of dumps here (I had to kill it).
Every dump contains the dump reason ("trigger"). After above example,
if I do
grep Trigger callgrind.out.*
I get
callgrind.out.15169.1:desc: Trigger: --dump-after=open_verify
callgrind.out.15169.10:desc: Trigger: --dump-after=_dl_map_object_from_fd
callgrind.out.15169.100:desc: Trigger: --dump-after=_IO_file_doallocate
callgrind.out.15169.1000:desc: Trigger: --dump-after=_dl_sysinfo_int80
callgrind.out.15169.10000:desc: Trigger: --dump-after=0x08051bcf
callgrind.out.15169.10001:desc: Trigger: --dump-after=0x08051bcf
callgrind.out.15169.10002:desc: Trigger: --dump-after=0x08051bcf
callgrind.out.15169.10003:desc: Trigger: --dump-after=gobble_file
...
It even matches against addresses of funtion entries if no debug info is found.
What version of Valgrind are you using?
> I'm a little unclear on whether this works with (say) template class
> functions in namespaces, etc.
Callgrind does the matching against demangled symbol names (unless you run with
"--demangle=no"), and these contain class name and namespaces.
> Has anyone ever actually seen this
> work? Googling doesn't turn up much.
Hmm.. I probably should add a regression test for this.
But as you see above, it works at least for me...
Josef
>
> Mike
>
|
|
From: Josef W. <Jos...@gm...> - 2010-09-27 19:08:56
|
Correcting myself... On Monday 27 September 2010, Josef Weidendorfer wrote: > On Saturday 25 September 2010, Mike Coleman wrote: > > Hadn't seen the wildcard thing documented anywhere. > > Ooops. > This should get a top priority on my TODO list. Thanks for pointing out. > It works like shell globbing, with wildcards "*" (0 or more unknown chars) > and "?" (exactly one unknown char). This *is* documented in the Callgrind manual, see http://valgrind.org/docs/manual/cl-manual.html In 6.2.1 under "Dumping at enter/leave of specified functions": "Function specifications support wildcards: e.g. use --dump-before='foo*' to generate dumps before entering any function starting with foo." In 6.3. "Callgrind Command-line Options": "Some options allow the specification of a function/symbol name, such as --dump-before=function, or --fn-skip=function. All these options can be specified multiple times for different functions. In addition, the function specifications actually are patterns by supporting the use of wildcards '*' (zero or more arbitrary characters) and '?' (exactly one arbitrary character), similar to file name globbing in the shell. This feature is important especially for C++, as without wildcard usage, the function would have to be specified in full extent, including parameter signature." Where did you expect the documentation of wildcards in addition to the above? Josef |