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

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5229
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Suggest on the debugger plugin
« on: July 09, 2010, 03:23:36 am »
I haven't tested the debugger branch. so, I'm sorry if it is already exist.

See the image below:


Is it possible to show the EIP Pointer on the Disassembly windows, so that the user can understand which is the next instruction.

By the way, I'm debugging ptest project(in the CCbranch), i found that one wxString can not show correctly, see the image :


It seems gdb can not show a empty wxString correctly. Any ideas?

thanks.
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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5229
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #1 on: July 09, 2010, 03:31:23 am »
Things becomes more wired, see the screen shot, I just create another wxString ,but it seems only one wxString works fine...



I don't know why, it is too strange...
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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5229
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #2 on: July 09, 2010, 04:16:53 am »
I just check the DWARF information in the parserthread.o

by using:

Code: [Select]
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:
Code: [Select]
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.





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:
« Last Edit: July 09, 2010, 04:49:01 am by ollydbg »
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: 12333
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #3 on: July 09, 2010, 09:14:47 am »
I think, I've seen the marker of the EIP Pointer in the disassembly window, but I remember that others were complaining too.
Can you check the debuggers branch and report back?
(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: 5229
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #4 on: July 09, 2010, 11:02:31 am »
I think, I've seen the marker of the EIP Pointer in the disassembly window, but I remember that others were complaining too.
Can you check the debuggers branch and report back?

I just tested, and there is not EIP pointer in debugger branch.
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: 12333
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #5 on: July 09, 2010, 01:57:29 pm »
OK, I'll look in to it tonight...
Do you see this behavior on simple hello world projects?
(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: 5229
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #6 on: July 09, 2010, 02:41:09 pm »
OK, I'll look in to it tonight...
Do you see this behavior on simple hello world projects?
Yes, I tested on a simple hello world projects.
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 jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Suggest on the debugger plugin
« Reply #7 on: July 09, 2010, 03:54:31 pm »
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:
Code: [Select]
> 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:

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12333
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #8 on: July 09, 2010, 04:20:24 pm »
Or it could be an gdb for windows issue.

Ollydbg: can you paste the output from "info frame"?
« Last Edit: July 09, 2010, 04:43:53 pm by oBFusCATed »
(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: 5229
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #9 on: July 09, 2010, 04:28:42 pm »
Ok, I just tested in the cc_branch.

Code: [Select]
>>>>>>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.
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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5229
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #10 on: July 09, 2010, 04:35:35 pm »
Hi, it seems there is a "=>" arrow in the debugger log. but this is not shown in the Disassemble window. See the image below:

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: 12333
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #11 on: July 09, 2010, 11:33:38 pm »
Ollydbg: You'll have to debug this issue yourself. Please set breakpoints at the callers of SetActiveAddress() and investigate what is going wrong.
On my machine it works, unfortunately, and I can't test it on windows at the moment.

p.s. the => is not parsed and used...
p.p.s. tested on debuggers branch and with trunk on linux 64bit
p.p.p.s. you could test it with older gdb's 6.8 for example.
(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: 5229
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #12 on: July 10, 2010, 12:57:00 pm »
Ollydbg: You'll have to debug this issue yourself. Please set breakpoints at the callers of SetActiveAddress() and investigate what is going wrong.
On my machine it works, unfortunately, and I can't test it on windows at the moment.

p.s. the => is not parsed and used...
p.p.s. tested on debuggers branch and with trunk on linux 64bit
p.p.p.s. you could test it with older gdb's 6.8 for example.

I just set a breakpoint in the first line of SetActiveAddress function, and found that this breakpoint never be hit. not sure what's the problem is. (I'm use the latest mingw cvs gdb 20100708, Loaden MinGW GCC 4.4.4, ccbranch).

By the way, it is quite cool to debug cb in cb.

That is CB->gdb->CB->gdb->test hello world app. (The arrow " ->" means function call) :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: 12333
    • Travis build status
Re: Suggest on the debugger plugin
« Reply #13 on: July 10, 2010, 10:58:05 pm »
I just set a breakpoint in the first line of SetActiveAddress function, and found that this breakpoint never be hit

It is obvious that the breakpoint won't be hit. Set breakpoints around lines which call the SetActiveAddress() function. Most probably the regexes don't match as Jens suggested.
Have you tested the old gdbs?
(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: 5229
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on the debugger plugin
« Reply #14 on: July 11, 2010, 03:47:12 am »
Have you tested the old gdbs?
Ok, I have download an old gdb, which is: Release Candidate_ GDB 6.8-3, but it is the same result as the new gdb 7.2.50 cvs.

There is no "EIP instruction arrow" appeared in the Disassembly windows either.
Quote
It is obvious that the breakpoint won't be hit. Set breakpoints around lines which call the SetActiveAddress() function. Most probably the regexes don't match as Jens suggested.
I will do more test if I have time. Thanks for the help.
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.