I added #pragma warn_stack_usage on top of my program and see who's the possible offender. I found out that "PilotMain uses 812 bytes of stack". Is it a bad thing??
If I want to use #pragma stack_cleanup to solve this problem, where should I put this statement? On top of the program? Or inside PilotMain? Thanks so much for your advice. George. "Ben Combee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Also, using #pragma warn_stack_usage (see Targeting Palm OS manual) can be useful for finding functions that use excessive stack. Also check out #pragma stack_cleanup if you've got a series of complex function calls. -----Original Message----- From: Jan Slodicka Date: 2/13/04 12:48 pm To: Palm Developer Forum Subj: Re: Code Warrior and Palm Emulator question (stack overflow??) Hello, > > This piece of code works in the emulator if the Global search is initiated > from outside my application! But not if I did a Global search while I'm in > my application! Different callers - different amount of stack is used. Perhaps your app is the one, which demands more stack. The simplest thing you can do is to put the breakpoint to the start of AppDoSearch() and once the debugger breaks, count manually the stack used by all your callers. I.e. count the total size of all local variables that are in the call chain between AppDoSearch and PilotMain. It is not exactly equal to what the compiler does, but it is a good estimate. Probably you'll find an explanation. Regards, Jan Slodicka ----- Original Message ----- From: "George" <[EMAIL PROTECTED]> Newsgroups: palm-dev-forum To: "Palm Developer Forum" <[EMAIL PROTECTED]> Sent: Friday, February 13, 2004 7:32 PM Subject: Code Warrior and Palm Emulator question (stack overflow??) > Hello all, > > I'm using CodeWarrior (V 9.2) for my Palm developement. I also downloaded > the palmos33-en-v.zip for the emulator and the palmos33-en-v.rom file from > PalmOS. I set it to duplicate my PalmV device so I can test my program using > the emulator. > > I then complied my program using Code Warrior. I sync the prc and pdb files > to the emulator for testing. It abended everytime when I did a global search > inside my application. > > This is the error message from the Palm OS Emulator: > > Testpgm has overflowed the stack: The functions currently using the stacks > are: PrvMisAlignedForwardInnerBitBlt(52),... > > I then debugged the code and found out it's actually happening in this part > of my code (the Global search area): > > void AppDoSearch(ContextType *ctxt, FindParamsPtr params) { > EntryType entry; > Int32 i; > UInt16 cat; > RectangleType r; > char catname[CAT_NAME_LENGTH]; > > (skipped some of the codes...) > > if (FindDrawHeader(params, catname) == true) { > params->more = true; > ctxt->prefs.findPos = -1; > ctxt->prefs.findCategory = cat; > return; (skipped the rest of the codes....) > > It actually abended during the call to "FindDrawHeader". > > The funny thing is, this is the Global search function in my program and it > is being called no matter if the Global search is coming from within my > application or other Palm applications such as Address or Calculator or > whateverelse. > > This piece of code works in the emulator if the Global search is initiated > from outside my application! But not if I did a Global search while I'm in > my application! > > Even stranger, if I hotsync the code to my PalmV device (the real device), > my application works! The Global search function works no matter if I do > Global search within my application or in other Palm applications. > > Very strange. Is this an emulator problem or Code Warrior problem. I did a > search on the Palm-dev-forum knowledge database and found out an article > about the option > "#pragma stack_cleanup on" I thought the newer version of Code Warrior > resolved the stack cleanup problem and I don't have to set this parameter > (as it would increase the program size and slow down the execution). > > Any suggestions? > > > Thanks, > > George. > > > > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
