News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Splitting debugger in two - specific debugger and common GUI

Started by oBFusCATed, July 26, 2009, 01:27:44 PM

Previous topic - Next topic

oBFusCATed

Olly: try the patch http://smrt.is-a-geek.org/codeblocks/dbg_refactor/fix_breakpoints.patch
It should have fix for it.
There was another build failure in the scintilla code... some usage of UINT which failed on linux.
(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!]

ollydbg

Quote from: oBFusCATed on October 02, 2009, 09:46:38 AM
Olly: try the patch http://smrt.is-a-geek.org/codeblocks/dbg_refactor/fix_breakpoints.patch
It should have fix for it.
There was another build failure in the scintilla code... some usage of UINT which failed on linux.
Thanks, after applying the patch, it build successfully.
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.

MortenMacFly

Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

oBFusCATed

Morten do you have some time to apply the last patch?
(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!]

MortenMacFly

Quote from: oBFusCATed on October 04, 2009, 08:46:31 PM
Morten do you have some time to apply the last patch?
Once I am back at a PC with C::B... ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

oBFusCATed

Here is another patch for the debugger: http://smrt.is-a-geek.org/codeblocks/dbg_refactor/dbg_refactor0004.patch

What it does:
1. Improvements to the backtrace window - the inactive stack frames are not shown as "??" any more
2. Fixed bug https://developer.berlios.de/bugs/?func=detailbug&bug_id=16146&group_id=5358
3. Some cleaning

Best regards
(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!]

oBFusCATed

Yet another patch http://smrt.is-a-geek.org/codeblocks/dbg_refactor/dbg_refactor0005.patch
This one includes the changes from the previous one plus:

