I think, this is known bug... will look at it tonight
Update: yes known bug...
Here is the output of the whatis command:
> whatis v_str
type = std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
And this line matches the regexp for std::string and so the script for std::string is used instead of the one for the vector.
Here is a patch that fixes the problem (not tested extensively)
Index: src/plugins/debuggergdb/gdb_commands.h
===================================================================
--- src/plugins/debuggergdb/gdb_commands.h (revision 5826)
+++ src/plugins/debuggergdb/gdb_commands.h (working copy)
@@ -702,6 +702,8 @@
m_watch->GetSymbol(symbol);
m_watch->GetType(type);
+ type.Trim(true);
+ type.Trim(false);
m_Cmd = static_cast<GDB_driver*>(m_pDriver)->GetScriptedTypeCommand(type, m_ParseFunc);
if (m_Cmd.IsEmpty())
{
@@ -798,7 +800,7 @@
// m_pWatch(watch)
m_watch(watch)
{
- m_Cmd << _T("whatis ");
+ m_Cmd << _T("whatis &");
// m_Cmd << m_pWatch->keyword;
wxString symbol;
m_watch->GetSymbol(symbol);
@@ -813,6 +815,7 @@
// type = bool
wxString tmp = output.AfterFirst(_T('='));
+ tmp = tmp.substr(0, tmp.length() - 1);
// actually add this watch with high priority
// m_pDriver->QueueCommand(new GdbCmd_Watch(m_pDriver, m_pDTree, m_pWatch, tmp), DebuggerDriver::High);
wxString old_type;
@@ -850,6 +853,8 @@
m_Type(w_type),
m_Address(address)
{
+ m_Type.Trim(true);
+ m_Type.Trim(false);
m_Cmd = static_cast<GDB_driver*>(m_pDriver)->GetScriptedTypeCommand(w_type, m_ParseFunc);
if (m_Cmd.IsEmpty())
{
Index: src/scripts/gdb_types.script
===================================================================
--- src/scripts/gdb_types.script (revision 5826)
+++ src/scripts/gdb_types.script (working copy)
@@ -24,7 +24,7 @@
// STL String
driver.RegisterType(
_T("STL String"),
- _T("[^[:alnum:]_]*string[^[:alnum:]_]*"),
+ _T("^std::basic_string<.*>$"),
_T("Evaluate_StlString"),
_T("Parse_StlString")
);
@@ -32,7 +32,7 @@
// STL Vector
driver.RegisterType(
_T("STL Vector"),
- _T("[^[:alnum:]_]*vector<.*"),
+ _T("^std::vector<(.*)>$"),
_T("Evaluate_StlVector"),
_T("Parse_StlVector")
);
The patch includes a fix for another problem:
> whatis gdb_type
Attempt to take contents of a non-pointer value.
>>>>>>cb_gdb:
> whatis &gdb_type
type = const wxString &*
>>>>>>cb_gdb:
That thing is caused by the command "source stl-views-1.0.3.script", and unfortunately, I've not reported it to gdb upstream, will do so someday...
The patch evaluates the type of the address of the watched variable and then strips the * at the end of the result.
Testing is welcome.
p.s. the patch is agains the wxpropgrid_debugger branch, if you have problems applying it, I'll produce one against trunk