Debian packages (binaries and sources) for 32-bit and 64-bit systems can be found in my repo.
If you want to use apt (or dselect, synaptic or whatever) you need to add the following entries to /etc/apt/sources.list :
deb http://apt.jenslody.de/ any dbg
deb-src http://apt.jenslody.de/ any dbg
and remove entries for the normal nightlies.
Alternatively you can download the deb's directly from http://apt.jenslody.de/pool/dbg/c/codeblocks/ (http://apt.jenslody.de/pool/dbg/c/codeblocks/) .
Codeblocks r7678
Windows Xp 32 bits | Windows7 32 bits | Windows7 64bits
TDM GCC 4.6.1
Hi!
Since I moved to the latest nightly I have a lot of problems with the debugger's watches.
Every time I want to watch a variable, the following message appears:
"Parsing GDB output failed for ..."
I have created a little sample code that demonstrates the problem:
#include <iostream>
#include <string>
using namespace std;
typedef std::string String;
class Foo
{
public:
Foo(std::string name) :mName(name),mBar(0){}
~Foo(){}
void print(){std::cout << mBar << std::endl;}
private:
std::string mName;
int mBar;
};
int main()
{
Foo foo("MyFoo");
foo.print();
cout << "Hello world!" << endl;
String str = "My string";
cout << str << endl;
return 0;
}
Put a breakpoint on and try to watch str and foo won't work (parsing output failed)
http://imageshack.us/photo/my-images/822/cbscreen.png/ (http://imageshack.us/photo/my-images/822/cbscreen.png/)
If you remove the string typedef, the str var is properly shown but not the foo one.
I also tried to enable the debugger's debug log but no log windows appears in the log pane. I only have the regular debug log:
Building to ensure sources are up-to-date
Selecting target:
Debug-Win32
Adding source dir: D:\Projects\Codeblocks\test\
Adding source dir: D:\Projects\Codeblocks\test\
Adding file: D:\Projects\Codeblocks\test\bin\Debug\test.exe
Changing directory to: D:/Projects/Codeblocks/test/.
[debug]PATH=.;C:\MinGW32\bin;C:\Python27\;C:\Python27\Scripts;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\swig;C:\Program Files\doxygen\bin;C:\Program Files\Graphic Remedy\gDEBugger\;C:\Program Files\Microsoft Platform SDK\Bin\.;C:\Program Files\Microsoft Platform SDK\Bin\WinNT\.;C:\Program Files\Autodesk\Backburner\;C:\Program Files\Fichiers communs\Autodesk Shared\;C:\Program Files\TortoiseSVN\bin;c:\swig
[debug]Command-line: C:\MinGW32\bin\gdb.exe -nx -fullname -quiet -args D:/Projects/Codeblocks/test/bin/Debug/test.exe
[debug]Working dir : D:\Projects\Codeblocks\test
Starting debugger: C:\MinGW32\bin\gdb.exe -nx -fullname -quiet -args D:/Projects/Codeblocks/test/bin/Debug/test.exe
done
[debug]> set prompt >>>>>>cb_gdb:
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
[debug]Reading symbols from d:\projects\codeblocks\test\bin\debug\test.exe...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.3
[debug]Copyright (C) 2011 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law. Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "mingw32".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off
Debugger name and version: GNU gdb (GDB) 7.3
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set debugevents on
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\Codeblocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> set print static-members off
show print static-members off
[debug]>>>>>>cb_gdb:Printing of C++ static members is off.
[debug]> directory D:/Projects/Codeblocks/test/
[debug]>>>>>>cb_gdb:Printing of C++ static members is off.
[debug]> break "D:/Projects/Codeblocks/test/main.cpp:21"
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]>>>>>>cb_gdb:Breakpoint 2 at 0x401452: file D:\Projects\Codeblocks\test\main.cpp, line 21.
[debug]>>>>>>cb_gdb:
[debug]gdb: windows_init_thread_list
Child process PID: 3104
[debug][New Thread 3104.0xbb8]
[debug]Breakpoint 2, main () at D:\Projects\Codeblocks\test\main.cpp:21
[debug]d:\projects\codeblocks\test\main.cpp:21:388:beg:0x401452
[debug]>>>>>>cb_gdb:
At d:\projects\codeblocks\test\main.cpp:21
[debug]> whatis str
[debug]type = String
[debug]>>>>>>cb_gdb:
[debug]> output str
[debug]{
[debug] _M_dataplus = {
[debug] <std::allocator<char>> = {
[debug] <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
[debug] members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider:
[debug] _M_p = 0x3e3d44 "My string"
[debug] }
[debug]}>>>>>>cb_gdb:
[debug]> whatis foo
[debug]type = Foo
[debug]>>>>>>cb_gdb:
[debug]> output foo
[debug]{
[debug] mName = {
[debug] _M_dataplus = {
[debug] <std::allocator<char>> = {
[debug] <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
[debug] members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider:
[debug] _M_p = 0x3e3d14 "MyFoo"
[debug] }
[debug] },
[debug] mBar = 0
[debug]}>>>>>>cb_gdb:
Everything was working fine with the previous nightly (7550).
Codeblocks is now unusable for debugging for me so I'm going to switch back to the previous nightly...
I've diffed the logs and there is not big differences in them.
The only suspicious thing in them is this:
>>>>>>cb_gdb:
> source D:\Codeblocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> source C:\MinGW32\bin\stl.gdb
source C:\MinGW32\bin\wx.gdb
>>>>>>cb_gdb:>>>>>>cb_gdb:
>>>>>>cb_gdb:
> source D:\Codeblocks_New\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> source C:\MinGW32\bin\stl.gdb
>>>>>>cb_gdb:>>>>>>cb_gdb:
I guess you've put this source commands in the initial commands.
Can you remove them and try again? Why are they different in the two versions?
Hi, renega_666 (http://forums.codeblocks.org/index.php?action=profile;u=30856), I just read all your posts on the thread.
There are currently two method of show a std::string value under C::B.
1,
Use a python enabled gdb.
Disable the script (Uncheck the "Enable watch scripts") in the debugger setting dialog.
Adding some custom scripts to load python pretty printers when gdb started.
(I use: "source $(TARGET_COMPILER_DIR)bin\stl.gdb" for c++ stl library and "source $(TARGET_COMPILER_DIR)bin\wx.gdb" for wxWidgts library).
Note: You should have pretty printer scripts folders under your MinGw/bin folder.
2,
Use a normal gdb (whether it was python enabled or not).
Enable the script (Check the "Enable watch scripts") in the debugger setting dialog.
Do not add any custom loading python scripts.
I just test the method 1, and it works OK.
When I test method 2, the watch window shows that: Parsing GDB output failed for 'str'!
I'm using this debugger branch nighty build, and windows XP, the gdb was my personal build version: GNU gdb (GDB) 7.4.50.20120128-cvs
The related failed log:
[debug]>>>>>>cb_gdb:
[debug]> whatis str
[debug]type = String
[debug]>>>>>>cb_gdb:
[debug]> output str
[debug]{
[debug] static npos = 4294967295
[debug],
[debug] _M_dataplus = {
[debug] <std::allocator<char>> = {
[debug] <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
[debug] members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider:
[debug] _M_p = 0x3f3d5c "My string"
[debug] }
[debug]}>>>>>>cb_gdb:
[debug]> whatis foo
[debug]type = Foo
[debug]>>>>>>cb_gdb:
[debug]> output foo
[debug]{
[debug] mName = {
[debug] static npos = 4294967295,
[debug] _M_dataplus = {
[debug] <std::allocator<char>> = {
[debug] <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
[debug] members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider:
[debug] _M_p = 0x3f3d2c "MyFoo"
[debug] }
[debug] },
[debug] mBar = 0
[debug]}>>>>>>cb_gdb:
So, either the new gdb has different output string than some old gdb version(like the official gdb7.3.1) Or there are some parsing errors.
To me, I suggest you use the method 1, because it is much better and powerful.
Why do you expect this is going to work?
If you set a breakpoint in the gui and the delete it manually with a gdb command, you'll have problems, don't do it!
Even I do not manually run the "delete" gdb command, I only click on the gui to set breakpoints, I still get a lot of index=-1 showing in the breakpoint window.
1, I set some bps when the debugger is in-active, all the setting bp have the -1 index.
2, when the debugger started, those bps are not re-indexed and updated.
3, When one of the bp(index=-1) was hit line 209, I can add more bps (line 215)through gui click, and they have all the positive index like index=3.
4, I click on the bp(index=-1) trying to remove one bp in line 210 , it looks like it's done(the bed circle has gone).
5, I continue to run the debugee, I will see the old place line 210 (the bp I try to remove in step 4) still hit by showing a yellow triangle there.
Here is the simple debug log:
Debugger name and version: GNU gdb (GDB) 7.4.50.20120128-cvs
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set debugevents on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\stl.gdb
source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\wx.gdb
set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> directory E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:Source directories searched: E:/code/cb/cb_trunk/src/plugins/codecompletion/parser;$cdir;$cwd
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:209"
[debug]>>>>>>cb_gdb:
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:210"
[debug]Breakpoint 2 at 0x4345b4: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 209.
[debug]>>>>>>cb_gdb:Breakpoint 3 at 0x4345c2: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 210.
[debug]> run
[debug]>>>>>>cb_gdb:
[debug]Starting program: E:\code\cb\cb_trunk\src\devel\parsertest.exe
[debug]gdb: windows_init_thread_list
Child process PID: 5416
[debug][New Thread 5416.0x15a0]
[debug]Breakpoint 2, Frame::Start (this=0x15f5b40) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209
[debug]E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209:10793:beg:0x4345b4
[debug]>>>>>>cb_gdb:
At E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:215"
[debug]Breakpoint 4 at 0x43466e: E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:215. (2 locations)
[debug]>>>>>>cb_gdb:
[debug]> delete breakpoints 2
[debug]>>>>>>cb_gdb:
Continuing...
[debug]> cont
[debug]Continuing.
[debug]Breakpoint 3, Frame::Start (this=0x15f5b40) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:210
[debug]E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:210:10842:beg:0x4345c2
[debug]>>>>>>cb_gdb:
At E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:210
Edit
I add line number of bp in the steps.
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:209"
[debug]>>>>>>cb_gdb:
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:210"
[debug]Breakpoint 2 at 0x4345b4: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 209.
[debug]>>>>>>cb_gdb:Breakpoint 3 at 0x4345c2: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 210.
Question: why there are many empty lines after the second debug log line?
I just test the official mingw gdb 7.3.1, it works Ok. see the log:
Debugger name and version: GNU gdb (GDB) 7.3.1
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set debugevents on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\stl.gdb
source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\wx.gdb
set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> directory E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:209"
[debug]Breakpoint 2 at 0x4345b4: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 209.
[debug]>>>>>>cb_gdb:
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:210"
[debug]Breakpoint 3 at 0x4345c2: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 210.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]gdb: windows_init_thread_list
Child process PID: 2196
[debug][New Thread 2196.0x200]
[debug]Breakpoint 2, Frame::Start (this=0x15f5b40) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209
[debug]e:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209:10793:beg:0x4345b4
[debug]>>>>>>cb_gdb:
At e:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209
[debug]> set debugevents off
[debug]>>>>>>cb_gdb:
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:215"
[debug]Breakpoint 4 at 0x43466e: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 215.
[debug]>>>>>>cb_gdb:
[debug]> delete breakpoints 3
[debug]>>>>>>cb_gdb:
Continuing...
[debug]> cont
[debug]Breakpoint 4, Frame::Start (this=0x15f5b40) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:215
[debug]e:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:215:11050:beg:0x43466e
[debug]>>>>>>cb_gdb:
At e:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:215
I'm not sure why the latest cvs gdb was broken, as you said
Notice how the second command is executed before the output of the first is parsed.
Note that both the bps in line 209 and 210 is set before I start the debugger.
I just add two line in the custom gdb's initial commands like:
source $(TARGET_COMPILER_DIR)bin\stl.gdb
source $(TARGET_COMPILER_DIR)bin\wx.gdb
break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:209"
break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:211"
Also, I try to check the "Do no run the debugee" option in the dialog. When I start the debugger, I see this in the log:
Debugger name and version: GNU gdb (GDB) 7.4.50.20120128-cvs
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set debugevents on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\stl.gdb
source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\wx.gdb
break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:209"
break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:211"
[debug]>>>>>>cb_gdb:
[debug]> directory E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/
[debug]>>>>>>cb_gdb:
[debug]Breakpoint 2 at 0x4345b4: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 209.
[debug]>>>>>>cb_gdb:Breakpoint 3 at 0x4345d0: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 211.
[debug]>>>>>>cb_gdb:Note: breakpoint 3 also set at pc 0x4345d0.
[debug]Breakpoint 4 at 0x4345d0: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 211.
[debug]>>>>>>cb_gdb:Source directories searched: E:/code/cb/cb_trunk/src/plugins/codecompletion/parser;$cdir;$cwd
[debug]>>>>>>cb_gdb:
You see: It looks like gdb now give some information:
[debug]>>>>>>cb_gdb:Note: breakpoint 3 also set at pc 0x4345d0.
[debug]Breakpoint 4 at 0x4345d0: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 211.
[debug]>>>>>>cb_gdb:Source directories searched: E:/code/cb/cb_trunk/src/plugins/codecompletion/parser;$cdir;$cwd
[debug]>>>>>>cb_gdb:
Question: what does the line beginning with
[debug]>>>>>>cb_gdb
[debug]>
[debug]
Even some empty line in the log?
I'm confused with those debug log prefix, can you give a explanation? Thanks.
Here is the same log with official mingw gdb 7.3.1.
Debugger name and version: GNU gdb (GDB) 7.3.1
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set debugevents on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\stl.gdb
source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\wx.gdb
break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:209"
break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:211"
[debug]>>>>>>cb_gdb:
[debug]> directory E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/
[debug]>>>>>>cb_gdb:
[debug]Breakpoint 2 at 0x4345b4: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 209.
[debug]>>>>>>cb_gdb:Breakpoint 3 at 0x4345d0: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 211.
[debug]>>>>>>cb_gdb:Breakpoint 4 at 0x4345d0: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 211.
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
PS:( I think the recent release gdb 7.4 will maybe have the same issue with my gdb cvs, because gdb just do a branch on the cvs trunk before it release a new release)
Here is the log I uncomment the line 838 in gdb_driver.cpp, so that I can see what it actually handle the output string
DebugLog(wxString::Format(_T("Command parsing output (cmd: %s): %s"), cmd->m_Cmd.c_str(), buffer.Left(idx).c_str()));
The log is below, when enter the first breakpoint, I just click on the second bp(line 210), but continue run the debugee, I still paused in the line 210.
Debugger name and version: GNU gdb (GDB) 7.4.50.20120128-cvs
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: set confirm off): >>>>>>
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: set width 0): >>>>>>
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: set height 0): >>>>>>
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: set breakpoint pending on): >>>>>>
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: set print asm-demangle on): >>>>>>
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: set unwindonsignal on): >>>>>>
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: set print elements 0): >>>>>>
[debug]> set debugevents on
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: set debugevents on): >>>>>>
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: set disassembly-flavor att): >>>>>>
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: catch throw): Catchpoint 1 (throw)
>>>>>>
[debug]> source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\stl.gdb
source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\wx.gdb
set print elements 200
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\stl.gdb
source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\wx.gdb
set print elements 200): >>>>>>
[debug]> directory E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:Source directories searched: E:/code/cb/cb_trunk/src/plugins/codecompletion/parser;$cdir;$cwd
[debug]Command parsing output (cmd: directory E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/): >>>>>>
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:209"
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:209"): >>>>>>
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:210"
[debug]Breakpoint 2 at 0x4345b4: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 209.
[debug]>>>>>>cb_gdb:Breakpoint 3 at 0x4345c2: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 210.
[debug]Command parsing output (cmd: break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:210"): Breakpoint 2 at 0x4345b4: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 209.
>>>>>>
[debug]> run
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: run): >>>>>>
[debug]Starting program: E:\code\cb\cb_trunk\src\devel\parsertest.exe
[debug]gdb: windows_init_thread_list
Child process PID: 3384
[debug][New Thread 3384.0xbc0]
[debug]d=bc0 code=LOAD_DLL_DEBUG_EVENT)
[debug]Breakpoint 2, Frame::Start (this=0x15f5c48) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209
[debug]E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209:10793:beg:0x4345b4
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: set debugevents off): Starting program: E:\code\cb\cb_trunk\src\devel\parsertest.exe
gdb: windows_init_thread_list
[New Thread 3384.0xbc0]
d=bc0 code=LOAD_DLL_DEBUG_EVENT)
Breakpoint 2, Frame::Start (this=0x15f5c48) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209
E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209:10793:beg:0x4345b4
>>>>>>
At E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:214"
[debug]Breakpoint 4 at 0x4345de: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 214.
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:214"): Breakpoint 4 at 0x4345de: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 214.
>>>>>>
[debug]> delete breakpoints 2
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: delete breakpoints 2): >>>>>>
Continuing...
[debug]> cont
[debug]Continuing.
[debug]Breakpoint 3, Frame::Start (this=0x15f5c48) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:210
[debug]E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:210:10842:beg:0x4345c2
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: cont): Continuing.
Breakpoint 3, Frame::Start (this=0x15f5c48) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:210
E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:210:10842:beg:0x4345c2
>>>>>>
At E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:210
Here is the mingw gdb official output
Debugger name and version: GNU gdb (GDB) 7.3.1
......
set print elements 200
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\stl.gdb
source E:\code\cb\gcc\mingw-static-4.4.5-all\bin\wx.gdb
set print elements 200): >>>>>>
[debug]> directory E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]Command parsing output (cmd: directory E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/): >>>>>>
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:209"
[debug]Breakpoint 2 at 0x4345b4: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 209.
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:209"): Breakpoint 2 at 0x4345b4: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 209.
>>>>>>
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:210"
[debug]Breakpoint 3 at 0x4345c2: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 210.
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:210"): Breakpoint 3 at 0x4345c2: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 210.
>>>>>>
[debug]> run
[debug]gdb: windows_init_thread_list
Child process PID: 1744
[debug][New Thread 1744.0xb54]
[debug]Breakpoint 2, Frame::Start (this=0x15f5c48) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209
[debug]e:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209:10793:beg:0x4345b4
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: run): gdb: windows_init_thread_list
[New Thread 1744.0xb54]
Breakpoint 2, Frame::Start (this=0x15f5c48) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209
e:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209:10793:beg:0x4345b4
>>>>>>
At e:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:209
[debug]> set debugevents off
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: set debugevents off): >>>>>>
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:214"
[debug]Breakpoint 4 at 0x4345de: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 214.
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/frame.cpp:214"): Breakpoint 4 at 0x4345de: file E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp, line 214.
>>>>>>
[debug]> delete breakpoints 3
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: delete breakpoints 3): >>>>>>
Continuing...
[debug]> cont
[debug]Breakpoint 4, Frame::Start (this=0x15f5c48) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:214
[debug]e:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:214:10979:beg:0x4345de
[debug]>>>>>>cb_gdb:
[debug]Command parsing output (cmd: cont): Breakpoint 4, Frame::Start (this=0x15f5c48) at E:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:214
e:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:214:10979:beg:0x4345de
>>>>>>
At e:\code\cb\cb_trunk\src\plugins\codecompletion\parser\frame.cpp:214
Can you see the difference? when you delete the same line, the debugger plugin send different index command.
Ok, I just find that I may find the reason of this issue:
GDB will return a ">>>>>>cb_gdb:" (we call it FULL_GDB_PROMPT or GDB_PROMPT string, this is the customized gdb prompt by codeblocks) to indicate the previous command is executed correctly.
But it looks like every gdb command should return a GDB_PROMPT.
But when I have many custom script in the debugger setting dialog, such as: I put three command here.
source $(TARGET_COMPILER_DIR)bin\stl.gdb
source $(TARGET_COMPILER_DIR)bin\wx.gdb
set print elements 200
Those three command will return three GDB_PROMPT.
Also, the command like setting the directory command will also return a GDB_PROMPT.
After that, we are sending setting break point command, then wait to receive the bp index from gdb. This is a handshake, gdb will return the correct bp index.
Now, if we do not eat/clear the previous GDB_PROMPT, they will be buffered, and serves as the response string from gdb, so we get a bp index mismatch.
So, the solution should be simple:
We should clear/wait the GDB_PROMPT after the custom gdb command, this will not later confuse the normal breakpoint command handshake.
Threat? dangerous? No, both should works quite well.
LOL, no - I meant it may use threads to speed up things and then the output can come mixed. But this really should not be the case.
I do not know whether gdb internally handle command by thread or not.
We should clear/wait the GDB_PROMPT after the custom gdb command, this will not later confuse the normal breakpoint command handshake.
Still weird that this does not happen with earlier versions of GDB.
That's because the later gdb, namely the gdb cvs I tested runs faster.
I have a compare test case:
1, the same test project
2, the same setting breakpoint before debugger started.
3, the same gdb cvs version and same gdb custom command.
The only difference is:
CaseA: I have a debug log code in the line 837 of gdb_dirver.cpp: (which log out a full send command and received text)
DebugLog(wxString::Format(_T("###Handshake: %s #### %s #####"), cmd->m_Cmd.c_str(), buffer.c_str()));
CaseB: I just comment out the above debug log code.
The result is:
CaseA works Ok, no bp index mismatch.
CaseB works badly.
So, you see, The DebugLog code generally does not cause anything, but only a time delay, but this hide the issue.
I have tried to fix this, but finally failed. So I decided to find a workaround. :)
Finally I find one workaround. That is: group all the custom gdb command in one *.gdb file.
Before:
source $(TARGET_COMPILER_DIR)bin\stl.gdb
source $(TARGET_COMPILER_DIR)bin\wx.gdb
set print elements 200
After:
source $(TARGET_COMPILER_DIR)bin\custom.gdb
Note: custom.gdb contains all the contents of the previous three command. Now, it works OK.