Author Topic: debuging the code: how add variables and arrays objects to watches window?  (Read 7287 times)

Offline cambalinho

  • Multiple posting newcomer
  • *
  • Posts: 93
i think i did. but i don't have sure... can you tell me more about?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
If you see the debug: at the beginning of the line, then you have done 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!]

Offline cambalinho

  • Multiple posting newcomer
  • *
  • Posts: 93
heres what i see on debug tab:
"Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\
Adding source dir: C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\
Adding file: C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\bin\Debug\classcontrols.exe
Changing directory to: C:/Users/Cambalinho/Documents/CodeBlocks/classcontrols/bin/Debug
Set variable: PATH=.;C:\Program Files (x86)\CodeBlocks\mingw32\i686-w64-mingw32\lib;C:\Program Files (x86)\CodeBlocks\mingw32\bin;C:\Program Files (x86)\CodeBlocks\mingw32;C:\Program Files (x86)\PC Connectivity Solution;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Broadcom\Broadcom 802.11\Driver;C:\Program Files (x86)\Skype\Phone
Starting debugger: C:\Program Files (x86)\CodeBlocks\mingw32\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Cambalinho/Documents/CodeBlocks/classcontrols/bin/Debug/classcontrols.exe
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.6
Child process PID: 4636"
i'm sorry, i know that i'm miss something, but i don't know what :(
i don't see the result of 'OutputDebugString("hello world");' :(

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Obviously you've not enabled full logging...

Settings -> Debugger -> Common -> Full (Debug) Log...

And when pasting please use code tags (the # button above the editor).
(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 cambalinho

  • Multiple posting newcomer
  • *
  • Posts: 93
now it's the full, but the:
Code
OutputDebugString("hello world");
isn't showed on it :(
Quote
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\
Adding source dir: C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\
Adding file: C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\bin\Debug\classcontrols.exe
Changing directory to: C:/Users/Cambalinho/Documents/CodeBlocks/classcontrols/bin/Debug
Set variable: PATH=.;C:\Program Files (x86)\CodeBlocks\mingw32\i686-w64-mingw32\lib;C:\Program Files (x86)\CodeBlocks\mingw32\bin;C:\Program Files (x86)\CodeBlocks\mingw32;C:\Program Files (x86)\PC Connectivity Solution;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Broadcom\Broadcom 802.11\Driver;C:\Program Files (x86)\Skype\Phone

[debug]Command-line: C:\Program Files (x86)\CodeBlocks\mingw32\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Cambalinho/Documents/CodeBlocks/classcontrols/bin/Debug/classcontrols.exe
[debug]Working dir : C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\bin\Debug

Starting debugger: C:\Program Files (x86)\CodeBlocks\mingw32\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Cambalinho/Documents/CodeBlocks/classcontrols/bin/Debug/classcontrols.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 C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\bin\Debug\classcontrols.exe...
[debug]done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.6
[debug]Copyright (C) 2013 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-w64-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.6

[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 disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Function "__cxa_throw" not defined.
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\Program Files (x86)\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory C:/Users/Cambalinho/Documents/CodeBlocks/classcontrols/
[debug]Source directories searched: C:/Users/Cambalinho/Documents/CodeBlocks/classcontrols;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/Cambalinho/Documents/CodeBlocks/classcontrols/main.cpp:79"
[debug]Breakpoint 2 at 0x405869: file C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\main.cpp, line 79.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\bin\Debug\classcontrols.exe

Child process PID: 1704

[debug][New Thread 1704.0xdd4]
[debug][New Thread 1704.0x850]
[debug][New Thread 1704.0x10fc]
[debug][New Thread 1704.0xe18]
[debug][New Thread 1704.0x1200]
[debug][New Thread 1704.0xcf8]
[debug]Breakpoint 2, WinMain@16 (hThisInstance=0x400000, hPreviousInstance=0x0, lpCmLine=0x8b3ad5 "", nCmdShow=10) at C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\main.cpp:79
[debug]C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\main.cpp:79:1830:beg:0x405869
[debug]>>>>>>cb_gdb:

At C:\Users\Cambalinho\Documents\CodeBlocks\classcontrols\main.cpp:79

[debug]> info locals
[debug]arraysize = -1
[debug]i = 1
[debug]>>>>>>cb_gdb:
[debug]> info args
[debug]hThisInstance = 0x400000
[debug]hPreviousInstance = 0x0
[debug]lpCmLine = 0x8b3ad5 ""
[debug]nCmdShow = 10
[debug]>>>>>>cb_gdb:

Continuing...

[debug]> cont
[debug]Continuing.

Trying to pause the running process...

[debug][New Thread 1704.0xd14]
[debug]Program received signal SIGTRAP, Trace/breakpoint trap.
[debug][Switching to Thread 1704.0xd14]
[debug]0x7734000d in ntdll!DbgBreakPoint () from C:\Windows\system32\ntdll.dll
[debug]>>>>>>cb_gdb:

Program received signal SIGTRAP, Trace/breakpoint trap.
In ntdll!DbgBreakPoint () (C:\Windows\system32\ntdll.dll)

[debug]> quit

Debugger finished with status 0

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Then it is a GDB or MinGW progblem (don't know if outputdebugstring is a OS or runtime thing).
(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 cambalinho

  • Multiple posting newcomer
  • *
  • Posts: 93
that's why i did my own:
Code
void debugtext(string text)
{
    //create a permanent controls
    static form debugwindow("Debug Window");
    static label lblDebugText("",debugwindow);

    //control the static depending on it's parent size
    debugwindow.Resize=[]()
    {
        lblDebugText.setWidth(debugwindow.width-10);
        lblDebugText.setHeight(debugwindow.height-10);
    };

    //resize the parent window
    debugwindow.width=1000;
    debugwindow.height=400;

    //print the text depnding if have some text or not
    if(lblDebugText.getText()=="")
        lblDebugText.setText(text);
    else
        lblDebugText.setText(lblDebugText.getText() + "\n" + text);
}
using it:
Code
bool blnRightMouseButtonDown=false;
button btnarray[8];

int WinMain()
{
    OutputDebugString("hello world");
    int arraysize=ArraySize(btnarray, button);//geting the array size
    int i=0;
    for (i; i<arraysize; i++)
    {
        int inttop=150 + (i*50);

        btnarray[i].setTop(inttop);
        btnarray[i].setLeft(0);
        btnarray[i].setText(to_string(i));
        btnarray[i].MouseClick=[i]()
        {
            MessageBox(btnarray[i].getText());
        };
        debugtext((string)to_string(inttop) + "\t" + to_string(i));
    }

https://onedrive.live.com/?id=C3EF456E15C8DEB6!1295&cid=C3EF456E15C8DEB6&group=0&parId=C3EF456E15C8DEB6!197&o=OneUp

it's from my public hotmail folder