观察者模式
2017-03-27 19:30:49 0 举报
观察者模式是一种行为设计模式,它定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象。这个主题对象在状态发生变化时,会通知所有观察者对象,使它们能够自动更新自己。 观察者模式的核心是抽象出一个主题对象,它可以注册、删除和通知观察者对象。观察者对象则负责监听主题对象的状态变化,并在状态发生变化时执行相应的操作。 这种模式适用于当一个对象的改变需要同时改变其他几个对象,而且它不知道具体有多少对象有待改变时。通过使用观察者模式,可以将这一过程解耦,使得对象之间的依赖关系更加清晰和灵活。
作者其他创作
大纲/内容
1
SEG1
4. printf
.text
grow
View
.got
IApplicationThread
+ schedulePauseActivity : void+ scheduleLaunchActivity : void+ scheduleDestroyActivity : void+ scheduleCreateService : void+ scheduleBindService : void+ scheduleUnbindService : void+ bindApplication : void+ scheduleCrash : void+ scheduleRegisteredReceiver
2
.bss
jump/push/jump
printf
Observable
BaseImpl
Observer
...
Observers
3
EBP
moduleID
push/jump
IInterface
+ asBinder : IBinder
5
VMA0
ApplicationThreadProxy
+ attribute1:type = defaultValue+ attribute2:type- attribute3:type
+ operation1(params):returnType- operation2(params)- operation3()
libGLES_android.so
2. resolve
ApplicationThread
main
Local Variables
Virtual Memory
print
.plt
load_bias
EGLImpl
SO 函数调用过程
4
libc.so
libdl.so
VMA1
Saved Registers
startAddr
ApplicationThreadNative
EglApi
Decorator1
Parameters
libclient.so
SEG0
.data
high address
Old EBP
Model
1. 读取 .got.plt 表 printf 项的值2. 如果第一次调用,则跳转到当前的下一条指令,压 printf 符号ID,跳转 PLT0 项3. 读 .got.plt moduleID 和 resolve 值4. 压入 moduleID ,跳转到动态链接器完成符号重定位5. 根据 EIP 重新执行到 .plt 表6. 跳转到已经解析完的 printf 地址处执行
File
endAddr
RecyclerView中的观察者模式
.rel.plt
EglProxy
.dynamic
Presenter
Java Level
Client
PC
Data
p_vaddr
IBinder
+ FLAG_ONEWAY : int+ MAX_IPC_SIZE : int
+ getInterfaceDescriptor : String+ pingBinder : boolean+ isBinderAlive : boolean+ queryLocalInterface : IInterface+ transact : boolean+ linkToDeath : void+ unlinkToDeath : boolean
.got.plt
libegl.so
Stack Frame#N
Implement Level
EGL14
ESP
Stack Frame#N+1
JNI Level
Proxy Level
libGLES_xx.so
Interface Level
DecoratorN
Binder
resolve
low address
0 条评论
下一页