User forums > Using Code::Blocks
Showing vector elements in debugger
BlueHazzard:
--- Quote ---As TDM gdb (python-enabled) works (more or less) for me (without having
installed python anywhere) I do doubt that it is necessary to install python separately.
For me it looks like a kind of "cooperation problem" (IDE, gdb, ...?).
--- End quote ---
i think it has something to do with your code (you never mentioned that you tested my code) or something with the python scripts.
the things what baffle me is the output of your debugger..
--- Code: ---[debug]>>>>>>cb_gdb:
[debug]> whatis diffVector
[debug]type = std::vector<double, std::allocator<double> > &
[debug]>>>>>>cb_gdb:
[debug]> output diffVector
[debug](std::vector<double, std::allocator<double> > &) @0x28fecc: {<std::_Vector_base<double, std::allocator<double> >> = {_M_impl = {<std::allocator<double>> = {<__gnu_cxx::new_allocator<double>> = {<No data fields>}, <No data fields>}, _M_start = 0x1c19678, _M_finish = 0x1c19678, _M_end_of_storage = 0x1c80850}}, <No data fields>}>>>>>>cb_gdb:
[debug]> whatis diffVector [2]
[debug]type = std::vector<double, std::allocator<double> >::reference
[debug]>>>>>>cb_gdb:
[debug]> output diffVector [2]
[debug](__gnu_cxx::__alloc_traits<std::allocator<double> >::value_type &) @0x147f660: 1.3795933261199322e-306>>>>>>cb_gdb:
--- End code ---
As you can see it is different from my output:
--- Code: ---[debug]> whatis test[0]
[debug]type = double
--- End code ---
vs
--- Code: ---whatis diffVector [2]
[debug]type = std::vector<double, std::allocator<double> >::reference
--- End code ---
Also what does show the watches window for this:
--- Code: ---[debug](__gnu_cxx::__alloc_traits<std::allocator<double> >::value_type &) @0x147f660: 1.3795933261199322e-306>>>>>>cb_gdb:
--- End code ---
?
nji:
Actually I used exactly your code
--- Code: --- vector<double> test;
test.push_back( 22.44 );
test.push_back( 1.3795933261199322e-306 );
test[1];
--- End code ---
And then the debugger's output is
--- Code: ---[debug]> whatis test
[debug]type = std::vector<double, std::allocator<double> >
[debug]>>>>>>cb_gdb:
[debug]> output test
[debug]std::vector of length 2, capacity 2 = {22.440000000000001, 1.3795933261199322e-306}>>>>>>cb_gdb:
[debug]> whatis test[1]
[debug]type = std::vector<double, std::allocator<double> >::reference
[debug]>>>>>>cb_gdb:
[debug]> output test[1]
[debug](__gnu_cxx::__alloc_traits<std::allocator<double> >::value_type &) @0x1bee910: <error reading variable>>>>>>>cb_gdb:
--- End code ---
oBFusCATed:
--- Quote from: killerbot on June 25, 2017, 09:42:01 am ---I also sometimes get lost with the "enable scripts" versus do not enable the scripts but have a gdb-python pair.
--- End quote ---
These are going away, soon. I'll just remove them as soon as I find some free time. They are useless anyway.
For gdb troubles: if we ship python enabled gdb then we'll need to ship our own version of python or modify the installer to start an installation of python itself.
BTW one of the gdb windows builds had some stub gdb.exe which was modifying env variables and then the only thing it did was to start the real executable. This version doesn't work too well (the pausing command doesn't work)!
p.s. unfortunately I don't have time nor desire to work on c::b on windows.
BlueHazzard:
@nji
any news on this?
I honestly have no idea what is going on on your system... I don't think this has anything to do with codeblocks and its configuration, but something with gdb and compiler combination?
TobiasA:
Well, the solution might be pretty simple...
Go to
http://forums.codeblocks.org/index.php/topic,22325.msg151987.html#msg151987
and check if you have disabled the startup scripts for GDB.
I am using TDM GCC as well and fell for the same... Came across this thread during my search and thought it might be interesting for you.
TDM GCC works right out of the box as it seems, there are just some hooks placed wrong in some online tutorials from some years back...
Navigation
[0] Message Index
[*] Previous page
Go to full version