How can I configure Qt Creator and/or gdb so that while debugging my program using Qt libraries the debugger would avoid stepping into Qt's source files?
相关问题
- Sorting 3 numbers without branching [closed]
- QML: Cannot read property 'xxx' of undefin
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
相关文章
- ubuntu20.4中c#通过c++库调用python脚本
- Qt槽函数自动执行多遍
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
The feature you want (as described by rpg) is not available from
GDB
, and IMHO would be difficult to use if it were implemented.A similar, but simpler to use
fstep
feature is proposed forGDB
. Given:the
fstep
would skip all calls on the current line, except the last one (thus skipping string constructors,operator+()
, andc_str()
, and stepping only intofoo
).This hasn't been implemented either, but likely will be in a couple of month (it's very useful for
C++
debugging).In the mean time, you can approximate the feature by setting a temporary breakpoint:
Update after comment clarification:
In gdb you can specify which source directories are searched - if it can't find them, it won't be able to go into them.
For gdb to be entering the source files of the qt libraries it must know where they are - it's likely that qt-creator is telling gdb where they are when it launches the debugger. Look around qt-creator for the gdb startup script - they might be specified in there.
If they aren't specified in the startup script and it's gdb finding the source files on it's own you should be able to modify the gdb startup script to clear any directories with the
directory
command (see the link above for syntax etc.)You may also be able to view the gdb console by going to "Debug -> Views -> Gdb" to get information about which source directories it is currently using with the
show directories
command in gdb, and clearing any off manually if you want to do this on a case-by-case basis.Maybe not exactly a perfect solution to this question, but maybe it would help to exclude the directories where your project is not (ie. 3rd party libraries, system headers (like STL), etc). If so, take a look at https://stackoverflow.com/a/31629136/5155476 and https://stackoverflow.com/a/42721326/5155476. The former allows you to specify directories (and all subdirectories) to skip when stepping while running GDB (so you can change the set whenever you like), but it requires you to build GDB. The latter allows the same functionality but pre-set before running GDB, and does not require building GDB.
You need to turn off auto-solib-add. From a normal gdb prompt you would type:
In Qt Creator, under Options->Debugger->Gdb you can specify a Gdb startup script. Create a file with the "set auto-solib-add off" command in it and then set your Gdb startup script to that file.