Home > Back-end >  How GDB in the member function print class member variables (class)?
How GDB in the member function print class member variables (class)?

Time:03-20

 class Client 
{

Int opp.
Void debuoop ();
}


Void debuoop ()
{

for(int i=0; I & lt; Opp. I++)
{
Do something;
}


}




When GDB debugging, enter debuoop (after), can use p I print out the value of the I, but opp is a member of the class variables, not members of the local variable function, how to print the value of it? This opp seems to be no good,

CodePudding user response:

P * this
P this - & gt; opp

CodePudding user response:

If it is a member function, you can directly access, do you like this debuoop is not a member function, to void the Client: : debuoop ()
  • Related