Author Topic: debugger_gdbmi pretty printing  (Read 8973 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
debugger_gdbmi pretty printing
« on: April 06, 2012, 04:10:08 pm »
I'm having a problem displaying wxStrings with the debugger_gdbmi plugin.

I've installed pretty printing according to http://code.google.com/p/qp-gcc/wiki/GDB#Load_the_python_script_when_Debugger_started_in_Codeblocks
This appears to work ok for the debugger branch of CB.

But for the debugger_gdbmi plugin:
When I put a breakpoint on the line "wxMessageBox..."
Code
void TestppDialog::OnAbout(wxCommandEvent &event)
{
    wxString msg = wxbuildinfo(long_f);
    wxMessageBox(msg, _("Welcome to..."));

Then hover over msg, I get the response "msg {...} wxString".

Whereas with the debugger branch of CB, I get: msg "wxWidgets 2.8.10-Windows-Unicode build" wxString

debugger_gdbmi output:
Code
[debug]output==>*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x00402f69",func="TestppDialog::OnAbout",args=[{name="this",value="0x2165d70"},{name="event",value="..."}],file="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",fullname="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",line="96"},thread-id="1",stopped-threads="all"
[debug]unparsable_output==>(gdb)
[debug]notification event recieved!
[debug]Executor stopped
[debug]ActionsMap::Run -> starting action: 028EE018 id: 6
[debug]cmd==>60000000000-var-create - @ msg
[debug]output==>60000000000^done,name="var1",numchild="1",value="{...}",type="wxString",thread-id="1",has_more="0"
[debug]unparsable_output==>(gdb)
[debug]WatchCreateAction::OnCommandOutput - processing command 60000000000
[debug]WatchCreateAction::Output - finishing at60000000000
[debug]updating watches
[debug]ActionsMap::Run -> starting action: 05614138 id: 7
[debug]cmd==>70000000000-var-delete var1
[debug]output==>70000000000^done,ndeleted="1"
[debug]unparsable_output==>(gdb)

gdb version output:
Code
c:\Usr\mingw431\bin>gdb --version
GNU gdb (GDB) 7.2.50.20101213
Copyright (C) 2010 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:

Any suggestions would be appreciated.


svn build  rev 7904 (2012-03-19 21:48:48)   gcc 4.3.1 Windows/unicode - 32 bit
« Last Edit: April 06, 2012, 04:20:09 pm by Pecan »

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13212
    • Travis build status
Re: debugger_gdbmi pretty printing
« Reply #1 on: April 06, 2012, 04:23:30 pm »
Can you try with gdb-7.4, but I guess I'm not handling this case correctly.

Also I doubt the pretty printers work for wxString in 2.8, they are made for 2.9+, but I may be wrong.
Does it work for std::string? Because I think, I've tried it and it worked.
(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: 5339
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: debugger_gdbmi pretty printing
« Reply #2 on: April 06, 2012, 04:34:32 pm »
Also I doubt the pretty printers work for wxString in 2.8, they are made for 2.9+, but I may be wrong.

If I remember correctly, wxWidgets 2.8.x and wx2.9+ need different python pretty printers (at least for wxString). See:
http://forums.codeblocks.org/index.php/topic,15050.msg100720.html#msg100720

I don't have c::b at hand right now, so I can not do any test.
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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
Re: debugger_gdbmi pretty printing
« Reply #3 on: April 06, 2012, 04:45:22 pm »
Can you try with gdb-7.4, but I guess I'm not handling this case correctly.

Also I doubt the pretty printers work for wxString in 2.8, they are made for 2.9+, but I may be wrong.
Does it work for std::string? Because I think, I've tried it and it worked.

Pretty printing does work with wx 2.8 in the debugger branch.

debugger_gdmi also does *not* display a std string:
Code
[debug]output==>*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x00403005",func="TestppDialog::OnAbout",args=[{name="this",value="0x2155c98"},{name="event",value="..."}],file="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",fullname="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",line="100"},thread-id="1",stopped-threads="all"
[debug]unparsable_output==>(gdb)
[debug]notification event recieved!
[debug]Executor stopped
[debug]ActionsMap::Run -> starting action: 02BF9328 id: 6
[debug]cmd==>60000000000-var-create - @ mystr
[b][debug]output==>60000000000^done,name="var1",numchild="2",value="{...}",type="TestppDialog::string",thread-id="1",has_more="0"[/b]
[debug]unparsable_output==>(gdb)
[debug]WatchCreateAction::OnCommandOutput - processing command 60000000000
[debug]WatchCreateAction::Output - finishing at60000000000
[debug]updating watches
[debug]ActionsMap::Run -> starting action: 0562EED0 id: 7
[debug]cmd==>70000000000-var-delete var1
[debug]output==>70000000000^done,ndeleted="1"
[debug]unparsable_output==>(gdb)

I'll see if I can find a gdb 7.4 for windows 7. If you have a link I'd appreciate it.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
Re: debugger_gdbmi pretty printing
« Reply #4 on: April 06, 2012, 05:08:48 pm »
Here's a screen shot with wx 2.8 and the debugger branch of CB using pretty printers.



Here's a screen shot with wx.2.8 and the debugger_gdbmi using pretty printers



so, it seems to me, that wx2.8 is not the problem.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13212
    • Travis build status
Re: debugger_gdbmi pretty printing
« Reply #5 on: April 06, 2012, 06:03:33 pm »
What happens if you expand it (click on the +) the watch?
(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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
Re: debugger_gdbmi pretty printing
« Reply #6 on: April 06, 2012, 06:53:55 pm »
There ya go.  How stupid can I get?? NO, don't answer that.




I didn't even see the little '+'. Old eyes, feeble mind.
« Last Edit: April 06, 2012, 07:10:28 pm by Pecan »

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13212
    • Travis build status
Re: debugger_gdbmi pretty printing
« Reply #7 on: April 06, 2012, 07:21:32 pm »
Hm, do you have the option 'use python pretty printers' enabled?

p.s. my std::string pretty printer works pretty well (gcc 4.5 + gdb 7.4 + 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!]

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
Re: debugger_gdbmi pretty printing
« Reply #8 on: April 06, 2012, 07:29:00 pm »
Pretty printing is enabled.



So far I have been unable to find gdb 7.4 for windows 7.
Still looking though....

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13212
    • Travis build status
Re: debugger_gdbmi pretty printing
« Reply #9 on: April 06, 2012, 07:33:31 pm »
Post the full log then...
(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!]

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13212
    • Travis build status
Re: debugger_gdbmi pretty printing
« Reply #10 on: April 06, 2012, 07:37:47 pm »
Looking at you other post, the problem is obvious. The initial commands handler has not escaped the paths in your source commands.

Can you also post the beginning of the log from the normal debugger?
(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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
Re: debugger_gdbmi pretty printing
« Reply #11 on: April 06, 2012, 08:16:02 pm »
Debugger_gdbmi log
Code
Active debugger config: GDB/MI:Default
start debugger
Building to ensure sources are up-to-date
Selecting target:
debug
Adding file: C:\Usr\Proj\test\Testpp\debug\Testpp.exe

[debug]PATH=.;C:\Usr\Proj\wxWidgets2810\lib\gcc_lib;C:\Usr\mingw431\bin;C:\Usr\mingw431;C:\Usr\Proj\ImageCraft\ImageCraft_IDB\trunk\src\output;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Dell\Dell Wireless WLAN Card;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared;C:\Usr\bin;C:\Program Files (x86)\CollabNet Subversion;C:\Program Files (x86)\TortoiseSVN\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Common Files\Adobe\AGL;c:\Usr\mingw431\bin

GDB path: c:\Usr\mingw431\bin\gdb.exe
DEBUGGEE path: C:\Usr\Proj\test\Testpp\debug\Testpp.exe
Command-line: c:\Usr\mingw431\bin\gdb.exe -fullname  -quiet --interpreter=mi -args C:\Usr\Proj\test\Testpp\debug\Testpp.exe
Working dir : C:\Usr\Proj\test\Testpp\.
Starting debugger:

[debug]Executing command: c:\Usr\mingw431\bin\gdb.exe -fullname  -quiet --interpreter=mi -args C:\Usr\Proj\test\Testpp\debug\Testpp.exe

done

[debug]Executor stopped
[debug]Debugger_GDB_MI::CommitBreakpoints
[debug]ActionsMap::Run -> starting action: 0594C9A8 id: 1
[debug]BreakpointAddAction::m_initial_cmd = 10000000000
[debug]cmd==>10000000000-break-insert C:\Usr\Proj\test\Testpp\TestppMain.cpp:96
[debug]ActionsMap::Run -> starting action: 05877B20 id: 2
[debug]cmd==>20000000000-interpreter-exec console "source c:\Usr\mingw431\bin\stl.gdb"
[debug]ActionsMap::Run -> starting action: 058776A0 id: 3
[debug]cmd==>30000000000-interpreter-exec console "source c:\Usr\mingw431\bin\wx.gdb"
[debug]ActionsMap::Run -> starting action: 05877658 id: 4
[debug]cmd==>40000000000-enable-pretty-printing
[debug]output==>=thread-group-added,id="i1"
[debug]unparsable_output==>~"Reading symbols from C:\\Usr\\Proj\\test\\Testpp\\debug\\Testpp.exe..."
[debug]notification event recieved!
[debug]unparsable_output==>~"done.\n"
[debug]unparsable_output==>(gdb)
[debug]output==>10000000000^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00402f69",func="TestppDialog::OnAbout(wxCommandEvent&)",file="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",fullname="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",line="96",times="0",original-location="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp:96"}
[debug]unparsable_output==>(gdb)
[debug]unparsable_output==>&"c:Usrmingw431\binstl.gdb: No such file or directory.\n"
[debug]output==>20000000000^error,msg="c:Usrmingw431\binstl.gdb: No such file or directory."
[debug]unparsable_output==>(gdb)
[debug]unparsable_output==>&"c:Usrmingw431\binwx.gdb: No such file or directory.\n"
[debug]BreakpointAddAction::OnCommandResult: 10000000000
[debug]BreakpointAddAction::breakpoint index is 1
[debug]BreakpointAddAction::Finishing1
[debug]BreakpointAddAction::destructor
[debug]output==>30000000000^error,msg="c:Usrmingw431\binwx.gdb: No such file or directory."
[debug]unparsable_output==>(gdb)
[debug]output==>40000000000^done
[debug]unparsable_output==>(gdb)
[debug]ActionsMap::Run -> starting action: 05792678 id: 5
[debug]RunAction::OnStart -> -exec-run
[debug]cmd==>50000000000-exec-run
[debug]output==>=thread-group-started,id="i1",pid="3060"
[debug]output==>=thread-created,id="1",group-id="i1"
[debug]unparsable_output==>~"[New Thread 3060.0xff4]\n"
[debug]output==>50000000000^running
[debug]output==>*running,thread-id="all"
[debug]unparsable_output==>(gdb)
[debug]notification event recieved!

Found child pid: 3060


[debug]notification event recieved!
[debug]RunAction success, the debugger is !stopped!
[debug]RunAction::Output - type: result
class: running
results:

[debug]Executor started
[debug]notification event recieved!
[debug]output==>=library-loaded,id="C:\\Windows\\system32\\ntdll.dll",target-name="C:\\Windows\\system32\\ntdll.dll",host-name="C:\\Windows\\system32\\ntdll.dll",symbols-loaded="0",thread-group="i1"
[debug]RunAction::destructor
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\kernel32.dll",target-name="C:\\Windows\\syswow64\\kernel32.dll",host-name="C:\\Windows\\syswow64\\kernel32.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\KernelBase.dll",target-name="C:\\Windows\\syswow64\\KernelBase.dll",host-name="C:\\Windows\\syswow64\\KernelBase.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\advapi32.dll",target-name="C:\\Windows\\syswow64\\advapi32.dll",host-name="C:\\Windows\\syswow64\\advapi32.dll",symbols-loaded="0",thread-group="i1"
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\msvcrt.dll",target-name="C:\\Windows\\syswow64\\msvcrt.dll",host-name="C:\\Windows\\syswow64\\msvcrt.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\SysWOW64\\sechost.dll",target-name="C:\\Windows\\SysWOW64\\sechost.dll",host-name="C:\\Windows\\SysWOW64\\sechost.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\rpcrt4.dll",target-name="C:\\Windows\\syswow64\\rpcrt4.dll",host-name="C:\\Windows\\syswow64\\rpcrt4.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\sspicli.dll",target-name="C:\\Windows\\syswow64\\sspicli.dll",host-name="C:\\Windows\\syswow64\\sspicli.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\cryptbase.dll",target-name="C:\\Windows\\syswow64\\cryptbase.dll",host-name="C:\\Windows\\syswow64\\cryptbase.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\WinSxS\\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16385_none_421189da2b7fabfc\\comctl32.dll",target-name="C:\\Windows\\WinSxS\\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16385_none_421189da2b7fabfc\\comctl32.dll",host-name="C:\\Windows\\WinSxS\\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16385_none_421189da2b7fabfc\\comctl32.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\gdi32.dll",target-name="C:\\Windows\\syswow64\\gdi32.dll",host-name="C:\\Windows\\syswow64\\gdi32.dll",symbols-loaded="0",thread-group="i1"
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\user32.dll",target-name="C:\\Windows\\syswow64\\user32.dll",host-name="C:\\Windows\\syswow64\\user32.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\lpk.dll",target-name="C:\\Windows\\syswow64\\lpk.dll",host-name="C:\\Windows\\syswow64\\lpk.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\usp10.dll",target-name="C:\\Windows\\syswow64\\usp10.dll",host-name="C:\\Windows\\syswow64\\usp10.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\shlwapi.dll",target-name="C:\\Windows\\syswow64\\shlwapi.dll",host-name="C:\\Windows\\syswow64\\shlwapi.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\comdlg32.dll",target-name="C:\\Windows\\syswow64\\comdlg32.dll",host-name="C:\\Windows\\syswow64\\comdlg32.dll",symbols-loaded="0",thread-group="i1"
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\shell32.dll",target-name="C:\\Windows\\syswow64\\shell32.dll",host-name="C:\\Windows\\syswow64\\shell32.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\SysWOW64\\mingwm10.dll",target-name="C:\\Windows\\SysWOW64\\mingwm10.dll",host-name="C:\\Windows\\SysWOW64\\mingwm10.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\ole32.dll",target-name="C:\\Windows\\syswow64\\ole32.dll",host-name="C:\\Windows\\syswow64\\ole32.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\oleaut32.dll",target-name="C:\\Windows\\syswow64\\oleaut32.dll",host-name="C:\\Windows\\syswow64\\oleaut32.dll",symbols-loaded="0",thread-group="i1"
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]output==>=library-loaded,id="C:\\Windows\\SysWOW64\\imm32.dll",target-name="C:\\Windows\\SysWOW64\\imm32.dll",host-name="C:\\Windows\\SysWOW64\\imm32.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\syswow64\\msctf.dll",target-name="C:\\Windows\\syswow64\\msctf.dll",host-name="C:\\Windows\\syswow64\\msctf.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\SysWOW64\\uxtheme.dll",target-name="C:\\Windows\\SysWOW64\\uxtheme.dll",host-name="C:\\Windows\\SysWOW64\\uxtheme.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\User\\Programs\\VirtuaWin\\vwHook.dll",target-name="C:\\User\\Programs\\VirtuaWin\\vwHook.dll",host-name="C:\\User\\Programs\\VirtuaWin\\vwHook.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-loaded,id="C:\\Windows\\SysWOW64\\dwmapi.dll",target-name="C:\\Windows\\SysWOW64\\dwmapi.dll",host-name="C:\\Windows\\SysWOW64\\dwmapi.dll",symbols-loaded="0",thread-group="i1"
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]notification event recieved!
[debug]output==>=library-loaded,id="C:\\Windows\\SysWOW64\\ole32.dll",target-name="C:\\Windows\\SysWOW64\\ole32.dll",host-name="C:\\Windows\\SysWOW64\\ole32.dll",symbols-loaded="0",thread-group="i1"
[debug]output==>=library-unloaded,id="C:\\Windows\\SysWOW64\\ole32.dll",target-name="C:\\Windows\\SysWOW64\\ole32.dll",host-name="C:\\Windows\\SysWOW64\\ole32.dll",thread-group="i1"
[debug]notification event recieved!
[debug]notification event recieved!
[debug]output==>*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x00402f69",func="TestppDialog::OnAbout",args=[{name="this",value="0x2115c98"},{name="event",value="..."}],file="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",fullname="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",line="96"},thread-id="1",stopped-threads="all"
[debug]unparsable_output==>(gdb)
[debug]notification event recieved!
[debug]Executor stopped
[debug]ActionsMap::Run -> starting action: 02D3D5B8 id: 6
[debug]cmd==>60000000000-var-create - @ msg
[debug]output==>60000000000^done,name="var1",numchild="1",value="{...}",type="wxString",thread-id="1",has_more="0"
[debug]unparsable_output==>(gdb)
[debug]WatchCreateAction::OnCommandOutput - processing command 60000000000
[debug]WatchCreateAction::Output - finishing at60000000000
[debug]updating watches
[debug]ActionsMap::Run -> starting action: 05877AD8 id: 7
[debug]cmd==>70000000000-var-delete var1
[debug]output==>70000000000^done,ndeleted="1"
[debug]unparsable_output==>(gdb)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
Re: debugger_gdbmi pretty printing
« Reply #12 on: April 06, 2012, 08:18:45 pm »
Debugger branch log
Code
Building to ensure sources are up-to-date
Selecting target:
debug
Adding source dir: C:\Usr\Proj\test\Testpp\
Adding source dir: C:\Usr\Proj\test\Testpp\
Adding file: C:\Usr\Proj\test\Testpp\debug\Testpp.exe
Changing directory to: C:/Usr/Proj/test/Testpp/.

[debug]PATH=.;C:\Usr\Proj\wxWidgets2810\lib\gcc_lib;C:\Usr\mingw431\bin;C:\Usr\mingw431;C:\Usr\Proj\ImageCraft\ImageCraft_IDB\trunk\src\output;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Dell\Dell Wireless WLAN Card;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared;C:\Usr\bin;C:\Program Files (x86)\CollabNet Subversion;C:\Program Files (x86)\TortoiseSVN\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Common Files\Adobe\AGL;c:\Usr\mingw431\bin
[debug]Command-line: C:\Usr\mingw431\bin\gdb.exe -nx -fullname  -quiet  -args C:/Usr/Proj/test/Testpp/debug/Testpp.exe
[debug]Working dir : C:\Usr\Proj\test\Testpp

Starting debugger: C:\Usr\mingw431\bin\gdb.exe -nx -fullname  -quiet  -args C:/Usr/Proj/test/Testpp/debug/Testpp.exe
done

[debug]> set prompt >>>>>>cb_gdb:
[debug]Skip initializing the scripting!

Setting breakpoints

[debug]Reading symbols from C:/Usr/Proj/test/Testpp/debug/Testpp.exe...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.2.50.20101213
[debug]Copyright (C) 2010 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.2.50.20101213

[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]> source C:\Usr\mingw431\bin\stl.gdb
source C:\Usr\mingw431\bin\wx.gdb
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> directory C:/Usr/Proj/test/Testpp/
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Usr/Proj/test/Testpp/TestppMain.cpp:96"
[debug]Breakpoint 1 at 0x402f69: file C:\Usr\Proj\test\Testpp\TestppMain.cpp, line 96.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]gdb: windows_init_thread_list

Child process PID: 964

[debug][New Thread 964.0xfd4]
[debug]Breakpoint 1, TestppDialog::OnAbout (this=0x2155c98, event=...) at C:\Usr\Proj\test\Testpp\TestppMain.cpp:96
[debug]C:\Usr\Proj\test\Testpp\TestppMain.cpp:96:2590:beg:0x402f69
[debug]>>>>>>cb_gdb:

At C:\Usr\Proj\test\Testpp\TestppMain.cpp:96

[debug]> set debugevents off
[debug]>>>>>>cb_gdb:
[debug]> whatis msg
[debug]type = wxString
[debug]>>>>>>cb_gdb:
[debug]> output &msg
[debug](wxString *) 0x28e770>>>>>>cb_gdb:
[debug]> output msg
[debug]"wxWidgets 2.8.10-Windows-Unicode build">>>>>>cb_gdb:

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13212
    • Travis build status
Re: debugger_gdbmi pretty printing
« Reply #13 on: April 06, 2012, 08:46:35 pm »
Pecan,
Have you disabled "Enable watch stripts" in the normal gdb plugin?
It looks like you have not?

About the problem: I guess, I have to escape all '\' characters, when executing cli commands.
I can't test on windows at the moment, but I guess this patch will fix it:

Code
Index: src/plugin.cpp
===================================================================
--- src/plugin.cpp      (revision 143)
+++ src/plugin.cpp      (working copy)
@@ -1250,7 +1250,10 @@
     if (escaped_cmd[0] == wxT('-'))
         AddStringCommand(escaped_cmd);
     else
+    {
+        escaped_cmd.Replace(wxT("\\"), wxT("\\\\"), true);
         AddStringCommand(wxT("-interpreter-exec console \"") + escaped_cmd + wxT("\""));
+    }
 }
 
 void Debugger_GDB_MI::AttachToProcess(const wxString& pid)
(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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
Re: debugger_gdbmi pretty printing
« Reply #14 on: April 06, 2012, 10:24:20 pm »
Ummm, nope. Enable watch scripts is UNchecked.



I'll give the patch a try. Thanks.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
Re: debugger_gdbmi pretty printing
« Reply #15 on: April 06, 2012, 10:46:51 pm »
The patch produced the same results as before. I have to click the little '+' sign to see the string.


Code
Active debugger config: GDB/MI:Default
start debugger
Building to ensure sources are up-to-date
Selecting target:
debug
Adding file: C:\Usr\Proj\test\Testpp\debug\Testpp.exe

[debug]PATH=.;C:\Usr\Proj\wxWidgets2810\lib\gcc_lib;C:\Usr\mingw431\bin;C:\Usr\mingw431;C:\Usr\Proj\ImageCraft\ImageCraft_IDB\trunk\src\output;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Dell\Dell Wireless WLAN Card;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared;C:\Usr\bin;C:\Program Files (x86)\CollabNet Subversion;C:\Program Files (x86)\TortoiseSVN\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Common Files\Adobe\AGL;c:\Usr\mingw431\bin

GDB path: c:\Usr\mingw463\bin\gdb.exe
DEBUGGEE path: C:\Usr\Proj\test\Testpp\debug\Testpp.exe
Command-line: c:\Usr\mingw463\bin\gdb.exe -fullname  -quiet --interpreter=mi -args C:\Usr\Proj\test\Testpp\debug\Testpp.exe
Working dir : C:\Usr\Proj\test\Testpp\.
Starting debugger:

[debug]Executing command: c:\Usr\mingw463\bin\gdb.exe -fullname  -quiet --interpreter=mi -args C:\Usr\Proj\test\Testpp\debug\Testpp.exe

done

[debug]Executor stopped
[debug]Debugger_GDB_MI::CommitBreakpoints
[debug]ActionsMap::Run -> starting action: 05D5D430 id: 1
[debug]BreakpointAddAction::m_initial_cmd = 10000000000
[debug]cmd==>10000000000-break-insert C:\Usr\Proj\test\Testpp\TestppMain.cpp:96
[debug]ActionsMap::Run -> starting action: 05D6B7F0 id: 2
[debug]cmd==>20000000000-interpreter-exec console "source c:\\Usr\\mingw431\\bin\\stl.gdb"
[debug]ActionsMap::Run -> starting action: 05D6B8C8 id: 3
[debug]cmd==>30000000000-interpreter-exec console "source c:\\Usr\\mingw431\\bin\\wx.gdb"
[debug]ActionsMap::Run -> starting action: 05D6B3B8 id: 4
[debug]cmd==>40000000000-enable-pretty-printing
[debug]output==>=thread-group-added,id="i1"
[debug]unparsable_output==>~"Reading symbols from C:\\Usr\\Proj\\test\\Testpp\\debug\\Testpp.exe..."
[debug]notification event recieved!
[debug]unparsable_output==>~"done.\n"
[debug]unparsable_output==>(gdb)
[debug]output==>10000000000^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00402f69",func="TestppDialog::OnAbout(wxCommandEvent&)",file="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",fullname="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",line="96",times="0",original-location="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp:96"}
[debug]unparsable_output==>(gdb)
[debug]unparsable_output==>&"c:\\Usr\\mingw431\\bin\\stl.gdb:6: Error in sourced command file:\n"
[debug]unparsable_output==>&"Python scripting is not supported in this copy of GDB.\n"
[debug]output==>20000000000^error,msg="c:\\Usr\\mingw431\\bin\\stl.gdb:6: Error in sourced command file:\nPython scripting is not supported in this copy of GDB."
[debug]unparsable_output==>(gdb)
[debug]unparsable_output==>&"c:\\Usr\\mingw431\\bin\\wx.gdb:6: Error in sourced command file:\n"
[debug]unparsable_output==>&"Python scripting is not supported in this copy of GDB.\n"
[debug]output==>30000000000^error,msg="c:\\Usr\\mingw431\\bin\\wx.gdb:6: Error in sourced command file:\nPython scripting is not supported in this copy of GDB."
[debug]unparsable_output==>(gdb)
[debug]output==>40000000000^done
[debug]BreakpointAddAction::OnCommandResult: 10000000000
[debug]BreakpointAddAction::breakpoint index is 1
[debug]BreakpointAddAction::Finishing1
[debug]BreakpointAddAction::destructor
[debug]ActionsMap::Run -> starting action: 05CC2740 id: 5
[debug]RunAction::OnStart -> -exec-run
[debug]cmd==>50000000000-exec-run
[debug]unparsable_output==>(gdb)
[debug]output==>=thread-group-started,id="i1",pid="4156"
[debug]output==>=thread-created,id="1",group-id="i1"
[debug]unparsable_output==>~"[New Thread 4156.0x9cc]\n"
[debug]output==>50000000000^running
[debug]notification event recieved!

Found child pid: 4156


[debug]notification event recieved!
[debug]RunAction success, the debugger is !stopped!
[debug]RunAction::Output - type: result
class: running
results:

[debug]Executor started
[debug]output==>*running,thread-id="all"
[debug]RunAction::destructor
[debug]unparsable_output==>(gdb)
[debug]notification event recieved!
[debug]unparsable_output==>&"warning: Can not parse XML library list; XML support was disabled at compile time\n"
[debug]output==>=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00402f69",func="TestppDialog::OnAbout(wxCommandEvent&)",file="C:\\\\Usr\\\\Proj\\\\test\\\\Testpp\\\\TestppMain.cpp",fullname="C:\\\\Usr\\\\Proj\\\\test\\\\Testpp\\\\TestppMain.cpp",line="96",times="1",original-location="C:\\\\Usr\\\\Proj\\\\test\\\\Testpp\\\\TestppMain.cpp:96"}
[debug]output==>*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x00402f69",func="TestppDialog::OnAbout",args=[{name="this",value="0x21c5ca8"},{name="event",value="..."}],file="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",fullname="C:\\Usr\\Proj\\test\\Testpp\\TestppMain.cpp",line="96"},thread-id="1",stopped-threads="all"
[debug]unparsable_output==>(gdb)
[debug]notification event recieved!
[debug]notification event recieved!
[debug]Executor stopped
[debug]ActionsMap::Run -> starting action: 05CCFD80 id: 6
[debug]cmd==>60000000000-var-create - @ msg
[debug]output==>60000000000^done,name="var1",numchild="1",value="{...}",type="wxString",thread-id="1",has_more="0"
[debug]unparsable_output==>(gdb)
[debug]WatchCreateAction::OnCommandOutput - processing command 60000000000
[debug]WatchCreateAction::Output - finishing at60000000000
[debug]updating watches
[debug]ActionsMap::Run -> starting action: 05D6B958 id: 7
[debug]cmd==>70000000000-var-delete var1
[debug]output==>70000000000^done,ndeleted="1"
[debug]unparsable_output==>(gdb)



Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13212
    • Travis build status
Re: debugger_gdbmi pretty printing
« Reply #16 on: April 06, 2012, 10:56:03 pm »
Code
[debug]cmd==>20000000000-interpreter-exec console "source c:\\Usr\\mingw431\\bin\\stl.gdb"
[debug]cmd==>30000000000-interpreter-exec console "source c:\\Usr\\mingw431\\bin\\wx.gdb"
[debug]cmd==>40000000000-enable-pretty-printing
[debug]output==>20000000000^error,msg="c:\\Usr\\mingw431\\bin\\stl.gdb:6: Error in sourced command file:\nPython scripting is not supported in this copy of GDB."
[debug]output==>30000000000^error,msg="c:\\Usr\\mingw431\\bin\\wx.gdb:6: Error in sourced command file:\nPython scripting is not supported in this copy of GDB."
I guess this is the reason - the source commands for loading the pretty printers are executed before the enable command for pretty printing.
I'll move it before them. In the mean time you can try to put '-enable-pretty-printing' before the two source commands in the initial commands.

Edit: I've committed both changes.
« Last Edit: April 06, 2012, 11:01:23 pm by oBFusCATed »
(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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
Re: debugger_gdbmi pretty printing
« Reply #17 on: April 07, 2012, 12:46:51 am »
Using the debugger branch (not gdbmi) and carefully specifying the gdb directory, I get the following with pretty printing. It looks very much like the output of the gdbmi plugin (except without so many '+'s .



Looks ok to me. What are we supposed to be looking for?
Now I'll do the same with gdbmi.

Edit: Here's the gdbmi output (also the debugger branch)


I don't see a problem. But I don't know what I'm supposed to see either.
« Last Edit: April 07, 2012, 12:53:54 am by Pecan »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
Re: debugger_gdbmi pretty printing
« Reply #18 on: April 07, 2012, 01:16:43 am »
Both default debugging and gdbmi debugging report that no python scripting is supported in this gdb (7.4 windows)

Code
debug]> source C:\Usr\MinGW431\bin\stl.gdb
source C:\Usr\MinGW431\bin\wx.gdb
[debug]C:\Usr\MinGW431\bin\stl.gdb:6: Error in sourced command file:
[debug]Python scripting is not supported in this copy of GDB.
[debug]C:\Usr\MinGW431\bin\wx.gdb:6: Error in sourced command file:
[debug]Python scripting is not supported in this copy of GDB.
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:

So... looks like pretty printing is not supported in windows gdb 7.4
At least it's not supported in any gdb I could find.

This is the only gdb 7.4 that I could find for windows.
Code
[debug]Reading symbols from C:/Usr/Proj/test/Testpp/debug/Testpp.exe...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.4
[debug]Copyright (C) 2012 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 "i686-pc-mingw32".
« Last Edit: April 07, 2012, 01:18:52 am by Pecan »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5339
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: debugger_gdbmi pretty printing
« Reply #19 on: April 07, 2012, 07:47:58 am »
@pecan: For gdb 7.4
Either python enabled gdb(gdb-python27.exe) and traditional gdb(gdb.exe) can be found in:
http://sourceforge.net/projects/mingw/files/MinGW/Extension/gdb/GDB-7.4/

BTW: I have gdb CVS build(newer than gdb 7.4)
You can also try my personal build gdb, which is python enabled.
http://forums.codeblocks.org/index.php/topic,11301.msg77000.html#msg77000
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.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13212
    • Travis build status
Re: debugger_gdbmi pretty printing
« Reply #20 on: April 07, 2012, 09:08:12 am »
Pecan:
What you should expect is to see something like this  '|msg |"msg value"|wxString|' in the watches or in the value tooltips.
If you see the guts of the object, then pretty printers doesn't work.
(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 p2rkw

  • Almost regular
  • **
  • Posts: 142
Re: debugger_gdbmi pretty printing
« Reply #21 on: April 07, 2012, 02:07:43 pm »
@Pecan: make sure that you selected correct debugger settings at: Settings->Compiler->Toolchain executables->Debugger.
And use gdb-python27.exe (its also included in tdm gcc) instead of gdb.exe.