Fixed
Status Update
Comments
sk...@gmail.com <sk...@gmail.com> #2
The debugger always highlights the last line with code on it before returning from a method. It doesn't actually execute the "return -1" in that case, even though it appears to do so. Check the return value you get from the method.
en...@google.com <en...@google.com> #3
what does Eclipse do if you debug the same code running on Sun's JVM?
to...@gmail.com <to...@gmail.com> #4
If I try debug the same code in eclipse like normal Java application on Sun's JVM everything is OK, it work as I expect, problem is only if I debug android application.
en...@google.com <en...@google.com> #5
yeah, if i run this on the RI i don't see the apparent step to "return -1" but on dalvik i do. looking at the dex file, it's obvious that dx has done this to us by compiling all three returns into one (instruction 0x7):
0001f4: |[0001f4] HelloWorld.f:()I
000204: 1211 |0000: const/4 v1, #int 1 // #1
000206: 3a01 0900 |0001: if-ltz v1, 000a // +0009
00020a: 1300 0a00 |0003: const/16 v0, #int 10 // #a
00020e: 3d00 0300 |0005: if-lez v0, 0008 // +0003
000212: 0f00 |0007: return v0
000214: 1200 |0008: const/4 v0, #int 0 // #0
000216: 28fe |0009: goto 0007 // -0002
000218: 12f0 |000a: const/4 v0, #int -1 // #ff
00021a: 28fc |000b: goto 0007 // -0004
catches : (none)
positions :
0x0000 line=8
0x0001 line=10
0x0003 line=11
0x0005 line=12
0x0007 line=18
0x0008 line=15
0x000a line=18
locals :
0x0005 - 0x0007 reg=0 count I
0x0008 - 0x000a reg=0 count I
0x0001 - 0x000c reg=1 row I
i'd guess the debug information for that instruction gets overwritten each time we compile a return, leaving us reporting the final return to the debugger. this is shit, and should be fixed, but sadly this isn't something i can fix in jdwp.
0001f4: |[0001f4] HelloWorld.f:()I
000204: 1211 |0000: const/4 v1, #int 1 // #1
000206: 3a01 0900 |0001: if-ltz v1, 000a // +0009
00020a: 1300 0a00 |0003: const/16 v0, #int 10 // #a
00020e: 3d00 0300 |0005: if-lez v0, 0008 // +0003
000212: 0f00 |0007: return v0
000214: 1200 |0008: const/4 v0, #int 0 // #0
000216: 28fe |0009: goto 0007 // -0002
000218: 12f0 |000a: const/4 v0, #int -1 // #ff
00021a: 28fc |000b: goto 0007 // -0004
catches : (none)
positions :
0x0000 line=8
0x0001 line=10
0x0003 line=11
0x0005 line=12
0x0007 line=18
0x0008 line=15
0x000a line=18
locals :
0x0005 - 0x0007 reg=0 count I
0x0008 - 0x000a reg=0 count I
0x0001 - 0x000c reg=1 row I
i'd guess the debug information for that instruction gets overwritten each time we compile a return, leaving us reporting the final return to the debugger. this is shit, and should be fixed, but sadly this isn't something i can fix in jdwp.
en...@google.com <en...@google.com> #6
i've raised internal bug 36949180 for this.
an...@gmail.com <an...@gmail.com> #8
Does the bug also occur in Android Studio?
When will the bug be fixed??
When will the bug be fixed??
bd...@google.com <bd...@google.com> #9
dx still has this bug, but its replacement jack does not:
http://tools.android.com/tech-docs/jackandjill
as work on dx is effectively stopped, marking this obsolete.
as work on dx is effectively stopped, marking this obsolete.
[Deleted User] <[Deleted User]> #10
[Comment deleted]
co...@androidgecko.com <co...@androidgecko.com> #11
Just run into this issue today,
Tested it with Jack -> does not happen
since :
"The Jack toolchain is deprecated,"
https://developer.android.com/guide/platform/j8-jack.html
https://android-developers.googleblog.com/2017/03/future-of-java-8-language-feature.html
I cannot trust my tools now :(
will it be fixed?
Tested it with Jack -> does not happen
since :
"The Jack toolchain is deprecated,"
I cannot trust my tools now :(
will it be fixed?
to...@gmail.com <to...@gmail.com> #12
to...@gmail.com <to...@gmail.com> #13
It is very funny. Because of this issue is closed I created new one, which was closed like duplication of another one, which was closed as duplication of this one. Circle is finished :-(
I hope that somebody still working on it.
I hope that somebody still working on it.
ks...@google.com <ks...@google.com> #14
Tomáš is correct to highlight a silly circularity here; Jack is no longer the replacement so this seems like it should still be valid.
jv...@google.com <jv...@google.com> #15
This has been fixed in the new Dexer of which we announced preview availability today: https://android-developers.googleblog.com/2017/08/next-generation-dex-compiler-now-in.html
Please give D8 a try and let us know your experience!
Please give D8 a try and let us know your experience!
to...@gmail.com <to...@gmail.com> #16
I tried to use D8 and the problem with debugger is really fixed.
I tried to use it also for one beta release of my app, I have just 200 beta testers
And one of them wrote me that he is not able to install this build.
He has Lenovo device with non oficial Cyanogen ROM:
Device: P70
romInfo: cm_P70-userdebug 5.1.1 LMY49J fd77b65ea8 test-keys
romFingerprint: Lenovo/cm_P70/P70:5.1.1/LMY49J/fd77b65ea8:userdebug/test-keys
So probably not a big deal, but I will just for sure wait before bigger release of this new D8.
I tried to use it also for one beta release of my app, I have just 200 beta testers
And one of them wrote me that he is not able to install this build.
He has Lenovo device with non oficial Cyanogen ROM:
Device: P70
romInfo: cm_P70-userdebug 5.1.1 LMY49J fd77b65ea8 test-keys
romFingerprint: Lenovo/cm_P70/P70:5.1.1/LMY49J/fd77b65ea8:userdebug/test-keys
So probably not a big deal, but I will just for sure wait before bigger release of this new D8.
jv...@google.com <jv...@google.com> #17
to...@gmail.com <to...@gmail.com> #18
Yes, it was also error 504 during installing from Play
Description
If I debugging code with multiple return statements, eclipse jump to the last one return 'statement' also when another should be used.
Here is simple example:
public int test() {
int row = 1;
if (row >= 0) {
int count = 10;
if (count > 0) {
return count;
} else {
return 0;
}
} else {
return -1;
}
}
When you will debug this code, you will se that Eclipse jump to the "return -1" after evaluating "if (count > 0) {", but count > 0 is true and next line should be used. Method return right value, problem is only in debugger.
Here is more complex video example:
Original thread:
(where Xavier Ducrohet suggest to write bug to the dalvik component)