News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

debuging the code: how add variables and arrays objects to watches window?

Started by cambalinho, August 05, 2015, 08:55:28 PM

Previous topic - Next topic

cambalinho

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?

oBFusCATed

1. Select it and wait for the popup to show up or right click -> add watch
2. This is more of a gdb question, but have you tried to enable the debug output in the settings -> 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!]

cambalinho

for that i must, 1st, enter\execute on debug mode. on watches window, on value section, i get 'Not available'. what means? why i can't get it's value? or is because i'm not using on code?

oBFusCATed

GDB can execute function, but I'm not sure what are the requirements. Sometimes it just fails.

BTW. I have really hard time understanding what you're talking about, please try harder to explain what you're doing.
(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!]

cambalinho

i'm trying using the watches windows for see the btnarray.getTop() value. and send some messages, for test other values, for watches window

oBFusCATed

You have add a watch for btnarray.getTop() or btnarray and then inspect the raw values.
(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!]

cambalinho

i did. but where is the values i get these string 'not avaiblable' or something like these

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!]

cambalinho

finally i get the point.
i must go to getTop() class member and test the intTop value.
thanks for all

cambalinho

another question: i can use OutputDebugString() function, but how can i see it's value\string?
(i'm trying, in hard way, learn more about debuging)

oBFusCATed

It should be in the log of the debugger (probably in the full log, which you have to enable in the debugger settings).
I've told you about this already.

Another option is to define it to something that prints on stdout/stderr:)
(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!]

cambalinho


oBFusCATed

Have you checked the log?
The debugger tab in you 'logs and others' window.
(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!]

cambalinho

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());
        };

oBFusCATed

Generally this is the place where you should see it.

Have you enabled full log from the 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!]