From: Maynard J. <may...@us...> - 2010-01-20 19:06:50
|
Randell Jesup wrote: > I'm using Oprofile 0.9.6, running natively on an ARM under 2.6.10 with > kernel support. > > I'm trying to look at a profile on an embedded device (where the > binaries are typically stripped and readonly/compressed). I have access > to vmlinux and the un-stripped binaries/libraries in a sub-tree (not a > full filesystem image: --root doesn't work). > > The problem is that even with --image-path, opreport seems to use the > original file to fetch the symbols from. Since the original location is > read-only, I can't replace it with the with-symbols copy. I've tried a > number of variations on --image-path; --root doesn't work, and I've > tried looking at the app, the library directly, etc. > > Any way to override debug symbol reading and make image-path take > precedence if the image is found? (Or at least if no symbols are found > in the canonical location)? If opreport does not find symbol info in the sampled binary, it checks to see if it contains a gnu-debuglink that indicates a separate debuginfo file has been created. If so, there are several standard locations opreport will look for the debuginfo file. If you pass an image-path argument, it will look there, too. Most distros will provide separate debuginfo files for libraries. If this is a distro-supplied library and there's a corresponding debuginfo rpm, then just install that rpm -- no need to use --image-path. If you (or someone else) builds the library in question, then make sure a separate debuginfo file is created. You can place the debuginfo file anywhere you want on the target system, and use the --image-path to tell opreport to look there. For a binary 'foo' that initially contains debug info . . . $ objcopy --only-keep-debug foo foo.debuginfo $ objcopy --strip-debug foo $ objcopy --add-gnu-debuglink=foo.debuginfo foo -Maynard > > Note: I used the trick from the OLPC laptop debugging page to capture the > data -- I had real problems trying to do it with --session-dir pointed > to /usr/proj/whatever > > rm -rf /var/lib/oprofile > mkdir /var/lib/oprofile > mount -t ramfs none /var/lib/oprofile > opcontrol --setup --vmlinux=/boot/vmlinux --separate=library > opcontrol --start > opcontrol --shutdown > > Thanks for any pointers or ideas! > > > $ opreport --verbose=all --symbols --image-path=/usr/proj/xyzzy/target /usr/lib/libxyzzy.so.4 /usr/lib/libxyzzy.so.4 > > Archive: > Matched sample files: 1 > /var/lib/oprofile/samples/current/{root}/opt/bin/xyzzy/{dep}/{root}/usr/lib/lib/libxyzzy.so.4/TIMER.0.0.all.all.all > profile_classes: > event: > cpuinfo: CPU: CPU with timer interrupt, speed 0 MHz (estimated) > class #0: > name: TIMER:0 > longname: Profiling through timer interrupt > ptemplate: > event: TIMER > count: 0 > unitmask: 0 > tgid: all > tid: all > cpu: all > profiles_set #0: > image: /opt/bin/xyzzy > profile_dep_set #0: > lib_image: /usr/lib/libxyzzy.so.4 > profile_sample_files #0: > sample_filename: /var/lib/oprofile/samples/current/{root}/opt/bin/xyzzy/{dep}/{root}/usr/lib/libxyzzy.so.4/TIMER.0.0.all.all.all > callgraph filenames: > > CPU: CPU with timer interrupt, speed 0 MHz (estimated) > Profiling through timer interrupt > op_bfd ctor for /usr/lib/libxyzzy.so.4 > bfd_info::get_symbols() for /usr/lib/libxyzzy.so.4 > bfd_get_symtab_upper_bound: 4 > bfd_canonicalize_symtab: 0 > fetching .gnu_debuglink section > failed to process separate debug file > number of symbols before filtering 1 > number of symbols now 1 > start_offset is now 0 > symbol /usr/lib/libxyzzy.so.4, value 0 > start 0, end 8609a0 > samples % image name symbol name > 2445 100.000 libxyzzy.so.4 /usr/lib/libxyzzy.so.4 > |