Bug 5850

Summary: how do I trace cairo calls in gtk-demo
Product: frysk Reporter: Andrew Cagney <cagney>
Component: generalAssignee: Petr Machata <pmachata>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 2245, 5846    

Description Andrew Cagney 2008-03-03 21:30:40 UTC
For instance:
  ftrace -sym '*cairo*' /usr/bin/gtk-demo
or
  ftrace -sym @libcairo.so /usr/bin/gtk-demo
or?
Comment 1 Petr Machata 2008-03-04 09:13:57 UTC
This would work if cairo is not stripped:
  ftrace -sym='@libcairo*'
otherwise you can only trace dynamic symbols:
  ftrace -dyn='@libcairo*'

Separate debuginfo doesn't help, ftrace doesn't have the necessary functionality
implemented.  I guess this will be available for free when I teach ftrace to set
breakpoint on arbitrary location (bug 5696), right?
Comment 2 Andrew Cagney 2008-03-04 15:17:00 UTC
Ok, I'm starting to see the differences between -sym and -dyn.

-sym is for an arbitrary symbol?
-dyn is all entry points

part of the bug here is likely documentation helping to clarify this.  I also
wonder if a -library <blah> would be more directly understandable?  I'm not sure
that typical uses want to learn the differences between plt and dynamic tables :-)
Comment 3 Petr Machata 2008-03-04 17:21:40 UTC
Once 5696 is resolved, we can consolidate the tracing interface.  I agree and
myself feel it's due.

Right now the behavior is:
 -sym: look for the symbols inside symbol table
 -dyn: look for the symbols inside dynamic symbol table (trace exported symbols)
 -plt: place the breakpoint on PLT entry (trace "imported" symbols)

Re the documentation, I try to keep ftrace man page up to date with all the
necessary explanations.  I just checked that it's included in the latest
greatest frysk Fedora package.
Comment 4 Petr Machata 2008-06-13 12:50:18 UTC
The commandline to use is:
  ftrace -sym=cairo_* -- /usr/bin/gtk-demo
or
  ftrace -sym=plt:cairo_* -- /usr/bin/gtk-demo
depending on whether you are after where the calls end (the first case) or where
the calls originate (the second case).

Calls that end in libcairo can be traced like this:
  ftrace -sym=#libcairo*#* -- /usr/bin/gtk-demo
(which can be combined with plt: again)

This didn't get it into 0.4, but is in git, which means it should be in 0.5 at
the end of June or early July.