How to avoid entering library's source files while debugging in Qt Creator with gdb?
You need to turn off auto-solib-add. From a normal gdb prompt you would type:
(gdb) set auto-solib-add off
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.
Debugging into external libraries in QtCreator
I assume since you can link a debug version of your app with OSG and you can't trace into OSG source code that you're using gcc (because with Visual C++ I don't think it's possible to link debug apps with non-debug libs) If that's the case, you simply need to re-build OSG for debugging. There may be an option when you run OSG's 'configure' or you may have to edit the Makefiles. Or if it's CMake-based, you run cmake with -DCMAKE_BUILD_TYPE=Debug.
ignore debugging message from include/library files in gdb (terminal)
At various points the debugger will start stepping through the code in libraries/included files which is very tedious and not helpful for me.
You are probably trying to step through code that looks something like this:
std::vector<int> v = ...
foo(v[i]); // Want to step into foo, but step will get into
// std::vector::operator[](size_t) instead.
The need to step over uninteresting "accessor" functions has been recognized long time ago (bug) but nobody implemented this in GDB yet.
Your best bet is to use the finish
command when you find yourself in uninteresting function, and step
again.
You can also ask GDB to ignore certain functions while stepping with the skip
command. Documentation.
Accessing internal project library's debugging symbols in Qt Creator?
In your .pro file you have this:
LIBS += -L../op -lop
If I understood you well, this is where you are linking the library you have problems with. You should, however, link two versions of it, the debug version for the debug build of your project, and the release version for the release version of your project. I don't know what OS are you under, but here's an example for you so you can get the idea:
unix:CONFIG(release): LIBS += -L$$PWD/../../Filters/release/ -lFilters
unix:CONFIG(debug): LIBS += -L$$PWD/../../Filters/debug/ -lFilters
Note that the first line links the release library if the current project is being built as release, and the second line is linking the debug library version if the current project is being built as debug.
Tell gdb to skip standard files
gdb 7.12 supports file globbing to specify the files to skip in the debugger. The documentation for the same is as below:
https://sourceware.org/gdb/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html
To skip stepping into all library headers in the directory /usr/include/c++/5/bits, add the below lines to ~/.gdbinit
# To skip all .h files in /usr/include/c++/5/bits
skip -gfi /usr/include/c++/5/bits/*.h
Instead to skip a specific file, say stl_vector.h, add the below lines to ~/.gdbinit
# To skip the file /usr/include/c++/5/bits/stl_vector.h
skip file /usr/include/c++/5/bits/stl_vector.h
Doing the above with gdb 7.11 and below version leads to the below error:
Ignore function pending future shared library load? (y or [n]) [answered N; input not from terminal]
However, gdb 7.12 seems to have solved the above issue.
This blog addresses the same problem for gdb version 7.11 or below.
Note - You can use the below command from the gdb command prompt to list all the files marked for skipping
info skip
automatically skipping/ignoring external code in gdb
As per my opinion this cannot be done.
every project has a flow of data from one function to other.
gdb is designed to work on the flow of data.
so if your project is somewhere in the middle of the flow,gdb cant help you,since evry function has some purpose to do with the input it gets and output it gives.
all you can do is create the same function separately and replicate the scenario as if its running in teh flow by giving the inputs it needs and output it gives.
Setup of Qt Creator to debug into Qt classes
If you are using a prebuilded version just remap the source code location as described in http://doc.qt.io/qtcreator/creator-debugger-engines.html
Mapping Source Paths
To enable the debugger to step into the code and display the source
code when using a copy of the source tree at a location different from
the one at which the libraries where built, map the source paths to
target paths:
- Select Tools > Options > Debugger > General > Add.
- In the Source path field, specify the source path in the debug information of the executable as reported by the debugger.
- In the Target path field, specify the actual location of the source tree on the local machine.
To get "the source path in the debug information of the executable as reported by the debugger", you can activate the "Use Tooltips in Stack-View when Debugging" option by right-clicking in the Stack View and move the mouse over a specific function call.
Related Topics
How Are the _Cplusplus Directive Defined in Various Compilers
Eclipse C++:"Program "G++" Not Found in Path"
Is Wchar_T Needed for Unicode Support
Why and How to Use Namespaces in C++
Lambda Capture and Parameter with Same Name - Who Shadows the Other? (Clang VS Gcc)
Is There Some Ninja Trick to Make a Variable Constant After Its Declaration
Weird Msc 8.0 Error: "The Value of Esp Was Not Properly Saved Across a Function Call..."
How to Simulate a Mouse Movement
Why Must Std::Sort Compare Function Return False When Arguments Are Equal
What Is the Safe Way to Fill Multidimensional Array Using Std::Fill
C++, Static VS. Namespace VS. Singleton
Are There Any Downsides to Using Upx to Compress a Windows Executable
What Does This C Code Do [Duff's Device]
Using Std::Map<K,V> Where V Has No Usable Default Constructor
Visual Studio 2010 & 2008 Can't Handle Source Files with Identical Names in Different Folders