Reputation: 355
image add
will add a new module to the current target list, but how can I remove a module afterwards?
Upvotes: 0
Views: 26
Reputation: 27110
You can't remove particular modules, they might be in use by one or another Target in the current lldb session and if they are, lldb isn't able to remove them. You also don't need to do this for functional reasons, since lldb uses the UUID of the binary, not just its name, so having an old module with the wrong UUID won't do anything but waste some VM space.
lldb also keeps all modules around between debug sessions even if they aren't being used because that makes subsequent debug sessions in the same lldb have faster turnaround. Most binaries share many of the same modules, so caching them is a useful strategy.
But you can tell lldb to look through the cached module list and discard any unused modules (not referenced by any target) by running:
(lldb) script lldb.debugger.MemoryPressureDetected()
If you have a target still extant, however, it might still be referencing that module, so you might need to delete the target first before running this API.
You can use the image list -g
command to see all the cached modules if that's helpful...
Upvotes: 0