chundongwang / smali

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

No detailed information in the error output #200

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What seems to be the problem?
When smaling, I got this output:

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalStateException: Cannot get the location of a label that hasn't 
been placed yet.
        at org.jf.dexlib2.builder.Label.getLocation(Label.java:54)
        at org.jf.dexlib2.builder.Label.getCodeAddress(Label.java:48)
        at org.jf.dexlib2.builder.BuilderOffsetInstruction.internalGetCodeOffset(BuilderOffsetInstruction.java:60)
        at org.jf.dexlib2.builder.BuilderOffsetInstruction.getCodeOffset(BuilderOffsetInstruction.java:50)
        at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:189)
        at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:944)
        at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:759)
        at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:214)
        at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:192)
        at org.jf.smali.main.main(main.java:229)

I know it's my fault, but there isn't any detailed information, like caused by 
which file and the line number, so I can't fix it.

What is the exact smali/baksmali command that you ran?
java -jar smali-2.0.3.jar . -o classes_mod.dex

What version of smali/baksmali are you using? What rom are you working
from?
smali 2.0.3 (also tried 2.0.2), baksmali 2.0.2, any ROM with Dalvik.

What is the airspeed velocity of an unladen swallow?
... Can't understand

Please provide any additional information below: error messages, symptoms,
etc.
Nothing more.

Original issue reported on code.google.com by chen.92...@gmail.com on 6 Feb 2014 at 3:10

GoogleCodeExporter commented 9 years ago

Original comment by jesusfreke@jesusfreke.com on 6 Feb 2014 at 4:05

GoogleCodeExporter commented 9 years ago
I think it simply means that one of your labels hasn't been defined yet, but 
you are using it in a conditional already.

Although it would be nice to know where the error is, you may have to comb 
through it manually..

Original comment by williams...@gmail.com on 6 Jul 2014 at 2:50

GoogleCodeExporter commented 9 years ago
Yes, but it is such a huge task that I think computers will do it better.

Original comment by chen.92...@gmail.com on 6 Jul 2014 at 10:38

GoogleCodeExporter commented 9 years ago
I agree :)

Original comment by jesusfreke@jesusfreke.com on 6 Jul 2014 at 7:50

GoogleCodeExporter commented 9 years ago
Get stuck, too
I got this exception when I tried to convert smali code from another assembly 
tools.
I can't fix it without file/line detail. :[
My test smali files are in attachment if you need
Help please

Original comment by tastyp...@gmail.com on 14 Jul 2014 at 5:31

Attachments:

GoogleCodeExporter commented 9 years ago
Would like to know as well then this or help resolve this. Came across same 
issue trying to port MIUI 4.4.2 and compiling my frameworks..
C:\apktool>apktool b services.jar.out                                          
I: Using Apktool 2.0.0-dirty on services.jar.out                                
I: Checking whether sources has changed...                                      
I: Smaling...                                                                   
services.jar.out\smali\com\android\server\NetworkManagementService.smali[6452,0]
 Cannot get the location of a label that hasn't been placed yet.                
Exception in thread "main" brut.androlib.AndrolibException: Could not smali 
file: com/android/server/NetworkManagementService.smali                         
            at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:72)   

at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:56)                  
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)                  
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:342)                  
at brut.androlib.Androlib.buildSources(Androlib.java:303)                      
at brut.androlib.Androlib.build(Androlib.java:289)                              
at brut.androlib.Androlib.build(Androlib.java:262)                              
at brut.apktool.Main.cmdBuild(Main.java:236)                                    
at brut.apktool.Main.main(Main.java:88)

And that line specified is the name of a method that is stock and was NOT added

Original comment by lacoursi...@gmail.com on 26 Jul 2014 at 8:35

GoogleCodeExporter commented 9 years ago
@lacoursiere18: That is a different problem. You shouldn't be getting that 
error after disassembling with no changes. Are you sure there are no changes in 
that file?

The problem in this issue is that there is no context associated with the 
error. But your error clearly has the line and number as context.

Original comment by jesusfreke@jesusfreke.com on 26 Jul 2014 at 8:41

GoogleCodeExporter commented 9 years ago
Just as an update on this issue, the main problem is that the label resolution 
stuff is happening later, and doesn't have access to the original context (file 
and line) where the labels were created. So I've been thinking of how to 
improve the situation here. I could throw a quick fix in for this one problem, 
but I want to fix it in a more systemic way.

Original comment by jesusfreke@jesusfreke.com on 26 Jul 2014 at 8:43