I had a similar situation where POSE was missing some bus errors, and
running the code OK, but as soon as I ran it on the target, it fell over. I
never managed to work out why POSE sometimes reports bus errors and at other
time dosent. I had to debug it on the target to find out what was going on.
Not much help I know, but if you find out why please tell me. One thing I
did notice was that the bus error was caused by a pointer held in a union,
along with different pointer types.
Rik
> -----Original Message-----
> From: Magn�s ��r Torfason [SMTP:[EMAIL PROTECTED]]
> Sent: 29 August 2000 16:17
> To: Palm Developer Forum
> Subject: Using the emulator/debugger functionality for Memory
> debugging
>
> I wish to debug memory access on POSE, and wrote a program to test the
> functionality. I am using:
>
> the newest (3.0a6) version of emulator,
> fresh ROM (Palm OS 3.5-en-ezdbg.rom),
> SDK 3.5 + new debugger plugin for CW, since this month.
>
> Debug settings on emulator are all on, but it seems not to be catching my
> errors in some cases. Following is a short code segment, for
> demonstration:
>
> //-----------------------------------------------------------------------
> static Boolean MainFormSelectEvent(UInt16 ctl) {
> Boolean handled = false;
> MemHandle intHandle;
> UInt16* intPtr;
> switch (ctl){
>
> case MainCheckUnlockedChunkAccessButton:
> intHandle = MemHandleNew(sizeof(UInt16));
> intPtr = (UInt16*)MemHandleLock(intHandle);
> MemHandleUnlock(intHandle);
> *intPtr = 32; // <- This is reported, as expected
> break; // (.. just read directly from
> unlocked chunk)
>
> case MainCheckFreeChunkAccessButton:
> intPtr = (UInt16*)MemPtrNew(sizeof(UInt16));
> MemPtrFree(intPtr);
> *intPtr = 32; // <- This is NOT reported at all!
> break;
>
> case MainCheckStackOverFlowButton:
> Recurse(0); // <- This is reported, as expected
> break; // (.. getting close to overflowing
> ..)
>
> case MainCheckOffStackedReferenceButton:
> intPtr = NULL;
> OffStacker(&intPtr); // This points intPtr to a
> // local array in OffStacker
> *intPtr = 43; // <- This is NOT reported at all!
> break;
> }
> return handled;
> }
>
> static void OffStacker(UInt16** t) {
> UInt16 localArray[5];
> *t = localArray;
> }
> static void Recurse(UInt16 i) {
> Recurse(i);
> }
> //-----------------------------------------------------------------------
>
> Am I incorrect in assuming that the Emulator can assist me in checking for
> errors such as the ones above that are not reported in my configuration.
> If
> there is additional configuration or installation to get this to work,
> pointers would be appreciated.
>
> ps. I did turn off the optimizer, and even tried putting some extra code
> in
> the functions to thwart it, and it is most definitely executing the
> illegal
> memory access.
>
> Thanks,
>
>
> Magnus Torfason
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/