I did override “get_loaded-images” but the reason it did not work is because get_loaded_images in scriptedprocess.cpp expects all modules to be loaded. Even if one module is not found by target.getorcreatemodule, it loads no module. I have changed the logic locally to bypass that and it loads fine now.
Coming back to my original problem, loading the elf-core modules and adding new modules from tombstones, loads the elf-core modules and unwinds stack correctly for elf-core
module but lldb does not load the newly added module. It is possible that the load address is not correct(PT_LOAD - offset from NT_FILE entry), or dynamic loader does not know how to read the .so file within apk . Alternatively, I did a hack to update the nt file entry in elf-core plugin locally to update the build-id, and lldb still does not load the module correctly. Does elf-core not load shared libraries with .apk correctly based on PT_LOAD entries in NT_FILE ? Do we need to add android specific logic similar to mini dump for dynamic loader to read modules within .apk ?