Skip to content

Instantly share code, notes, and snippets.

@wmanth
Last active October 29, 2025 13:26
Show Gist options
  • Select an option

  • Save wmanth/873c6ff60ea960139ebe to your computer and use it in GitHub Desktop.

Select an option

Save wmanth/873c6ff60ea960139ebe to your computer and use it in GitHub Desktop.
LLDB script to summarize Qt types in Xcode.
import lldb
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('type summary add QString -F lldb_qt.QString_summary')
debugger.HandleCommand('type summary add QUuid -F lldb_qt.QUuid_summary')
print 'lldb_qt.py has been loaded and is ready for use.'
def QString_summary(value, internal_dict):
name = value.GetName()
deref = '->' if value.TypeIsPointerType() else '.'
return value.frame.EvaluateExpression(name + deref + 'toStdString()').GetSummary()
def QUuid_summary(value, internal_dict):
name = value.GetName()
deref = '->' if value.TypeIsPointerType() else '.'
return value.frame.EvaluateExpression(name + deref + 'toString().toStdString()').GetSummary()
@wmanth
Copy link
Copy Markdown
Author

wmanth commented May 31, 2015

Copy this file to ~/Library/Developer/LLDB/ and add the following line to your ~/.lldbinit

command script import ~/Library/Developer/LLDB/lldb_qt.py

@RobertoSA20
Copy link
Copy Markdown

Good script, it still works 10 years after!
Just put the print argument in brackets, and wanted install it at Xcode startup, put the import command in a ~/.lldbinit-Xcode script file.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment