简体   繁体   中英

How to execute a function (identified by pointer) from lldb

How can i call a regular function (not a block) in LLDB?

I have tried using:

expr int $addr = 0x51bb45
expr (void (^)(void))$addr
expr $0()

but i get an error 'Didn't get running event after intiial resume, got stopped instead. Couldn't execute function; result was eExecutionSetupError'

this is how the function is declared but i don't have the symbols... extern "C" void do_something(void)

edit:

the solution is to use:

(void (*)(void))$addr

If that is how the function is declared, then it is a block pointer not a regular function. As nos said, it would have a * in the declaration if it was a function pointer. lldb doesn't currently know how to call block pointers: like C++ & ObjC methods they need a correctly cons'ed up artificial first argument and lldb doesn't know how to do that for blocks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM