Add a dc alias for dump context in lldb (#7972)

This handles the common case where there is a `context` variable or
method available in scope.

Users can't provide this alias in their own config files since the
`dump` command does not yet exist when user configs are parsed.
This commit is contained in:
Dana Jansens authored and GitHub committed 2026-10-15 16:28:20 +00:00
1 parent d649699682
commit 690a050550
1 file changed
+6
+6
View File
@@ -64,6 +64,11 @@ Args:
can come with a `0x` prefix, allowing easier copy-paste from raw printed
hex values (such as via the `p/x` lldb command).
Aliases:
dc [<EXPR>|-- <EXPR>|<TYPE><ID>|<TYPE> <ID>]
- Shorthand for `dump context` which is the common case where there is a
`context` var or method in scope.
Example usage:
# Dumps the `inst_id` local variable, with a `context` local variable.
dump context inst_id
@@ -204,6 +209,7 @@ def format_carbon_id(
def __lldb_init_module(debugger: Any, internal_dict: Any) -> None:
RunCommand("command script add -f lldbinit.cmd_dump dump")
RunCommand("command alias dc dump context")
RunCommand(
"type summary add --python-function lldbinit.format_carbon_id"
+ " --recognizer-function lldbinit.is_carbon_id"