[Qt-creator] Loading source files while debugging mingw app with gdb

Andre Poenitz andre.poenitz at mathematik.tu-chemnitz.de
Sat Mar 12 19:58:36 CET 2011


On Sat, Mar 12, 2011 at 01:00:30PM +0100, Piotr Dobrogost wrote:
> Hi!
> 
> I'm on Windows using mingw 4.4.0 installed (in c:\mingw\4.4.0-qt) some time ago by Creator's installer. I have the following test app:
> 
> #include <ext/stdio_filebuf.h>
> #include <iostream>
> #include <fstream>
> #include <string>
> 
> #include <QtCore>
> 
> using namespace std;
> 
> int main()
> {
> 	ofstream ofs("test.txt");
> 	ofs << "Writing to a basic_ofstream object..." << endl;
> 	ofs.close();
> 
> 	int posix_handle = fileno(::fopen("test.txt", "r"));
> 	__gnu_cxx::stdio_filebuf<char> filebuf(posix_handle, std::ios::in);
> 	istream is(&filebuf);
> 
> 	string line;
> 	getline(is, line);
> 	cout << "line: " << line << std::endl;
> 
> 	return 0;
> }
 
> which I compiled in debug mode from within Creator. During debugging,
> files in backtrace like fstream, fstream.tcc and others weren't
> loaded. I noticed in tooltips when hovering over them they have paths
> like \mingw\src\gccbf\mingw32\libstdc++-v3\include so I used
> Options/Debugger/Source Paths Mapping to map
> \mingw\src\gccbf\mingw32\libstdc++-v3\include path to
> C:\MinGW\4.4.0-qt\lib\gcc\mingw32\4.4.0\include\c++. This made these
> files available to debugger which started to load them during
> debugging.
> 
> My question is this; why debugger had no problem loading
> stdio_filebuf.h file (which is gcc's extension and lives in
> c:\mingw\4.4.0-qt\lib\gcc\mingw32\4.4.0\include\c++\ext\stdio_filebuf.h
> while it was unable to load other files?

Creator uses (more or less) what gdb tells it, and gdb uses (more or
less) what information the compiler put into the debug information.
This is often enough insufficient. In this case it looks like the C:
bit is missing in some cases.
 
> I'll add that pressing F2 in Creator's editor finds both
> stdio_filebuf.h _and_ fstream header files.

That uses a different mechanism, it basically reproduces what the
compiler does when searching include paths.

Andre'



More information about the Qt-creator-old mailing list