Skip to contentSkip to conversation

gdb/systemd: enable minidebuginfo support conditionally

PATCH Etienne Cordonnier 3 participants 7 messages Nov 30, 2023 – Dec 1, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi all, I sent this patch to start the conversation, but I guess PACKAGE_MINIDEBUGINFO may have to be turned into a DISTRO_FEATURES before this can be merged.
I tested this with core-image-sato after enabling systemd in local.conf. I then started:

$ vi
In other terminal:
$ kill -SEGV $(pidof vi)
$ coredumpctl info

Before the patch, I didn't get a call-stack with symbols. After the patch, I get a call-stack including function names inside busybox.nosuid ("read_key()").

This is a very useful feature for debugging and/or bug reporting, so I think it would make sense to make it easy to enable via a DISTRO_FEATURES. I was just not sure why MINIDEBUGINFO was not a DISTRO_FEATURES in the first place, and whether you would be willing to enable systemd-coredump via the MINIDEBUGINFO DISTRO_FEATURES.

Quoted 88 lines · Etienne Cordonnier via lists.openembedded.org

From: Etienne Cordonnier <[email protected]>

Enabling minidebuginfo is not useful if gdb and systemd-coredump are unable to parse it.

In order to parse it, gdb needs xz support. Systemd needs coredump enabled, as
well as elfutil enabled as well (systemd-coredump loads libdw which is part of elfutils using dlopen).

---
 meta/recipes-core/systemd/systemd_254.4.bb       | 1 +
 meta/recipes-devtools/elfutils/elfutils_0.189.bb | 3 ++-
 meta/recipes-devtools/gdb/gdb-common.inc         | 3 ++-
 3 files changed, 5 insertions(+), 2 deletions(-)
meta/recipes-core/systemd/systemd_254.4.bb +1 -0
index ecf693ef92..f3e56bf94c 100644
@@ -70,6 +70,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '',
 'link-udev-shared', d)} \
+    ${@'coredump elfutils' if d.getVar('PACKAGE_MINIDEBUGINFO') == '1'
 else ''} \
     backlight \
     binfmt \
     gshadow \
meta/recipes-devtools/elfutils/elfutils_0.189.bb +0 -1
index d8bf82b022..4f097e5b5c 100644
@@ -39,7 +39,8 @@ BUILD_CFLAGS += "-Wno-error=stringop-overflow"
 DEPENDS_BZIP2 = "bzip2-replacement-native"
 DEPENDS_BZIP2:class-target = "bzip2"
 
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'debuginfod',

'debuginfod libdebuginfod', '', d)}"
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'debuginfod', 'debuginfod libdebuginfod', '', d)} \
+ ${@'xz' if d.getVar('PACKAGE_MINIDEBUGINFO') == '1'
else ''}"
PACKAGECONFIG[bzip2] = "--with-bzlib,--without-bzlib,${DEPENDS_BZIP2}" PACKAGECONFIG[xz] = "--with-lzma,--without-lzma,xz" PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd"

meta/recipes-devtools/gdb/gdb-common.inc +0 -2
index 3349719a6b..c444af62b3 100644
@@ -30,7 +30,8 @@ EXTRA_OECONF = "--disable-gdbtk --disable-x
--disable-werror \
                 --with-libgmp-prefix=${STAGING_EXECPREFIXDIR} \
 "
 
-PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES',

'debuginfod', d)} python"
+PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)} python \
+ ${@'xz' if d.getVar('PACKAGE_MINIDEBUGINFO') == '1'
else ''}"
# Use --without-system-readline to compile with readline 5. PACKAGECONFIG[readline] =
"--with-system-readline,--without-system-readline,readline"
PACKAGECONFIG[python] =
"--with-python=${WORKDIR}/python,--without-python,python3,python3-codecs" --
2.36.1.vfs.0.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#191493):
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Dcore_message_191493&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=hIJuYfiJHr9GFKRELhnwn96gLMBgh_mp9x4xUGbJgon0FWJJ5jnlxx1XaSOKLhdI&s=m-F8Rs9jc8nYVkwZ6tVpeEnQ3Ka6WesbxwvuQbo4xCY&e=
Mute This Topic:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_102891486_7048771&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=hIJuYfiJHr9GFKRELhnwn96gLMBgh_mp9x4xUGbJgon0FWJJ5jnlxx1XaSOKLhdI&s=kA0ZAZrvS23OaO3PpSWredRNZRqodA4pdr2LOIO4di4&e=
Group Owner: [email protected] Unsubscribe:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Dcore_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=hIJuYfiJHr9GFKRELhnwn96gLMBgh_mp9x4xUGbJgon0FWJJ5jnlxx1XaSOKLhdI&s=OQS2e4tCqxw_s3J_gabhUAfSjZxmBRl95PLjCFQyXM4&e=
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hi,

I saw some of this discussion on the systemd-devel list so I'm happy to see patches to sort out the configuration on our side, thanks!

