8000 Inject方法可以用在自己写的方法中么 · Issue #44 · XianyuTech/aspectd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Inject方法可以用在自己写的方法中么 #44

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

Closed
8000
kelciej opened this issue May 21, 2020 · 4 comments
Closed

Inject方法可以用在自己写的方法中么 #44

kelciej opened this issue May 21, 2020 · 4 comments

Comments

@kelciej
Copy link
kelciej commented May 21, 2020

您好,
请问一下@Inject可以注入到自己写的方法中么?
比方说 注入到 官方 example 的_incrementCounter 中,
image
比方说想在【91】行写入一个输出

` @Inject("package:example/lib/main.dart","_MyHomePageState","-_incrementCounter",lineNum:91)

@pragma("vm:entry-point")

static void counterHook() {

int count;//Aspectd Ignore

int _counter;//Aspectd Ignore

print("[KWLM12]:count:$count,counter:$_counter");

//【91】行 }`

但是无法注入
生成文件app.aspectd.dill.txt显示 如下图,
image

@kelciej kelciej changed the title 如何检查kernel_blob.bin的内容 Inject方法可以用在自己写的方法中么 May 21, 2020
@kelciej
Copy link
Author
kelciej commented May 26, 2020

自己尝试写了一些inject,但是出现了有的时候能够 inject成功,有的时候 inject不成功的情况。
请教一下,inject的位置(行数)有什么主要注意的地方么?,比方说不能inject在空行中

@kangwang1988
Copy link
Contributor

Inject is a sophisticated thing and I don't think it's robust enough to use.
You can try it under aspectd 1.0.0 for flutter v1.22.1 and i may have a look at it given a reproducible mvp.

@dudumuta
Copy link

自己尝试写了一些inject,但是出现了有的时候能够 inject成功,有的时候 inject不成功的情况。
请教一下,inject的位置(行数)有什么主要注意的地方么?,比方说不能inject在空行中

我想咨询下大佬,我自己写了个方法,然后按照文档增加了注解,如何使之生效呢?怎么触发dill的生成?

@FloydP
Copy link
FloydP commented Apr 19, 2021

@kelciej Hi,我也在官方example 尝试了Inject , 在我的例子里变量并不会 因为//Aspectd Ignore 在hook时被忽略,你是如何成功使用的,能否告诉我一下?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0