Bug 1882311 - GDB/LLDB cannot step into libsystemd functions
Summary: GDB/LLDB cannot step into libsystemd functions
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 33
Hardware: x86_64
OS: All
unspecified
medium
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-09-24 10:07 UTC by ryan@testtoast.com
Modified: 2020-09-24 20:19 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-09-24 20:19:04 UTC
Type: Bug


Attachments (Terms of Use)

Description ryan@testtoast.com 2020-09-24 10:07:52 UTC
Description of problem:

I'm trying to debug a Swift program using sd-bus so have linked to libsystemd. However when I try to step into any systemd function (specifically sd_bus_emit_properties_changed_strv) in either GDB (9.2-7.fc33) or LLDB (lldb version 10.0.0) the debugger steps over the function.


Version-Release number of selected component (if applicable):
FC33, systemd 246.4-2.fc33

How reproducible:
100%

Steps to Reproduce:
1. Install libsystemd debugsource/debuginfo
2. Try to step into a libsystemd library call


Actual results:
The debugger steps into the library function.

Expected results:
The debugger steps over the function.

Additional info:

Possibly related RHEL 7 bug regarding LTO being enabled - https://bugzilla.redhat.com/show_bug.cgi?id=1578413

$ dnf list --installed | grep systemd
libreport-plugin-systemd-journal.x86_64           2.14.0-8.fc33                          @updates-testing
python-systemd-doc.x86_64                         234-14.fc33                            @fedora
python3-systemd.x86_64                            234-14.fc33                            @fedora
rpm-plugin-systemd-inhibit.x86_64                 4.16.0-0.rc1.1.fc33                    @updates-testing
systemd.x86_64                                    246.4-2.fc33                           @updates-testing
systemd-bootchart.x86_64                          233-7.fc33                             @fedora
systemd-container.x86_64                          246.4-2.fc33                           @updates-testing
systemd-debuginfo.i686                            245.6-2.fc32                           @updates-debuginfo
systemd-debuginfo.x86_64                          245.6-2.fc32                           @updates-debuginfo
systemd-debugsource.i686                          245.6-2.fc32                           @updates-debuginfo
systemd-debugsource.x86_64                        245.6-2.fc32                           @updates-debuginfo
systemd-devel.x86_64                              246.4-2.fc33                           @updates-testing
systemd-libs.i686                                 246.4-2.fc33                           @updates-testing
systemd-libs.x86_64                               246.4-2.fc33                           @updates-testing
systemd-libs-debuginfo.i686                       245.6-2.fc32                           @updates-debuginfo
systemd-libs-debuginfo.x86_64                     245.6-2.fc32                           @updates-debuginfo
systemd-pam.x86_64                                246.4-2.fc33                           @updates-testing
systemd-rpm-macros.noarch                         246.4-2.fc33                           @updates-testing
systemd-udev.x86_64                               246.4-2.fc33                           @updates-testing
 
LLDB output:
Process 12985 stopped
* thread #3, name = 'Tsunami', stop reason = step in
    frame #0: 0x00005555556f3034 Tsunami`Earthquake.DBus.emitPropertyChanged(bus: Earthquake.BusType, path: Swift.String, interface: Swift.String, name: Swift.String) -> () at DBus.swift:214:62
   211 	        nameStrings[0] = UnsafeMutablePointer(mutating: name.utf8String)
   212 	
   213 	        //nameStrings.withUnsafeMutableBufferPointer { buffer in
-> 214 	            let r = sd_bus_emit_properties_changed_strv(bus, path, interface, &nameStrings/*buffer.baseAddress*/)
   215 	            if r < 0 {
   216 	                let errString = String(cString: strerror(-r), encoding: .utf8)!
   217 	                Log.warning("sd_bus_emit_properties_changed_strv failed: \(errString)")
Target 0: (Tsunami) stopped.
(lldb) s
Process 12985 stopped
* thread #3, name = 'Tsunami', stop reason = step in
    frame #0: 0x00005555556f3bc6 Tsunami`Earthquake.DBus.emitPropertyChanged(bus: Earthquake.BusType, path: Swift.String, interface: Swift.String, name: Swift.String) -> () at DBus.swift:215:18
   212 	
   213 	        //nameStrings.withUnsafeMutableBufferPointer { buffer in
   214 	            let r = sd_bus_emit_properties_changed_strv(bus, path, interface, &nameStrings/*buffer.baseAddress*/)
-> 215 	            if r < 0 {
   216 	                let errString = String(cString: strerror(-r), encoding: .utf8)!
   217 	                Log.warning("sd_bus_emit_properties_changed_strv failed: \(errString)")
   218 	            }
Target 0: (Tsunami) stopped.
(lldb)

Comment 1 Zbigniew Jędrzejewski-Szmek 2020-09-24 10:44:31 UTC
The debuginfo packages you have don't match. I don't think systemd is doing anything special here.
Please install all debuginfo packages with versions that match and see if that helps.

Comment 2 ryan@testtoast.com 2020-09-24 20:19:04 UTC
Sorry, you are right, they weren't upgraded when I moved from FC32->33. Manually updating them allowed GCC to step into libsystemd. LLDB still refuses however this seems to be due to a lack of DWZ symbol support - using a version with this patch - https://reviews.llvm.org/D40474 - works fine. 

Sorry for the noise.


Note You need to log in before you can comment on or make changes to this bug.