https://bugs.kde.org/show_bug.cgi?id=522317
Bug ID: 522317
Summary: GDB hangs infinitely traversing pretty printers
Classification: Applications
Product: kdevelop
Version First 6.5.260402
Reported In:
Platform: Other
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: CPP Debugger
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
DESCRIPTION
Sometimes GDB hangs trying to deep-print a value which has loops in its
children graph.
The main pieces of the problem are:
1. Using GDB pretty printers on pointers to make them expandable. This makes
perfect sense, since otherwise pointers look like dead hex values in the
debugger.
2. Having loops in the pointer / children graph of some data structures. This
makes perfect sense again, there so many data structures with all kind of
backlinks that make pointer graph cyclic.
3. Unlucky situation causes debugger to force GDB to pretty-print cyclic data
structure... which is infinite.
With the attached repro steps, I recorded stdin/stdout of GDB using strace, and
I see that the last MI command was:
46-stack-list-locals --thread 1 --frame 0 --simple-values
The parameter --simple-values is not documented properly, but I'm pretty sure
it includes pointers. If a pointer has children, then it basically triggers
deep-printing, which can easily be infinite.
STEPS TO REPRODUCE
1. Clone "kdevelop" branch of this repository:
https://github.com/stgatilov/vscode-gdb-pretty-printers-hangs-repro-code/tree/kdevelop
2. Build the code with CMake.
3. Set breakpoint at the call of the function "badfunc".
4. Start debugging.
5. In GDB console, execute "source ../printers.py".
6. Make sure the file was found and loaded!
7. Set breakpoint on the last line of "badfunc" function.
8. Continue execution until the new breakpoint triggers.
9. Notice that gdb hangs completely.
SOFTWARE/OS VERSIONS
Operating System: Bazzite 44
KDE Plasma Version: 6.6.5
KDE Frameworks Version: 6.26.0
Qt Version: 6.11.1
ADDITIONAL INFORMATION
VS Code has the same issue, but with function arguments instead of local
variables:
* https://github.com/microsoft/vscode-cpptools/issues/14487
--
You are receiving this mail because:
You are watching all bug changes.