Quoted 14 lines · Etienne Cordonnier via lists.openembedded.org

Hi all, I sent this patch to start the conversation, but I guess PACKAGE_MINIDEBUGINFO may have to be turned into a DISTRO_FEATURES before this can be merged.
I tested this with core-image-sato after enabling systemd in local.conf. I then started:

$ vi
In other terminal:
$ kill -SEGV $(pidof vi)
$ coredumpctl info

Before the patch, I didn't get a call-stack with symbols. After the patch, I get a call-stack including function names inside busybox.nosuid ("read_key()").

Quoted 5 lines

This is a very useful feature for debugging and/or bug reporting, so I think it would make sense to make it easy to enable via a DISTRO_FEATURES. I was just not sure why MINIDEBUGINFO was not a DISTRO_FEATURES in the first place, and whether you would be willing to enable systemd-coredump via the MINIDEBUGINFO DISTRO_FEATURES.

I think we should make minidebuginfo a DISTRO_FEATURE and then key all the tweaks off that.

I was looking at your patches and thinking we might want to enable minidebuginfo in poky or perhaps OE-Core by default too.

A test to ensure this backtracing works and stays working would be really nice too! (whilst we have the context in our heads)

Cheers,

Richard

#3 lore raw

OK, thanks for your quick answer. I'll try to turn it into a DISTRO_FEATURES and write a test for it then (I need to check how tests running on the target work in poky. I'm not sure can test systemd-coredump without target easily).

Etienne

Quoted 40 lines · Richard Purdie

Hi,

I saw some of this discussion on the systemd-devel list so I'm happy to see patches to sort out the configuration on our side, thanks!

Quoted 14 lines · Etienne Cordonnier via lists.openembedded.org

Hi all, I sent this patch to start the conversation, but I guess PACKAGE_MINIDEBUGINFO may have to be turned into a DISTRO_FEATURES before this can be merged.
I tested this with core-image-sato after enabling systemd in local.conf. I then started:

$ vi
In other terminal:
$ kill -SEGV $(pidof vi)
$ coredumpctl info

Before the patch, I didn't get a call-stack with symbols. After the patch, I get a call-stack including function names inside busybox.nosuid ("read_key()").

Quoted 5 lines

This is a very useful feature for debugging and/or bug reporting, so I think it would make sense to make it easy to enable via a DISTRO_FEATURES. I was just not sure why MINIDEBUGINFO was not a DISTRO_FEATURES in the first place, and whether you would be willing to enable systemd-coredump via the MINIDEBUGINFO DISTRO_FEATURES.

I think we should make minidebuginfo a DISTRO_FEATURE and then key all the tweaks off that.

I was looking at your patches and thinking we might want to enable minidebuginfo in poky or perhaps OE-Core by default too.

A test to ensure this backtracing works and stays working would be really nice too! (whilst we have the context in our heads)

Cheers,

Richard

#4 lore raw
Quoted 4 lines · Etienne Cordonnier

OK, thanks for your quick answer. I'll try to turn it into a DISTRO_FEATURES and write a test for it then (I need to check how tests running on the target work in poky. I'm not sure can test systemd-coredump without target easily).

We have both "configuration" tests in oe-selftest and runtime tests with "-c testimage". With this one I'm a little torn.

We could assume we'll end up enabling this by default and if we do that, we could add a new runtime tests if it is configured knowing it will be by default in some of our builds.

You can see the runtime tests here:

https://git.yoctoproject.org/poky/tree/meta/lib/oeqa/runtime/cases

The selftests are here:

https://git.yoctoproject.org/poky/tree/meta/lib/oeqa/selftest/cases

and include running things under runqemu to test target pieces but a runtime test may be enough for this feature.

Cheers,

Richard

#5 lore raw
In reply to Richard Purdie
Quoted 27 lines · Richard Purdie

Hi,

I saw some of this discussion on the systemd-devel list so I'm happy to see patches to sort out the configuration on our side, thanks!

Quoted 14 lines · Etienne Cordonnier via lists.openembedded.org

Hi all, I sent this patch to start the conversation, but I guess PACKAGE_MINIDEBUGINFO may have to be turned into a DISTRO_FEATURES before this can be merged.
I tested this with core-image-sato after enabling systemd in local.conf. I then started:

$ vi
In other terminal:
$ kill -SEGV $(pidof vi)
$ coredumpctl info

Before the patch, I didn't get a call-stack with symbols. After the patch, I get a call-stack including function names inside busybox.nosuid ("read_key()").

Quoted 5 lines

This is a very useful feature for debugging and/or bug reporting, so I think it would make sense to make it easy to enable via a DISTRO_FEATURES. I was just not sure why MINIDEBUGINFO was not a DISTRO_FEATURES in the first place, and whether you would be willing to enable systemd-coredump via the MINIDEBUGINFO DISTRO_FEATURES.

Quoted 5 lines

