Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better representation for monitor-* and move-exception Dalvik bytecode instructions #34

Open
XVilka opened this issue Aug 11, 2023 · 0 comments

Comments

@XVilka
Copy link
Member

XVilka commented Aug 11, 2023

[0x100055a18]> pdf
            ;-- sym.android.support.v4.content.LocalBroadcastManager.void_registerReceiver_android.content.BroadcastReceiver__android.content.IntentFilter:
╭ method.public.android.support.v4.content.LocalBroadcastManager.void_registerReceiver_android.content.BroadcastReceiver__android.content.IntentFilter();
│           0x100055a18      5480b903       iget-object v0, v8, Landroid/support/v4/content/LocalBroadcastManager;->mReceivers Ljava/util/HashMap; ; void registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)
│           0x100055a1c      1d00           monitor-enter v0
│           0x100055a1e      22010202       new-instance v1, Landroid/support/v4/content/LocalBroadcastManager$ReceiverRecord; ; str.Landroid_support_v4_content_LocalBroadcastManager_ReceiverRecord
│                                                                      ; 0x1000d262a
│           0x100055a22      7030650ba109   invoke-direct {v1, v10, v9}, Landroid/support/v4/content/LocalBroadcastManager$ReceiverRecord;-><init>(Landroid/content/IntentFilter;Landroid/content/BroadcastReceiver;) ; method.constructor.android.support.v4.content.LocalBroadcastManager_ReceiverRecord.void__init__android.content.IntentFilter__android.content.BroadcastReceiver
│           0x100055a28      5482b903       iget-object v2, v8, Landroid/support/v4/content/LocalBroadcastManager;->mReceivers Ljava/util/HashMap;
│           0x100055a2c      6e20892c9200   invoke-virtual {v2, v9}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; ; sym.java.util.HashMap.Object_get_Object
│           0x100055a32      0c02           move-result-object v2
│           0x100055a34      1f024706       check-cast v2, Ljava/util/ArrayList;
│           0x100055a38      1213           const/4 v3, 0x1
│       ╭─< 0x100055a3a      39020d00       if-nez v2, 0x100055a54
│       │   0x100055a3e      22044706       new-instance v4, Ljava/util/ArrayList; ; str.Ljava_util_ArrayList
│       │                                                              ; 0x1000e2d36
│       │   0x100055a42      70206d2c3400   invoke-direct {v4, v3}, Ljava/util/ArrayList;-><init>(I)V ; sym.java.util.ArrayList.void__init__int
│       │   0x100055a48      0742           move-object v2, v4
│       │   0x100055a4a      5484b903       iget-object v4, v8, Landroid/support/v4/content/LocalBroadcastManager;->mReceivers Ljava/util/HashMap;
│       │   0x100055a4e      6e308a2c9402   invoke-virtual {v4, v9, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; ; sym.java.util.HashMap.Object_put_Object__Object
│       ╰─> 0x100055a54      6e20702ca200   invoke-virtual {v2, v10}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z ; sym.java.util.ArrayList.boolean_add_Object
│           0x100055a5a      1204           const/4 v4, 0
│           ; CODE XREF from method.public.android.support.v4.content.LocalBroadcastManager.void_registerReceiver_android.content.BroadcastReceiver__android.content.IntentFilter @ 0x100055aa4
│       ╭─> 0x100055a5c      6e1032010a00   invoke-virtual {v10}, Landroid/content/IntentFilter;->countActions()I ; sym.android.content.IntentFilter.int_countActions
│       ╎   0x100055a62      0a05           move-result v5
│      ╭──< 0x100055a64      35542100       if-ge v4, v5, 0x100055aa6
│      │╎   0x100055a68      6e2033014a00   invoke-virtual {v10, v4}, Landroid/content/IntentFilter;->getAction(I)Ljava/lang/String; ; sym.android.content.IntentFilter.String_getAction_int
│      │╎   0x100055a6e      0c05           move-result-object v5
│      │╎   0x100055a70      5486b303       iget-object v6, v8, Landroid/support/v4/content/LocalBroadcastManager;->mActions Ljava/util/HashMap;
│      │╎   0x100055a74      6e20892c5600   invoke-virtual {v6, v5}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; ; sym.java.util.HashMap.Object_get_Object
│      │╎   0x100055a7a      0c06           move-result-object v6
│      │╎   0x100055a7c      1f064706       check-cast v6, Ljava/util/ArrayList;
│     ╭───< 0x100055a80      39060d00       if-nez v6, 0x100055a9a
│     ││╎   0x100055a84      22074706       new-instance v7, Ljava/util/ArrayList; ; str.Ljava_util_ArrayList
│     ││╎                                                              ; 0x1000e2d36
│     ││╎   0x100055a88      70206d2c3700   invoke-direct {v7, v3}, Ljava/util/ArrayList;-><init>(I)V ; sym.java.util.ArrayList.void__init__int
│     ││╎   0x100055a8e      0776           move-object v6, v7
│     ││╎   0x100055a90      5487b303       iget-object v7, v8, Landroid/support/v4/content/LocalBroadcastManager;->mActions Ljava/util/HashMap;
│     ││╎   0x100055a94      6e308a2c5706   invoke-virtual {v7, v5, v6}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; ; sym.java.util.HashMap.Object_put_Object__Object
│     ╰───> 0x100055a9a      6e20702c1600   invoke-virtual {v6, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z ; sym.java.util.ArrayList.boolean_add_Object
│      │╎   0x100055aa0      d8040401       add-int/lit8 v4, v4, 0x1
│      │╰─< 0x100055aa4      28dc           goto  0x100055a5c
│      ╰──> 0x100055aa6      1e00           monitor-exit v0
│           0x100055aa8      0e00           return-void
│           0x100055aaa      0d01           move-exception v1
│           0x100055aac      1e00           monitor-exit v0
╰           0x100055aae      2701           throw v1
[0x100055a18]> pdd
/* jsdec pseudo code output */
/* apk://some.apk @ 0x100055a18 */
void method.public.android.support.v4.content.LocalBroadcastManager.void.registerReceiver.android.content.BroadcastReceiver..android.content.IntentFilter (android.support.v4.content.LocalBroadcastManager v8, java.lang.Object v10, java.lang.Object v9, java.lang.Object v4, java.util.ArrayList v6) {
    /* void registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter) */
    v0 = v8.mReceivers;
    __asm ("monitor-enter v0");
    v1 = new android.support.v4.content.LocalBroadcastManager$ReceiverRecord (v10, v9);
    v2 = v8.mReceivers;
    v2 = v2.java.util.HashMap.get (v9);
    if (!(v2 instanceof java.util.ArrayList)) {
        throw java.lang.ClassCastException ("java.util.ArrayList");
    }
    v3 = 0x1;
    if (v2 != 0) {
        void (*0x100055a54)() ();
    }
    v5 = v10.android.content.IntentFilter.countActions ();
    void (*0x100055aa6)() ();
    v6.java.util.ArrayList.add (v1);
    v4 += 0x1;
    void (*0x100055a5c)() ();
    v7 = new java.util.ArrayList (v3);
    v6 = v7;
    v7 = v8.mActions;
    v7.java.util.HashMap.put (v5, v6);
    __asm ("monitor-exit v0");
    return;
    __asm ("move-exception v1");
    __asm ("monitor-exit v0");
    throw v1;
    v5 = v10.android.content.IntentFilter.getAction (v4);
    v6 = v8.mActions;
    v6 = v6.java.util.HashMap.get (v5);
    throw java.lang.ClassCastException ("java.util.ArrayList");
    void (*0x100055a9a)() ();
    v2.java.util.ArrayList.add (v10);
    v4 = 0;
    v4.java.util.ArrayList.<init> (v3);
    v2 = v4;
    v4 = v8.mReceivers;
    return v4.java.util.HashMap.put (v9, v2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant