lldb cannot lookup symbol in imported dylib

Multi tool use


lldb cannot lookup symbol in imported dylib
I am debugging a C program on arm64 with lldb and in order to implement my own debugging function I wrote a standalone debug helper program, compiled it as a dylib and imported it into lldb by using:
(lldb) target modules add debugHelper.dylib
(lldb) target modules add debugHelper.dylib
However when I call the function declared in the dylib, lldb errors:
(lldb) expression debugPrint()
error: Couldn't lookup symbols:
_debugPrint
If I type in a random function name (e.g. foo):
(lldb) expression foo()
error: use of undeclared identifier 'foo'
, which makes me believe importing the dylib is indeed successful, since debugPrint
is not an undeclared identifier
.
debugPrint
undeclared identifier
// debugHelper.c
#include <stdio.h>
int debugPrint() {
printf("%sn", "Debug info printed! n");
return 0;
}
debugHelper.dylib is compiled with:
$ xcrun --sdk iphoneos cc debugHelper.c -o debugHelper.dylib -dynamiclib -arch arm64 -g
I also verified with nm
that debugHelper.dylib does have the _debugPrint
symbol:
nm
_debugPrint
$ nm debugHelper.dylib
0000000000007f2c T _debugPrint
U _printf
U dyld_stub_binder
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.