User forums > Using Code::Blocks

Showing vector elements in debugger

<< < (2/11) > >>

BlueHazzard:

If you look in the log:

--- Code: ---s = {<cv::Vec<double, 4>> = {<cv::Matx<double, 4, 1>> = {val = {0, 0, 0, 0}}, <No data fields>}, <No data fields>}

--- End code ---
there seems that the matrix is deducted right, so the printing seems to work..


and there seems to be the right value:

--- Code: --- 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:

--- End code ---

so you still get some different output from the script.
Probably you have to update the python script:
https://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python/libstdcxx/v6/

this is what i get with this test code:

--- Code: ---  vector<double> test;
    test.push_back( 22.44 );
    test.push_back( 1.3795933261199322e-306 );
--- End code ---

--- Code: ---[debug]> whatis test
[debug]type = std::vector<double>
[debug]>>>>>>cb_gdb:
[debug]> output test
[debug]std::vector of length 2, capacity 2 = {22.440000000000001, 1.3795933261199322e-306}>>>>>>cb_gdb:

--- End code ---

nji:
Could you please try what happens when you add
--- Code: --- test [1]
--- End code ---
to the watch?

BlueHazzard:

--- Code: ---[debug]> whatis test[1]
[debug]type = double
[debug]>>>>>>cb_gdb:
[debug]> output test[1]
[debug]1.3795933261199322e-306>>>>>>cb_gdb:
--- End code ---

i hope you don't use the space in the watch window, like here in the code section

BlueHazzard:
jep, you are using a space... this is wrong. Don't use a space in the watch name and you should be fine

--- Code: ---[debug]> whatis diffVector [2]
[debug]type = std::vector<double, std::allocator<double> >::reference

--- End code ---

--- Code: ---whatis diffVector
--- End code ---
is as gdb says a reference...

nji:
Space or not space ... this is ... NOT ... the question  ;)

What I mean:
It doesn't matter if I add "test[1]" to the watch window (in c:b) or "test [1]" ... both don't work.
Could you please check at you?


--- Code: ---[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 &) @0x19de910: <error reading variable>>>>>>>cb_gdb:
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version