-
Notifications
You must be signed in to change notification settings - Fork 112
Seer internal debug information
Seer interoperates with the gdb program. Gdb, in turn, may interoperate with a gdbserver, or the like.
With all these components talking to each other, it may be necessary to turn on some internal debugging to see what's happening or track down a problem.
This Wiki shows what's available in Seer.
Seer is written in Qt and uses Qt's qDebug() function to print Seer debug information.
These debug messages are enabled with the -xxx-debug option on the command line. At a very minimum you'll see the below. But don't be surprised if you see other stray messages as I tend to leave some debug messages in my code sometimes when I'm developing features.
$ seergdb -xxx-debug -s helloworld one two three
[10:38:39][main:145][default] SETTINGS "/home/erniep/.config/seergdb/seergdb.conf"
[10:38:39][main:343][default] EXECUTABLENAME "helloworld"
[10:38:39][main:344][default] WORKINGDIRECTORY ""
[10:38:39][main:345][default] SYMBOLNAME ""
[10:38:39][main:346][default] PID -1
[10:38:39][main:347][default] CONNECTHOST ""
[10:38:39][main:348][default] RRTRACEDIRECTORY ""
[10:38:39][main:349][default] COREFILENAME ""
[10:38:39][main:350][default] PROJECTFILE ""
[10:38:39][main:351][default] ARGUMENTS QList("one", "two", "three")
[10:38:39][SeerGdbWidget::handleGdbSourceScripts:3624][default] Sourcing scripts from: "/home/erniep/.config/seergdb/scripts"
[10:38:39][SeerGdbWidget::handleGdbSourceScripts:3628][default] "source /home/erniep/.config/seergdb/scripts/QString_pp.py"
[10:38:39][SeerGdbWidget::handleGdbSourceScripts:3632][default] Done.
Seer uses Qt's resource database. This holds the various help pages and holds all the custom icons that Seer uses. It's handy way of including things into the Seer executable to make things easier to distrubute.
The --xxx-resources flag will print the filenames in the resource database.
RESOURCES
...
:/qt-project.org/dialogs/qprintpreviewdialog/images/view-pages-facing-24.png
:/qpdf
:/qpdf/qpdfa_metadata.xml
:/qpdf/sRGB2014.icc
:/seer
:/seer/resources
:/seer/resources/help
:/seer/resources/help/VariableRegisterInfoBrowser.md
:/seer/resources/help/DebugModes.md
:/seer/resources/help/RRDebugMode.md
:/seer/resources/help/StructVisualizer.md
...
ENDRESOURCES
Seer uses Qt. Qt has, at a minimum, two gui styles. The --xxx-styles flag will print the available list of styles. Note, some distros include other styles. Seer will pick these up.
$ seergdb --xxx-styles
STYLES
kvantum-dark
kvantum
HighContrastInverse
HighContrast
Adwaita-HighContrastInverse
Adwaita-HighContrast
Adwaita-Dark
Adwaita
Windows
Fusion
ENDSTYLES
Seer uses a very important object called GdbMonitor. This sends commands to gdb in behalf of Seer and gets the results. The receiving communication can be printed to the terminal via setting an environment variable. Warning, the amount of text can be overwhelming.
$ export QT_LOGGING_RULES='*.gdbmonitor.debug=true'
$ seergdb -s helloworld one two three
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:64][seer.gdbmonitor] Ready to read stdout
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:86][seer.gdbmonitor] "=thread-group-added,id=\"i1\""
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:86][seer.gdbmonitor] "~\"GNU gdb (GDB; SUSE Linux Enterprise 15) 14.2\\n\""
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:86][seer.gdbmonitor] "~\"Copyright (C) 2023 Free Software Foundation, Inc.\\n\""
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:86][seer.gdbmonitor] "~\"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\\nThis is free software: you are free to change and redistribute it.\\nThere is NO WARRANTY, to the extent permitted by law.\""
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:86][seer.gdbmonitor] "~\"\\nType \\\"show copying\\\" and \\\"show warranty\\\" for details.\\n\""
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:86][seer.gdbmonitor] "~\"This GDB was configured as \\\"x86_64-suse-linux\\\".\\n\""
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:118][seer.gdbmonitor] Finished reading stdout
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:64][seer.gdbmonitor] Ready to read stdout
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:86][seer.gdbmonitor] "~\"Type \\\"show configuration\\\" for configuration details.\\n\""
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:86][seer.gdbmonitor] "~\"For bug reporting instructions, please see:\\n\""
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:86][seer.gdbmonitor] "~\"<http://bugs.opensuse.org/>.\\n\""
[10:48:20][GdbMonitor::handleReadyReadStandardOutput:86][seer.gdbmonitor] "~\"Find the GDB manual and other documentation resources online at:\\n <\""
...
As well, enabling the logging below will show the commands sent to gdb. Again, the output can get verbose.
$ export QT_LOGGING_RULES='*.gdbwidget.debug=true'
$ seergdb --project project.seer
[11:37:04][unknown:0][seer.gdbwidget] Starting 'gdb run/start': "inmain"
[11:37:04][unknown:0][seer.gdbwidget] Command= "-gdb-set mi-async on"
[11:37:04][unknown:0][seer.gdbwidget] Command= "-gdb-set non-stop off"
[11:37:04][unknown:0][seer.gdbwidget] Command= "source /home/erniep/.config/seergdb/scripts/QString_pp.py"
[11:37:04][unknown:0][seer.gdbwidget] Command= "-inferior-tty-set /dev/pts/4"
[11:37:04][unknown:0][seer.gdbwidget] Command= "skip -fu \"std::vector<int, std::allocator<int> >::back()\""
[11:37:04][unknown:0][seer.gdbwidget] Command= "skip -fu \"std::unique_ptr<int, std::default_delete<int> >::operator*() const\""
[11:37:04][unknown:0][seer.gdbwidget] Command= "info skip"
[11:37:04][unknown:0][seer.gdbwidget] Command= "source MISkip.py"
[11:37:04][unknown:0][seer.gdbwidget] Command= "-file-exec-and-symbols \"helloskip\""
[11:37:04][unknown:0][seer.gdbwidget] Command= "-file-list-exec-source-files"
[11:37:04][unknown:0][seer.gdbwidget] Command= "source -v /nas/erniep/Development/seer/tests/helloskip/breakpoints.seer"
[11:37:04][unknown:0][seer.gdbwidget] Command= "-break-list"
[11:37:04][unknown:0][seer.gdbwidget] Command= "-gdb-set disassembly-flavor att"
[11:37:04][unknown:0][seer.gdbwidget] Command= "-gdb-set print asm-demangle on"
[11:37:04][unknown:0][seer.gdbwidget] Command= "-gdb-set unwind-on-terminating-exception on"
There are two tabs for showing log messages. One for messages from gdb, and one for messages from Seer. The more interesting one is the gdb log tab.
Each log tab needs to be enabled to see the messages. There are other options like adding a timestamp or wrapping the text. At any point, the contents can be cleared, printed, or saved to a file.
Don't for get you can detach the tab into a separate window (right mouse click on the tab) !


A gdbserver is used in Seer's Connect launch method. Occasionally, it might be handy to see the debug communication messages that are happening between gdb and the gdbserver.
This is done by setting set debug remote 1 before the target is started.
Seer has a convenient button to enable on the Connect launcher.

Debug messages for this will go to the Gdb log tab.

Gdb, itself, has a lot of internal debug settings.
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Debugging-Output.html
They can be added to the launch dialog in the "gdb commands before run" section.

And the debug output will appear in the Gdb log tab.

If you need more types of debugging information from Seer or gdb, let me know by submitting a Issue report.