[Lldb-commits] [lldb] [lldb-dap] Destroy debugger when debug session terminates (PR #156231)

Roy Shi via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 1 16:36:16 PDT 2025


royitaqi wrote:

> do you know if destroying the debugger will free the module cache?

@walter-erquinigo: I assume, by "module cache", you meant the global module list accessible by `ModuleList::GetSharedModule()` and `ModuleList::GetSharedModuleList()`.

I think destroying the debugger will NOT free it (which I think is the desired behavior). Verified by the commands below, where the memory address of the `Module` object of the main executable didn't change (as printed by the `-p` flag) after the first session has terminated.

```
// Server mode.
// 1st session, after target creation.
(lldb) image list -u -p -f -S -g
[  0] 091DE3B7-FE99-4174-BE03-4F90EFEB4584 0x12b780128 /Users/royshi/demo/simple/a.out 
      /Users/royshi/demo/simple/a.out.dSYM/Contents/Resources/DWARF/a.out
...

// 2nd session, before target creation (as init command).
(lldb) image list -u -p -f -S -g
[  0] 091DE3B7-FE99-4174-BE03-4F90EFEB4584 0x12b780128 /Users/royshi/demo/simple/a.out 
      /Users/royshi/demo/simple/a.out.dSYM/Contents/Resources/DWARF/a.out
...
```


https://github.com/llvm/llvm-project/pull/156231


More information about the lldb-commits mailing list