the watches window adds, automatic, local variables but not what i need to test. for that i nee do it manually(select the variable and then click on right button for add it to watches window).
until here fine, but see these: i have a class button with a getTop() function member.
vector<button> btnarray;
int WinMain()
{
//int arraysize=ArraySize(btnarray, button);//geting the array size
btnarray.resize(8);
for (int i=0; i<btnarray.size(); i++)
{
int b=100 + ((i+1)*50);
btnarray[i].setTop(b);
//OutputDebugStr(to_string(btnarray[i].getTop()).c_str());
btnarray[i].setLeft(0);
btnarray[i].setText(to_string(i));
btnarray[i].MouseClick=[i]()
{
MessageBox(btnarray[i].getText());
};
}
now heres the questions points:
- how can i add the btnarray [ i ].getTop() to watches window and see it's value?
- how can i see the string of OutputDebugStr() on debug mode?
i'm sorry, the string isn't printed on that tab :(
button btnarray[8];
int WinMain()
{
int arraysize=ArraySize(btnarray, button);//geting the array size
//btnarray.resize(8);
int i=0;
for (i; i<arraysize; i++)
{
int inttop=150 + (i*50);
btnarray[i].setTop(inttop);
OutputDebugStr(to_string(btnarray[i].getTop()).c_str());//i belive these string must be printed on debugger tab, right?
btnarray[i].setLeft(0);
btnarray[i].setText(to_string(i));
btnarray[i].MouseClick=[i]()
{
MessageBox(btnarray[i].getText());
};
now it's the full, but the:
OutputDebugString("hello world");
isn't showed on it :(
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
that's why i did my own:
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:
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