Bug 409702

Summary: Invalid gdb version check
Product: [Applications] kdevelop Reporter: Ivan Stepanov <ivanstepanovftw>
Component: CPP DebuggerAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: freddie, ivanstepanovftw, niko.sams, peje66
Priority: NOR    
Version: 5.3.2   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In: 5.12.230800

Description Ivan Stepanov 2019-07-10 23:04:39 UTC
SUMMARY
Cannot debug CMake target after Unreal Engine install.

STEPS TO REPRODUCE
1. Install Unreal Engine
2. Try to debug any CMake target

OBSERVED RESULT
gdb error - KDE Develop
```
You need gdb 7.0.0 or higher.
You are using: Registered pretty printers for UE4 classes 
```


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.2.0-1-MANJARO
KDE Plasma Version: 5.16.2
KDE Frameworks Version: 5.59.0
Qt Version: 5.13.0

ADDITIONAL INFORMATION
[user@pc ~]$ gdb
GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Registered pretty printers for UE4 classes
(gdb)
Comment 1 Ivan Stepanov 2019-07-11 08:31:14 UTC
[user@pc ~]$ cat .gdbinit
python 
import sys

sys.path.append('/home/user/.config/Epic/GDBPrinters/')

from UE4Printers import register_ue4_printers
register_ue4_printers(None)
print("Registered pretty printers for UE4 classes")

end
Comment 2 peje66 2020-01-23 07:02:45 UTC
I also encountered this when adding:
skip -gfi /usr/include/*
skip -gfi /usr/include/*/*
skip -gfi /usr/include/*/*/*
skip -gfi /usr/include/*/*/*/*

to .gdbinit. Seems that anything making output in .gdbinit makes this test fail which is annoying.
Comment 3 peje66 2020-01-23 07:03:24 UTC
(In reply to peje66 from comment #2)
> I also encountered this when adding:
> skip -gfi /usr/include/*
> skip -gfi /usr/include/*/*
> skip -gfi /usr/include/*/*/*
> skip -gfi /usr/include/*/*/*/*
> 
> to .gdbinit. Seems that anything making output in .gdbinit makes this test
> fail which is annoying.

Running latest master
Comment 4 peje66 2020-01-24 07:25:50 UTC
(In reply to peje66 from comment #3)
> (In reply to peje66 from comment #2)
> > I also encountered this when adding:
> > skip -gfi /usr/include/*
> > skip -gfi /usr/include/*/*
> > skip -gfi /usr/include/*/*/*
> > skip -gfi /usr/include/*/*/*/*
> > 
> > to .gdbinit. Seems that anything making output in .gdbinit makes this test
> > fail which is annoying.
> 
> Running latest master

A workaround is to put:
show version

as the first line in .gdbinit
Comment 5 Bug Janitor Service 2023-07-22 10:06:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/468
Comment 6 Igor Kushnir 2023-07-25 17:23:22 UTC
Git commit a974c3c66130f9e454de1006a7894e4002541dd0 by Igor Kushnir, on behalf of Denis Biryukov.
Committed on 25/07/2023 at 19:22.
Pushed by igorkushnir into branch 'release/23.08'.

gdb: skip to GDB version string

This change allows to use ~/.gdbinit file with constructions like
`skip -gfi /usr/include/c++/*`.
Problem with current implementation is that when .gdbinit contains such
strings GDB output produced is following:
```
File(s) /usr/include/c++/* will be skipped when stepping.
GNU gdb (Ubuntu 8.2.91.20190405-0ubuntu3) 8.2.91.20190405-git
```
And current implementation expects version on the first output from GDB.

This change fixes it by adding skip functionality during GDB session
initialization.
Related: bug 428688, bug 446786
FIXED-IN: 5.12.230800

M  +29   -15   plugins/gdb/debugsession.cpp

https://invent.kde.org/kdevelop/kdevelop/-/commit/a974c3c66130f9e454de1006a7894e4002541dd0