User forums > Using Code::Blocks

see content of a vector in debugging

<< < (4/26) > >>

killerbot:
while we are disliking GDB shortcomings.
Does anyone know how alive GDB is ? There are cvs updates, but real info seems to be real sparse or even completely hidden.
Basically, when will there be a next GDB, anyone any ideas ?

oBFusCATed:
/Off
Here: http://sources.redhat.com/gdb/schedule/ there should have been a release already :-)

/On

I don't think, gdb is to blame here. The v is not an array, but a class, v._M_start is an array (or I think it is).
I've not tested, but the value in the watch should be v._M_start[0],
this way you are not depending on the operator[] being present.

Edit:
Here is the official info about C++ STL and gdb: http://sourceware.org/gdb/wiki/STLSupport

ollydbg:
Thanks, I'm trying to use this way on MinGW.

http://www.yolinux.com/TUTORIALS/GDB-Commands.html#STLDEREF

Not sure how to add "gdbinit", so, still Googling :D

Edit1:
In my cb debug start up, it the command line ( I copied from debug log output)


--- Code: ---Command-line: D:\MinGW\bin\gdb.exe -nx -fullname  -quiet -args bin/Debug/test_for_cb_forum.exe
Working dir : C:\test\test_for_cb_forum\

--- End code ---

Seems there is default "-nx" options. :(

Edit2

I find in the "gdb_driver.cpp", these code "disable the .gdbinit related function".


--- Code: ---wxString GDB_driver::GetCommandLine(const wxString& debugger, const wxString& debuggee)
{
    wxString cmd;
    cmd << debugger;
    cmd << _T(" -nx");          // don't run .gdbinit
    cmd << _T(" -fullname ");   // report full-path filenames when breaking
    cmd << _T(" -quiet");       // don't display version on startup
    cmd << _T(" -args ") << debuggee;
    return cmd;
}

wxString GDB_driver::GetCommandLine(const wxString& debugger, int pid)
{
    wxString cmd;
    cmd << debugger;
    cmd << _T(" -nx");          // don't run .gdbinit
    cmd << _T(" -fullname ");   // report full-path filenames when breaking
    cmd << _T(" -quiet");       // don't display version on startup
    cmd << _T(" -pid=") << wxString::Format(_T("%d"), pid);
    return cmd;
}
--- End code ---

ollydbg:
Hi, all, I can successfully view the vectors.

Here is the debug log output from "debugger (debug)" panel.

--- Code: --->>>>>>cb_gdb:
> pvector v
elem[0]: $1 = {
  static npos = 4294967295,
  _M_dataplus = {
    <std::allocator<char>> = {
      <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
    members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider:
    _M_p = 0x3247c "bla bla"
  }
}
elem[1]: $2 = {
  static npos = 4294967295,
  _M_dataplus = {
    <std::allocator<char>> = {
      <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
    members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider:
    _M_p = 0x324ac "abcdef"
  }
}
Vector size = 2
Vector capacity = 2
Element type = std::basic_string<char, std::char_traits<char>, std::allocator<char> > *


--- End code ---


There are several steps:

1. copy the "stl-views-1.0.3.gdb" file  to the project directory.( This directory serves as working directory as GDB.exe starts)

2. In the Menu->setting->compiler and debuggers dialog.

Add "source stl-views-1.0.3.gdb" to the debugger initialization command control.

3. start debugging!

4.In the Menu->debug->set user command to the debug dialog.
Enter " pvector v"

5, the v will be shown :D


By the way, I think the "set user command to the debug" dialog should be embeded in the "debugger(debug" panel, so, people don't need to open it again and again. (seems to annoying).

oBFusCATed:
Yes, as discussed in the other thread.
I'll see if I can add it there tonight.

If you have more power and desire to hack the vector issue, can you try to use the pvector command in a debugger script (http://wiki.codeblocks.org/index.php?title=Debugger_scripts)?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version