3 ms·
> Do not underestimate the power of the print command! Still waiting for it to print the contents of a QList or QString, or pull actual data in cases where I s
by nyanpasu64 5y ago
> Do not underestimate the power of the print command!
Still waiting for it to print the contents of a QList or QString, or pull actual data in cases where I see <optimized out>.
- gnud 5y agoAs I understand it, you can plug in the qt pretty printers from https://invent.kde.org/kdevelop/kdevelop/-/tree/master/plugins/gdb/printers https://invent.kde.org/kdevelop/kdevelop/-/tree/master/plugi...
- nyanpasu64 5y agoHow do I use these pretty printers outside of KDevelop? When I source that file from my global .gdbinit, I get the classic Python relative import error: ModuleNotFoundError: No module named 'qt' Changing KDevelop's gdbinit to `from .qt import register_qt_printers` results in: ImportError: attempted relative import with no known parent package The problem is that sourcing KDevelop's gdbinit doesn't let Python import packages relative to that file. Is there an alternative way to do this?
- gnud 5y agoI've never actually used these, I just knew they existed. I found them via DuckDuckGo, in the github repository of qBittorrent. They have a step-by-step guide for using them, without mentioning kdevelop: https://github.com/qbittorrent/qBittorrent/wiki/Setup-GDB-with-Qt-pretty-printers https://github.com/qbittorrent/qBittorrent/wiki/Setup-GDB-wi...
- mark_undoio 5y agoThe best solution I'm aware of for <optimized out> is to choose your preferred flavour of time travel debug and then step backwards until the variable comes back into scope. This will do the trick, so long as the compiler hasn't completely elided a value. It feels like there's scope for the DWARF debug info to make optimised variables debuggable normally but that's probably a pretty hairy problem.