static int32_t compare_break_method( mrb_state *mrb, mrb_debug_breakpoint *bp, struct RClass *class_obj, mrb_sym method_sym, mrb_bool* isCfunc ) { const char* class_name; const char* method_name; struct RProc* m; struct RClass* sc; const char* sn; mrb_sym ssym; mrb_debug_methodpoint *method_p; mrb_bool is_defined; method_name = mrb_sym2name(mrb, method_sym); method_p = &bp->point.methodpoint; if(strcmp(method_p->method_name, method_name) == 0) { class_name = get_class_name(mrb, class_obj); if(class_name == NULL) { if(method_p->class_name == NULL) { return bp->bpno; } } else if(method_p->class_name != NULL) { m = mrb_method_search_vm(mrb, &class_obj, method_sym); if(m == NULL) { return MRB_DEBUG_OK; } if(MRB_PROC_CFUNC_P(m)) { *isCfunc = TRUE; } is_defined = mrb_class_defined(mrb, method_p->class_name); if(is_defined == FALSE) { return MRB_DEBUG_OK; } sc = mrb_class_get(mrb, method_p->class_name); ssym = mrb_symbol(mrb_check_intern_cstr(mrb, method_p->method_name)); m = mrb_method_search_vm(mrb, &sc, ssym); if(m == NULL) { return MRB_DEBUG_OK; } class_name = get_class_name(mrb, class_obj); sn = get_class_name(mrb, sc); if(strcmp(sn, class_name) == 0) { return bp->bpno; } } } return MRB_DEBUG_OK; }
void Object::get_method_list(List<MethodInfo> *p_list) const { ClassDB::get_method_list(get_class_name(), p_list); if (script_instance) { script_instance->get_method_list(p_list); } }
void Expander::expand_class_representation(const string & name){ if(logger.is_info()) logger.log_info() << indent << name << " : expanding..." << endl; jvm_class.name = get_class_name(); if(jvm_class.name != name){ ostringstream os; os << "name mismatch - expected to expand " << name << " but class file representation contains " << jvm_class.name << endl; throw JvmException (os.str()); } jvm_class.access_flags = class_file_representation.access_flags; if(logger.is_info()) logger.log_info() << indent << jvm_class.name << " : access specifiers [" << jvm_class.get_access_string() << "]" << endl; if(jvm_class.name == "java/lang/Object"){ if(logger.is_debug()) logger.log_debug() << indent << jvm_class.name << " : has no super class" << endl; }else{ string super_class_name = get_super_class_name(); if(logger.is_debug()) logger.log_debug() << indent << jvm_class.name << " : super class name : " << super_class_name << endl; jvm_class.super_class = &class_loader.get_class(super_class_name, depth + 1); } expand_interfaces(); expand_members(); if(logger.is_info()) logger.log_info() << indent << name << " : ...expanded" << endl; }
void Object::disconnect(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method) { ERR_FAIL_NULL(p_to_object); Signal *s = signal_map.getptr(p_signal); if (!s) { ERR_EXPLAIN("Nonexistent signal: " + p_signal); ERR_FAIL_COND(!s); } if (s->lock > 0) { ERR_EXPLAIN("Attempt to disconnect signal '" + p_signal + "' while emitting (locks: " + itos(s->lock) + ")"); ERR_FAIL_COND(s->lock > 0); } Signal::Target target(p_to_object->get_instance_id(), p_to_method); if (!s->slot_map.has(target)) { ERR_EXPLAIN("Disconnecting nonexistent signal '" + p_signal + "', slot: " + itos(target._id) + ":" + target.method); ERR_FAIL(); } p_to_object->connections.erase(s->slot_map[target].cE); s->slot_map.erase(target); if (s->slot_map.empty() && ClassDB::has_signal(get_class_name(), p_signal)) { //not user signal, delete signal_map.erase(p_signal); } }
/* Useful for printing annotations as comments. Expects that * the annotation is a BrickAnnote. */ void Printer::print_annote(Annote *annote) { start_comment(); IdString name = annote->get_name(); if (name != k_comment) fprintf(out, "[%s", name.chars()); if (is_kind_of<BrickAnnote>(annote)) { BrickAnnote *an = (BrickAnnote *)(annote); char *separator = ": "; for (Iter<SuifBrick*> iter = an->get_brick_iterator(); iter.is_valid(); iter.next()) { fputs(separator, out); separator = ", "; SuifBrick *brick = iter.current(); if (is_a<IntegerBrick>(brick)) { Integer i = ((IntegerBrick*)iter.current())->get_value(); if (i.is_c_string_int()) fputs(i.chars(), out); else fprintf(out, "%ld", i.c_long()); } else if (is_a<StringBrick>(brick)) { putc('"', out); for (const char *p = ((StringBrick*)iter.current())->get_value().c_str(); *p != '\0'; ++p) { if (*p == '"' || *p == '\\') putc('\\', out); putc(*p, out); } putc('"', out); } else { claim(is_a<SuifObjectBrick>(brick)); SuifObject *so = ((SuifObjectBrick*)brick)->get_object(); if (is_kind_of<Type>(so)) fprint(out, (TypeId)so); else { const char *kind = so ? get_class_name(so) : "NULL"; fprintf(out, "<<<%s object>>>", kind); } } } } else { claim(is_kind_of<GeneralAnnote>(annote), "Unexpected kind of Annote"); } if (name != k_comment) fputs("]", out); fputs("\n", out); }
static void JNICALL FieldModifyCallBack(jvmtiEnv * jvmti_env, JNIEnv * jni_env, jthread thread, jmethodID method, jlocation location, jclass field_klass, jobject object, jfieldID field, char signature_type, jvalue new_value) { // char *className = "ek/JVMTICallback"; // char *methodName = "FieldModify"; // char *descriptor = "(Ljava/lang/String;)V"; // // jclass callbackClass = (*jni_env)->FindClass(jni_env, className); // // if (!callbackClass) { // fprintf(stderr,"C:\tUnable to locate callback class.\n"); // return; // } // char *name_ptr; char *cls_name=NULL; char *signature_ptr=NULL; char *generic_ptr=NULL; jvmtiError error; if (inited) { printf("C:\tField modify catched\n"); (*jvmti_env)->GetFieldName(jvmti_env, field_klass, field, &name_ptr, &signature_ptr, &generic_ptr); printf("C:\t Field Name: %s\n", name_ptr); jclass clsObj = (*jni_env)->GetObjectClass(jni_env, object); if (!clsObj) { fprintf(stderr, "C:\tUnable to get cls\n"); return; } printf("C:\t Got class obj\n"); get_class_name(jvmti_env, clsObj, cls_name, 50); printf("C:\t Name: %s->%s\n", cls_name, name_ptr); jstring jstr1 = (*jni_env)->NewStringUTF(jni_env, name_ptr); (*jni_env)->CallStaticVoidMethod(jni_env, callbackClass, callbackFieldModifyMethodID, jstr1); //TODO:ek:relese jstr1 error = (*jvmti_env)->Deallocate(jvmti_env, (unsigned char *) name_ptr); if (error != JVMTI_ERROR_NONE) fprintf(stderr, "!!!\n"); error = (*jvmti_env)->Deallocate(jvmti_env, (unsigned char *) cls_name); if (error != JVMTI_ERROR_NONE) fprintf(stderr, "!!!\n"); } }
void Object::add_user_signal(const MethodInfo &p_signal) { ERR_FAIL_COND(p_signal.name == ""); ERR_FAIL_COND(ClassDB::has_signal(get_class_name(), p_signal.name)); ERR_FAIL_COND(signal_map.has(p_signal.name)); Signal s; s.user = p_signal; signal_map[p_signal.name] = s; }
int32 zEventBase::registeEvent(const char* evt, int32 luafn) { if (!evt) return -1; // make full event name std::string eventName = get_class_name(); eventName += evt; _eventsList.insert(std::make_pair(eventName, luafn)); return 0; }
int32 zEventBase::unregisteEvent(const char* evt) { if (!evt) return -1; // make full event name std::string eventName = get_class_name(); eventName += evt; auto it = _eventsList.find(eventName); if (it != _eventsList.end()) _eventsList.erase(it); return 0; }
/* * get_client_class * * inputs - pointer to client struct * output - pointer to name of class * side effects - NONE */ const char * get_client_class(struct Client *target_p) { const char *retc = "unknown"; if(target_p == NULL || IsMe(target_p)) return retc; if(IsServer(target_p)) { struct server_conf *server_p = target_p->localClient->att_sconf; return server_p->class_name; } return get_class_name(target_p->localClient->att_conf);; }
bool Object::has_method(const StringName &p_method) const { if (p_method == CoreStringNames::get_singleton()->_free) { return true; } if (script_instance && script_instance->has_method(p_method)) { return true; } MethodBind *method = ClassDB::get_method(get_class_name(), p_method); if (method) { return true; } return false; }
void Object::get_signal_list(List<MethodInfo> *p_signals) const { if (!script.is_null()) { Ref<Script>(script)->get_script_signal_list(p_signals); } ClassDB::get_signal_list(get_class_name(), p_signals); //find maybe usersignals? const StringName *S = NULL; while ((S = signal_map.next(S))) { if (signal_map[*S].user.name != "") { //user signal p_signals->push_back(signal_map[*S].user); } } }
Variant::Type Object::get_static_property_type(const StringName &p_property, bool *r_valid) const { bool valid; Variant::Type t = ClassDB::get_property_type(get_class_name(), p_property, &valid); if (valid) { if (r_valid) *r_valid = true; return t; } if (get_script_instance()) { return get_script_instance()->get_property_type(p_property, r_valid); } if (r_valid) *r_valid = false; return Variant::NIL; }
int print_rr_info(void *rr_info) { char tmp_addr[INET_ADDRSTRLEN]; RR_INFO *rr_info_p; assert(rr_info); rr_info_p = rr_info; printf("%s\t%s\t%s\t%d\t%s\n", rr_info_p->name, get_class_name(rr_info_p->rr_class), get_type_name(rr_info_p->type), rr_info_p->ttl, inet_ntop(AF_INET, &rr_info_p->data.ip4, tmp_addr, INET_ADDRSTRLEN) ); return RET_OK; }
//Dump all classes declared in DEX file 'df'. void dump_all_class_and_field(DexFile * df) { if (g_tfile == NULL) { return; } fprintf(g_tfile, "\n==---- DUMP ALL CLASS and FIELD ----=="); //Walk through each class declaration via class-index in file. IS_TRUE0(df && df->pHeader); for (UINT i = 0; i < df->pHeader->classDefsSize; i++) { fprintf(g_tfile, "\n"); //Show section header. //dumpClassDef(pDexFile, i); //Dump class name. DexClassDef const* class_info = dexGetClassDef(df, i); //IS_TRUE(i == class_info->classIdx, ("they might be equal")); //CHAR const* class_name = dexStringByTypeIdx(df, class_info->classIdx); //IS_TRUE0(class_name); fprintf(g_tfile, "class %s {", get_class_name(df, class_info)); //Dump class fields. BYTE const* encoded_data = dexGetClassData(df, class_info); if (encoded_data != NULL) { DexClassData * class_data = dexReadAndVerifyClassData(&encoded_data, NULL); if (class_data != NULL) { for (UINT i = 0; i < class_data->header.instanceFieldsSize; i++) { fprintf(g_tfile, "\n"); DexField * finfo = &class_data->instanceFields[i]; IS_TRUE0(finfo); dumpf_field(df, finfo, 4); fflush(g_tfile); } } else { fprintf(g_tfile, "\n\t--"); } } else { fprintf(g_tfile, "\n\t--"); } fprintf(g_tfile, "\n"); fprintf(g_tfile, "}"); fflush(g_tfile); } fflush(g_tfile); }
void CKXDialog::rest_position(char *p) { if(p!=0) prefix=p; if(prefix==0) prefix=(char *)get_class_name(); int bm_width=get_bitmap_width(); if(bm_width<=0) bm_width=600; int bm_height=get_bitmap_height(); if(bm_height<=0) bm_height=340; int prev_x=GetSystemMetrics(SM_CXFULLSCREEN)/2-bm_width/2, prev_y=GetSystemMetrics(SM_CYFULLSCREEN)/2-bm_height/2; kSettings cfg; char tmp_str[21]; char tmp_key[21]; sprintf(tmp_key,"Prev%sX",prefix); if(cfg.read_abs("Mixer",tmp_key,tmp_str,21)==0) sscanf(tmp_str,"%d",&prev_x); sprintf(tmp_key,"Prev%sY",prefix); if(cfg.read_abs("Mixer",tmp_key,tmp_str,21)==0) sscanf(tmp_str,"%d",&prev_y); if((prev_x<GetSystemMetrics(SM_CXFULLSCREEN)-16) && (prev_y<GetSystemMetrics(SM_CYFULLSCREEN)-16)&& (prev_x>-bm_width+16) && (prev_y>-bm_height+16) && (prev_x>-2048) && (prev_y>-2048)) { SetWindowPos(NULL, prev_x, prev_y, -1, -1, SWP_NOSIZE|SWP_NOZORDER|SWP_NOREDRAW|SWP_NOACTIVATE); } else CenterWindow(); }
void Object::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) { MethodBind *method = ClassDB::get_method(get_class_name(), p_method); Variant::CallError error; OBJ_DEBUG_LOCK if (method) { method->call(this, p_args, p_argcount, error); _test_call_error(p_method, error); } //Variant ret; if (script_instance) { script_instance->call_multilevel_reversed(p_method, p_args, p_argcount); //_test_call_error(p_method,error); } }
void Object::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) { if (p_method == CoreStringNames::get_singleton()->_free) { #ifdef DEBUG_ENABLED if (Object::cast_to<Reference>(this)) { ERR_EXPLAIN("Can't 'free' a reference."); ERR_FAIL(); return; } if (_lock_index.get() > 1) { ERR_EXPLAIN("Object is locked and can't be freed."); ERR_FAIL(); return; } #endif //must be here, must be before everything, memdelete(this); return; } //Variant ret; OBJ_DEBUG_LOCK Variant::CallError error; if (script_instance) { script_instance->call_multilevel(p_method, p_args, p_argcount); //_test_call_error(p_method,error); } MethodBind *method = ClassDB::get_method(get_class_name(), p_method); if (method) { method->call(this, p_args, p_argcount, error); _test_call_error(p_method, error); } }
Error Object::connect(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method, const Vector<Variant> &p_binds, uint32_t p_flags) { ERR_FAIL_NULL_V(p_to_object, ERR_INVALID_PARAMETER); Signal *s = signal_map.getptr(p_signal); if (!s) { bool signal_is_valid = ClassDB::has_signal(get_class_name(), p_signal); //check in script if (!signal_is_valid && !script.is_null() && Ref<Script>(script)->has_script_signal(p_signal)) signal_is_valid = true; if (!signal_is_valid) { ERR_EXPLAIN("In Object of type '" + String(get_class()) + "': Attempt to connect nonexistent signal '" + p_signal + "' to method '" + p_to_object->get_class() + "." + p_to_method + "'"); ERR_FAIL_COND_V(!signal_is_valid, ERR_INVALID_PARAMETER); } signal_map[p_signal] = Signal(); s = &signal_map[p_signal]; } Signal::Target target(p_to_object->get_instance_id(), p_to_method); if (s->slot_map.has(target)) { ERR_EXPLAIN("Signal '" + p_signal + "' is already connected to given method '" + p_to_method + "' in that object."); ERR_FAIL_COND_V(s->slot_map.has(target), ERR_INVALID_PARAMETER); } Signal::Slot slot; Connection conn; conn.source = this; conn.target = p_to_object; conn.method = p_to_method; conn.signal = p_signal; conn.flags = p_flags; conn.binds = p_binds; slot.conn = conn; slot.cE = p_to_object->connections.push_back(conn); s->slot_map[target] = slot; return OK; }
//Dump LIR stmts stored in fu->lirList array. void dump_all_lir(LIRCode * fu, DexFile * df, DexMethod const* dm) { if (g_tfile == NULL) return; IS_TRUE0(fu && df && dm); CHAR const* class_name = get_class_name(df, dm); CHAR const* func_name = get_func_name(df, dm); IS_TRUE0(class_name && func_name); fprintf(g_tfile, "\n==---- DUMP LIR of %s::%s ----== maxreg:%d ", class_name, func_name, fu->maxVars - 1); if (fu->maxVars > 0) { fprintf(g_tfile, "("); for (INT i = fu->maxVars - fu->numArgs; i < (INT)fu->maxVars; i++) { IS_TRUE0(i >= 0); fprintf(g_tfile, "v%d,", i); } fprintf(g_tfile, ")"); } fprintf(g_tfile, " ===="); if (fu->triesSize != 0) { for (UINT i = 0; i < fu->triesSize; i++) { fprintf(g_tfile, "\ntry%d, ", i); LIROpcodeTry * each_try = fu->trys + i; fprintf(g_tfile, "start_idx=%dth, end_idx=%dth", each_try->start_pc, each_try->end_pc); for (UINT j = 0; j < each_try->catchSize; j++) { LIROpcodeCatch * each_catch = each_try->catches + j; fprintf(g_tfile, "\n catch%d, kind=%d, start_idx=%dth", j, each_catch->class_type, each_catch->handler_pc); } } } for (INT i = 0; i < LIRC_num_of_op(fu); i++) { LIR * lir = LIRC_op(fu, i); IS_TRUE0(lir); fprintf(g_tfile, "\n"); dump_lir2(lir, df, i); } fflush(g_tfile); }
bool Object::is_connected(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method) const { ERR_FAIL_NULL_V(p_to_object, false); const Signal *s = signal_map.getptr(p_signal); if (!s) { bool signal_is_valid = ClassDB::has_signal(get_class_name(), p_signal); if (signal_is_valid) return false; if (!script.is_null() && Ref<Script>(script)->has_script_signal(p_signal)) return false; ERR_EXPLAIN("Nonexistent signal: " + p_signal); ERR_FAIL_COND_V(!s, false); } Signal::Target target(p_to_object->get_instance_id(), p_to_method); return s->slot_map.has(target); //const Map<Signal::Target,Signal::Slot>::Element *E = s->slot_map.find(target); //return (E!=NULL); }
void CKXDialog::save_position(char *p) { if(p!=0) prefix=p; if(prefix==0) prefix=(char *)get_class_name(); // save previous win coords kSettings cfg; char tmp_str[21]; char tmp_key[21]; kRect r; get_rect_abs(r); sprintf(tmp_str,"%d",r.left); sprintf(tmp_key,"Prev%sX",prefix); cfg.write_abs("Mixer",tmp_key,tmp_str); sprintf(tmp_str,"%d",r.top); sprintf(tmp_key,"Prev%sY",prefix); cfg.write_abs("Mixer",tmp_key,tmp_str); }
static void get(lua_State* L) { lua_pushstring(L, get_class_name(L, LUABIND_TYPEID(T)).c_str()); }
static int mo_testline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct ConfItem *aconf; struct ConfItem *resv_p; struct rb_sockaddr_storage ip; const char *name = NULL; const char *username = NULL; const char *host = NULL; char *mask; char *p; int host_mask; int type; mask = LOCAL_COPY(parv[1]); if(IsChannelName(mask)) { resv_p = hash_find_resv(mask); if(resv_p != NULL) { sendto_one(source_p, form_str(RPL_TESTLINE), me.name, source_p->name, (resv_p->flags & CONF_FLAGS_TEMPORARY) ? 'q' : 'Q', (resv_p->flags & CONF_FLAGS_TEMPORARY) ? (long)((resv_p->hold - rb_current_time ()) / 60) : 0L, resv_p->host, resv_p->passwd); /* this is a false positive, so make sure it isn't counted in stats q * --nenolod */ resv_p->port--; } else sendto_one(source_p, form_str(RPL_NOTESTLINE), me.name, source_p->name, parv[1]); return 0; } if((p = strchr(mask, '!'))) { *p++ = '\0'; name = mask; mask = p; if(EmptyString(mask)) return 0; } if((p = strchr(mask, '@'))) { *p++ = '\0'; username = mask; host = p; if(EmptyString(host)) return 0; } else host = mask; /* parses as an IP, check for a dline */ if((type = parse_netmask(host, (struct sockaddr *)&ip, &host_mask)) != HM_HOST) { aconf = find_dline((struct sockaddr *)&ip); if(aconf && aconf->status & CONF_DLINE) { sendto_one(source_p, form_str(RPL_TESTLINE), me.name, source_p->name, (aconf->flags & CONF_FLAGS_TEMPORARY) ? 'd' : 'D', (aconf->flags & CONF_FLAGS_TEMPORARY) ? (long)((aconf->hold - rb_current_time()) / 60) : 0L, aconf->host, aconf->passwd); return 0; } } /* now look for a matching I/K/G */ if((aconf = find_address_conf(host, NULL, username ? username : "******", (type != HM_HOST) ? (struct sockaddr *)&ip : NULL, (type != HM_HOST) ? ( #ifdef RB_IPV6 (type == HM_IPV6) ? AF_INET6 : #endif AF_INET) : 0))) { static char buf[HOSTLEN + USERLEN + 2]; if(aconf->status & CONF_KILL) { rb_snprintf(buf, sizeof(buf), "%s@%s", aconf->user, aconf->host); sendto_one(source_p, form_str(RPL_TESTLINE), me.name, source_p->name, (aconf->flags & CONF_FLAGS_TEMPORARY) ? 'k' : 'K', (aconf->flags & CONF_FLAGS_TEMPORARY) ? (long)((aconf->hold - rb_current_time()) / 60) : 0L, buf, aconf->passwd); return 0; } else if(aconf->status & CONF_GLINE) { rb_snprintf(buf, sizeof(buf), "%s@%s", aconf->user, aconf->host); sendto_one(source_p, form_str(RPL_TESTLINE), me.name, source_p->name, 'G', (long)((aconf->hold - rb_current_time()) / 60), buf, aconf->passwd); return 0; } } /* they asked us to check a nick, so hunt for resvs.. */ if(name && (resv_p = find_nick_resv(name))) { sendto_one(source_p, form_str(RPL_TESTLINE), me.name, source_p->name, (resv_p->flags & CONF_FLAGS_TEMPORARY) ? 'q' : 'Q', (resv_p->flags & CONF_FLAGS_TEMPORARY) ? (long)((resv_p->hold - rb_current_time()) / 60) : 0L, resv_p->host, resv_p->passwd); /* this is a false positive, so make sure it isn't counted in stats q * --nenolod */ resv_p->port--; return 0; } /* no matching resv, we can print the I: if it exists */ if(aconf && aconf->status & CONF_CLIENT) { sendto_one_numeric(source_p, RPL_STATSILINE, form_str(RPL_STATSILINE), aconf->info.name, show_iline_prefix(source_p, aconf, aconf->user), aconf->host, aconf->port, get_class_name(aconf)); return 0; } /* nothing matches.. */ sendto_one(source_p, form_str(RPL_NOTESTLINE), me.name, source_p->name, parv[1]); return 0; }
//Dump LIR stmts stored in fu->lirList array. void dump_lir2(LIR * lir, DexFile * df, INT pos) { if (g_tfile == NULL || lir == NULL) return; if (pos < 0) { fprintf(g_tfile, "%s", LIR_name(lir)); } else { fprintf(g_tfile, "(%dth)%s", pos, LIR_name(lir)); } switch (LIR_opcode(lir)) { case LOP_NOP: break; case LOP_CONST: switch (LIR_dt(lir)) { case LIR_JDT_unknown: fprintf(g_tfile, ", INT"); if (is_s4(LIR_int_imm(lir)) && LIR_res(lir) < 16) { //AB fprintf(g_tfile, ", v%d <- %d", LIR_res(lir), (INT)LIR_int_imm(lir)); } else if (is_s16(LIR_int_imm(lir))) { //AABBBB fprintf(g_tfile, ", v%d <- %d", LIR_res(lir), (INT)LIR_int_imm(lir)); } else { //AABBBBBBBB fprintf(g_tfile, ", v%d <- %d", LIR_res(lir), (INT)LIR_int_imm(lir)); } break; case LIR_JDT_wide: fprintf(g_tfile, ", %s", get_dt_name(lir)); if (is_swide16(LIR_int_imm(lir))) { //AABBBB fprintf(g_tfile, ", (v%d,v%d) <- %d", LIR_res(lir), LIR_res(lir) + 1, (INT)LIR_int_imm(lir)); } else if (is_swide32(LIR_int_imm(lir))) { //AABBBBBBBB fprintf(g_tfile, ", (v%d,v%d) <- %d", LIR_res(lir), LIR_res(lir) + 1, (INT)LIR_int_imm(lir)); } else { //AABBBBBBBBBBBBBBBB fprintf(g_tfile, ", (v%d,v%d) <- %lld", LIR_res(lir), LIR_res(lir) + 1, LIR_int_imm(lir)); } break; default: /* It seems dex does not distinguish float and integer const. And regard float as 32bit integer, double will be 64bit integer. */ IS_TRUE0(0); } break; case LOP_RETURN: { switch (LIR_dt(lir)) { case LIR_JDT_unknown: //return preg. fprintf(g_tfile, ", INT"); fprintf(g_tfile, ", v%d", LIR_res(lir)); break; case LIR_JDT_void: //No return value. break; case LIR_JDT_object: //return object. fprintf(g_tfile, ", obj_ptr:v%d", LIR_res(lir)); break; case LIR_JDT_wide: fprintf(g_tfile, ", %s", get_dt_name(lir)); fprintf(g_tfile, ", (v%d,v%d)", LIR_res(lir), LIR_res(lir) + 1); break; default: IS_TRUE0(0); } } break; case LOP_THROW: //AA //Throws an exception object. //The reference of the exception object is in vx. fprintf(g_tfile, ", v%d", LIR_res(lir)); break; case LOP_MONITOR_ENTER : fprintf(g_tfile, ", v%d", LIR_res(lir)); break; case LOP_MONITOR_EXIT : break; case LOP_MOVE_RESULT : { //Move function return value to regisiter. //AA LIRAOp * p = (LIRAOp*)lir; switch (LIR_dt(lir)) { case LIR_JDT_unknown: //lexOpcode = lc_mov_result32; break; fprintf(g_tfile, ", INT"); fprintf(g_tfile, ", retval -> v%d", LIR_res(lir)); break; case LIR_JDT_wide: //lexOpcode = lc_mov_result64; break; fprintf(g_tfile, ", %s", get_dt_name(lir)); fprintf(g_tfile, ", retval -> (v%d,v%d)", LIR_res(lir), LIR_res(lir) + 1); break; case LIR_JDT_object: //lexOpcode = lc_mov_result_object; break; fprintf(g_tfile, ", obj-ptr"); fprintf(g_tfile, ", retval -> v%d", LIR_res(lir)); break; } } break; case LOP_MOVE_EXCEPTION : //AA fprintf(g_tfile, ", v%d", LIR_res(lir)); break; case LOP_GOTO : //AABBBBBBBB { LIRGOTOOp * p = (LIRGOTOOp*)lir; fprintf(g_tfile, ", (lirIdx)%dth", p->target); } break; case LOP_MOVE : switch (LIR_dt(lir)) { case LIR_JDT_unknown: fprintf(g_tfile, ", INT"); if ((LIR_op0(lir) | LIR_res(lir)) < 16) { //AB fprintf(g_tfile, ", v%d <- v%d", LIR_res(lir), LIR_op0(lir)); } else if (LIR_res(lir) < 256) { //AABBBB fprintf(g_tfile, ", v%d <- v%d", LIR_res(lir), LIR_op0(lir)); } else { //AAAABBBB fprintf(g_tfile, ", v%d <- v%d", LIR_res(lir), LIR_op0(lir)); } break; case LIR_JDT_wide: fprintf(g_tfile, ", %s", get_dt_name(lir)); if ((LIR_op0(lir) | LIR_res(lir)) < 16) { //AB fprintf(g_tfile, ", (v%d,v%d) <- (v%d,v%d)", LIR_res(lir), LIR_res(lir) + 1, LIR_op0(lir), LIR_op0(lir) + 1); } else if (LIR_res(lir) < 256) { //AABBBB fprintf(g_tfile, ", (v%d,v%d) <- (v%d,v%d)", LIR_res(lir), LIR_res(lir) + 1, LIR_op0(lir), LIR_op0(lir) + 1); } else { //AAAABBBB fprintf(g_tfile, ", (v%d,v%d) <- (v%d,v%d)", LIR_res(lir), LIR_res(lir) + 1, LIR_op0(lir), LIR_op0(lir) + 1); } break; case LIR_JDT_object: fprintf(g_tfile, ", obj-ptr"); if ((LIR_op0(lir) | LIR_res(lir)) < 16) { //AB fprintf(g_tfile, ", v%d <- v%d", LIR_res(lir), LIR_op0(lir)); } else if (LIR_res(lir) < 256) { //AABBBB fprintf(g_tfile, ", v%d <- v%d", LIR_res(lir), LIR_op0(lir)); } else { //AAAABBBB fprintf(g_tfile, ", v%d <- v%d", LIR_res(lir), LIR_op0(lir)); } break; } break; case LOP_NEG : //AB case LOP_NOT : //AB fprintf(g_tfile, ", %s", get_dt_name(lir)); if (is_wide(lir)) { fprintf(g_tfile, ", (v%d,v%d) <- (v%d,v%d)", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), LIR_op0(lir)+1); } else { fprintf(g_tfile, ", v%d <- v%d", LIR_res(lir), LIR_op0(lir)); } break; case LOP_CONVERT : //AB switch (LIR_dt(lir)) { case LIR_convert_i2l: fprintf(g_tfile, ", INT->LONG"); fprintf(g_tfile, ", (v%d,v%d) <- v%d", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir)); break; case LIR_convert_i2f: fprintf(g_tfile, ", INT->FLOAT"); break; case LIR_convert_i2d: fprintf(g_tfile, ", INT->DOUBLE"); fprintf(g_tfile, ", (v%d,v%d) <- v%d", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir)); break; case LIR_convert_l2i: fprintf(g_tfile, ", LONG->INT"); fprintf(g_tfile, ", v%d <- (v%d,v%d)", LIR_res(lir), LIR_op0(lir), LIR_op0(lir)+1); break; case LIR_convert_l2f: fprintf(g_tfile, ", LONG->FLOAT"); fprintf(g_tfile, ", v%d <- (v%d,v%d)", LIR_res(lir), LIR_op0(lir), LIR_op0(lir)+1); break; case LIR_convert_l2d: fprintf(g_tfile, ", LONG->DOUBLE"); fprintf(g_tfile, ", (v%d,v%d) <- (v%d,v%d)", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), LIR_op0(lir)+1); break; case LIR_convert_f2i: fprintf(g_tfile, ", FLOAT->INT"); break; case LIR_convert_f2l: fprintf(g_tfile, ", FLOAT->LONG"); fprintf(g_tfile, ", (v%d,v%d) <- v%d", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir)); break; case LIR_convert_f2d: fprintf(g_tfile, ", FLOAT->DOUBLE"); fprintf(g_tfile, ", (v%d,v%d) <- v%d", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir)); break; case LIR_convert_d2i: fprintf(g_tfile, ", DOUBLE->INT"); fprintf(g_tfile, ", v%d <- (v%d,v%d)", LIR_res(lir), LIR_op0(lir), LIR_op0(lir)+1); break; case LIR_convert_d2l: fprintf(g_tfile, ", DOUBLE->LONG"); fprintf(g_tfile, ", (v%d,v%d) <- (v%d,v%d)", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), LIR_op0(lir)+1); break; case LIR_convert_d2f: fprintf(g_tfile, ", DOUBLE->FLOAT"); fprintf(g_tfile, ", v%d <- (v%d,v%d)", LIR_res(lir), LIR_op0(lir), LIR_op0(lir)+1); break; case LIR_convert_i2b: fprintf(g_tfile, ", INT->BOOL"); fprintf(g_tfile, ", v%d <- v%d", LIR_res(lir), LIR_op0(lir)); break; case LIR_convert_i2c: fprintf(g_tfile, ", INT->CHAR"); fprintf(g_tfile, ", v%d <- v%d", LIR_res(lir), LIR_op0(lir)); break; case LIR_convert_i2s: fprintf(g_tfile, ", INT->SHORT"); fprintf(g_tfile, ", v%d <- v%d", LIR_res(lir), LIR_op0(lir)); break; default: IS_TRUE0(0); } break; case LOP_ADD_ASSIGN : case LOP_SUB_ASSIGN : case LOP_MUL_ASSIGN : case LOP_DIV_ASSIGN : case LOP_REM_ASSIGN : case LOP_AND_ASSIGN : case LOP_OR_ASSIGN : case LOP_XOR_ASSIGN : case LOP_SHL_ASSIGN : case LOP_SHR_ASSIGN : case LOP_USHR_ASSIGN: fprintf(g_tfile, ", %s", get_dt_name(lir)); if (is_wide(lir)) { fprintf(g_tfile, ", (v%d,v%d) <- (v%d,v%d), (v%d,v%d)", LIR_res(lir), LIR_res(lir)+1, LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), LIR_op0(lir)+1); } else { fprintf(g_tfile, ", v%d <- v%d, v%d", LIR_res(lir), LIR_res(lir), LIR_op0(lir)); } break; case LOP_ARRAY_LENGTH: //AABBBB //Calculates the number of elements of the array referenced by vy //and puts the length value into vx. fprintf(g_tfile, ", v%d <- v%d", LIR_res(lir), LIR_op0(lir)); break; case LOP_IFZ : //AABBBB switch (LIR_dt(lir)) { case LIR_cond_EQ: fprintf(g_tfile, ", =="); break; case LIR_cond_NE: fprintf(g_tfile, ", !="); break; case LIR_cond_LT: fprintf(g_tfile, ", <"); break; case LIR_cond_GE: fprintf(g_tfile, ", >="); break; case LIR_cond_GT: fprintf(g_tfile, ", >"); break; case LIR_cond_LE: fprintf(g_tfile, ", <="); break; } if (is_wide(lir)) { fprintf(g_tfile, ", (v%d,v%d), 0, (lirIdx)%dth", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir)); } else { fprintf(g_tfile, ", v%d, 0, (lirIdx)%dth", LIR_res(lir), LIR_op0(lir)); } break; case LOP_NEW_INSTANCE: //AABBBB //LIR_op0(lir) is class-type-id, not class-declaration-id. IS_TRUE0(df); fprintf(g_tfile, ", (obj_ptr)v%d <- (clsname<%d>)%s", LIR_res(lir), LIR_op0(lir), get_class_name(df, LIR_op0(lir))); break; case LOP_CONST_STRING: //AABBBB or AABBBBBBBB IS_TRUE0(df); fprintf(g_tfile, ", v%d <- (strofst<%d>)\"%s\"", LIR_res(lir), LIR_op0(lir), dexStringById(df, LIR_op0(lir))); break; case LOP_CONST_CLASS : //AABBBB //const-class vx,type_id //Moves the class object of a class identified by //type_id (e.g. Object.class) into vx. fprintf(g_tfile, ", v%d <- (clsname<%d>)%s", LIR_res(lir), LIR_op0(lir), dexStringByTypeIdx(df, LIR_op0(lir))); break; case LOP_SGET : //AABBBB fprintf(g_tfile, ", %s", get_dt_name(lir)); IS_TRUE0(df); fprintf(g_tfile, ", v%d <- (ofst<%d>)%s::%s", LIR_res(lir), LIR_op0(lir), get_field_class_name(df, LIR_op0(lir)), get_field_name(df, LIR_op0(lir))); break; case LOP_CHECK_CAST : //AABBBB IS_TRUE0(df); fprintf(g_tfile, ", v%d '%s'", LIR_res(lir), dexStringByTypeIdx(df, LIR_op0(lir))); break; case LOP_SPUT : { //AABBBB LIRABOp * p = (LIRABOp*)lir; fprintf(g_tfile, ", %s", get_dt_name(lir)); IS_TRUE0(df); if (is_wide(lir)) { fprintf(g_tfile, ", (v%d,v%d) -> %s::%s", LIR_res(lir), LIR_res(lir)+1, get_field_class_name(df, LIR_op0(lir)), get_field_name(df, LIR_op0(lir))); } else { fprintf(g_tfile, ", v%d -> %s::%s", LIR_res(lir), get_field_class_name(df, LIR_op0(lir)), get_field_name(df, LIR_op0(lir))); } } break; case LOP_APUT : //AABBCC fprintf(g_tfile, ", %s", get_dt_name(lir)); IS_TRUE0(df); if (is_wide(lir)) { fprintf(g_tfile, ", (v%d,v%d) -> (array_base_ptr)v%d, (array_elem)v%d", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), (UINT)LIR_op1(lir)); } else { fprintf(g_tfile, ", v%d -> (array_base_ptr)v%d, (array_elem)v%d", LIR_res(lir), LIR_op0(lir), (UINT)LIR_op1(lir)); } break; case LOP_AGET : //AABBCC fprintf(g_tfile, ", %s", get_dt_name(lir)); IS_TRUE0(df); if (is_wide(lir)) { fprintf(g_tfile, ", (v%d,v%d) <- (array_base_ptr)v%d, (array_elem)v%d", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), (UINT)LIR_op1(lir)); } else { fprintf(g_tfile, ", v%d <- (array_base_ptr)v%d, (array_elem)v%d", LIR_res(lir), LIR_op0(lir), (UINT)LIR_op1(lir)); } break; case LOP_CMPL : case LOP_CMP_LONG : //AABBCC IS_TRUE0(df); switch (LIR_dt(lir)) { case LIR_CMP_float: fprintf(g_tfile, ", FLOAT"); fprintf(g_tfile, ", v%d, v%d, %d", LIR_res(lir), LIR_op0(lir), (UINT)LIR_op1(lir)); break; case LIR_CMP_double: fprintf(g_tfile, ", DOUBLE"); fprintf(g_tfile, ", (v%d,v%d), (v%d,v%d), %d", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), LIR_op0(lir)+1, (UINT)LIR_op1(lir)); break; default: IS_TRUE0(0); } break; case LOP_ADD : case LOP_SUB : case LOP_MUL : case LOP_DIV : case LOP_REM : case LOP_AND : case LOP_OR : case LOP_XOR : case LOP_SHL : case LOP_SHR : case LOP_USHR : { fprintf(g_tfile, ", %s", get_dt_name(lir)); LIRABCOp * p = (LIRABCOp*)lir; if (is_wide(lir)) { fprintf(g_tfile, ", (v%d,v%d) <- (v%d,v%d), (v%d,v%d)", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), LIR_op0(lir)+1, (UINT)LIR_op1(lir), (UINT)LIR_op1(lir)+1); } else { fprintf(g_tfile, ", v%d <- v%d, v%d", LIR_res(lir), LIR_op0(lir), (UINT)LIR_op1(lir)); } } break; case LOP_IF : //ABCCCC switch (LIR_dt(lir)) { case LIR_cond_EQ: fprintf(g_tfile, ", =="); break; case LIR_cond_NE: fprintf(g_tfile, ", !="); break; case LIR_cond_LT: fprintf(g_tfile, ", <"); break; case LIR_cond_GE: fprintf(g_tfile, ", >="); break; case LIR_cond_GT: fprintf(g_tfile, ", >"); break; case LIR_cond_LE: fprintf(g_tfile, ", <="); break; } fprintf(g_tfile, ", v%d, v%d, (lirIdx)%dth", LIR_res(lir), LIR_op0(lir), (UINT)LIR_op1(lir)); break; case LOP_ADD_LIT : //AABBCC, AABBCCCC case LOP_SUB_LIT : //AABBCC, AABBCCCC case LOP_MUL_LIT : //AABBCC, AABBCCCC case LOP_DIV_LIT : //AABBCC, AABBCCCC case LOP_REM_LIT : //AABBCC, AABBCCCC case LOP_AND_LIT : //AABBCC, AABBCCCC case LOP_OR_LIT : //AABBCC, AABBCCCC case LOP_XOR_LIT : //AABBCC, AABBCCCC case LOP_SHL_LIT : //AABBCC case LOP_SHR_LIT : //AABBCC case LOP_USHR_LIT : //AABBCC { fprintf(g_tfile, ", %s", get_dt_name(lir)); LIRABCOp * p = (LIRABCOp*)lir; if (is_wide(lir)) { fprintf(g_tfile, ", (v%d,v%d) <- (v%d,v%d),", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), LIR_op0(lir)+1); } else { fprintf(g_tfile, ", v%d <- v%d,", LIR_res(lir), LIR_op0(lir)); } if (is_s8((INT)LIR_op1(lir))) { //8bit imm fprintf(g_tfile, "(lit8)%d", (INT)LIR_op1(lir)); } else if (is_s16((INT)LIR_op1(lir))) { //16bit imm fprintf(g_tfile, "(lit16)%d", (INT)LIR_op1(lir)); } else { IS_TRUE0(0); } } break; case LOP_IPUT : fprintf(g_tfile, ", %s", get_dt_name(lir)); //ABCCCC IS_TRUE0(df); if (is_wide(lir)) { fprintf(g_tfile, ", (v%d,v%d) -> (obj_ptr)v%d, (ofst<%d>)%s::%s", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), (UINT)LIR_op1(lir), get_field_class_name(df, (UINT)LIR_op1(lir)), get_field_name(df, (UINT)LIR_op1(lir))); } else { fprintf(g_tfile, ", v%d -> (obj_ptr)v%d, (ofst<%d>)%s::%s", LIR_res(lir), LIR_op0(lir), (UINT)LIR_op1(lir), get_field_class_name(df, (UINT)LIR_op1(lir)), get_field_name(df, (UINT)LIR_op1(lir))); } break; case LOP_IGET : fprintf(g_tfile, ", %s", get_dt_name(lir)); //ABCCCC IS_TRUE0(df); if (is_wide(lir)) { fprintf(g_tfile, ", (v%d,v%d) <- (obj_ptr)v%d, (ofst<%d>)%s::%s", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), (UINT)LIR_op1(lir), get_field_class_name(df, (UINT)LIR_op1(lir)), get_field_name(df, (UINT)LIR_op1(lir))); } else { fprintf(g_tfile, ", v%d <- (obj_ptr)v%d, (ofst<%d>)%s::%s", LIR_res(lir), LIR_op0(lir), (UINT)LIR_op1(lir), get_field_class_name(df, (UINT)LIR_op1(lir)), get_field_name(df, (UINT)LIR_op1(lir))); } break; case LOP_INSTANCE_OF: fprintf(g_tfile, ", (pred)v%d <- v%d, (clsname<%d>)'%s'", LIR_res(lir), LIR_op0(lir), (UINT)LIR_op1(lir), dexStringByTypeIdx(df, (UINT)LIR_op1(lir))); break; case LOP_NEW_ARRAY : //ABCCCC //new-array v%d(res) <- v%d(op0), LCAnimal(op1) fprintf(g_tfile, ", %s", get_dt_name(lir)); //ABCCCC IS_TRUE0(df); fprintf(g_tfile, ", v%d <- (num_of_elem)v%d, (elem_type<%d>)'%s'", LIR_res(lir), LIR_op0(lir), (UINT)LIR_op1(lir), dexStringByTypeIdx(df, (UINT)LIR_op1(lir))); break; case LOP_TABLE_SWITCH: { LIRSwitchOp * p = (LIRSwitchOp*)lir; IS_TRUE0(LIR_dt(p) == 0x1); fprintf(g_tfile, ", v%d", p->value); USHORT * pdata = p->data; //data[0]: flag to indicate switch-table type: // 0x1 TABLE_SWITCH, 0x2 LOOKUP_SWITCH USHORT f = pdata[0]; IS_TRUE0(f == 0x100); //data[1]: the number of CASE entry. USHORT num_of_case = pdata[1]; //data[2..3]: the base value of case-table UINT base_val = *((UINT*)(&pdata[2])); fprintf(g_tfile, ", basev:%d", base_val); //((BYTE*)data)[4..num_of_case*4]: // the position of the index table is at current instruction. if (num_of_case > 0) { UINT * pcase_entry = (UINT*)&pdata[4]; fprintf(g_tfile, " tgtidx:"); for (USHORT i = 0; i < num_of_case; i++) { UINT idx_of_insn = pcase_entry[i]; fprintf(g_tfile, "%d", idx_of_insn); if (i != num_of_case - 1) { fprintf(g_tfile, ","); } } } } break; case LOP_LOOKUP_SWITCH: { LIRSwitchOp * p = (LIRSwitchOp*)lir; IS_TRUE0(LIR_dt(p) == 0x2); fprintf(g_tfile, ", v%d", p->value); USHORT * pdata = p->data; //pdata[0]: flag to indicate switch-table type: // 0x1 TABLE_SWITCH, 0x2 LOOKUP_SWITCH UINT f = pdata[0]; IS_TRUE0(f == 0x200); //pdata[1]: the number of CASE entry. UINT num_of_case = pdata[1]; if (num_of_case > 0) { BYTE * tp = (BYTE*)pdata; //((BYTE*)pdata)[4..4+num_of_case*4-1]: the case-value buffer. UINT * pcase_value = (UINT*)&tp[4]; //((BYTE*)pdata)[4+num_of_case*4, 4+num_of_case*8-1]: // the position of the index table is at current instruction. UINT * pcase_entry = (UINT*)&tp[4 + num_of_case * 4]; fprintf(g_tfile, " val2idx("); for (UINT i = 0; i < num_of_case; i++) { UINT idx_of_insn = pcase_entry[i]; fprintf(g_tfile, "%d:%d", pcase_value[i], idx_of_insn); if (i != num_of_case - 1) { fprintf(g_tfile, ","); } } fprintf(g_tfile, ")"); } } break; case LOP_FILL_ARRAY_DATA: { fprintf(g_tfile, ", %s", get_dt_name(lir)); //AABBBBBBBB //pdata[0]: the magic number of code //0x100 PACKED_SWITCH, 0x200 SPARSE_SWITCH, 0x300 FILL_ARRAY_DATA LIRSwitchOp * r = (LIRSwitchOp*)lir; UInt16 const* pdata = (UInt16 const*)r->data; IS_TRUE0(pdata[0] == 0x300); //pdata[1]: size of each element. //pdata[2]: the number of element. UINT size_of_elem = pdata[1]; UINT num_of_elem = pdata[2]; UINT data_size = num_of_elem * size_of_elem; //fprintf(g_tfile, ", (elem_sz<%d>), (elem_num<%d>), (data_ptr)0x%x", fprintf(g_tfile, ", (elem_sz<%d>), (elem_num<%d>)", size_of_elem, num_of_elem); } break; case LOP_INVOKE: { /* ABCCCCDDDD the layout clarifies: A(p4), B(argc), CCCC(method_id), DDDD(p0, p1, p2, p3) where p0,p1,p2,p3,p4 are five parameters. AABBBBCCCC the layout clarifies: AA(argc), BBBB(method_id), CCCC(p0,p1,...p(argc-1)) */ LIRInvokeOp * r = (LIRInvokeOp*)lir; UINT flags = LIR_dt(lir); UINT flag1 = flags & 0x0F; UINT flag2 = flags & 0xF0; IS_TRUE(flag1 != 0, ("means LIR is LOP_FILLED_NEW_ARRAY")); DexMethodId const* method_id = dexGetMethodId(df, r->ref); IS_TRUE0(method_id); CHAR const* method_name = dexStringById(df, method_id->nameIdx); CHAR const* class_name = dexStringByTypeIdx(df, method_id->classIdx); IS_TRUE0(method_name); DexProtoId const* proto_id = dexGetProtoId(df, method_id->protoIdx); CHAR const* shorty_name = dexStringById(df, proto_id->shortyIdx); fprintf(g_tfile, ", %s::%s", class_name, method_name); UINT k = LIR_dt(lir); bool is_range = HAVE_FLAG((k & 0xf0), LIR_Range); if (is_range) { switch (k & 0x0f) { case LIR_invoke_unknown: IS_TRUE0(0); break; case LIR_invoke_virtual: fprintf(g_tfile, ", virtual-range"); break; case LIR_invoke_direct: fprintf(g_tfile, ", direct-range"); break; case LIR_invoke_super: fprintf(g_tfile, ", super-range"); break; case LIR_invoke_interface: fprintf(g_tfile, ", interface-range"); break; case LIR_invoke_static: fprintf(g_tfile, ", static-range"); break; default: IS_TRUE0(0); } } else { switch (k & 0x0f) { case LIR_invoke_unknown: IS_TRUE0(0); break; case LIR_invoke_virtual: fprintf(g_tfile, ", virtual"); break; case LIR_invoke_direct: fprintf(g_tfile, ", direct"); break; case LIR_invoke_super: fprintf(g_tfile, ", super"); break; case LIR_invoke_interface: fprintf(g_tfile, ", interface"); break; case LIR_invoke_static: fprintf(g_tfile, ", static"); break; default: IS_TRUE0(0); } } if (r->argc != 0) { fprintf(g_tfile, ", arg("); for (USHORT i = 0; i < r->argc; i++) { fprintf(g_tfile, "v%d", r->args[i]); if (i != r->argc-1) { fprintf(g_tfile, ","); } } fprintf(g_tfile, ")"); } } break; case LOP_FILLED_NEW_ARRAY: { /* AABBBBCCCC or ABCCCCDEFG e.g: A(argc), B,D,E,F,G(parampters), CCCC(class_tyid) */ LIRInvokeOp * r = (LIRInvokeOp*)lir; UINT flags = LIR_dt(lir); CHAR const* class_name = dexStringByTypeIdx(df, r->ref); IS_TRUE0(class_name); fprintf(g_tfile, ", %s", class_name); if (r->argc != 0) { fprintf(g_tfile, ", arg("); for (USHORT i = 0; i < r->argc; i++) { fprintf(g_tfile, "v%d", r->args[i]); if (i != r->argc-1) { fprintf(g_tfile, ","); } } fprintf(g_tfile, ")"); } } break; case LOP_CMPG: //AABBCC IS_TRUE0(df); switch (LIR_dt(lir)) { case LIR_CMP_float: fprintf(g_tfile, ", FLOAT"); fprintf(g_tfile, ", v%d, v%d, %d", LIR_res(lir), LIR_op0(lir), (INT)LIR_op1(lir)); break; case LIR_CMP_double: fprintf(g_tfile, ", DOUBLE"); fprintf(g_tfile, ", (v%d,v%d), v%d, %d", LIR_res(lir), LIR_res(lir)+1, LIR_op0(lir), (INT)LIR_op1(lir)); break; default: IS_TRUE0(0); } break; case LOP_PHI: IS_TRUE0(0); break; default: IS_TRUE0(0); } //end switch fflush(g_tfile); }
void JNICALL vmInit(jvmtiEnv * jvmti_env, JNIEnv * jni_env, jthread thread) { printf("C:\tVMInit, preparing to callback Java method\n"); char *className = "ek/JVMTICallback"; char *methodName = "VMInit"; char *descriptor = "()V"; callbackClass = (*jni_env)->FindClass(jni_env, className); callbackClass = (jclass)(*jni_env)->NewGlobalRef(jni_env, callbackClass); if (!callbackClass) { fprintf(stderr,"C:\tUnable to locate callback class.\n"); return; } printf("C:\tClass found\n"); jmethodID callbackMethodID = (*jni_env)->GetStaticMethodID(jni_env, callbackClass, methodName, descriptor); if (!callbackMethodID) { fprintf(stderr, "C:\tUnable to locate callback VMInit method\n"); return; } printf("C:\tMethod found1\n"); methodName = "FieldModify"; descriptor = "(Ljava/lang/String;)V"; callbackFieldModifyMethodID = (*jni_env)->GetStaticMethodID(jni_env, callbackClass, methodName, descriptor); callbackFieldModifyMethodID = (jmethodID)(*jni_env)->NewGlobalRef(jni_env, callbackFieldModifyMethodID); if (!callbackFieldModifyMethodID) { fprintf(stderr, "C:\tUnable to locate callback field modify method\n"); return; } printf("C:\tMethod found2\n"); va_list empty_va_list; (*jni_env)->CallStaticVoidMethod(jni_env, callbackClass, callbackMethodID); printf("C:\tVMInit, callback Java method returned successfully\n"); jmethodID ctorMethod = (*jni_env)->GetMethodID(jni_env, callbackClass, "<init>", "()V"); if (!ctorMethod) { fprintf(stderr, "C:\tUnable to locate constructor\n"); return; } printf("C:\t Got ctor\n"); jobject jObj = (*jni_env)->NewObject(jni_env, callbackClass, ctorMethod); if (!jObj) { fprintf(stderr, "C:\tUnable to create JVMTICallback\n"); return; } printf("C:\t Got obj\n"); jclass clsObj = (*jni_env)->GetObjectClass(jni_env, jObj); if (!clsObj) { fprintf(stderr, "C:\tUnable to get cls\n"); return; } printf("C:\t Got class obj\n"); char *cls_name=NULL; get_class_name(jvmti_env, clsObj, cls_name, 50); printf("C:\t Cls Name: %s\n", cls_name); inited = true; }
PersistableObjectForTest(int some_value = 0): PersistableObject(), m_some_value(some_value) { m_STI_type = get_class_name(); }
static void get(lua_State* L) { lua_pushstring(L, get_class_name(L, typeid(T)).c_str()); }
void MuStream::inspect_aux(int level, std::stringstream *ss) { inspect_indent(level, ss); *ss << "#<" << get_class_name() << " " << this << ">" << std::endl; }
std::string name_of_type(by_value<T>, lua_State* L) { return get_class_name(L, LUABIND_TYPEID(T)); };