Bug 2179554

Summary: Fedora's GDB sets a less expected gdb.VERSION format
Product: [Fedora] Fedora Reporter: Dominik 'Disconnect3d' Czarnota <dominik.b.czarnota+redhat>
Component: gdbAssignee: Kevin Buettner <kevinb>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: aburgess, ahajkova, fweimer, guinevere, jan, keiths, kevinb, mcermak, pmuldoon, sergiodj
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-07 13:40:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dominik 'Disconnect3d' Czarnota 2023-03-18 15:33:34 UTC
Hi,

GDB installed on Fedora Linux 13.1-1.fc37 has the gdb.VERSION attribute set to a "Fedora Linux 13.1-1.fc37" string. This can be seen with this command:

$ gdb --quiet --nx --batch --ex 'pi print(repr(gdb.VERSION))'
'Fedora Linux 13.1-1.fc37'

The problem is that this format is incompatible with what a non-patched GDB uses for this field. Let's see how it works on other systems:
1) Ubuntu
$ gdb --quiet --nx --batch --ex 'pi print(repr(gdb.VERSION))'
'10.2'

2) MacOS
$ gdb --quiet --nx --batch --ex 'pi print(repr(gdb.VERSION))'
'12.1'

3) Manjaro (and so Arch Linux)
$ gdb --quiet --nx --batch --ex 'pi print(repr(gdb.VERSION))'
'12.1'

Since normal GDB uses such format, a lot of GDB scripts/plugins like Pwndbg [0] also assume such format and this field is often used to do something based on the GDB version (e.g., use new features or apply workaround for old bugs). You can also see how some GDB scripts parse the gdb.VERSION field here [1].

Please, consider changing this the value of gdb.VERSION to "13.1" or "13.1-1.fc37" so it may be easier to parse.

[0] https://github.com/pwndbg/pwndbg
[1] https://grep.app/search?q=gdb.VERSION&filter[lang][0]=Python

Comment 1 Andrew Burgess 2023-03-30 09:08:21 UTC
A patch to address this issue has been merged into Fedora rawhide (https://src.fedoraproject.org/rpms/gdb/pull-request/69) and should be included in the next update.

Comment 2 Andrew Burgess 2023-08-07 13:40:16 UTC
Hopefully, this issue should be resolved with the latest rawhide version of GDB.