how to print/inspect stuff with XCode?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to print/inspect stuff with XCode?

Mariano Martinez Peck
 
Hi guys. While debugging the VM with XCode, I sometime feel really stupid.  Uhhh, sorry, happy Christmats ;)
I cannot inspect values or do things. Maybe I am so used to Smalltalk that I am asking too much to C.

So, for example I have this code:

    if (! ( (  (usqInt) addr  ) <=  (   (usqInt) GIV(fwdTableNext) )   ))
    {
        print("fwdTableNext");
    };


And I have a breakpoint on the print. I can see the value of fwdTableNext  or addr. But how can I inspect for example, "GIV(fwdTableNext)" ?  or "(   (usqInt) GIV(fwdTableNext) )" ?
I mean...how can I inspect the result of calling certain functions to such variables?  can I do that?  if I cannot, how it is expected I can debug that for example?  (assing each result to another variable ans inspect that?)

I tried using the the expressions browser, but everything I add says "out of scope"

Thanks in advance,

Mariano
Reply | Threaded
Open this post in threaded view
|

Re: [Vm-beginners] how to print/inspect stuff with XCode?

johnmci
 
Well since my wife and eldest son are wrestling with a dead turkey I'm hiding in the study casually checking email. 

This would be because GIV is a macro/definition/etc  
Its to decide to generate either foo->interpreterInstVar  or just interpreterInstVar

The use of SQ_USE_GLOBAL_STRUCT and declaring foo static or not has serious performance implications all 
twisted by the type of CPU and which compiler and which version of the compiler.  Only trying lots of combinations for 
your particular setup of the day (not in the past, or in the future) would say which is best. Update your compiler? All bets are off.

So in this case it's not a function call otherwise you could say call (int) printAllStacks() in gnu debug, which can be very useful.


#if SQ_USE_GLOBAL_STRUCT
 } fum;
# define DECL_MAYBE_SQ_GLOBAL_STRUCT register struct foo * foo = &fum;
# define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT volatile register struct foo * foo = &fum;
# define GIV(interpreterInstVar) (foo->interpreterInstVar)
#else
# define DECL_MAYBE_SQ_GLOBAL_STRUCT /* oh, no mr bill! */
# define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT /* oh no, mr bill! */
# define GIV(interpreterInstVar) interpreterInstVar
#endif


 
On 2010-12-25, at 10:53 AM, Mariano Martinez Peck wrote:

Hi guys. While debugging the VM with XCode, I sometime feel really stupid.  Uhhh, sorry, happy Christmats ;)
I cannot inspect values or do things. Maybe I am so used to Smalltalk that I am asking too much to C.

So, for example I have this code:

    if (! ( (  (usqInt) addr  ) <=  (   (usqInt) GIV(fwdTableNext) )   ))
    {
        print("fwdTableNext");
    };


And I have a breakpoint on the print. I can see the value of fwdTableNext  or addr. But how can I inspect for example, "GIV(fwdTableNext)" ?  or "(   (usqInt) GIV(fwdTableNext) )" ?
I mean...how can I inspect the result of calling certain functions to such variables?  can I do that?  if I cannot, how it is expected I can debug that for example?  (assing each result to another variable ans inspect that?)

I tried using the the expressions browser, but everything I add says "out of scope"

Thanks in advance,

Mariano
_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners

--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================