1. Fixed bug 13972 ( http://developer.berlios.de/bugs/?func=detailbug&bug_id=13972&group_id=5358 )
2. Modified one of the regexpr for matching lines of the backtrace (case #0)
3. Added two menu options to choose the default action on double click in the backtrace window ("jump to" or "switch to")

(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!]

ollydbg

Hi, oBF, thanks!!!!! :D

I just apply this patch, and find a small bug.

The test code is the attachment of this message
http://forums.next.codeblocks.org/index.php/topic,11301.msg77123.html#msg77123

In debugger branch, I can set breakpoint in the function body.


void __declspec(dllexport) MyFunction(const LPCSTR sometext)
{
   /** SET BREAK POINT HERE VVVVVVVVVVV **/
   MessageBoxA(0, sometext, "DLL Message", MB_OK | MB_ICONINFORMATION); *************breakpoint set here.
   /** SET BREAK POINT HERE ^^^^^^^^^^^^ **/
}


when the debugger hit the bp, cursor jumped to the wrong place,

       if ( NULL != ProcAdd )
           {
           fRunTimeLinkSuccess = TRUE;
           ( ProcAdd ) ( TEXT( "Message via DLL function\n" ) ); *********when bp hit, the cursor always jump here.
           }


I think this is wrong behavior.

It works fine in the trunk version.

My environment: TDM-MinGW GCC 4.4.1 and GDB 7.02
and with patch from jens:
http://forums.next.codeblocks.org/index.php/topic,11301.msg77156.html#msg77156

thanks.


Edit


I just found that if the Call stack window was not opened during debugging, the cursor can jump to the right place. :D, so, this is an issue of interpreting the backtrack output.
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.

oBFusCATed

Uau, you are quite fast :)

Can you provide a platform independent test case? (probably not because I'm sure it breaks because of the "__declspec(dllexport)" )
Can you paste here the output in the debugger log window after the "bt 30" command..
Unfortunately the output of that command is made for users not parsers and so it is quite unreliable :(

Thanks for the feadback

(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!]

ollydbg

Quote from: oBFusCATed on October 19, 2009, 09:35:28 AM
Uau, you are quite fast :)

Can you provide a platform independent test case? (probably not because I'm sure it breaks because of the "__declspec(dllexport)" )
Can you paste here the output in the debugger log window after the "bt 30" command..
Unfortunately the output of that command is made for users not parsers and so it is quite unreliable :(

Thanks for the feadback



Ok, but I can only supply a windows test case, because I only have windows. I haven't tried linux till now. :(

Log with no call stack window:

(gdb) >>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.0
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
> catch throw
Function "__cxa_throw" not defined.
Catchpoint 1 (throw)
>>>>>>cb_gdb:
> source F:\debugger_branch\src\output\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> directory D:/codeblocks_opencv/call_DLL_wxDebugTest/
>>>>>>cb_gdb:
> break "D:/codeblocks_opencv/call_DLL_wxDebugTest/TestApp/main.cpp:63"
Breakpoint 2 at 0x401438: file D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp, line 63.
>>>>>>cb_gdb:
> break "D:/codeblocks_opencv/call_DLL_wxDebugTest/TestDLL/dllmain.cpp:10"
No source file named D:/codeblocks_opencv/call_DLL_wxDebugTest/TestDLL/dllmain.cpp.
Breakpoint 3 ("D:/codeblocks_opencv/call_DLL_wxDebugTest/TestDLL/dllmain.cpp:10) pending.
>>>>>>cb_gdb:
> run
gdb: windows_init_thread_list
[New Thread 1844.0x260]
[New Thread 1844.0x2c8]
Breakpoint 2, WinMain@16 (hThisInstance=0x400000, hPrevInstance=0x0, lpszArgument=0x251f1a "", nCmdShow=10) at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:63
D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:63:2773:beg:0x401438
Current language:  auto
The current source language is "auto; currently c++".
>>>>>>cb_gdb:
> set debugevents off
>>>>>>cb_gdb:
> whatis szClassName
type = char [21]
>>>>>>cb_gdb:
> output &szClassName
(char (*)[21]) 0x402000>>>>>>cb_gdb:
> output szClassName
"CodeBlocksWindowsApp">>>>>>cb_gdb:
> cont
Breakpoint 3, MyFunction (sometext=0x40305d "Message via DLL function\n") at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestDLL\dllmain.cpp:10
D:\codeblocks_opencv\call_DLL_wxDebugTest\TestDLL\dllmain.cpp:10:192:beg:0x684c11de
>>>>>>cb_gdb:
> cont
warning: Temporarily disabling breakpoints for unloaded shared library "D:\codeblocks_opencv\call_DLL_wxDebugTest\bin\TestDLL.dll"
Program exited normally.
>>>>>>cb_gdb:
> quit


Log with call stack window opened.

> bt 30
#0  WinMain@16 (hThisInstance=0x400000, hPrevInstance=0x0, lpszArgument=0x251f1a "", nCmdShow=10) at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:63
#1  0x00401a86 in main ()
>>>>>>cb_gdb:
> break "D:/codeblocks_opencv/call_DLL_wxDebugTest/TestApp/main.cpp:65"
Breakpoint 4 at 0x40143d: file D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp, line 65.
>>>>>>cb_gdb:
> cont
Breakpoint 3, MyFunction (sometext=0x40305d "Message via DLL function\n") at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestDLL\dllmain.cpp:10
D:\codeblocks_opencv\call_DLL_wxDebugTest\TestDLL\dllmain.cpp:10:192:beg:0x684c11de
>>>>>>cb_gdb:
> bt 30
#0  MyFunction (sometext=0x40305d "Message via DLL function\n") at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestDLL\dllmain.cpp:10
#1  0x0040156b in LoadDllPlugin () at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:127
#2  0x0040143d in WinMain@16 (hThisInstance=0x400000, hPrevInstance=0x0, lpszArgument=0x251f1a "", nCmdShow=10) at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:63
#3  0x00401a86 in main ()
>>>>>>cb_gdb:
> frame 1
#1  0x0040156b in LoadDllPlugin () at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:127
D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:127:4719:beg:0x40156b
>>>>>>cb_gdb:
> bt 30
#0  MyFunction (sometext=0x40305d "Message via DLL function\n") at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestDLL\dllmain.cpp:10
#1  0x0040156b in LoadDllPlugin () at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:127
#2  0x0040143d in WinMain@16 (hThisInstance=0x400000, hPrevInstance=0x0, lpszArgument=0x251f1a "", nCmdShow=10) at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:63
#3  0x00401a86 in main ()
>>>>>>cb_gdb:
> frame 1
#1  0x0040156b in LoadDllPlugin () at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:127
D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:127:4719:beg:0x40156b
>>>>>>cb_gdb:
> cont
warning: Temporarily disabling breakpoints for unloaded shared library "D:\codeblocks_opencv\call_DLL_wxDebugTest\bin\TestDLL.dll"
Breakpoint 4, WinMain@16 (hThisInstance=0x400000, hPrevInstance=0x0, lpszArgument=0x251f1a "", nCmdShow=10) at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:65
D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:65:2799:beg:0x40143d
>>>>>>cb_gdb:
> bt 30
#0  WinMain@16 (hThisInstance=0x400000, hPrevInstance=0x0, lpszArgument=0x251f1a "", nCmdShow=10) at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:65
#1  0x00401a86 in main ()
>>>>>>cb_gdb:
> cont
Program exited normally.
>>>>>>cb_gdb:
> quit
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.

oBFusCATed

#115
Quote from: ollydbg on October 19, 2009, 01:49:21 PM
Log with call stack window opened.

> bt 30
#0  WinMain@16 (hThisInstance=0x400000, hPrevInstance=0x0, lpszArgument=0x251f1a "", nCmdShow=10) at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:63
#1  0x00401a86 in main ()

> bt 30
#0  MyFunction (sometext=0x40305d "Message via DLL function\n") at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestDLL\dllmain.cpp:10
#1  0x0040156b in LoadDllPlugin () at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:127
#2  0x0040143d in WinMain@16 (hThisInstance=0x400000, hPrevInstance=0x0, lpszArgument=0x251f1a "", nCmdShow=10) at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:63
#3  0x00401a86 in main ()

> bt 30
#0  MyFunction (sometext=0x40305d "Message via DLL function\n") at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestDLL\dllmain.cpp:10
#1  0x0040156b in LoadDllPlugin () at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:127
#2  0x0040143d in WinMain@16 (hThisInstance=0x400000, hPrevInstance=0x0, lpszArgument=0x251f1a "", nCmdShow=10) at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:63
#3  0x00401a86 in main ()

> bt 30
#0  WinMain@16 (hThisInstance=0x400000, hPrevInstance=0x0, lpszArgument=0x251f1a "", nCmdShow=10) at D:\codeblocks_opencv\call_DLL_wxDebugTest\TestApp\main.cpp:65
#1  0x00401a86 in main ()


That is the relevant output, I'll fix it tonight, when I get home.

Update:

Here is the fixed patch http://smrt.is-a-geek.org/codeblocks/dbg_refactor/dbg_refactor0006.patch

And the diff of the two patches

--- dbg_refactor0005.patch      2009-10-19 01:26:10.000000000 +0300
+++ dbg_refactor0006.patch      2009-10-19 19:52:09.000000000 +0300
@@ -406,7 +406,7 @@
 //#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
-static wxRegEx reBT0(_T("#([0-9]+)[ \t]+([^(]+)[ \t]+(\\([^)]*\\))")); // case #0
-+static wxRegEx reBT0(_T("#([0-9]+)[ \t]+([a-zA-Z:\\(\\)0-9 ,=_@]+)[ \t]at[ \t](.+):([0-9]+)")); // case #0
++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]+)"));


UPDATE: Olly have you tried the new patch?
(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!]

ollydbg

QuoteUPDATE:  Olly have you tried the new patch?

Oh my God, you just update your original post and I'm just waiting for a new notification email from this thread.
So, it's late.
I will tested it soon!
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.

ollydbg

QuoteUpdate:

Here is the fixed patch http://smrt.is-a-geek.org/codeblocks/dbg_refactor/dbg_refactor0006.patch

I just apply this patch, and the problem is fixed  :D.

Thanks for your effort!!!
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.

oBFusCATed

Thanks, next time I'll use new post for such things.

Morten, can you apply 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!]

MortenMacFly

Quote from: oBFusCATed on October 21, 2009, 09:55:02 AM
Morten, can you apply it?
I applied it (as of today) in my local copy... Give me some time for testing and then I'll be happy to submit to the branch.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]