User forums > Using Code::Blocks
GDB & Code::Blocks : Is it possible to add own registering classes ?
Jenna:
--- Quote from: Feneck91 on January 29, 2010, 06:18:44 am ---I use GNU gdb (GDB) 7.0.1
--- End quote ---
If you are on windows, switch to 7.0.2, because 7.0.1 is known to have problems.
eeghem:
I've been recently using C::B and Qt, hence my interest in adding types to the gdb_types.script file. After some experimenting I was able to neatly print the QString. In case anyone is interesed, I solved it using the following steps:
1. in the RegisterTypes function I added:
--- Code: ---driver.RegisterType (_T("Qt String"), _T("[^[:alnum:]_]*QString[^[:alnum:]_]*"), _T("Evaluate_QtString"), _T("Parse_QtString"))
--- End code ---
2. in the file I added the functions Evaluate_QtString and Parse_QtString like this:
--- Code: ---function Evaluate_QtString (type, a_str, start, count) {
// determine the method of accessing the variable (if it is a reference use the
// '.' else use the '->'.
local oper = _T(".");
if (type.Find(_T("*"), false) > 0)
oper = _T("->");
// create the output string send to the debugger
// since it is a qstring we actually want the debugger to do the following
// (char*) stringvar.d
local result = _T("output /c ") + a_str + oper + _T("d.data[0]@") + a_str + oper + _T("d.size");
return result;
}
function Parse_QtString (a_str, start) {
return Parse_wxString (a_str, start);
}
--- End code ---
Note that I reuse the Parse_wxString. No need to reinvent the wheel. The result is quite satisfactoring :D.
Ruud
ollydbg:
--- Quote from: eeghem on May 03, 2010, 03:09:17 pm ---I've been recently using C::B and Qt, hence my interest in adding types to the gdb_types.script file. After some experimenting I was able to neatly print the QString. In case anyone is interesed, I solved it using the following steps:
--- End quote ---
I just find some discussion about viewing the Qt string, see here:
Re: Debugging QString
Navigation
[0] Message Index
[*] Previous page
Go to full version