Bug 12773 - invoke abrt-action-debuginfo-install --id=XXXXX if missing debuginfo
Summary: invoke abrt-action-debuginfo-install --id=XXXXX if missing debuginfo
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Chris Meek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-17 16:23 UTC by Frank Ch. Eigler
Modified: 2011-08-30 14:30 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Ch. Eigler 2011-05-17 16:23:32 UTC
On fedora rawhide, ABRT has been extended with an interface we
could use to fetch dwarf stuff on demand.  We could suggest or
even invoke this widget in the rpm-finder code.

https://bugzilla.redhat.com/show_bug.cgi?id=585039
Comment 1 Frank Ch. Eigler 2011-05-30 20:38:25 UTC
mjw advises the following scheme may work.  In setupdwfl.cxx, replace
dwfl_standard_find_debuginfo with a new function of our own.  This
function would:
- call dwfl_module_build_id to find the build-id hex string of interest
- run dwfl_build_id_find_debuginfo to see if it's already installed
- check whether /usr/bin/abrt-action-debuginfo-install exists
- try to run it with   --id=XXXXX  
- if it fails, set a flag so we don't try again
- tail-call through to  return dwfl_standard_find_debuginfo();
Comment 2 Frank Ch. Eigler 2011-07-04 21:21:05 UTC
With fedora15 abrt-2.0.3-1.fc15.x86_64, the following works:

% eu-readelf -x .note.gnu.build-id /usr/bin/zip # for example

Hex dump of section [3] '.note.gnu.build-id', 36 bytes at offset 0x23c:
  0x00000000 04000000 14000000 03000000 474e5500 ............GNU.
  0x00000010 b038a398 648e7c04 6fd298aa c20b70bb .8..d.|.o.....p.
  0x00000020 9d4a2f05                            .J/.

% echo b038a398648e7c046fd298aac20b70bb9d4a2f05 | abrt-action-install-debuginfo-to-abrt-cache -y --ids=-
[...]

% ls /var/cache/abrt-di/usr/lib/debug/.build-id/b0/38a398648e7c046fd298aac20b70bb9d4a2f05
[...]
Comment 3 Mark Wielaard 2011-07-04 21:48:09 UTC
(In reply to comment #2)
> % eu-readelf -x .note.gnu.build-id /usr/bin/zip # for example

FYI.
eu-readelf -n or eu-unzip -n give a slightly easier way to read the build-id:

$ eu-readelf -n /usr/bin/zip

Note section [ 2] '.note.ABI-tag' of 32 bytes at offset 0x148:
  Owner          Data size  Type
  GNU                   16  VERSION
    OS: Linux, ABI: 2.6.32

Note section [ 3] '.note.gnu.build-id' of 36 bytes at offset 0x168:
  Owner          Data size  Type
  GNU                   20  GNU_BUILD_ID
    Build ID: d39236960645ea293a34c2af6761a74b821e231d

$ eu-unstrip -n -e /usr/bin/zip
0x8047000+0x80580 d39236960645ea293a34c2af6761a74b821e231d@0x8047178 /usr/bin/zip -
Comment 4 Chris Meek 2011-08-30 14:30:40 UTC
Implemented with the following major commits:

- Commit: e1e8b44e3293090f29262beb1b0762951b833e62
Use abrt to download and install debuginfo

  dwflpp.cxx
    - In setup_user(), pass the session to setup_dwfl_user().

  setupdwfl.cxx
    - Added internal_find_debuginfo() and
      execute_abrt_action_install_debuginfo_to_abrt_cache() to call
      abrt to automatically download and install the needed debuginfo.

  setupdwfl.h
    - Added function declarations.

  util.h
    Added hex_dump() to convert a binary string to a hex string.

- Commit: ea60076d16b4ac271464f5a259ba3767085bd682
Added --download-debuginfo= option

 Possible values for option:

 'yes':      Automatically download debuginfo - no timeout.
             Also, if no value is given to the option, it
             is the same as this.
 'no':       Do not automatically download debuginfo. Also
             if the option is not specified at all, it
             defaults to this.
 'ask':      Show output from abrt, including file size of
             needed debuginfo, and make it wait for user
             input before downloading.
 '<number>'  A positive number, in seconds, to represent
             the timeout to use when downloading. If the
             download takes longer than this, it will
             abort the download.

 **NOTE** Due to a few bugs in abrt, both the 'ask' feature
 and the 'timeout' feature will not work properly. In terms
 of the 'ask feature (BZ726192), it will ask the user, but
 abrt then assumes 'yes' right away and continues the
 download. When this is fixed in abrt, stap should function
 properly. In terms of the timeout feature (BZ730107), stap
 does stop if a timeout occurs, but the download process
 continues to completion.

- Commit: 9f11a75c623a3a8bb919532b68b0772ea16d53a6
Added Kernel Debuginfo Support

NOTE: Due to BZ733690, abrt cannot download the kernel-debuginfo.
As soon as that bug is fixed, this feature should work.

  setupdwfl.cxx
    - Added get_kernel_build_id_from_notes()
        - This is used to extract the build ID hex string
          from /sys/kernel/notes
    - Added download_kernel_debuginfo(systemtap_session &s)
        - This attempts to extract the build ID hex string
          from /lib/modules/<release>/build/vmlinux.id and
          if it fails, it calls the above function. It then
          calls abrt to attempt to download the associated
          debuginfo.
  setupdwfl.cxx
    Added function declarations for the above.