Generating ARM code for a managed assembly on an I

2019-03-02 11:39发布

问题:

Directly related to this question.

Given a managed assembly for Windows Phone, how can I generate native code for it for an ARM CPU? I don't have a Windows/ARM device (neither tablet nor a phone). There's the ngen utility out there, but AFAIK it can only generate code for the host machine (i. e. Intel).

The reason why I'm asking, the offsets in the crash stack that Windows Phone Dev Center provides are not MSIL offsets (I've checked - they go way beyond MSIL function size). Those look like native code offsets. Now, there's no guarantee that the ARM code that's generated offline will exactly match what's executing on the phone, but at least there'd be some semblance.

EDIT: the crossgen tool sounds like the thing. But I can't get it to work; says file "..." or one of its dependencies was not found - the file is right there and I'm specifying the /MissingDependenciesOK flag.

回答1:

Regardless of what you generate locally you aren't going to get the exact offsets that match the device's output that you are seeing on the store, since there is an extra, final compilation step that is only done at install time on the device which can further change any offsets that you generate locally.

Instead of tracking through those raw stacks people often setup the Application.UnhandledException event so that you capture the real managed stack with extra debugging information and then send that to themselves, either by having the users mail the crash in, or by setting up a web service to collect them.