Dan, Thanks for the pointers. I will try the dex-debug option. Just to clarify, I generally do not suspect the classes.dex (from core.jar) to be corrupt, because I copied this file in verbatim from the Android build environment. I did not rebuild this. I am able to run emulator version using the same core.jar.
Also I ran dexdump and it does not show any errors. Seeing the code for dexdump, it dumps only the class details (optionally the classdefs). As far as I understood the code, it was not parsing the type list. Also is there a standard procedure to build for glibc (one earlier posting talked about "lunch 2", but I think it is now not supporting glibc). Also as another experiment, I pulled the optimized cache file from emulator /data/dalvik-cache/sys...@framework@[email protected] and copied into my ARM SoC and I got the following message r...@172:/system/bin# dalvikvm -Xbootclasspath:/system/framework/ core.jar V( 5320) VM init args (3): (dalvikvm) V( 5320) 0: '-Xbootclasspath:/system/framework/core.jar' (dalvikvm) V( 5320) 1: '-classpath' (dalvikvm) V( 5320) 2: '/data/HelloWorld.jar' (dalvikvm) V( 5320) VM options (3): (dalvikvm) V( 5320) 0: '-Xbootclasspath:/system/framework/core.jar' (dalvikvm) V( 5320) 1: '-classpath' (dalvikvm) V( 5320) 2: '/data/HelloWorld.jar' (dalvikvm) V( 5320) Using executionMode 2 (dalvikvm) V( 5320) mterp: interp is 16384 bytes, sisters are 2608 bytes (dalvikvm) V( 5320) Creating VM heap of size 2097152 (dalvikvm-heap) V( 5320) threadid=3: interp stack at 0x40016000 (dalvikvm) V( 5320) Opening archive '/system/framework/core.jar' 0xbecd7ab4 (dalvikvm) V( 5320) +++ numEntries=26 cdOffset=1557197 (dalvikvm) V( 5320) Couldn't open /system/framework/core.odex: No such file or directory (dalvikvm) V( 5320) Cache file for '/system/framework/core.jar' 'classes.dex' is '/data/dalvik-cache/sys...@framework@[email protected]' (dalvikvm) V( 5320) dvmDexCacheStatus: Checking cache for /system/framework/ core.jar (/data/dalvik-cache/sys...@framework@[email protected]) (dalvikvm) V( 5320) DexOpt: locking cache file /data/dalvik-cache/ sys...@framework@[email protected] (fd=4, boot=1) (dalvikvm) V( 5320) DexOpt: locked cache file (dalvikvm) V( 5320) checking deps, expecting vfy=1 opt=1 (dalvikvm) V( 5320) +++ DexOpt: numDeps = 0 (dalvikvm) V( 5320) DexOpt: good deps in cache file (dalvikvm) V( 5320) Good opt header, DEX offset is 40, flags=0x0d (dalvikvm) V( 5320) +++ found NEW dex format (dalvikvm) V( 5320) +++ DEX 0x195b8: allocateAux 27166+2910+24694+9879 * 4 = 258596 bytes (dalvikvm) V( 5320) Successfully opened 'classes.dex' in '/system/framework/ core.jar' (dalvikvm) V( 5320) +++ threadid=3: added 0x19268, now 1 (dalvikvm) V( 5320) +++ dvmAddClassToHash 'Ljava/lang/Thread;' (nil) (isnew=1) -- > 0x404f0340 (dalvikvm) V( 5320) +++ threadid=3: added 0x5ae20, now 2 (dalvikvm) V( 5320) +++ dvmAddClassToHash 'Ljava/lang/Class;' (nil) (isnew=1) --> 0x404f03e8 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ dvmAddClassToHash 'Ljava/lang/Object;' (nil) (isnew=1) -- > 0x404f0490 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ dvmAddClassToHash 'Ljava/io/Serializable;' (nil) (isnew=1) --> 0x404f0538 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ dvmAddClassToHash 'Ljava/lang/reflect/ GenericDeclaration;' (nil) (isnew=1) --> 0x404f05e0 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) THROW 'Ljava/lang/NoClassDefFoundError;' msg='D' cause= (none) (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ dvmAddClassToHash 'Ljava/lang/ NoClassDefFoundError;' (nil) (isnew=1) --> 0x404f0688 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b298, now 4 (dalvikvm) V( 5320) +++ dvmAddClassToHash 'Ljava/lang/LinkageError;' (nil) (isnew=1) --> 0x404f0730 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b3a8, now 5 (dalvikvm) V( 5320) +++ dvmAddClassToHash 'Ljava/lang/Error;' (nil) (isnew=1) --> 0x404f07d8 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b860, now 6 (dalvikvm) V( 5320) +++ dvmAddClassToHash 'Ljava/lang/Throwable;' (nil) (isnew=1) --> 0x404f0880 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b860, now 5 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b3a8, now 4 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b298, now 3 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) ----- type is 0x06 7, ptr=0x419e8bf4 [0x33bbcc] (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) ----- type is 0x06 7, ptr=0x419e9022 [0x33bffa] (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) ----- type is 0x06 7, ptr=0x419e92ff [0x33c2d7] (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) ----- type is 0x06 7, ptr=0x419e9569 [0x33c541] (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b0e8, now 2 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b0e8, now 3 (dalvikvm) V( 5320) +++ dvmAddClassToHash 'Ljava/lang/String;' (nil) (isnew=1) -- > 0x404f0948 (dalvikvm) V( 5320) +++ threadid=3: added 0x5b298, now 4 (dalvikvm) V( 5320) +++ dvmAddClassToHash 'Ljava/lang/CharSequence;' (nil) (isnew=1) --> 0x404f09f0 (dalvikvm) V( 5320) +++ threadid=3: removed 0x5b298, now 3 (dalvikvm) V( 5320) THROW 'Ljava/lang/NoClassDefFoundError;' msg='F' cause= (none) (dalvikvm) E( 5320) Too many exceptions during init (failed on 'Ljava/lang/ NoClassDefFoundError;' 'F') (dalvikvm) E( 5320) VM aborting (dalvikvm) Segmentation fault (core dumped) On Mar 12, 12:53 pm, Dan Bornstein <[email protected]> wrote: > On Thu, Mar 12, 2009 at 8:10 AM, vkat <[email protected]> wrote: > > I am in the process of porting the dalvik VM to a glibc based ARM SoC. > > I have done (hopefully) most of the the porting. Now when I start > > dalvikvm I am getting an error when dexopt is trying to optimize the > > core.jar file. > > [...] > > W( 5289) Bad index: (pType->typeIdx)(49280) > (state->pHeader- > >typeIdsSize)(2910) (dalvikvm) > > E( 5289) Trouble with item 4 @ offset 0x2393e4 (dalvikvm) > > E( 5289) Swap of section type 1001 failed (dalvikvm) > > E( 5289) ERROR: Byte swap + verify failed (dalvikvm) > > These are the salient lines from the file. It's not entirely clear to > me where the actual problem is, but what the above log says is that > item #4 in the type_list section (that's what section type 1001 is; > see the dex format specification document) contains a type index > that's out of range. > > This might be because the dex file is corrupt, because the size of the > type_ids section is being misinterpreted, because the offset to the > type_list section is being misinterpreted, or because the contents of > the type_list in question are being misinterpreted. > > To figure out which of these is the case, you should probably start by > inspecting the dex file. The "dexdump" tool can help with this (in > particular the "-f" option to display the header), but dexdump won't > print out the entire contents of the file in general. To get a fully > annotated dex file, you can produce it at build time by adding a "-- > dump-to=<file>" option to dx (the tool that converts class files to > dex files). If you are using the standard Android build system, you > can say "make dex-debug", and this will cause annotated dex files to > be dropped into dalvik/DEBUG-FILES (in your source tree). > > FWIW, this probably won't turn out to be a glibc problem per se, since > at least a couple of folks on the Android team build Dalvik for a > Linux host environment without problem. > > Best of luck, > > -dan --~--~---------~--~----~------------~-------~--~----~ unsubscribe: [email protected] website: http://groups.google.com/group/android-porting -~----------~----~----~----~------~----~------~--~---
