Add LLDB summary for Vector.

This commit is contained in:
Bartosz Taudul 2024-05-06 22:36:56 +02:00
parent 11eee619fb
commit 4b14d961f0
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 12 additions and 0 deletions

View File

@ -16,4 +16,5 @@
"variant": { "statusBarVisibility": "compact" } "variant": { "statusBarVisibility": "compact" }
}, },
"cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json", "cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json",
"lldb.launch.initCommands": ["command script import ${workspaceRoot}/extra/natvis.py"],
} }

11
extra/natvis.py Normal file
View File

@ -0,0 +1,11 @@
import lldb
def VectorSummary(value, dict):
size = value.GetChildMemberWithName('m_size').GetValueAsUnsigned()
capacity = 1 << value.GetChildMemberWithName('m_capacity').GetValueAsUnsigned()
magic = bool(value.GetChildMemberWithName('m_magic').GetValueAsUnsigned())
return 'size={0}, capacity={1}, magic={2}'.format(size, capacity, magic)
def __lldb_init_module(debugger, dict):
debugger.HandleCommand('type summary add -w tracy -F natvis.VectorSummary -x ^tracy::Vector<.+>')
debugger.HandleCommand('type category enable tracy')