Author Topic: Debugger: bug hard to fix by improving the regex  (Read 6534 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Debugger: bug hard to fix by improving the regex
« on: April 18, 2012, 02:46:44 am »
Code
//#0 wxEntry () at main.cpp:5
//#8  0x77d48734 in USER32!GetDC () from C:\WINDOWS\system32\user32.dll
//#9  0x001b04fe in ?? ()
//#30 0x00403c0a in WinMain (hInstance=0x400000, hPrevInstance=0x0, lpCmdLine=0x241ef9 "", nCmdShow=10) at C:/Devel/wxSmithTest/app.cpp:297
//#31 0x004076ca in main () at C:/Devel/wxWidgets-2.6.1/include/wx/intl.h:555
//#50  0x00410c8c in one::~one() (this=0x3d24c8) at main.cpp:14
//#11  0x00406810 in main ()
static wxRegEx reBT0(_T("#([0-9]+)[ \t]+(.+)[ \t]at[ \t](.+):([0-9]+)")); // case #0
static wxRegEx reBT1(_T("#([0-9]+)[ \t]+0x([A-Fa-f0-9]+)[ \t]+in[ \t]+(.+)[ \t]+(\\([^)]*\\))[ \t]")); // all other cases (gdb 6.3)
static wxRegEx reBTX(_T("#([0-9]+)[ \t]+0x([A-Fa-f0-9]+)[ \t]+in[ \t]+([^(]+)[ \t]*(\\([^)]*\\)[ \t]*\\([^)]*\\))")); // all other cases (gdb 5.2)
static wxRegEx reBT2(_T("\\)[ \t]+[atfrom]+[ \t]+(.*):([0-9]+)"));
static wxRegEx reBT3(_T("\\)[ \t]+[atfrom]+[ \t]+(.*)"));
static wxRegEx reBT4(_T("#([0-9]+)[ \\t]+(.+)[ \\t]in[ \\t](.+)")); // case #11

Surely can't match the code like:
Code
[debug]> bt 30
[debug]#0  ParserThread::DoParse (this=0x5f0fc50) at plugins\codecompletion\parser\parserthread.cpp:521
[debug]#1  0x65eb95d9 in ParserThread::Parse (this=0x5f0fc50) at plugins\codecompletion\parser\parserthread.cpp:497
[debug]#2  0x65e96d8d in Parser::ParseBuffer (this=0x3d44ce0, buffer="#define __DBL_MIN_EXP__ (-1021)\n#define __UINT_LEAST16_MAX__ 65535\n#define __FLT_MIN__ 1.17549435082228750797e-38F\n#define __UINT_LEAST8_TYPE__ unsigned char\n#define _WIN32 1\n#define __INTMAX_C(c) c ##"..., isLocal=false, bufferSkipBlocks=false, isTemp=false, filename="", parentIdx=-1, initLine=0) at plugins\codecompletion\parser\parser.cpp:699
[debug]#3  0x65ed2547 in ParserThreadedTask::Execute (this=0x3b7e9b8) at plugins\codecompletion\parser\parserthreadedtask.cpp:73
[debug]#4  0x6181ff90 in cbThreadPool::cbWorkerThread::Entry (this=0x22c4620) at sdk\cbthreadpool.cpp:216
[debug]#5  0x00e4c609 in wxThreadInternal::DoThreadStart(wxThread*) () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#6  0x00e4c6fb in wxThreadInternal::WinThreadStart () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#7  0x77c3a3b0 in msvcrt!_endthreadex () from C:\WINDOWS\system32\msvcrt.dll
[debug]#8  0x7c80b729 in KERNEL32!GetModuleFileNameA () from C:\WINDOWS\system32\kernel32.dll
[debug]#9  0x00000000 in ?? ()
[debug]>>>>>>cb_gdb:
Note: There are ")" in the string.

So, I'm going to try the GDB/MI plugin. :)
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: 13406
    • Travis build status
Re: Debugger: bug hard to fix by improving the regex
« Reply #1 on: April 18, 2012, 08:36:13 am »
As far as I can see the watches are broken in gdb/mi
(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: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger: bug hard to fix by improving the regex
« Reply #2 on: April 18, 2012, 09:04:46 am »
As far as I can see the watches are broken in gdb/mi
You mean that the watches are not shown correctly in your debugger plugin(gdb/mi)?

I also find some issue with current debugger plugin(gdb/cli), when I pause the debugee, and switch the thread from one to another, sometimes, the thread windows becomes empty.  :)
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: 13406
    • Travis build status
Re: Debugger: bug hard to fix by improving the regex
« Reply #3 on: April 18, 2012, 10:02:53 am »
There was a bug, which I've fixed, hopefully...

I also find some issue with current debugger plugin(gdb/cli), when I pause the debugee, and switch the thread from one to another, sometimes, the thread windows becomes empty.  :)
Known problem, probably impossible to fix it.
(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!]