-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
添加look命令,用来观测方法内的本地变量表,可以通过行号或者特殊Code(jad -L 来输出)来指定位置 #2435
Conversation
…i-look-command � Conflicts: � core/src/main/java/com/taobao/arthas/core/advisor/Enhancer.java
特殊Code的解释如下: kotlin源码: /*56*/ fun index(): JSONObject {
/*57*/ listOf(1,2,3,4,5,6).map {
/*58*/ listOf("a","b","c","d","e","f").map {
/*59*/ listOf(true,false,true,false,false).map {
/*60*/ println(it)
/*61*/ if (true) return JSONObject()
/*62*/ }
/*63*/ }
/*64*/ }
/*65*/ return ResponseBuilder().ok().data("Hello World!").build()
/*66*/ } jad出来的样子: public final JSONObject index() {
void var3_3;
void $receiver$iv$iv;
Iterable $receiver$iv;
/*57*/ Iterable iterable = $receiver$iv = (Iterable)CollectionsKt.listOf(1, 2, 3, 4, 5, 6);
Collection destination$iv$iv = new ArrayList(CollectionsKt.collectionSizeOrDefault($receiver$iv, 10));
/*83*/ for (Object item$iv$iv : $receiver$iv$iv) {
void $receiver$iv$iv2;
Iterable $receiver$iv2;
int n = ((Number)item$iv$iv).intValue();
Collection collection = destination$iv$iv;
boolean bl = false;
/*58*/ Iterable iterable2 = $receiver$iv2 = (Iterable)CollectionsKt.listOf("a", "b", "c", "d", "e", "f");
Collection destination$iv$iv2 = new ArrayList(CollectionsKt.collectionSizeOrDefault($receiver$iv2, 10));
/*86*/ for (Object item$iv$iv2 : $receiver$iv$iv2) {
void $receiver$iv$iv3;
Iterable $receiver$iv3;
String string = (String)item$iv$iv2;
Collection collection2 = destination$iv$iv2;
boolean bl2 = false;
/*59*/ Iterable iterable3 = $receiver$iv3 = (Iterable)CollectionsKt.listOf(true, false, true, false, false);
Collection destination$iv$iv3 = new ArrayList(CollectionsKt.collectionSizeOrDefault($receiver$iv3, 10));
Iterator iterator2 = $receiver$iv$iv3.iterator();
if (iterator2.hasNext()) {
void it;
void it2;
void it3;
Object item$iv$iv3 = iterator2.next();
boolean bl3 = (Boolean)item$iv$iv3;
Collection collection3 = destination$iv$iv3;
boolean bl4 = false;
/*60*/ System.out.println((boolean)it3);
JSONObject jSONObject = new JSONObject();
return jSONObject;
}
/*91*/ List list = (List)destination$iv$iv3;
collection2.add(list);
}
/*92*/ List list = (List)destination$iv$iv2;
collection.add(list);
}
/*93*/ List cfr_ignored_0 = (List)var3_3;
return new ResponseBuilder().ok().data((Object)"Hello World!").build();
} 问题: 另外的想法:
|
已自行打包后吃到红利,过来还愿 |
Is there a plan to merge this feature? |
变更了实现方式: |
为什么要做这个呢?
为什么要定义新的命令?
watch
,但是watch的对象是method
,而我们观测local variables
的时候,用行
来作为定位点是比较合适的(因为同一个变量会被多次重复赋值),这样会导致watch
的listener
的key
跟根据参数而有所差异,在处理注册监听时会比较麻烦实现思路:
Advice
变量varMap
,类型是HashMap
,key是变量名,value是变量值已经做的基本测试:
local variables
,并能在condition-express
中使用LocationFilter
,避免重复插桩trace
及watch
命令的同时使用的兼容处理其它: