[Lldb-commits] [lldb] [lldb] Unwind through ARM Cortex-M exceptions automatically (PR #153922)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 26 07:03:01 PDT 2025
================
@@ -0,0 +1,51 @@
+"""
+Test that we can backtrace up an ARM Cortex-M Exception return stack
+"""
+
+import lldb
+import json
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCortexMExceptionUnwind(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def test_no_fpu(self):
+ """Test that we can backtrace correctly through an ARM Cortex-M Exception return stack"""
+
+ target = self.dbg.CreateTarget("")
+ exe = "binary.json"
+ f = open(exe)
+ exe_json = json.load(f)
+ exe_uuid = exe_json["uuid"]
+ f.close()
+ target.AddModule(exe, "", exe_uuid)
+ self.assertTrue(target.IsValid())
+
+ core = self.getBuildArtifact("core")
+ self.yaml2macho_core("armv7m-nofpu-exception.yaml", core, exe_uuid)
+
+ process = target.LoadCore(core)
+ self.assertTrue(process.IsValid())
+
+ if self.TraceOn():
+ self.runCmd("image list")
+ self.runCmd("target modules dump sections")
+ self.runCmd("target modules dump symtab")
+ self.runCmd("bt")
+
+ thread = process.GetThreadAtIndex(0)
+ self.assertTrue(thread.IsValid())
+
+ self.assertEqual(thread.GetNumFrames(), 6)
+ stackframe_names = [
+ "exception_catcher",
+ "exception_catcher",
+ "exception_thrower",
+ "main",
+ ]
+ for i in range(4):
----------------
DavidSpickett wrote:
`for i, name in enumerate(stackframe_names)`
https://github.com/llvm/llvm-project/pull/153922
More information about the lldb-commits
mailing list