static void dumpMethodList(CTX, ksfp_t *sfp, size_t start, kArray *list) { size_t i; for(i = start; i < kArray_size(list); i++) { dumpMethod(_ctx, sfp, list->methods[i]); } }
static void dumpMethodList(KonohaContext *kctx, KonohaStack *sfp, size_t start, kArray *list) { size_t i; for(i = start; i < kArray_size(list); i++) { dumpMethod(kctx, sfp, list->MethodItems[i]); } }
/* * Run through all direct and virtual methods in the class. */ void dumpClass(DexFile* pDexFile, int idx) { const DexClassDef* pClassDef; DexClassData* pClassData; const u1* pEncodedData; const char* fileName; int i; pClassDef = dexGetClassDef(pDexFile, idx); pEncodedData = dexGetClassData(pDexFile, pClassDef); pClassData = dexReadAndVerifyClassData(&pEncodedData, NULL); if (pClassData == NULL) { fprintf(stderr, "Trouble reading class data\n"); return; } if (pClassDef->sourceFileIdx == 0xffffffff) { fileName = NULL; } else { fileName = dexStringById(pDexFile, pClassDef->sourceFileIdx); } /* * TODO: Each class def points at a sourceFile, so maybe that * should be printed out. However, this needs to be coordinated * with the tools that parse this output. */ for (i = 0; i < (int) pClassData->header.directMethodsSize; i++) { dumpMethod(pDexFile, fileName, &pClassData->directMethods[i], i); } for (i = 0; i < (int) pClassData->header.virtualMethodsSize; i++) { dumpMethod(pDexFile, fileName, &pClassData->virtualMethods[i], i); } free(pClassData); }
/* * Dump the class. */ void dumpClass(DexFile* pDexFile, int idx) { const DexTypeList* pInterfaces; const DexClassDef* pClassDef; DexClassData* pClassData; const u1* pEncodedData; const char* fileName; const char* classDescriptor; const char* superclassDescriptor; char* accessStr; int i; pClassDef = dexGetClassDef(pDexFile, idx); printf("Class #%d -\n", idx); pEncodedData = dexGetClassData(pDexFile, pClassDef); pClassData = dexReadAndVerifyClassData(&pEncodedData, NULL); if (pClassData == NULL) { printf("Trouble reading class data\n"); return; } classDescriptor = dexStringByTypeIdx(pDexFile, pClassDef->classIdx); printf(" Class descriptor : '%s'\n", classDescriptor); accessStr = createAccessFlagStr(pClassDef->accessFlags, kAccessForClass); printf(" Access flags : 0x%04x (%s)\n", pClassDef->accessFlags, accessStr); if (pClassDef->superclassIdx == kDexNoIndex) superclassDescriptor = "(none)"; else { superclassDescriptor = dexStringByTypeIdx(pDexFile, pClassDef->superclassIdx); printf(" Superclass : '%s'\n", superclassDescriptor); } printf(" Interfaces -\n"); pInterfaces = dexGetInterfacesList(pDexFile, pClassDef); if (pInterfaces != NULL) { for (i = 0; i < (int) pInterfaces->size; i++) dumpInterface(pDexFile, dexGetTypeItem(pInterfaces, i), i); } printf(" Static fields -\n"); for (i = 0; i < (int) pClassData->header.staticFieldsSize; i++) { dumpSField(pDexFile, &pClassData->staticFields[i], i); } printf(" Instance fields -\n"); for (i = 0; i < (int) pClassData->header.instanceFieldsSize; i++) { dumpIField(pDexFile, &pClassData->instanceFields[i], i); } printf(" Direct methods -\n"); for (i = 0; i < (int) pClassData->header.directMethodsSize; i++) { dumpMethod(pDexFile, &pClassData->directMethods[i], i); } printf(" Virtual methods -\n"); for (i = 0; i < (int) pClassData->header.virtualMethodsSize; i++) { dumpMethod(pDexFile, &pClassData->virtualMethods[i], i); } // TODO: Annotations. if (pClassDef->sourceFileIdx != kDexNoIndex) fileName = dexStringById(pDexFile, pClassDef->sourceFileIdx); else fileName = "unknown"; printf(" source_file_idx : %d (%s)\n", pClassDef->sourceFileIdx, fileName); printf("\n"); free(pClassData); free(accessStr); }