File indexing completed on 2024-05-12 04:02:07

0001 <!DOCTYPE html>
0002 <html><head>
0003 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
0004 <title>highlight.gdb</title>
0005 <meta name="generator" content="KF5::SyntaxHighlighting - Definition (GDB) - Theme (Breeze Dark)"/>
0006 </head><body style="background-color:#232629;color:#cfcfc2"><pre>
0007 GNU gdb (GDB) 8.1
0008 Copyright (C) 2018 Free Software Foundation, Inc.
0009 License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html>
0010 This is free software: you are free to change and redistribute it.
0011 There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
0012 and "show warranty" for details.
0013 This GDB was configured as "x86_64-pc-linux-gnu".
0014 Type "show configuration" for configuration details.
0015 For bug reporting instructions, please see:
0016 &lt;http://www.gnu.org/software/gdb/bugs/>.
0017 Find the GDB manual and other documentation resources online at:
0018 &lt;http://www.gnu.org/software/gdb/documentation/>.
0019 For help, type "help".
0020 Type "apropos word" to search for commands related to "word"...
0021 Reading symbols from your_application...done.
0022 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">break</span><span style="color:#8e44ad"> main</span>
0023 <span style="color:#7a7c7d"># this is a comment</span>
0024 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">run</span><span style="color:#8e44ad"> &lt;arguments for your application></span>
0025 ...
0026 Breakpoint 1 at 0x400b56: file yourmain.cpp, line 3
0027 3: int main(int argc, char* argv[])
0028 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">continue</span>
0029 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">backtrace</span>
0030 #0  0x7f59e39bf18d in <span style="color:#8e44ad;font-weight:bold">poll</span> () from<span style="color:#2980b9"> /usr/lib/libc.so.6</span>
0031 #1  0x7f59df6c8c7c in <span style="color:#8e44ad;font-weight:bold">??</span> () from<span style="color:#2980b9"> /usr/lib/libglib-2.0.so.0</span>
0032 #2  0x7f59df6c8d8c in <span style="color:#8e44ad;font-weight:bold">g_main_context_iteration</span> () from<span style="color:#2980b9"> /usr/lib/libglib-2.0.so.0</span>
0033 #3  0x7f59e480b23f in <span style="color:#27ae60">QEventDispatcherGlib::</span><span style="color:#8e44ad;font-weight:bold">processEvents</span>(...)
0034     from<span style="color:#2980b9"> /usr/lib/libQt5Core.so.5</span>
0035 ...
0036 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">where</span>
0037 #0  <span style="color:#8e44ad;font-weight:bold">main</span> (argc=1, argv=0x7fffffffca88) at<span style="color:#2980b9"> ../../debugging/ex_debugger/main.cpp</span>:11
0038 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">list</span>
0039 10          bool run = true;
0040 11          while (run) {
0041 12              // infinite loop! can you make it quit?
0042 13          }
0043 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">info</span><span style="color:#8e44ad"> locals</span>
0044 app = &lt;incomplete type>
0045 run = true
0046 complexData = {{d = 0x61d430, e = 0x61d430}}
0047 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">info</span><span style="color:#8e44ad"> scope main.cpp:12</span>
0048 Scope for main.cpp:12:
0049 Symbol argc is a variable at frame base reg $rbp offset 0+-8, length 4.
0050 Symbol argv is a variable at frame base reg $rbp offset 0+-16, length 8.
0051 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">ptype</span><span style="color:#8e44ad"> run</span>
0052 type = bool
0053 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">print</span><span style="color:#8e44ad"> run</span>
0054 run = true
0055 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">set</span><span style="color:#8e44ad"> run = false</span>
0056 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">print</span><span style="color:#8e44ad"> run</span>
0057 run = false
0058 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">print</span><span style="color:#8e44ad"> myString.size()</span>
0059 42
0060 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">ptype</span><span style="color:#8e44ad"> MyType</span>
0061 type = class MyType {
0062 private:
0063     int foo;
0064 public:
0065     int foo() const;
0066     ...
0067 }
0068 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">break</span><span style="color:#8e44ad"> QMessageLogger::warning</span>
0069 Breakpoint 1 at 0x7ffff6f143f0 (8 locations)
0070 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">command</span><span style="color:#8e44ad"> 1</span>
0071 Type commands for breakpoint(s) 1, one per line.
0072 End with a line saying just \"end\".
0073 <span style="color:#8e44ad">> </span><span style="font-weight:bold">backtrace</span>
0074 <span style="color:#8e44ad">> </span><span style="font-weight:bold">continue</span>
0075 <span style="color:#8e44ad">> </span><span style="font-weight:bold">end</span>
0076 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">catch</span><span style="color:#8e44ad"> throw </span><span style="color:#7a7c7d"># or when an exception is thrown</span>
0077 Catchpoint 2 (throw)
0078 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">break</span><span style="color:#8e44ad"> main.cpp:12 </span><span style="color:#7a7c7d"># or when certain code is executed</span>
0079 Breakpoint 3 at 0x401216: file ../../debugging/ex_debugger/main.cpp, line 12.
0080 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">info</span><span style="color:#8e44ad"> breakpoints</span>
0081 Num     Type           Disp Enb Address            What
0082 1       breakpoint     keep y   &lt;MULTIPLE>
0083 1.1                         y     0x7ffff6f143f0 &lt;QMessageLogger::warning(char const*, …
0084 ...
0085 2       breakpoint     keep y   0x7ffff66d9b90 exception throw
0086 3       breakpoint     keep y   0x000000401216 in main(int, char**)
0087                                                 at debugging/ex_debugger/main.cpp:12
0088 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">condition</span><span style="color:#8e44ad"> 3 argc > 5</span>
0089                 <span style="color:#7a7c7d"># ^-- breakpoint id, see `info breakpoints` above</span>
0090 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">call</span><span style="color:#8e44ad"> myFunction()</span>
0091 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">set</span><span style="color:#8e44ad"> pagination off</span>
0092 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">set</span><span style="color:#8e44ad"> logging file /tmp/warnings.log</span>
0093 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">set</span><span style="color:#8e44ad"> logging on</span>
0094 Copying output to /tmp/warnings.log.
0095 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">info</span><span style="color:#8e44ad"> threads</span>
0096             Id   Target Id         Frame
0097 2    Thread 0x7fffe10e1700 (LWP 7271) \"QXcbEventReader\"
0098     0x7ffff0b6718d in poll () from /usr/lib/libc.so.6
0099 * 1    Thread 0x7ffff7edd840 (LWP 7267) \"kwrite\"
0100     0x7ffff0b6718d in poll () from /usr/lib/libc.so.6
0101 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">thread</span>
0102 <span style="color:#f67400">[Current thread is 1 (Thread 0x7ffff7edd840 (LWP 7267))]</span>
0103 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">thread</span><span style="color:#8e44ad"> 2</span>
0104 [Switching to thread 2 (Thread 0x7fffe10e1700 (LWP 9765))]
0105 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">thread</span><span style="color:#8e44ad"> apply all backtrace</span>
0106 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">info</span><span style="color:#8e44ad"> sharedlibrary</span>
0107 From                To                  Syms Read   Shared Object Library
0108 0x7ffff7ddbb80  0x7ffff7df5610  Yes (*)     /lib64/ld-linux-x86-64.so.2
0109 0x7ffff7690460  0x7ffff7ab723c  Yes         /opt/qt/5.5/gcc_64/lib/libQt5Gui.so.5
0110 0x7ffff6efdb80  0x7ffff71af318  Yes         /opt/qt/5.5/gcc_64/lib/libQt5Core.so.5
0111 0x7ffff6c02f60  0x7ffff6c5f852  Yes (*)     /usr/lib/libGL.so.1
0112 0x7ffff69d3ac0  0x7ffff69e0931  Yes (*)     /usr/lib/libpthread.so.0
0113 0x7ffff66d5fa0  0x7ffff6781d89  Yes         /usr/lib/libstdc++.so.6
0114 0x7ffff6353510  0x7ffff63bb33a  Yes (*)     /usr/lib/libm.so.6
0115 ...
0116 (*): Shared library is missing debugging information.
0117 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">list</span><span style="color:#8e44ad"> 64</span>
0118 59           * If no red can be seen, then the cached implementation is \"good enough\".
0119 60           */
0120 61          void paintEvent(QPaintEvent *event)
0121 62          {
0122 63              const QRect rect = event->rect();
0123 64
0124 65              QPainter painter(this);
0125 66              painter.setRenderHint(QPainter::Antialiasing);
0126 67              painter.fillRect(rect, Qt::black);
0127 68
0128 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">dprintf</span><span style="color:#8e44ad"> main.cpp:64,\"paint rect(w=%d,h=%d)\\n\",rect.width(),rect.height()</span>
0129 Dprintf 1 at 0x403a1e: file path/to/main.cpp, line 64.
0130 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">continue</span>
0131 Continuing.
0132 paint rect(w=202,h=200)
0133 paint rect(w=213,h=203)
0134 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">target</span><span style="color:#8e44ad"> remote &lt;device ip>:&lt;port></span>
0135 Remote debugging using &lt;device ip>:&lt;port>
0136 Reading /lib64/ld-linux-x86-64.so.2 from remote target...
0137 warning: File transfers from remote targets can be slow.
0138             Use \"set sysroot\"to access files locally instead.
0139 ...
0140 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">set</span><span style="color:#8e44ad"> sysroot /path/to/sysroot</span>
0141 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">print</span><span style="color:#8e44ad"> myMap</span>
0142 $1 = QMap&lt;QString, int> = {
0143     [\"bar\"] = 1,
0144     [\"foo\"] = 2
0145 }
0146 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">print</span><span style="color:#8e44ad"> money</span>
0147 $1 {
0148     {value = 1.20000005, currency = Money::Euro},
0149     {value = 3.4000001, currency = Money::Dollar}
0150 }
0151 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">python</span>
0152 <span style="color:#3f8058">></span> <span style="color:#27ae60">import</span> sys
0153 <span style="color:#3f8058">></span> sys.path.insert(<span style="color:#f67400">0</span>, <span style="color:#f44f4f">'/path/to/addon/debugging/ex_gdb_pretty_printer'</span>)
0154 <span style="color:#3f8058">></span> <span style="color:#27ae60">import</span> money_printer
0155 <span style="color:#3f8058">></span> <span style="font-weight:bold">end</span>
0156 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">print</span><span style="color:#8e44ad"> money</span>
0157 $2 = {
0158     \"1.200000 Euro\",
0159     \"3.400000 Dollar\"
0160 }
0161 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">continue</span>
0162 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">detach</span>
0163 <span style="color:#8e44ad">(gdb) </span><span style="font-weight:bold">quit</span>
0164 </pre></body></html>