Thursday, June 19, 2008

On device debugging S60 applications

Sorry for posting this topic so long after my anouncement here.

But finally I could evaluate the on device debugging (ODD) functionality of Carbide.C++ 1.3.1. with 2 S60 SDKs: the 3rd MR SDK and the S60 3rd FP1 SDK.

First the ODD feature works with some minor disadvantages. Second you need at least a Carbide Developer license (which costs about 300€ in the Nokia e-Store). I could test it with an evaluation license.

Didn't work:
- dereferencing of the this pointer in the scope of a non static member function could not be done (members could not be examined)
- automatic descriptor variables could not be evaluated in the scope of a function (content could not be examined)

Worked great:
- debugging of an import library (aka static link library)
-

Here comes a short step by step guide for debugging a simple application on device:
  1. Install App TRK on your Symbian S60 phone (you can find it here).
  2. Ensure the phone is connected to the computer and is connected via Nokia-PC-Suite too.
  3. Ensure your application is buildable for WINS emulator with Carbide.C++ IDE.
  4. Switch the Build condiguration to GCCE (debug) you can use the S60 3rd MR or FP1 according to the device you are using (e.g. an E60 uses the MR SDK, an E90 uses the FP1 SDK). You can reach the build configuration dialog by right clicking on the project.
  5. Right click on the project, select "Open debug dialog", ensure there is nothing preconfigured under "Symbian OS Application TRK". If there is something preconfigured you can delete this subitem by clicking the red cross above that dialog. This step has only be done the first time. Every other step OOD session you can use the following configuration.
  6. Close the debug dialog
  7. Right click on the project, select Properties.
  8. Select Carbide.C++ subitem in the properties dialog. And after this the Carbide Build configuration subitem.
  9. Select the desired configuration. I use "Phone Debug (GCCE) [S60_3rd_FP1] because I use an E90 for ODD.
  10. In the below "Sis builder tab" add a new entry by clicking on the "Add" button
  11. In the following dialog browse to the location of your projects package file (pkg extension)
  12. Insert an output filename (insert: .sis)
  13. Leave content search location empty
  14. Because I have a developer certificate from Symbian, I use "sign sis file with a certificate/key pair"
  15. The signed sis file name will be: ".sisx" (recognize the trailing x)
  16. Insert the password for the "signsis" procedure
  17. Leave additional options empty
  18. Browse to the location of your certificate file (.cer extension)
  19. Browse to the location of your key file (.key extension)
  20. You can now build your project for the target. Rightclick on project and select "build project"
  21. Observe the console output: after a successfull build a successfull makesis step is performed and after this a successfull signsis step
  22. You are now ready for debugging. Rightclick on project, select "debug as" > "Debug symbian application".
  23. A dialog shows up "New launch configuration", select "Application TRK Launch Configuration" > "Next"
  24. Ensure the correct exe is preselected in the "Process to launch" selection box. "Next"
  25. Select the correct COM port for your device connection. Usually after the COM port the name of the device is shown. In my case I select "COM 14 - Nokia E90 Communicator USB" > "Next"
  26. Ensure the correct sis file is preselected. You can do this by comparing the filepath with the files in this directory. During step 21 the sisx file was placed in the folder \projectpath\sis\project.sisx. Simply check if both paths (the preselected and the real path in your filesystem) are the same. "Next"
  27. "Finish", the debug session is started and the application shows up on your phone.
  28. If you have put a breakpoints within your sourcecode the processing is stopped here and you can debug ;-)

The steps 15 - 19 should be known from signing a sis file on command line. You can do it in another way when not signing a file or signing a file with a selfsign certificate.

I hope this post is helpfull. Any feedback is appreciated.