Extended panic code
Article Metadata
Code Example
Article
If your application generates a panic it will be closed and an error note is shown by the OS: "Program closed:/n%S" where %S is your application's name.
In emulator, if just in time debugging is enabled, a panic will launch the debugger instead of displaying a panic note and terminating the thread. Some Symbian Software Development Kit releases have just in time debugging enabled by default. You can disable it by editing %EPOCROOT%\epoc32\data\epoc.ini and making sure the following line exists in the file:JustInTime 0
Contents |
S60 1st and 2nd Edition
To get the emulator/device display the reason and error code for panics, create a zero-sized file named ErrRd (no file name extension) under the PC's directory %EPOCROOT%\epoc32\wins[cw|b]\c\system\bootdata\.
On the device, you should create a zero-sized file ErrRd (no file name extension) under the directory c:\system\bootdata\. You can use a file explorer application (for instance, FExplorer) to create the file, or if none is available, use a signed sis file.
S60 3rd Edition and later
To get the emulator display the reason and error code for panics, start the emulator, then open its Tools -> Preferences menu, and finally make sure the "Extended panic code file" option is checked on the C++ Debug tab. (This has the effect of creating a zero-sized file named ErrRd (no file name extension) under the PC's directory %EPOCROOT%\epoc32\wins[cw|b]\c\resource\.)
On the device, you should create a zero-sized file ErrRd (no file name extension) under the directory c:\resource\. You can use a file explorer application (for instance, YBrowser) to create the file, or if none is available, deploy the file through a SIS file. In case you don't want to use ErrRd, then you could also use Y-Tasks Crash monitor or Panic Observer.
Copy the following code into ErrRd.bat
@echo off
echo #{"ErrRd"},(0xEEEEEEEE),1,0,3 >ErrRd.pkg
echo %%{"ErrRd"} >> ErrRd.pkg
echo :"ErrRd" >> ErrRd.pkg
echo [0x101F7961], 0, 0, 0, {"S60 3rd ProductID"} >> ErrRd.pkg
echo [0x1028315F], 0, 0, 0, {"S60 5th ProductID"} >> ErrRd.pkg
echo [0x20022E6D], 0, 0, 0, {"Symbian^3 ProductID"} >> ErrRd.pkg
echo "nul"-"c:\resource\ErrRd" >>ErrRd.pkg
makesis ErrRd.pkg
makekeys -cert -expdays 3650 -password test -dname "CN=Developer OU=MobileDev" test.key test.cer
signsis ErrRd.sis ErrRd.sisx test.cer test.key test
del test.key
del test.cer
del .rnd
del ErrRd.sis
del ErrRd.pkg
pause
- Do not release this file with your application. This is an R&D tool for developers to use, it does not belong on an end-user's phone.
The results
Once this file is created, the error note shown by the OS would look like: "Program closed:/n%S/n%S %d" where the second %S is replaced by the panic reason (for example, USER, KERN-EXEC, etc.) and %d would be replaced by the panic code.
- The screenshots are taken from an emulator. Target devices may show even less info than illustrated in image a) (or no info at all) when the ErrRd file is missing.
A quick search in SDK's help and you will find a hint on the kind of programming error you should be hunting for in your code.
When reporting an application crash, either on Nokia Developer's Discussion Boards or to Nokia Developer's Technical Support service, please add the panic reason and code to the problem description.
Refer to the following link for: Symbian OS Error Codes.
The same trick will also enable the InfoMsg API which allows developers to print debug information in a pop-up info note showing in the top left right corner of the screen. See below such a info print as displayed by S60 5.0's FEP
CEikonEnv::Static()->InfoMsg(_L("iFnKeyState = EFnKeyLock"));Troubleshooting
Have you activated the "Extended panic code" in the emulator but it does not appear to work? See Running the emulator from Carbide.c++.
You cannot find any reference to the identified panic in the SDK (documentation and/or header files)? Add the panic reason and code to the end of Undocumented Symbian OS and S60 panics.




04 Sep
2009
During initial phase of development of application it is normally happens that it generates a panic. And if a panic occurs in an application running on the phone, the application will be terminated. Thus developer need to handle these panic.
This article explained well about how to get these panic codes in emulator as well as on device. This article is a very useful to beginners.
Nice review but ...
The article has still issues (just fixed a few) and some re-writing might be needed, to make it more clear and easy to follow by newcomers.
ltomuta 14:45, 10 October 2009 (UTC)