https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/205692

ScriptedFrame.get_register_info() dispatched on a hardcoded list of 
architectures (x86_64/arm64/arm/hexagon) to pick a general-purpose register 
layout and raised ValueError for anything else. Because ScriptedFrame.__init__ 
calls get_register_info() eagerly, this made every scripted frame fail to 
construct on an unlisted architecture such as wasm32: the Python exception 
surfaced as "invalid script object", the frame provider produced an empty 
stack, and that tripped the "a valid thread has no frames" assert in 
StackFrameList::GetFrameAtIndex.

Without better error reporting, I don't think that's a good or welcoming 
default.

Such architectures have no predefined GPR layout here, so leave the register 
info empty instead of raising and let the frame construct.

Assisted-by: Claude

>From a71a55351cbb294c889a740ac28c352a9597a4ed Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <[email protected]>
Date: Wed, 24 Jun 2026 16:01:56 -0700
Subject: [PATCH] [lldb] Don't fail scripted frame construction on unknown
 architectures

ScriptedFrame.get_register_info() dispatched on a hardcoded list of
architectures (x86_64/arm64/arm/hexagon) to pick a general-purpose
register layout and raised ValueError for anything else. Because
ScriptedFrame.__init__ calls get_register_info() eagerly, this made
every scripted frame fail to construct on an unlisted architecture
such as wasm32: the Python exception surfaced as "invalid script
object", the frame provider produced an empty stack, and that tripped
the "a valid thread has no frames" assert in
StackFrameList::GetFrameAtIndex.

Without better error reporting, I don't think that's a good or welcoming
default.

Such architectures have no predefined GPR layout here, so leave the
register info empty instead of raising and let the frame construct.

Assisted-by: Claude
---
 lldb/examples/python/templates/scripted_process.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lldb/examples/python/templates/scripted_process.py 
b/lldb/examples/python/templates/scripted_process.py
index af21c80e6896d..82e19d82357aa 100644
--- a/lldb/examples/python/templates/scripted_process.py
+++ b/lldb/examples/python/templates/scripted_process.py
@@ -533,7 +533,11 @@ def get_register_info(self):
                     self.register_info["sets"] = ["General Purpose Registers"]
                     self.register_info["registers"] = HEXAGON_GPR
                 else:
-                    raise ValueError("Unknown architecture", self.arch)
+                    # No predefined general-purpose register layout for this
+                    # architecture. Leave the register info empty rather than
+                    # failing to construct the scripted frame.
+                    self.register_info["sets"] = []
+                    self.register_info["registers"] = []
         return self.register_info
 
     @abstractmethod

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to