How to find function memory address with lldb?

In GDB, I can use "info line func_name" to get the memory address of func_name, and then use "set $ PC = memory_address" to start debugging this function. How do i do the same in lldb? Thanks in advance!

+5
source share
1 answer

The command in lldb is "view image". I think the example "info func" ↔ "image lookup" was recently added to the lldb / gdb command line page - http://lldb.llvm.org/lldb-gdb.html

eg.

(lldb) im loo -n puts
1 match found in /usr/lib/system/libsystem_c.dylib:
        Address: libsystem_c.dylib[0x0000000000011d9a] (libsystem_c.dylib.__TEXT.__text + 69850)
        Summary: libsystem_c.dylib`puts
(lldb) 

libsystem_c.dylib (0x11d9a) - , "-v" , , . lldb,

(lldb) reg read pc
     rip = 0x0000000100000f2b  a.out`main + 11 at a.c:3
(lldb) reg write pc `(void(*)())puts`
(lldb) reg read pc
     rip = 0x00007fff99ce1d9a  libsystem_c.dylib`puts

OK puts(), lldb - , , :

(lldb) reg write pc `main`
(lldb) reg read pc
     rip = 0x0000000100000f20  a.out`main at a.c:2
+13

All Articles