| Issue |
76332
|
| Summary |
LLDB ignores breakpoints set in lib loaded using dlopen
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
mehlian
|
Hello, I have difficulty setting the lldb debugger correctly to be able to set breakpoints and stopping the program in a library loaded dynamically from the code using the dlopen function.
Here is my setup:
- in Windows 10 I compile the code into two libraries: libmain.so and libsup.so
- in both cases the code is compiled as follows:
> clang++ [sourceCodePath] --target=aarch64-linux-androideabi26 -shared -v -g -fPIC -fstack-protector-strong -Werror -Wl,--no-undefined-version -Wl,-undefined,error -Wl,--error-unresolved-symbols -Wl,--no-undefined -Wl,-error-limit=0 -mno-relax -static-libstdc++ -landroid -llog -lEGL -lGLESv3 -lm -o [outputDirPath]/lib[libname].so
- next, an APK package for Android is created and the libmain.so library is added to it
- APK is installed on Android 10 device using ADB
- the Android application installs and runs correctly
- debugging this application using lldb also works correctly (you can set breakpoints and the source code is displayed when the program stops at this breakpoint)
- then second compiled library libsup.so is sent to the device via ADB to the directory created after installing application (/data/data/com.company.testapp/)
- in the libmain.so library there is a piece of code that dynamically loads the libsup.so library
```
auto supModule = dlopen("/data/data/com.company.testapp/libsup.so", RTLD_NOW);
if(supModule)
{
LOGV("Module found");
auto supFunc = (void (*)())dlsym(supModule, "supModuleFunction");
if(supFunc)
{
LOGV("Sup function found");
supFunc();
}
}
```
- the "supModuleFunction" function in libsup.so is a regular function that logs a string to the console.
This setup works - the "supModuleFunction" function is found and called correctly. The problem is that I cannot set a breakpoint inside the "supModuleFunction" function, and when I try to enter this function using the "step-into" command, the debbuger behaves as if I had entered the "continue" command, ignoring the contents of the libsup.so library.
Using 'image list' command doesn't help - there is no 'libsup.so' on the list but 'libmain.so' was found.
Any advice?
Systems and tools:
Windows 10
Android 10
clang++ 14.0.6
lldb 17.0.0-custom rust-enabled
lldb-server 14.0.6git (revision 4c603efb0cca074e9238af8b4106c30add4418f6)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs