Changeset View
Changeset View
Standalone View
Standalone View
autotests/folding/highlight.gdb.fold
- This file was added.
1 | GNU gdb (GDB) 8.1 | ||||
---|---|---|---|---|---|
2 | Copyright (C) 2018 Free Software Foundation, Inc. | ||||
3 | License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | ||||
4 | This is free software: you are free to change and redistribute it. | ||||
5 | There is NO WARRANTY, to the extent permitted by law. Type "show copying" | ||||
6 | and "show warranty" for details. | ||||
7 | This GDB was configured as "x86_64-pc-linux-gnu". | ||||
8 | Type "show configuration" for configuration details. | ||||
9 | For bug reporting instructions, please see: | ||||
10 | <http://www.gnu.org/software/gdb/bugs/>. | ||||
11 | Find the GDB manual and other documentation resources online at: | ||||
12 | <http://www.gnu.org/software/gdb/documentation/>. | ||||
13 | For help, type "help". | ||||
14 | Type "apropos word" to search for commands related to "word"... | ||||
15 | Reading symbols from your_application...done. | ||||
16 | (gdb) break main | ||||
17 | (gdb) run <arguments for your application> | ||||
18 | ... | ||||
19 | Breakpoint 1 at 0x400b56: file yourmain.cpp, line 3 | ||||
20 | 3: int main(int argc, char* argv[]) | ||||
21 | (gdb) continue | ||||
22 | (gdb) backtrace | ||||
23 | #0 0x7f59e39bf18d in poll () from /usr/lib/libc.so.6 | ||||
24 | #1 0x7f59df6c8c7c in ?? () from /usr/lib/libglib-2.0.so.0 | ||||
25 | #2 0x7f59df6c8d8c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0 | ||||
26 | #3 0x7f59e480b23f in QEventDispatcherGlib::processEvents(...) | ||||
27 | from /usr/lib/libQt5Core.so.5 | ||||
28 | ... | ||||
29 | (gdb) where | ||||
30 | #0 main (argc=1, argv=0x7fffffffca88) at ../../debugging/ex_debugger/main.cpp:11 | ||||
31 | (gdb) list | ||||
32 | 10 bool run = true; | ||||
33 | 11 while (run) { | ||||
34 | 12 // infinite loop! can you make it quit? | ||||
35 | 13 } | ||||
36 | (gdb) info locals | ||||
37 | app = <incomplete type> | ||||
38 | run = true | ||||
39 | complexData = {{d = 0x61d430, e = 0x61d430}} | ||||
40 | (gdb) info scope main.cpp:12 | ||||
41 | Scope for main.cpp:12: | ||||
42 | Symbol argc is a variable at frame base reg $rbp offset 0+-8, length 4. | ||||
43 | Symbol argv is a variable at frame base reg $rbp offset 0+-16, length 8. | ||||
44 | (gdb) ptype run | ||||
45 | type = bool | ||||
46 | (gdb) print run | ||||
47 | run = true | ||||
48 | (gdb) set run = false | ||||
49 | (gdb) print run | ||||
50 | run = false | ||||
51 | (gdb) print myString.size() | ||||
52 | 42 | ||||
53 | (gdb) ptype MyType | ||||
54 | type = class MyType { | ||||
55 | private: | ||||
56 | int foo; | ||||
57 | public: | ||||
58 | int foo() const; | ||||
59 | ... | ||||
60 | } | ||||
61 | (gdb) break QMessageLogger::warning | ||||
62 | Breakpoint 1 at 0x7ffff6f143f0 (8 locations) | ||||
63 | (gdb) command 1 | ||||
64 | Type commands for breakpoint(s) 1, one per line. | ||||
65 | End with a line saying just \"end\". | ||||
66 | > backtrace | ||||
67 | > continue | ||||
68 | > end | ||||
69 | (gdb) catch throw # or when an exception is thrown | ||||
70 | Catchpoint 2 (throw) | ||||
71 | (gdb) break main.cpp:12 # or when certain code is executed | ||||
72 | Breakpoint 3 at 0x401216: file ../../debugging/ex_debugger/main.cpp, line 12. | ||||
73 | (gdb) info breakpoints | ||||
74 | Num Type Disp Enb Address What | ||||
75 | 1 breakpoint keep y <MULTIPLE> | ||||
76 | 1.1 y 0x7ffff6f143f0 <QMessageLogger::warning(char const*, … | ||||
77 | ... | ||||
78 | 2 breakpoint keep y 0x7ffff66d9b90 exception throw | ||||
79 | 3 breakpoint keep y 0x000000401216 in main(int, char**) | ||||
80 | at debugging/ex_debugger/main.cpp:12 | ||||
81 | (gdb) condition 3 argc > 5 | ||||
82 | # ^-- breakpoint id, see `info breakpoints` above | ||||
83 | (gdb) call myFunction() | ||||
84 | (gdb) set pagination off | ||||
85 | (gdb) set logging file /tmp/warnings.log | ||||
86 | (gdb) set logging on | ||||
87 | Copying output to /tmp/warnings.log. | ||||
88 | (gdb) info threads | ||||
89 | Id Target Id Frame | ||||
90 | 2 Thread 0x7fffe10e1700 (LWP 7271) \"QXcbEventReader\" | ||||
91 | 0x7ffff0b6718d in poll () from /usr/lib/libc.so.6 | ||||
92 | * 1 Thread 0x7ffff7edd840 (LWP 7267) \"kwrite\" | ||||
93 | 0x7ffff0b6718d in poll () from /usr/lib/libc.so.6 | ||||
94 | (gdb) thread | ||||
95 | [Current thread is 1 (Thread 0x7ffff7edd840 (LWP 7267))] | ||||
96 | (gdb) thread 2 | ||||
97 | [Switching to thread 2 (Thread 0x7fffe10e1700 (LWP 9765))] | ||||
98 | (gdb) thread apply all backtrace | ||||
99 | (gdb) info sharedlibrary | ||||
100 | From To Syms Read Shared Object Library | ||||
101 | 0x7ffff7ddbb80 0x7ffff7df5610 Yes (*) /lib64/ld-linux-x86-64.so.2 | ||||
102 | 0x7ffff7690460 0x7ffff7ab723c Yes /opt/qt/5.5/gcc_64/lib/libQt5Gui.so.5 | ||||
103 | 0x7ffff6efdb80 0x7ffff71af318 Yes /opt/qt/5.5/gcc_64/lib/libQt5Core.so.5 | ||||
104 | 0x7ffff6c02f60 0x7ffff6c5f852 Yes (*) /usr/lib/libGL.so.1 | ||||
105 | 0x7ffff69d3ac0 0x7ffff69e0931 Yes (*) /usr/lib/libpthread.so.0 | ||||
106 | 0x7ffff66d5fa0 0x7ffff6781d89 Yes /usr/lib/libstdc++.so.6 | ||||
107 | 0x7ffff6353510 0x7ffff63bb33a Yes (*) /usr/lib/libm.so.6 | ||||
108 | ... | ||||
109 | (*): Shared library is missing debugging information. | ||||
110 | (gdb) list 64 | ||||
111 | 59 * If no red can be seen, then the cached implementation is \"good enough\". | ||||
112 | 60 */ | ||||
113 | 61 void paintEvent(QPaintEvent *event) | ||||
114 | 62 { | ||||
115 | 63 const QRect rect = event->rect(); | ||||
116 | 64 | ||||
117 | 65 QPainter painter(this); | ||||
118 | 66 painter.setRenderHint(QPainter::Antialiasing); | ||||
119 | 67 painter.fillRect(rect, Qt::black); | ||||
120 | 68 | ||||
121 | (gdb) dprintf main.cpp:64,\"paint rect(w=%d,h=%d)\\n\",rect.width(),rect.height() | ||||
122 | Dprintf 1 at 0x403a1e: file path/to/main.cpp, line 64. | ||||
123 | (gdb) continue | ||||
124 | Continuing. | ||||
125 | paint rect(w=202,h=200) | ||||
126 | paint rect(w=213,h=203) | ||||
127 | (gdb) target remote <device ip>:<port> | ||||
128 | Remote debugging using <device ip>:<port> | ||||
129 | Reading /lib64/ld-linux-x86-64.so.2 from remote target... | ||||
130 | warning: File transfers from remote targets can be slow. | ||||
131 | Use \"set sysroot\"to access files locally instead. | ||||
132 | ... | ||||
133 | (gdb) set sysroot /path/to/sysroot | ||||
134 | (gdb) print myMap | ||||
135 | $1 = QMap<QString, int> = { | ||||
136 | [\"bar\"] = 1, | ||||
137 | [\"foo\"] = 2 | ||||
138 | } | ||||
139 | (gdb) print money | ||||
140 | $1 { | ||||
141 | {value = 1.20000005, currency = Money::Euro}, | ||||
142 | {value = 3.4000001, currency = Money::Dollar} | ||||
143 | } | ||||
144 | (gdb) python | ||||
145 | > import sys | ||||
146 | > sys.path.insert<beginfold id='3'>(</beginfold id='3'>0, '/path/to/addon/debugging/ex_gdb_pretty_printer'<endfold id='3'>)</endfold id='3'> | ||||
147 | > import money_printer | ||||
148 | > end | ||||
149 | (gdb) print money | ||||
150 | $2 = { | ||||
151 | \"1.200000 Euro\", | ||||
152 | \"3.400000 Dollar\" | ||||
153 | } | ||||
154 | (gdb) continue | ||||
155 | (gdb) detach | ||||
156 | (gdb) quit |