All,
I need help! I am looking for some suggestions to help me track down a
bug in my code.
Here is an overview of the problem I am having, followed by what I have done
to debug the problem.
I have a registered a callback function for the serial port via
SrmSetWakeupHandler(). From the callback function I call one line of code:
SysNotifyBroadcastFromInterrupt(). I have a shared lib that is registered
to the notification that I am sending. On my m500 and m515 this works
absolutely fine. On the Tungsten I get an error "Fatal Alert" -
"MemoryMgr.c, Line:3564 NULL handle".
I am not sure what "handle" the error is referring to.
Here is what I have done to try to catch the problem in the simulator:
1st - Tried to configure the OS 5 simulator to connect to my PC's COM port
so I can send an event and capture the error. I was unable to figure out
how to do this (I am a little frustrated with the fact that I cannot find
any docs on how to do this. I feel like I am losing functionality by
leaving the 4.0 debugging platform to go to the 5.0 platform).
2nd - I added some test code to call SysNotifyBroadcast() to see if this
would show the same error. Unfortunately [for me], this works absolutely as
expected [fortunate for others]!
3rd - I added an ErrDisplay message in the wakeup handler to make sure I was
getting at least that far. This causes the system to crash, but it is an
effective debugging mechanism. I sent a serial packet to the physical
device and I saw the message, so I know the wakeup handler is being called.
4th - By this time I figure it has got to be my code in the notification
handler, so I commented out all of the code in the Notification handler
(i.e. the function I registered during SysNotifyRegister() ). The function
simply calls ErrDisplay( "Made it this far" ) and return errNone. I still
get the original NULL handle message when I send a packet of data to the
serial port.
Conclusion: I am completely confused, but I assume I am calling
SysNotifyBroadcastFromInterrupt() incorrectly. I call it as follows:
SysNotifyBroadcastFromInterrupt( appFileCreator, appFileCreator, ( void
* )&g_paramBlock );
g_paramBlock is a global instance of the following structure:
typedef struct NOTIFICATION_PARAMETER_BLOCK
{
UInt32 serialPortID;
DmOpenRef databaseHandle;
} NOTIFICATION_PARAMETER_BLOCK;
I also had one other idea to debug the problem, but I am not sure how to
implement it. I would like to setup another interrupt handler that is not
based on the serial port. This would be handy for instances like this one
where I cannot reproduce the problem in the simulator and it would allow me
to call SysNotifyBroadcastFromInterrupt() to see where the code is crashing.
Is there any way to register interrupt handlers for general purpose clocks
(or something similar) on the 68k processor? If so, will it work on the
simulator? Should I try to register an interrupt handler for a general
purpose clock on the ARM processor? Should I bang my head on my desk and
hope the problem goes away. Or better yet, bang my head on my Tungsten and
hope IT goes away (J/K)?
Any suggestions would be greatly appreciated.
Brad Figler
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/