[comp.sys.mac.programmer] Lightspeed C Debugger Question

pff@beach.cis.ufl.edu (Pablo Fernicola) (04/03/89)

Using the debugger to find the value of a variable (actually
a structure referenced by a Handle), I select the line where the statement
involving that variable appears (in the Source Window) and then enter the 
name of the variable in the Data window.  The variable name is listed in the
Data window, but no value (ie. address, or C string) appears alongside the name.
Anybody has any idea why that would happen.
Also, can anybody tell me if the following way of referencing an element
(one of the "entry" values in the following code) is okay?

/* This will be compiled as a XCFN resource for Hypercard */


typedef struct	VALUEARRAY
{
char	*entry[6][6];
} VALUEARRAY;

main()
{
struct	VALUEARRAY	*myValue[3];
char			*myString = "hello";
int			i, j, valueIndex;
long			strSize;


/* initializing 3 structures	*/
for(valueIndex = 0; valueIndex < 3; valueIndex++)
	myValue = (VALUEARRAY *) NewHandle( (long) sizeof(VALUEARRAY));

/* Assigning values to the entries in the structures */
for(valueIndex = 0; valueIndex < 3; valueIndex++)
{
	MoveHHi( (Handle) myValue[valueIndex]);
	HLock( (Handle) myValue[valueIndex]);
	for(i = 0; i < 6; i++)
		for(j = 0; j < 6; j++)
		{
		strSize = (long) strlen(myString) +1;
		myValue[valueIndex]->entry[i][j] = (char *) NewHandle(strSize);
		strcpy( (char *) (*myValue[valueIndex]->entry[i][j]),myString);
		}
	HUnlock( (Handle) myValue[valueIndex]);
}
}

The program works okay the first time through (for one cycle of valueIndex), butcrashes afterward and the debugger has a message on the bottom of the Source
Window that says "Odd Address".

Any help will be greatly appreciated.

I'm using a Mac SE, Lightspeed C 3.01p4, and this is part of a program that will
be a XCFN resource for Hypercard.
--
Pablo Fernicola			pff@beach.cis.ufl.edu
Machine Intelligence Laboratory
University of Florida
Disclaimer: The above opinions belong only to me.

siegel@endor.harvard.edu (Rich Siegel) (04/03/89)

In article <19983@uflorida.cis.ufl.EDU> pff@beach.cis.ufl.edu (Pablo Fernicola) writes:
>Using the debugger to find the value of a variable (actually
>a structure referenced by a Handle), I select the line where the statement
>involving that variable appears (in the Source Window) and then enter the 
>name of the variable in the Data window.  The variable name is listed in the
>Data window, but no value (ie. address, or C string) appears alongside the name.

	It sounds like the variable you're trying to display is one that
is not in the current procedure invocation.

		--Rich


~~~~~~~~~~~~~~~
 Rich Siegel
 Staff Software Developer
 Symantec Corporation, Language Products Group
 Internet: siegel@endor.harvard.edu
 UUCP: ..harvard!endor!siegel

 "She told me to make myself comfortable, so I pulled down my pants
 and sat in the pudding." -Emo Phillips
~~~~~~~~~~~~~~~