From 61ef19eb07ec1cdf058a31baebbf58a35325c54e Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 19 Dec 2025 12:35:01 -0500 Subject: [PATCH] Allow copy-pasting `0x` prefixed hex values as ids to the dump debugger command (#6526) --- scripts/lldbinit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/lldbinit.py b/scripts/lldbinit.py index 3f0f8c3517f7..e4aa7adc8c8b 100644 --- a/scripts/lldbinit.py +++ b/scripts/lldbinit.py @@ -55,7 +55,9 @@ Args: the `Label` string in `IdBase` classes to find possible TYPE names, though only Id types that have a matching `Make...Id()` function are supported. - ID is an integer number, such as `42`, in hex, such as in `inst6000000A`. + ID is an integer number, such as `42`, in hex, such as in `inst6000000A`. It + can come with a `0x` prefix, allowing easier copy-paste from raw printed + hex values (such as via the `p/x` lldb command). Example usage: # Dumps the `inst_id` local variable, with a `context` local variable. @@ -114,7 +116,7 @@ Example usage: found_id_type = False # Look for as a single argument. - if m := re.fullmatch("([a-z_]+)([0-9A-Fa-f]+)", args[1]): + if m := re.fullmatch("([a-z_]+)(?:0x)?([0-9A-Fa-f]+)", args[1]): if m[1] in id_types: if len(args) != 2: print_usage()