loganchien / smali

Automatically exported from code.google.com/p/smali
0 stars 0 forks source link

Enhancement: Add switch for call to Debug.waitForDebugger during assembly #140

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This request comes from lessons learned in Black Box testing.

Debugging a re-engineered APK requires the binary have 
android:debuggable="true" on the <application> element in the 
AndroidManifest.xml. In addition, its [very] convenient if the executable waits 
for the debugger to attach in MainActivity's onCreate.

Currently, I add the following by hand to re-engineered APKs in onCreate:

    invoke-static {}, Landroid/os/Debug;->waitForDebugger()V

Other's have suggested to add a while loop and spin (until the debugger changes 
the condition variable):

    bool debuggerAttached=false;
    while(!debuggerAttached) { ; }

It would be incredibly convenient if the assembler would add a call to 
Debug.waitForDebugger() if prompted to do so through an option or switch 
(perhaps -w for wait). Bonus points will be awarded for adding 
android:debuggable="true" to the manifest when the "-d" switch is present.

Original issue reported on code.google.com by noloa...@gmail.com on 29 Aug 2012 at 2:14

GoogleCodeExporter commented 9 years ago
But where would it add it? It doesn't know anything about activities, services, 
broadcast receivers, etc. You would have to specify what class and method you 
wanted to add this to -- at which point, you could just as easily add it 
yourself.

Original comment by jesusfreke@jesusfreke.com on 29 Aug 2012 at 6:41