Ken includes some good information and advice here. If it looks like the
unininitialized pointer when running under Poser should have caused some sort of
access violation, then you would be correct in calling this a "pose error".
Otherwise, it's just an unimplemented feature: Poser doesn't claim to catch the
utilization of uninitialized pointers.
I have ideas on how uninitialized variable access can be detected, but it's a
big job, and I don't quite have the time right now to tackle it.
-- Keith Rollin
-- Palm OS Emulator engineer
Ken Krugler <[EMAIL PROTECTED]> on 06/26/99 09:21:17 AM
Please respond to [EMAIL PROTECTED]
Sent by: Ken Krugler <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: [EMAIL PROTECTED] (Keith Rollin/HQ/3Com)
Subject: Re: pose error
Pete,
>hello keith and others,
>
>i have a strange error for you. it involves pose (d26). i was working
>on a bit of code with a CharPtr. i used StrIToA to set the CharPtr, and
>then i wrote on the form with that. worked fine.
>hours later, i had a good prototype to try on a real device. it crashed
>every time with a fatal exception, but it didnt crash in pose. it took
>me over an hour to track down the fact that i had not used MemPtrNew on
>the CharPtr. when i tried this, it worked fine on both.
>
>so anyway, the error in pose is that it allowed an uninitialized ptr to
>be written to, when a real device crashes fatally everytime.
>
>here is the problem in code:
>
>static void SetFieldInt(Int fieldID, UInt value)
>{
> FieldPtr fld;
> CharPtr strP;
> FormPtr frm = FrmGetActiveForm();
>/* this function crashes a real device, but not pose, with these lines
>commented out */
>// strP=MemPtrNew(sizeof(CharPtr));
> StrIToA(strP, value);
> fld = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, fieldID));
> FldDelete(fld, 0, FldGetTextLength(fld));
> FldInsert(fld, strP, StrLen(strP));
>// MemPtrFree(strP);
strP is an uninitialized local, which means that it will have whatever
value wound up at that location on the stack when the SetFieldInt routine
was called. So on Pose this could point into an allocated block in the
dynamic heap (looks fine to Pose) while on the device it could be a pointer
to the 328 hardware control registers.
If you really want to help Keith out, figure out where strP was pointing
when running the app on Pose, then figure out if Pose could & should have
caught a write to that address as being invalid. Remember, this has to be
doable without any AI techniques.
-- Ken
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200 (direct) +1 408-261-7550 (main)