Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Debugger output parsing
MortenMacFly:
--- Quote from: mandrav on May 24, 2006, 10:52:38 am ---But if you find any way to make it misbehave again, I 'd like to know it ;)
--- End quote ---
Unfortunately I found a way :(. This is the example code, where I've placed a breakpoint at line 9:
--- Code: ---#include <iostream>
#include <string>
int main()
{
std::string s1 = "Hoho";
std::string s2 = "Hähä";
std::cout << s1 << s2 << std::endl;
return 0;
}
--- End code ---
This is the debuggers debug log (I've enabled watching local variables in the debugger's setup):
--- Code: ---Command-line: D:\Devel\GCC345\bin\gdb.exe -nx -fullname -quiet -args Debug/hallo.exe
Working dir : C:\Dokumente und Einstellungen\ftmh.DLR\Desktop\hallo\
> set prompt >>>>>>cb_gdb:
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
>>>>>>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 new-console on
>>>>>>cb_gdb:
> set disassembly-flavor intel
>>>>>>cb_gdb:
> directory C:/DOKUME~1/ftmh.DLR/Desktop/hallo/
>>>>>>cb_gdb:
> delete breakpoints
>>>>>>cb_gdb:
> break main.cpp:9
Breakpoint 1 at 0x401512: file main.cpp, line 9.
>>>>>>cb_gdb:
> run
Breakpoint 1, main () at main.cpp:9
C:/DOKUME~1/ftmh.DLR/Desktop/hallo/main.cpp:9:105:beg:0x401512
>>>>>>cb_gdb:
> info locals
s1 = {static npos = 4294967295, _M_dataplus = {<allocator<char>> = {<new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x3e2594 "Hoho"}}
s2 = {static npos = 4294967295, _M_dataplus = {<allocator<char>> = {<new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x3e25c4 "H>>>>>cb_gdb:
> info args
No arguments.
>>>>>>cb_gdb:
--- End code ---
With regards, Morten.
Ps.: By the way: Do you know what is "funny", too? If the debugger stops at the breakpoint and you have local watches enabled, then select all text in the open editor (CTRL+A) and watch the debuggers debug log when you place the mouse cursor over the selected text... ;-)
Edit: In the case of the example above it is:
--- Code: ---> whatis #include <iostream>
#include <string>
int main()
{
std::string s1 = "Hoho";
std::string s2 = "Hähä";
std::cout << s1 << s2 << std::endl;
return 0;
}
Invalid character '#' in expression.
>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:
> output #include <iostream>
#include <string>
int main()
{
std::string s1 = "Hoho";
std::string s2 = "Hähä";
std::cout << s1 << s2 << std::endl;
return 0;
}
Ambiguous command "int main()": internals, interpreter-exec, interrupt.
Undefined command: "". Try "help".
Undefined command: "std". Try "help".
Undefined command: "std". Try "help".
Undefined command: "std". Try "help".
Undefined command: "std". Try "help".
Undefined command: "std". Try "help".
Invalid character ';' in expression.
Undefined command: "". Try "help".
Undefined command: "". Try "help".
Invalid character '#' in expression.
>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:
Ambiguous command "int main()": internals, interpreter-exec, interrupt.
Undefined command: "". Try "help".
Undefined command: "std". Try "help".
Undefined command: "std". Try "help".
Undefined command: "std". Try "help".
Undefined command: "std". Try "help".
Undefined command: "std". Try "help".
Invalid character ';' in expression.
Undefined command: "". Try "help".
Undefined command: "". Try "help".
--- End code ---
MortenMacFly:
...another nice example on that topic in addition to my previous post:
The code (breakpoint again at line 9):
--- Code: ---#include <iostream>
#include <string>
int main()
{
const char s1 = 'H';
const char s2 = 'Ä';
std::cout << s1 << s2 << std::endl;
return 0;
}
--- End code ---
The debugger's debug log:
--- Code: ---Command-line: D:\Devel\GCC345\bin\gdb.exe -nx -fullname -quiet -args Debug/hallo.exe
Working dir : C:\Dokumente und Einstellungen\ftmh.DLR\Desktop\hallo\
> set prompt >>>>>>cb_gdb:
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
>>>>>>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 new-console on
>>>>>>cb_gdb:
> set disassembly-flavor intel
>>>>>>cb_gdb:
> directory C:/DOKUME~1/ftmh.DLR/Desktop/hallo/
>>>>>>cb_gdb:
> delete breakpoints
>>>>>>cb_gdb:
> break main.cpp:9
Breakpoint 1 at 0x401410: file main.cpp, line 9.
>>>>>>cb_gdb:
> run
Breakpoint 1, main () at main.cpp:9
C:/DOKUME~1/ftmh.DLR/Desktop/hallo/main.cpp:9:97:beg:0x401410
>>>>>>cb_gdb:
> info locals
s1 = 72 'H'
s2 = -60 '>cb_gdb:
> info args
No arguments.
>>>>>>cb_gdb:
--- End code ---
...edit: Could you (maybe) move this to a new topic? We have hijacked this one by now... ;-)
mandrav:
Well, I don't see anything wrong...
[attachment deleted by admin]
MortenMacFly:
...for the first example my output is [see image 2 attached].
...for the second example my output is [see image 1 attached].
Why is this? What encoding are you using (for me it's WINDOWS-1252)?
mandrav: Could you tell me where I should debug into (which methods)? If you reproduce this I'd like to give it a try...
With regards, Morten.
Edit: Attached image for the other example.
[attachment deleted by admin]
mandrav:
--- Quote ---Why is this? What encoding are you using (for me it's WINDOWS-1252)?
--- End quote ---
I 'm using WINDOWS-1253 but I couldn't even see the file so I switched to UTF8.
Can you try the attached patch? If it still doesn't work, you can find the comments in there and get a general feeling about the problem.
[attachment deleted by admin]
Navigation
[0] Message Index
[#] Next page
Go to full version