Jump to content

Debugger / Performance analysis...


Guest spacemonkey

Recommended Posts

Guest spacemonkey

I can't seem to get the debugger to work with my phone. It goes through the usual connection dialogue but then eVC hangs with Starting Debugee... showing in the status line at the bottom. Does this debugger only work with the emulator? Any one else tried it?

Also, any ideas on a good approach to performance analysing a smartphone app? I am working on porting the GnuBoy Pocket PC gameboy emulator and I've got it running, still need to sort out controls and a ROM chooser at the start but... it runs like a dog... possibly useable for non-action games, like Pokemon or Zelda, but if I could get the performance a bit better it'd be nice. However I'm not keep on learning how the whole thing works, just want if possibly to use some analysis tool to figure out where it's spending lots of time so I can try to improve the slowest piece type approach.

My other slight issue is it runs fine on my SPV but the emulator just doesn't want to know, anyone got any suggestions of likely areas to look for that stuff?

I'm gonna muddle on on my own but just thought if anyone else has hit these issues it'd save me reinventing the wheel...

Link to comment
Share on other sites

Spacemonkey, talk to muff about getting pocketpc apps to run on the emulator i seem to remeber it was a bitch for him to get quake running properly on the emulator. Is its possible that their is some arm asm code? Anyways ask muff about that ;)

And heres some stuff on the debugger and crack fones check this, ripped straight off the MS.Pub.SP.Developer from "Francois Didier":

Yes, the first problem occurs precisely with Debugprep.EXE because

this program basically configures system memory division using

SetSystemMemoryDivision. It happens that this function is restricted

by default, according to Smartphone documentation.

So the debugger cannot start because it uses some privileged

functions that apparently are not allowed when using the crack. I have

checked myself that you cannot run any of the restricted functions

from an uncertified program, despite the crack.

It is because of that restriction that I proposed to use flag 136

instead of flag value 196, because theoretically this flag may allow

MANAGER privileges for any application, trusted or not.

Of course any certified application might have the trustee level

necessary to run any API but this is not the case with uncertified

programs that run untrusted. I have used the MS certificate as

provided with the SDK but it does not give any additional trust level.

This certificate used to work with beta phone versions but it seems it

is not considered anymore an acceptable certificate by SPV ROM so any

program with this certificate will run untrusted as well.

Sorted

DJ Hope

Link to comment
Share on other sites

Guest spacemonkey

Ah, cheers for that DJHope, I hadn't thought of that one. Basically if I can get the debugger working on my phone I'm not fussed about the emulator side of things.

So that means I will have to either patch so privileged functions are unsigned (not sure if I can do that or want to) or patch a certificate for privileged functions into the phone so I can use the debugger...

The pain about that is, I'll have to hard reset my phone again and reload all my damn settings.... oh well....

Link to comment
Share on other sites

Oh and spacemonkey sounds like your really making some progress, congrats, and good luck! Its really nice to see a much bigger smartphone dev community since cert has been removed ;)

DJ Hope

Link to comment
Share on other sites

Guest spacemonkey

It's really a sign of how easy porting from Pocket PC to Smartphone is cos I've really done bugger all on it, and my C skills are REALLY out of date. (I taught myself C++ on the PC in the early 90s and never really used it much, since then the closest I've been to Cish languages is javascript)

Mainly I just had to strip out a few functions that aren't implemented (one of which was using a common file open dialogue box, which currently I've replaced with a hard coded ROM filename) and then it just started working. Easy peasy, then I just needed to tweak the graphics a bit cos they were hard coded for Pocket PC screen sizes.

So, recommendation... go find some GPL'd Pocket PC programs and just have a hack...

Link to comment
Share on other sites

Guest vickerto

Hi all,

I have changed the 196 flag to 136, but I still can't seem to get the debugger up and running. It is still locking up at the "Launching debugee....". I am curious about DebugPrep.exe. Is this something that I have to start myself? Or should eVC++ do that for me? Thanks.

Tom

Link to comment
Share on other sites

Guest spacemonkey

I redid my phone. Left the original unsigned tweak as is but added :

as well

This means that RapiConfig, the tool that the dev kit uses to add any provisions it likes to the phones.

Then in your project in settings - security tab you need to select your privileged security certificate and select to add it to the privileged security store on the phone. Then you should be able to debug.

Whatever other settings you use to get your personal dev certificate to load onto the phone for dev work you need to enable this. This only opens your phone up to directly connected computers with the SDK on them so isn't a big security risk.

Link to comment
Share on other sites

Guest vickerto

Forgive my ignorance, I'm still trying to figure this out...

Did you create an XML file that installs your cert into the store on the phone and then use rapiconfig to run it? When I set up the settings like you suggested, the app won't run because it says it doesn't have security privileges. Thanks.

Tom

Link to comment
Share on other sites

Guest spacemonkey

OK, you know the process for hacking your phone to remove the certification. Follow that process exactly but where it tells you to add the security policy piece to the provxml files also add the param 4097 as mentioned above in the security policy section.

Then once your phone is finished hard resetting and everything and is able to run the normal unsigned programs (PHM Registry editor is a good test) it should also be able to work with RapiConfig.

Now, I choose not to use Rapiconfis by hand because then I'd have to figure out how it works, but in eVC in Project - Settings, scroll the tabs fully to the right and the last tab will be security. On the security tab at the top you choose what signature to sign any output with and at the bottom, what signatures to load onto the phone. In that section at the bottom of the security tab you want to select you privileged certificate and load it into the privileged certificate store. (RapiConfig is used internally by eVC to do this).

That's it. If your phone is unlocked any app you build in eVC should run on the phone regardless of these settings as long as your phone has been unlocked. The point of enabling RapiConfig is to get your certificate on the priveleged end of the phone which you need for the debuger.

Hope thats a bit clearer.

PS. The debugger does crash a bit ;) but it gives you watches on variables which was my main desire. Also debug apps perform a lot slower than proper release compiled apps.

Link to comment
Share on other sites

  • 2 weeks later...
Guest adrianfox

I cannot seem to get the debugger to work (hangs as per above post).

Just to be clear, in addition to the 4097, do I need the 196 or 136 flag?

UPDATE

Just followed this advice from smartphonedn.com and it works!!

There are three steps that need to happen for you to be able to debug source-level code from your desktop actually running on the SPV:

(1) You HAVE to run the utility SP2002dps.exe from the directory

C:Windows CE Toolswce300Smartphone 2002tools

(assuming that you have installed eMbedded Visual C++ v3.0 and

the Smartphone 2002 SDK in their default locations).

You need to turn on your SPV, put it into it's cradle, plug the USB

connector into your machine, and see that ActiveSync recognizes

the SPV and shows the word "Connected". Then, from a Command

Prompt window, run the following command:

sp2002dps.exe /create /device

This creates and puts a certificate on your SPV, as well as signing all

the Smartphone 2002 SDK files with the new certificate.

(2) Copy an executable called DebugPrep.exe to the SPV. This

application should be located in the directory

C:windows ce toolswce300Smartphone 2002targetarm

(assuming that you have installed eMbedded Visual C++ v3.0 and

the Smartphone 2002 SDK in their default locations).

I create a directory called IPSMWindowsStart MenuOrange

and place the DebugPrep.exe into that directory.

(3) Every time you turn on your SPV, you have to run the DebugPrep

application - or else the eMbedded Visual C++ will hang saying

"Waiting for debugee..."

see

http://www.smartphonedn.com/forums/viewtop...hlight=debugger

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.