添加look命令,用来观测方法内的本地变量表,可以通过行号或者特殊Code(jad -L 来输出)来指定位置#2435
Closed
isadliliying wants to merge 4 commits intoalibaba:masterfrom
Closed
添加look命令,用来观测方法内的本地变量表,可以通过行号或者特殊Code(jad -L 来输出)来指定位置#2435isadliliying wants to merge 4 commits intoalibaba:masterfrom
isadliliying wants to merge 4 commits intoalibaba:masterfrom
Conversation
…i-look-command � Conflicts: � core/src/main/java/com/taobao/arthas/core/advisor/Enhancer.java
Author
|
特殊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();
}问题: 另外的想法: |
Contributor
|
已自行打包后吃到红利,过来还愿 |
|
Is there a plan to merge this feature? |
Author
|
变更了实现方式: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
为什么要做这个呢?
为什么要定义新的命令?
watch,但是watch的对象是method,而我们观测local variables的时候,用行来作为定位点是比较合适的(因为同一个变量会被多次重复赋值),这样会导致watch的listener的key跟根据参数而有所差异,在处理注册监听时会比较麻烦实现思路:
Advice变量varMap,类型是HashMap,key是变量名,value是变量值已经做的基本测试:
local variables,并能在condition-express中使用LocationFilter,避免重复插桩trace及watch命令的同时使用的兼容处理其它: