newbie: debugging programs with boost
Hi all, I'm having trouble using GDB with my program that uses boost. In GDB (bra is a vector<double>): (gdb) print bra(j) Invalid data type for function to be called. I've compiled my program with -g3. How can I peek at boost datatypes? Thanks!
On Thu, Sep 4, 2008 at 11:31 PM,
wrote:
Hi all,
I'm having trouble using GDB with my program that uses boost. In GDB (bra is a vector<double>):
(gdb) print bra(j) Invalid data type for function to be called.
I've compiled my program with -g3. How can I peek at boost datatypes?
I don't think this has got anything to do with boost library. If bra
is a vector<double> then you cannot print it like that. The following
seems to work.
(gdb) print bra
$1 = {<_Vector_base
On Fri, Sep 05, 2008 at 01:46:33PM -0500, Annamalai Gurusami wrote:
After printing the vector object, I obtain the start address of the data. Then I access the elements using the offsets. But this approach seems to be tedious. Is there any better approach? Ideally speaking, gdb should be able to work with "print bra.at(0)" or "print bra[0]". But currently that is not working. Maybe newer versions of gdb will improve C++ support!
Try using better development tools: Intel compiler includes also a debugger and is free for non-commercial use on Linux. You can also try SunStudio and dbx debugger for Linux. (dbx is different than gdb, but after using it for a while on Solaris, together with other Solaris powerful monitoring features, I have never looked back to Linux. If you have time and willpower, I'd certainly recommend you to switch your development to Solaris and take some time to learn it... in my case, the invested time has been repaid multiple times by just by the availability of superior diagnostic tools and superb documentation that accompanies them.)
participants (3)
-
Annamalai Gurusami
-
p@dirac.org
-
Zeljko Vrba