1

I am trying to find ways to use oprofile on a stripped binary yet still get detailed information when symbol tables are available later, but so far I haven't find any solution.

Here is my situation: Our software is shipped to our customer stripped, but we have unstripped version on our build machine. When we have a software crash, the backtrace can be sent back and we can interpret it with local unstripped build.

Since oprofile is about taking samples and interpreting samples, is there a way to de-couple this process? Is there a way for oprofile/opreport to generate hex-address based profile information that can be interpretted on a different machine with all symbols available. Maybe I can do so by copying back the sample files?

I am sure it must be possible, so I am reaching out to the experts for advice. Detailed steps would be nice.

Thanks in advance.

Junping
  • 619
  • 7
  • 9

1 Answers1

2

I found a way to do it. It might not be the best, but I am surprised this didn't generate enough interest.

Say you have a binary called "mybin" and running its stripped version at customer site. Here would be my procedure:

  1. Ask the customer (or your field engineer) run oprofile, the whole nine yard (setup, start, dump and shutdown), then do:

    tar czf OP-`date +"%Y%m%d%H%M%S"`.tgz /var/lib/oprofile
    

    and ship that back.

  2. On your build machine, do the following

    mkdir /tmp/migrate && cd /tmp/migrate
    tar xzf OP-*.tgz
    

    Now you can check the overall CPU usage on target, by

    opreport -% --session-dir=/tmp/migrate/var/lib/oprofile
    

    If your "mybin" is built under /home/nobody/build/1.2.0/, you can use

    opreport -l mybin --image-path /home/nobody/build/1.2.0/ --session-dir=/tmp/migrate/var/lib/oprofile
    

    to see the details just for "mybin".

Junping
  • 619
  • 7
  • 9