其他分享
首页 > 其他分享> > android-“ smali”语法规范| smali原木注射

android-“ smali”语法规范| smali原木注射

作者:互联网

是否有适用于smali代码的语法规范?我正在尝试使用smali代码,而我想念的一件事是,smali中的某些方法具有.prologue部分,而有些则没有.不幸的是wiki似乎没有关于smali语法的信息.以前有没有人发现自己处于这种情况?任何建议/解决方案将不胜感激.

EDIT1:我的目标是将日志消息添加到应用程序所有活动的onResume方法的开头.

EDIT2:我正在使用ANTLRv4.1解析器来解析我的smali文件,并且从smaliLexer获得了CommonTree(解析树)和TokenStream.现在是为log指令创建Token并更改分析树,然后生成正确的方法吗?到目前为止,我还没有找到更改TokenStream的方法,并且我无法从更改后的ParseTree生成dex文件.

解决方法:

smali语言中的几乎所有内容都直接以dalvik字节码/ dex格式进行模拟.在这种情况下,.prologue指令对应于作为debug_info_item一部分的DBG_SET_PROLOGUE_END调试操作码.

http://s.android.com/tech/dalvik/dex-format.html开始:

sets the prologue_end state machine register, indicating that the next
position entry that is added should be considered the end of a method
prologue (an appropriate place for a method breakpoint). The
prologue_end register is cleared by any special (>= 0x0a) opcode.

标签:grammar,smali,android,antlr4
来源: https://codeday.me/bug/20191030/1969017.html