Lldb: how to call a function from a specific library / structure

Problem. In the project, we have localization functions that are specific to the framework / dynamic library. That is, they have the same name, but they extract resources from different packages / folders.

I would like to call a function from a specific library, something similar to:

lldb> p my_audio_engine.framework::GetL10nString( stringId );
lldb> expr --shlib my_audio_engine.framework -- GetL10nString();
lldb> p my_audio_engine`L10N_Utils::GetString(40000)

but all of these options do not work.

Adding gdb to tags, hoping the same if semantics exist, will also work on lldb.

+4
source share
1 answer
In parser lldb expressions

lldb is currently not the equivalent of gdb foo.c :: function meta-symbol to encode a function from a specific source file.

, , bugreporter.apple.com. , , - , , , , ...

nonce . printf, , , libsystem_c.dylib OS X. , :

(lldb) image lookup -vn printf libsystem_c.dylib
1 match found in /usr/lib/system/libsystem_c.dylib:
        Address: libsystem_c.dylib[0x0000000000042948] (libsystem_c.dylib.__TEXT.__text + 266856)
        Summary: libsystem_c.dylib`printf
         Module: file = "/usr/lib/system/libsystem_c.dylib", arch = "x86_64"
         Symbol: id = {0x00000653}, range = [0x00007fff91307948-0x00007fff91307a2c), name="printf"

( ) - dylib, , . . , , , , , - , . 0x00007fff91307948 - , .

. , , :

(lldb) expr typedef int (*$printf_type)(const char *, ...)
(lldb) expr $printf_type $printf_function = ($printf_type) 0x00007fff91307948

, :

(lldb) expr $printf_function("Hello world %d times.\n", 400)
Hello world 400 times.
(int) $2 = 23

, Python, , . API Python (lldb-talk ), , ..

+12

All Articles