Author Topic: Debugger output parsing  (Read 10288 times)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Debugger output parsing
« on: May 24, 2006, 11:15:24 am »
But if you find any way to make it misbehave again, I 'd like to know it ;)
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;
}
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:
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".
« Last Edit: May 24, 2006, 11:38:21 am by mandrav »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: The 22 May 2006 build is out.
« Reply #1 on: May 24, 2006, 11:21:25 am »
...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;
}
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:

...edit: Could you (maybe) move this to a new topic? We have hijacked this one by now... ;-)
« Last Edit: May 24, 2006, 11:23:00 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Debugger output parsing
« Reply #2 on: May 24, 2006, 11:40:49 am »
Well, I don't see anything wrong...


[attachment deleted by admin]
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Debugger output parsing
« Reply #3 on: May 24, 2006, 12:15:46 pm »
...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]
« Last Edit: May 24, 2006, 12:23:29 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Debugger output parsing
« Reply #4 on: May 24, 2006, 12:38:50 pm »
Quote
Why is this? What encoding are you using (for me it's WINDOWS-1252)?

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]
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Debugger output parsing
« Reply #5 on: May 24, 2006, 01:59:14 pm »
Can you try the attached patch?
...I tried and the output changed to: [see image].
I'll do further research on that, but later today (there is so much work I have to do before here at work...). I'll report back...
With regards, Morten.

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

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Debugger output parsing
« Reply #6 on: May 24, 2006, 03:00:04 pm »
i get the same result as Morten when i use file encoding "System standard" which defaults to WINDOWS-1252

when i use UTF-8, the the result in the debugger pane is correct, but the characters sent to stdout are garbage (obviously)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Debugger output parsing
« Reply #7 on: May 24, 2006, 03:11:21 pm »
I don't think we can have a solution for this, at least not an easy one...
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Debugger output parsing
« Reply #8 on: May 24, 2006, 03:31:54 pm »
I don't think we can have a solution for this, at least not an easy one...
...I wonder what makes you think so? :?:
BTW: If I switch to UTF-8 it workes fine here, too. At least that's an information one can give for such purposes.

I've compared the hex-dump of both files. This is for Windows-1252:
Code
3D 20 22 48 E4 68 E4 22 │ 3B 0A 0A 20 20 73 74 64 -> [= "Hähä";◙◙  std]
...and this for UTF-8:
Code
3D 20 22 48 C3 A4 68 C3 │ A4 22 3B 0A 0A 20 20 73 -> [= "Hähä";◙◙  s]

mandrav: You said it's working for you with Windows-1253. What hex values do you have in that case?

Edit: Sorry, I misunderstood:
I 'm using WINDOWS-1253 but I couldn't even see the file so I switched to UTF8.
This makes things obvious...
« Last Edit: May 24, 2006, 03:36:16 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