0

I'm trying to log p1 string to logcat.

This is my function.

new-instance v4, Ljava/lang/StringBuilder;

invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

invoke-virtual {v4, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v4, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v4, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object p1

const-string v8, "log-tag"

invoke-static {v8, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

However, the app keeps crashing when log is triggered, with an error that p1 is somehow object, even though it was converted to string.

Whole code:

.super Lbv2;
.source "SourceFile"

.implements Lfu2;

.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lm72$a;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x19
name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
value = {
"Lbv2;",
"Lfu2<",
"Lcom/myapp/testapp/core/network/model/Result<",
"+",
"Lcom/myapp/testapp/core/network/model/request/CheckRequest;",
">;",
"Lrs2;",
">;"
}
.end annotation


.field public final synthetic e:Lm72$a;

.field public final synthetic f:Ljava/lang/String;

.method public constructor <init>(Lm72$a;Ljava/lang/String;)V
.locals 0

iput-object p1, p0, Lm72$a$a;->e:Lm72$a;

iput-object p2, p0, Lm72$a$a;->f:Ljava/lang/String;

const/4 p1, 0x1

invoke-direct {p0, p1}, Lbv2;-><init>(I)V

return-void
.end method

.method public invoke(Ljava/lang/Object;)Ljava/lang/Object;
.locals 8

.line 1
check-cast p1, Lcom/myapp/testapp/core/network/model/Result;

const-string v0, "result"

.line 2
invoke-static {p1, v0}, Lav2;->e(Ljava/lang/Object;Ljava/lang/String;)V

.line 3
instance-of v0, p1, Lcom/myapp/testapp/core/network/model/Result$Success;

if-eqz v0, :cond_1

.line 4
check-cast p1, Lcom/myapp/testapp/core/network/model/Result$Success;

invoke-virtual {p1}, Lcom/myapp/testapp/core/network/model/Result$Success;->getData()Ljava/lang/Object;

move-result-object p1

check-cast p1, Lcom/myapp/testapp/core/network/model/request/CheckRequest;

invoke-virtual {p1}, Lcom/myapp/testapp/core/network/model/request/CheckRequest;->getSessionToken()Ljava/lang/String;

move-result-object p1

.line 5
iget-object v0, p0, Lm72$a$a;->e:Lm72$a;

iget-object v0, v0, Lm72$a;->g:Lm72;

.line 6
iget-object v0, v0, Lm72;->n:Landroid/content/res/Resources;

const v1, 0x7f110179

.line 7
invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

move-result-object v0

const-string v1, "resources.getString(R.string.x_session_ver)"

invoke-static {v0, v1}, Lav2;->d(Ljava/lang/Object;Ljava/lang/String;)V

.line 8
new-instance v1, Lcom/myapp/testapp/Secrets;

invoke-direct {v1}, Lcom/myapp/testapp/Secrets;-><init>()V

iget-object v2, p0, Lm72$a$a;->e:Lm72$a;

iget-object v2, v2, Lm72$a;->g:Lm72;

.line 9
iget-object v2, v2, Lm72;->o:Landroid/content/Context;

.line 10
invoke-virtual {v2}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

move-result-object v2

const-string v3, "context.packageName"

invoke-static {v2, v3}, Lav2;->d(Ljava/lang/Object;Ljava/lang/String;)V

invoke-virtual {v1, v2}, Lcom/myapp/testapp/Secrets;->geteSDwHUZA(Ljava/lang/String;)Ljava/lang/String;

move-result-object v1

const-string v2, "/v1/"

.line 11
invoke-static {v2}, Lsu;->t(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v2

const-string v3, "messages/sms"

invoke-virtual {v3}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

move-result-object v3

const-string v4, "(this as java.lang.String).toLowerCase()"

invoke-static {v3, v4}, Lav2;->d(Ljava/lang/Object;Ljava/lang/String;)V

invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v2

.line 12
new-instance v3, Lpr1;

invoke-direct {v3}, Lpr1;-><init>()V

iget-object v4, p0, Lm72$a$a;->e:Lm72$a;

iget-object v4, v4, Lm72$a;->h:Ljava/lang/Object;

invoke-virtual {v3, v4}, Lpr1;->g(Ljava/lang/Object;)Ljava/lang/String;

move-result-object v3

.line 13

new-instance v4, Ljava/lang/StringBuilder;

invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

invoke-virtual {v4, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v4, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v4, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object p1

const-string v8, "log-tag"

invoke-static {v8, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

const-string v1, "input"

.line 14
invoke-static {p1, v1}, Lav2;->e(Ljava/lang/Object;Ljava/lang/String;)V

const-string v1, "MD5"

.line 15
invoke-static {v1}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;

move-result-object v1

.line 16
sget-object v2, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset;

const-string v3, "StandardCharsets.UTF_8"

invoke-static {v2, v3}, Lav2;->d(Ljava/lang/Object;Ljava/lang/String;)V

invoke-virtual {p1, v2}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B

move-result-object p1

const-string v2, "(this as java.lang.String).getBytes(charset)"

invoke-static {p1, v2}, Lav2;->d(Ljava/lang/Object;Ljava/lang/String;)V

invoke-virtual {v1, p1}, Ljava/security/MessageDigest;->digest([B)[B

move-result-object p1

.line 17
new-instance v1, Ljava/lang/StringBuilder;

invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

.line 18
array-length v2, p1

const/4 v3, 0x0

move v4, v3

:goto_0
if-ge v4, v2, :cond_0

aget-byte v5, p1, v4

const/4 v6, 0x1

new-array v7, v6, [Ljava/lang/Object;

.line 19
invoke-static {v5}, Ljava/lang/Byte;->valueOf(B)Ljava/lang/Byte;

move-result-object v5

aput-object v5, v7, v3

invoke-static {v7, v6}, Ljava/util/Arrays;->copyOf([Ljava/lang/Object;I)[Ljava/lang/Object;

move-result-object v5

const-string v6, "%02x"

invoke-static {v6, v5}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

move-result-object v5

const-string v6, "java.lang.String.format(format, *args)"

invoke-static {v5, v6}, Lav2;->d(Ljava/lang/Object;Ljava/lang/String;)V

invoke-virtual {v1, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

add-int/lit8 v4, v4, 0x1

goto :goto_0

.line 20
:cond_0
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object p1

const-string v1, "sb.toString()"

invoke-static {p1, v1}, Lav2;->d(Ljava/lang/Object;Ljava/lang/String;)V

.line 21
iget-object v1, p0, Lm72$a$a;->e:Lm72$a;

iget-object v2, v1, Lm72$a;->i:Llu2;

iget-object v3, p0, Lm72$a$a;->f:Ljava/lang/String;

iget-object v1, v1, Lm72$a;->h:Ljava/lang/Object;

invoke-interface {v2, p1, v0, v3, v1}, Llu2;->a(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

goto :goto_1

.line 22
:cond_1
instance-of v0, p1, Lcom/myapp/testapp/core/network/model/Result$Error;

if-eqz v0, :cond_2

.line 23
iget-object v0, p0, Lm72$a$a;->e:Lm72$a;

iget-object v1, v0, Lm72$a;->j:Lfu2;

iget-object v0, v0, Lm72$a;->g:Lm72;

.line 24
iget-object v0, v0, Lc0;->l:Lb22;

.line 25
invoke-interface {v1, v0}, Lfu2;->invoke(Ljava/lang/Object;)Ljava/lang/Object;

.line 26
iget-object v0, p0, Lm72$a$a;->e:Lm72$a;

iget-object v0, v0, Lm72$a;->g:Lm72;

check-cast p1, Lcom/myapp/testapp/core/network/model/Result$Error;

invoke-virtual {p1}, Lcom/myapp/testapp/core/network/model/Result$Error;->getError()Lcom/myapp/testapp/core/network/model/ServerException;

move-result-object p1

invoke-virtual {p1}, Lcom/myapp/testapp/core/network/model/ServerException;->getExceptionMessage()Ljava/lang/String;

move-result-object p1

sget-object v1, Ll72;->e:Ll72;

.line 27
invoke-virtual {v0, p1, v1}, Lc0;->i(Ljava/lang/String;Lut2;)V

.line 28
:cond_2
:goto_1
sget-object p1, Lrs2;->a:Lrs2;

return-object p1
.end method
1
  • There is code after yours that uses the value in p1, but you're clobbering the register with your own value.
    – JesusFreke
    Sep 1 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.