I just check the DWARF information in the parserthread.o
by using:
objdump -W parserthread.o >> aaaa.txt
Then I have found that there are two entries for templateArgument in the debug information.
The source code is like:
wxString ParserThread::ReadAncestorList()
{
wxString ccc;
wxString templateArgument;
wxString aaa;
aaa = m_Tokenizer.GetToken(); // eat ":"
templateArgument = aaa;
while (!TestDestroy())
{
//Peek the next token
wxString next = m_Tokenizer.PeekToken();
if (next.IsEmpty()
|| next==ParserConsts::opbrace
|| next==ParserConsts::semicolon ) // here, we are at the end of ancestor list
{
break;
}
else if (next==ParserConsts::lt) // class AAA : BBB < int, float >
{
wxString arg = SkipAngleBraces();
if(!arg.IsEmpty()) // find a matching <>
{
templateArgument<<arg;
}
else
{
TRACE(_T("Not Matching <> find. Error!!!") );
}
}
//check the returned Token is a simple Macro usage
wxString tmp = GetClassFromMacro(m_Tokenizer.GetToken());
//Handle Current token first
//Skip the public, protected and private keyword, we don't care them
if (tmp==ParserConsts::kw_public
||tmp==ParserConsts::kw_protected
||tmp==ParserConsts::kw_private )
{
continue;
}
else
{
templateArgument<<tmp;
}
}
TRACE(_T("ReadAncestorList() : Ancestors: ") + templateArgument);
return templateArgument;
}
Then you can see, there is only one entry for wxString aaa, but two entry for wxString templateArgument.
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2010-07-09100534.png)
Is it possible a bug in GCC?
I have just tested in TDM GCC 4.5 and Loaden GCC 4.4.4.
Both of them has bad information about "wxString templateArgument".
Any suggestions?
Thanks.
Edit:
It seems some thing related to "return variables", because when I use "aaa" as a return variable, then, the wxString aaa shows badly, at this time, the wxString templateArgument shows correctly.
see the image:
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2010-07-09104153.png)
It works here on linux with a wxWidgets project without problems.
It might be an issue with the regexes that parse the gdb output (or a possibly different output on newer gdb).
I use gdb 7.1 for x86_64.
Output is:
> info frame
Stack level 0, frame at 0x7fffffffd5c0:
rip = 0x410158 in SPS_LogFrame::OnAbout (/home/jens/src/src/SPS_LogMain.cpp:326); saved rip 0x4105a4
called by frame at 0x7fffffffd5e0
source language c++.
Arglist at 0x7fffffffd5b0, args: this=0x6e0060
Locals at 0x7fffffffd5b0, Previous frame's sp is 0x7fffffffd5c0
Saved registers:
rbx at 0x7fffffffd5a0, rbp at 0x7fffffffd5b0, r12 at 0x7fffffffd5a8, rip at 0x7fffffffd5b8
>>>>>>cb_gdb:
Ok, I just tested in the cc_branch.
>>>>>>cb_gdb:
> info frame
Stack level 0, frame at 0x22ff60:
eip = 0x4013ce in main (E:\code\cb\codeblocks_test_code\forLoaden\main.cpp:6); saved eip 0x4010db
source language c++.
Arglist at 0x22ff58, args:
Locals at 0x22ff58, Previous frame's sp is 0x22ff60
Saved registers:
ebp at 0x22ff58, eip at 0x22ff5c
>>>>>>cb_gdb:
So, it seems the eip value is correctly returned from gdb. But when I opened the Disassembly window, there is no "arrow" showing.
Sorry I don't have debugger_branch at home now.
I have several problem when debugging debugger plugin.
1, it seems I can't set breakpoint.
See the log:
> break "E:/code/cb/cc_branch/src/plugins/debuggergdb/disassemblydlg.cpp:139"
No source file named E:/code/cb/cc_branch/src/plugins/debuggergdb/disassemblydlg.cpp.
Breakpoint 6 ("E:/code/cb/cc_branch/src/plugins/debuggergdb/disassemblydlg.cpp:139) pending.
>>>>>>cb_gdb:
> break "E:/code/cb/cc_branch/src/plugins/debuggergdb/debuggergdb.cpp:2852"
Breakpoint 7 at 0x6d895b46: file E:\code\cb\cc_branch\src\plugins\debuggergdb\debuggergdb.cpp, line 2852.
>>>>>>cb_gdb:
The line 139 in disassemblydlg.cpp is in the function body of:
void DisassemblyDlg::SetActiveAddress(unsigned long int addr)
{
if (m_HasActiveAddr && addr == m_LastActiveAddr)
return;
m_HasActiveAddr = false;
m_LastActiveAddr = addr;
for (int i = 0; i < m_pCode->GetLineCount(); ++i)
{
wxString str = m_pCode->GetLine(i).AfterFirst(_T('x')).BeforeFirst(_T('\t'));
unsigned long int lineaddr;
if (str.ToULong(&lineaddr, 16) && lineaddr >= addr) ////////////////////// this is line 139
{
m_pCode->MarkerDeleteAll(DEBUG_MARKER);
m_pCode->MarkerAdd(i, DEBUG_MARKER);
m_pCode->GotoLine(i);
m_pCode->EnsureVisible(i);
m_HasActiveAddr = true;
break;
}
}
}
But it seems I can set a breakpoint in debuggergdb.cpp.
The other problem is: call stack information is not shown correctly.
see the image:
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2010-07-11112446.png)
The third issue is: it seems I can't view the value in this function:
wxString str = m_pCode->GetLine(i).AfterFirst(_T('x')).BeforeFirst(_T('\t'));
Here is the debugger log:
> p str
$2 = UnicodeEncodeError: 'gbk' codec can't encode character u'\ufeee' in position 0: illegal multibyte sequence
>>>>>>cb_gdb:
So, I still suspect that there are "two debug entries" for the autovariable "str", so gdb get confused.
BTW: I'm using TDM4.5 at home, with gdb cvs 0708.
It seems I need to use an old compiler like: gcc 4.4.1 or gcc 4.4.3??
Does this happen for simple hello world project?
Yes, much simpler than "hello world project",
see:
int main()
{
int a =1;
a ++;
a =3;
}
:D