I think we should make minidebuginfo a DISTRO_FEATURE and then key all the tweaks off that.

I was looking at your patches and thinking we might want to enable minidebuginfo in poky or perhaps OE-Core by default too.

is it dependent on systemd for coredumpctl or can be use some other tool as well for inspection.

Quoted 16 lines

A test to ensure this backtracing works and stays working would be really nice too! (whilst we have the context in our heads)

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#191498): https://lists.openembedded.org/g/openembedded-core/message/191498
Mute This Topic: https://lists.openembedded.org/mt/102891486/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#6 lore raw
Quoted 29 lines · Khem Raj
Quoted 27 lines · Richard Purdie

Hi,

I saw some of this discussion on the systemd-devel list so I'm happy to see patches to sort out the configuration on our side, thanks!

Quoted 19 lines · Etienne Cordonnier via lists.openembedded.org

Hi all, I sent this patch to start the conversation, but I guess PACKAGE_MINIDEBUGINFO may have to be turned into a DISTRO_FEATURES before this can be merged.
I tested this with core-image-sato after enabling systemd in local.conf. I then started:

$ vi
In other terminal:
$ kill -SEGV $(pidof vi)
$ coredumpctl info

Before the patch, I didn't get a call-stack with symbols. After the patch, I get a call-stack including function names inside busybox.nosuid ("read_key()").

This is a very useful feature for debugging and/or bug reporting, so I think it would make sense to make it easy to enable via a DISTRO_FEATURES. I was just not sure why MINIDEBUGINFO was not a DISTRO_FEATURES in the first place, and whether you would be willing to enable systemd-coredump via the MINIDEBUGINFO DISTRO_FEATURES.

Quoted 8 lines
Quoted 5 lines

I think we should make minidebuginfo a DISTRO_FEATURE and then key all the tweaks off that.

I was looking at your patches and thinking we might want to enable minidebuginfo in poky or perhaps OE-Core by default too.

is it dependent on systemd for coredumpctl or can be use some other tool as well for inspection.

binutils and gdb know how to read them too, as long as the right configuration is in place (xz support generally) as I understand it.

Cheers,

Richard

#7 lore raw

Correct, gbd supports minidebuginfo and can print backtraces using it.

Quoted 61 lines · Richard Purdie
Quoted 9 lines · Khem Raj
Quoted 7 lines · Richard Purdie

Hi,

I saw some of this discussion on the systemd-devel list so I'm happy to see patches to sort out the configuration on our side, thanks!

On Thu, 2023-11-30 at 12:15 +0100, Etienne Cordonnier via

Quoted 20 lines · lists.openembedded.org
Quoted 20 lines
Quoted 19 lines

Hi all, I sent this patch to start the conversation, but I guess PACKAGE_MINIDEBUGINFO may have to be turned into a DISTRO_FEATURES before this can be merged.
I tested this with core-image-sato after enabling systemd in local.conf. I then started:

$ vi
In other terminal:
$ kill -SEGV $(pidof vi)
$ coredumpctl info

Before the patch, I didn't get a call-stack with symbols. After the patch, I get a call-stack including function names inside busybox.nosuid ("read_key()").

This is a very useful feature for debugging and/or bug reporting, so I think it would make sense to make it easy to enable via a DISTRO_FEATURES. I was just not sure why MINIDEBUGINFO was not a DISTRO_FEATURES in the first place, and whether you would be willing to enable systemd-coredump via the MINIDEBUGINFO DISTRO_FEATURES.

Quoted 7 lines
Quoted 5 lines

I think we should make minidebuginfo a DISTRO_FEATURE and then key all the tweaks off that.

I was looking at your patches and thinking we might want to enable minidebuginfo in poky or perhaps OE-Core by default too.

is it dependent on systemd for coredumpctl or can be use some other tool

as well

Quoted 1 line

for inspection.

binutils and gdb know how to read them too, as long as the right configuration is in place (xz support generally) as I understand it.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#191516):
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Dcore_message_191516&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=k9bMfp0fSxT-LJc_NIOCkQtN_kNzYNgwa9-EUwL8RqQa3nsY3w3lbcehHgg1PuXf&s=RVEAeOWBvFtjM_HL4Sz_XZ0fSha_e6fUN1jYmfqD1Dc&e=
Mute This Topic:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_102891486_7048771&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=k9bMfp0fSxT-LJc_NIOCkQtN_kNzYNgwa9-EUwL8RqQa3nsY3w3lbcehHgg1PuXf&s=K07zlm6GIEMswXkGfhzUug5wCrsA1WSb11mWIwd4-QE&e=
Group Owner: [email protected] Unsubscribe:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Dcore_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=k9bMfp0fSxT-LJc_NIOCkQtN_kNzYNgwa9-EUwL8RqQa3nsY3w3lbcehHgg1PuXf&s=-3laPxADPmKUAv7QhIDuXYYM1uo3Pl7SWjyAqgeGE7A&e=
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-