File gdb-add-rpm-suggestion-script-suse.patch of Package gdb
From 15d2ec49a716e217a031786034596fd0f0face6c Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 25 Mar 2025 14:12:51 +0100
Subject: [PATCH 018/110] Update gdb-add-rpm-suggestion-script.patch for SUSE
---
gdb/doc/gdb.texinfo | 126 +++++++++---------
gdb/python/lib/gdb/command/rpm-suggestions.py | 12 +-
2 files changed, 74 insertions(+), 64 deletions(-)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e9202b85f90..d7d8c772c35 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -50355,15 +50355,19 @@ a hint before the next prompt is displayed:
@smallexample
(@value{GDBP}) file /bin/ls
Reading symbols from /bin/ls...
-Reading symbols from .gnu_debugdata for /usr/bin/ls...
-(No debugging symbols found in .gnu_debugdata for /usr/bin/ls)
-Missing rpms, try: dnf --enablerepo='*debug*' install coreutils-debuginfo-9.3-7.fc39.x86_64
+@c Reading symbols from .gnu_debugdata for /usr/bin/ls...
+@c (No debugging symbols found in .gnu_debugdata for /usr/bin/ls)
+@c Missing rpms, try: dnf --enablerepo='*debug*' install coreutils-debuginfo-9.3-7.fc39.x86_64
+(No debugging symbols found in /bin/ls)
+Missing separate debuginfos, use: zypper install coreutils-debuginfo-8.32-150400.9.6.1.x86_64
(@value{GDBP})
@end smallexample
-In this case, installing @file{coreutils-debuginfo-9.3-7.fc39.x86_64}
-will provide the missing debug information for @file{/bin/ls}. It is
-up to you to install the suggested package, if possible, and after
+@c In this case, installing @file{coreutils-debuginfo-9.3-7.fc39.x86_64}
+@c will provide the missing debug information for @file{/bin/ls}.
+In this case, installing @file{coreutils-debuginfo-8.32-150400.9.6.1.x86_64}
+will provide the missing debug information for @file{/bin/ls}.
+It is up to you to install the suggested package, if possible, and after
that reload the executable in @value{GDBN} so that the newly installed
debug information can be found.
@@ -50379,62 +50383,62 @@ When @samp{on} @value{GDBN} will make RPM suggestions where possible.
When @samp{off} all RPM suggestion will be disabled.
@end table
-When opening a core file (@pxref{core-file command}), it may be the
-case that not only is the debug information missing, but the
-corresponding executable itself is missing. For example, if a core
-file is copied from one machine to another in order to debug.
+@c When opening a core file (@pxref{core-file command}), it may be the
+@c case that not only is the debug information missing, but the
+@c corresponding executable itself is missing. For example, if a core
+@c file is copied from one machine to another in order to debug.
+
+@c In this case @value{GDBN} is able to suggest a command which will
+@c install the missing executable based on the build-id of the
+@c executable. For example:
+
+@c @smallexample
+@c (@value{GDBP}) core-file /tmp/core.5489
+@c warning: Can't open file /usr/bin/sl during file-backed mapping note processing
+@c [New LWP 5489]
+@c Core was generated by `sl'.
+@c Program terminated with signal SIGQUIT, Quit.
+@c #0 0x00007f1b41ced1a7 in ?? ()
+@c Missing file(s), try: dnf --enablerepo='*debug*' install /usr/lib/.build-id/33/2f1a8e56693960e3beb2d7@c 0cd79ddfec451cc3 /usr/lib/debug/.build-id/33/2f1a8e56693960e3beb2d70cd79ddfec451cc3.debug
+@c (@value{GDBP})
+@c @end smallexample
+
+@c The core file was generated from the @file{/usr/bin/sl} binary, which
+@c is not present on the machine opening the core file. @value{GDBN} has
+@c suggested a command, based on the build-id of the binary, which was
+@c extracted from the core file, that would install both the missing
+@c binary, and the corresponding debug information.
+
+@c Unfortunately, @value{GDBN} doesn't know if the suggested command will
+@c actually find a matching RPM or not. Querying the RPM database to see
+@c which packages, if any, will provide a file with the given build-id,
+@c is rather slow. As @file{/usr/bin/sl} is available in an RPM, then
+@c the above command will succeed.
+
+@c It is possible to have @value{GDBN} check to see if there is a package
+@c available before making the suggestion, but this is significantly
+@c slower. To enable this mode use the following command:
-In this case @value{GDBN} is able to suggest a command which will
-install the missing executable based on the build-id of the
-executable. For example:
-
-@smallexample
-(@value{GDBP}) core-file /tmp/core.5489
-warning: Can't open file /usr/bin/sl during file-backed mapping note processing
-[New LWP 5489]
-Core was generated by `sl'.
-Program terminated with signal SIGQUIT, Quit.
-#0 0x00007f1b41ced1a7 in ?? ()
-Missing file(s), try: dnf --enablerepo='*debug*' install /usr/lib/.build-id/33/2f1a8e56693960e3beb2d70cd79ddfec451cc3 /usr/lib/debug/.build-id/33/2f1a8e56693960e3beb2d70cd79ddfec451cc3.debug
-(@value{GDBP})
-@end smallexample
-
-The core file was generated from the @file{/usr/bin/sl} binary, which
-is not present on the machine opening the core file. @value{GDBN} has
-suggested a command, based on the build-id of the binary, which was
-extracted from the core file, that would install both the missing
-binary, and the corresponding debug information.
-
-Unfortunately, @value{GDBN} doesn't know if the suggested command will
-actually find a matching RPM or not. Querying the RPM database to see
-which packages, if any, will provide a file with the given build-id,
-is rather slow. As @file{/usr/bin/sl} is available in an RPM, then
-the above command will succeed.
-
-It is possible to have @value{GDBN} check to see if there is a package
-available before making the suggestion, but this is significantly
-slower. To enable this mode use the following command:
-
-@table @code
-@kindex set rpm-suggestion build-id-mode
-@kindex show rpm-suggestion build-id-mode
-@cindex rpm suggestions, build-id-mode
-@item set rpm-suggestion build-id-mode @r{[}fast@r{|}slow@r{]}
-@itemx show rpm-suggestion build-id-mode
-When set to @samp{fast}, which is the default, @value{GDBN} will offer
-suggestions based on the build-id of any missing executables or shared
-libraries while opening a core file. This is fast, but @value{GDBN}
-has not checked if there is a package available that can supply the
-required file, so running the suggested command might not install any
-packages.
-
-When set to @samp{slow}, each time @value{GDBN} encounters an
-executable, or shared library, that is missing, @value{GDBN} will
-check to see if there is an RPM available that will supply the missing
-binary. If a suitable RPM is found then @value{GDBN} will offer a
-command which will install the missing RPM. If no suitable RPM is
-found then @value{GDBN} will make no suggestions.
-@end table
+@c @table @code
+@c @kindex set rpm-suggestion build-id-mode
+@c @kindex show rpm-suggestion build-id-mode
+@c @cindex rpm suggestions, build-id-mode
+@c @item set rpm-suggestion build-id-mode @r{[}fast@r{|}slow@r{]}
+@c @itemx show rpm-suggestion build-id-mode
+@c When set to @samp{fast}, which is the default, @value{GDBN} will offer
+@c suggestions based on the build-id of any missing executables or shared
+@c libraries while opening a core file. This is fast, but @value{GDBN}
+@c has not checked if there is a package available that can supply the
+@c required file, so running the suggested command might not install any
+@c packages.
+
+@c When set to @samp{slow}, each time @value{GDBN} encounters an
+@c executable, or shared library, that is missing, @value{GDBN} will
+@c check to see if there is an RPM available that will supply the missing
+@c binary. If a suitable RPM is found then @value{GDBN} will offer a
+@c command which will install the missing RPM. If no suitable RPM is
+@c found then @value{GDBN} will make no suggestions.
+@c @end table
It is possible to review all of the previous RPM suggestions that
@value{GDBN} has made using the following command:
diff --git a/gdb/python/lib/gdb/command/rpm-suggestions.py b/gdb/python/lib/gdb/command/rpm-suggestions.py
index d72db9c8015..4e119bb759e 100644
--- a/gdb/python/lib/gdb/command/rpm-suggestions.py
+++ b/gdb/python/lib/gdb/command/rpm-suggestions.py
@@ -351,7 +351,7 @@ else:
# Take a non-empty list of RPM names and print a command line a
# user could run to install these RPMs.
def print_rpm_suggestions(rpm_name_list):
- print("Missing rpms, try: dnf --enablerepo='*debug*' install " + ' '.join(rpm_name_list))
+ print("Missing separate debuginfos, use: zypper install " + ' '.join(rpm_name_list))
# Take a non-empty list of build-id strings and print a series of
# lines that a user could run to instll the RPMs that provide
@@ -416,7 +416,10 @@ else:
# Register the missing debug and missing objfile handlers with GDB.
gdb.missing_debug.register_handler(None, RPM_MissingDebugHandler())
- gdb.missing_objfile.register_handler(None, RPM_MissingObjfileHandler())
+
+ # Not enabled for SUSE/openSUSE. Zypper doesn't support finding packages
+ # based on build-id, unless the package's installed.
+ #gdb.missing_objfile.register_handler(None, RPM_MissingObjfileHandler())
# Implement the core of 'info rpm-suggestions'. Reprint all rpm
# suggestions.
@@ -518,7 +521,10 @@ class rpm_suggestion_info(gdb.Command):
rpm_suggestion_set_prefix()
rpm_suggestion_show_prefix()
param_rpm_suggestion_enabled = rpm_suggestion_enabled()
-param_rpm_suggestion_build_id_mode = rpm_suggestion_build_id_mode()
+
+# The rpm-suggestion build-id-mode is only relevant for
+# RPM_MissingObjfileHandler, which is disabled for SUSE/openSUSE.
+#param_rpm_suggestion_build_id_mode = rpm_suggestion_build_id_mode()
# Create the 'info rpm-suggestions' commands.
rpm_suggestion_info()
--
2.43.0