It just so happens that I have been spending a lot of time with the GNU / Linux family of operating systems. My main activity is software development in C ++.
So, the main problem with using the debugger is displaying complex containers, for example, stl-containers.
The solution I propose is relevant to gdb. This debugger supports scripts written in python, and the mechanisms for displaying complex objects are called pretty printers. Those. In order for the debugger to display everything correctly, you need to tell it where the scripts are located with these pretty printers. To indicate additional commands to the debugger, a .gdbinit file is required.
')
So, I will try to arrange everything, both the instructions and it is more convenient to read, and I will not forget myself.
1. Install gcc, g ++, gdb, libstdc ++ - dbg , the latter is very important, since in fresh distributions it is with debugging symbols that scripts are installed with pretty printers, for example, in Ubuntu 14.04 the directory /usr/share/gcc-4.8/python/libstdcxx appears.
2. Create a .gdbinit file in the home directory with the following contents:
Everything seems to be fine, but there is a problem, in recent versions of GNU / Linux, gdb is built with support for python version 3. *, and by default python version 2 is installed. *. To fix this problem, i.e. to make scripts with support for both versions of python there is a patch, you can find it in the open spaces of the network, you can take it here: _https: //www.dropbox.com/s/ef265fbo00yk1x8/libstdcpp.patch. Changes are subject to the file /usr/share/gcc-4.8/python/libstdcxx/v6/printers.py
And again, everything seems to be fine, but again there is a problem, on some distributions, those very scripts with pretty printers are not installed. To do this, there is the svn repository _svn: //gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python. Here is a link with an additional description: _http: //sourceware.org/gdb/wiki/STLSupport. If this is your case, then, after unloading the repository, do not forget to change the path to the downloaded scripts in the .gdbinit file.
3. When building a project with debugging, remember to include the _GLIBCXX_DEBUG flag. This is necessary to properly display containers such as stringstream.
In conclusion, I want to say that “dancing” with pretty printers (second paragraph) is not needed if you use QtCreator as an IDE. This IDE uses its own scripts to interact with gdb.