Author Topic: Suggest on the debugger plugin  (Read 17149 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #15 on: July 11, 2010, 05:42:02 am »
I have several problem when debugging debugger plugin.
1, it seems I can't set breakpoint.
See the log:
Quote
> 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:
Code: [Select]
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:


The third issue is: it seems I can't view the value in this function:
Code: [Select]
wxString str = m_pCode->GetLine(i).AfterFirst(_T('x')).BeforeFirst(_T('\t'));
Here is the debugger log:
Quote
> 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??
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12129
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #16 on: September 14, 2010, 09:32:19 pm »
ollydbg: do you still experience this problem?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #17 on: September 15, 2010, 01:48:27 am »
ollydbg: do you still experience this problem?
Ok, I will try it if I have time, which version should I test? the latest debugger_branch?

(currently, I'm mostly focus on cc_branch, and there are still crash problem on cc_branch :(), but the crash seldomly happened).


If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12129
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #18 on: September 15, 2010, 08:43:09 am »
I'm talking about the disassembly problem...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #19 on: September 15, 2010, 10:35:33 am »
I'm talking about the disassembly problem...
OK, I just test the latest debugger_branch, and the dis-assembly problem still exist. There is no arrow in the dis-assembly window.

I use TDM 4.5.1 and unofficial GDB 7.2 released myself.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12129
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #20 on: September 15, 2010, 10:52:02 am »
Does this happen for simple hello world project?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #21 on: September 15, 2010, 11:11:27 am »
Does this happen for simple hello world project?

Yes, much simpler than "hello world project",

see:

Code: [Select]
int main()
{
    int a =1;
    a ++;
    a =3;

}
:D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12129
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #22 on: September 15, 2010, 01:16:15 pm »
OK, I hope I'll find some time to test with your versions of gcc/gdb
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cbexaminr

  • Multiple posting newcomer
  • *
  • Posts: 104
Re: Suggest on the debugger plugin
« Reply #23 on: September 18, 2010, 05:26:06 am »
possible difference in wxwidgets msw/*nix wxString::Printf("%p")?

Note that OllyDbg's disassembly lines have (instruction line location) hex addresses without leading 'x' or 0x.  (As do mine.)

The routine void cbDisassemblyDlg::AddAssemblerLine(unsigned long int addr, const wxString& line)
contains lines:
    wxString fmt;
    fmt.Printf(_T("%p\t%s\n"), (void*)addr, line.c_str());
    m_pCode->AppendText(fmt);

The routine (just beneath previous one) void cbDisassemblyDlg::SetActiveAddress(unsigned long int addr)
contains lines:
        wxString str = m_pCode->GetLine(i).AfterFirst(_T('x')).BeforeFirst(_T('\t'));
        unsigned long int lineaddr;
        if (str.ToULong(&lineaddr, 16) && lineaddr >= addr)

When I traced, it appeared that 'str' was either empty, or returning some random portion of the instruction line.

I'm guessing the *nix disassembly does have an 'x' immediately preceding the disassembly addresses resulting from %p, while the MSW disassembly (at least mine and OllyDbg's) does not have any such 'x'...???

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12129
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #24 on: September 19, 2010, 09:36:44 pm »
cbexaminr: versions of gcc and gdb?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cbexaminr

  • Multiple posting newcomer
  • *
  • Posts: 104
Re: Suggest on the debugger plugin
« Reply #25 on: September 20, 2010, 11:07:05 am »
gcc (TDM-2 mingw32) 4.4.1
-from codelite ....4189.... version installation

GDB gnu (GDB) 7.1
-a)from  codelite ...4189... version installation
-b)locally built
(have used both GDB's)

[edit]
And ollydbg  reported several posts above:
"I use TDM 4.5.1 and unofficial GDB 7.2 released myself." - ollydbg
« Last Edit: September 20, 2010, 11:09:37 am by cbexaminr »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12129
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #26 on: September 20, 2010, 12:18:05 pm »
I know, I was collecting more data :)

I'll try it tonight
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12129
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #27 on: September 20, 2010, 11:45:33 pm »
Please test the latest patch: http://forums.codeblocks.org/index.php/topic,10908.msg89814.html#msg89814
The bug should be fixed. At least for me it is (gdb 7.1.50.xxxxx, gcc 4.4.1 tdm or something like that, windows xp sp3 32bit)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #28 on: September 21, 2010, 01:59:28 am »
Please test the latest patch: http://forums.codeblocks.org/index.php/topic,10908.msg89814.html#msg89814
The bug should be fixed. At least for me it is (gdb 7.1.50.xxxxx, gcc 4.4.1 tdm or something like that, windows xp sp3 32bit)

Hi, obf, I have just test your patch(TDM 4.5.1 and unofficial GDB 7.2 released myself), and confirm the fix, thank you very much!!!!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.