Skip to content

Conversation

@da-viper
Copy link
Contributor

object indexing causes key error.

Initial commit #290ba2

object indexing causes key error.

Initial commit #290ba281e819d60be4903436cbc07efc12e22d4c
@da-viper da-viper requested a review from JDevlieghere as a code owner April 27, 2025 14:05
@llvmbot llvmbot added the lldb label Apr 27, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 27, 2025

@llvm/pr-subscribers-lldb

Author: Ebuka Ezike (da-viper)

Changes

object indexing causes key error.

Initial commit #290ba2


Full diff: https://github.com/llvm/llvm-project/pull/137516.diff

1 Files Affected:

  • (modified) lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py (+18-8)
diff --git a/lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py b/lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py
index d47e485c7f9d9..08c225b3cada4 100644
--- a/lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py
+++ b/lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py
@@ -67,45 +67,55 @@ def build_and_run_until_breakpoint(self):
     def verify_frames_source(
         self, frames, main_frame_assembly: bool, other_frame_assembly: bool
     ):
+        self.assertLessEqual(2, len(frames), "expect at least 2 frames")
+        source_0 = frames[0].get("source")
+        source_1 = frames[1].get("source")
+        self.assertIsNotNone(source_0, "Expects a source object in frame 0")
+        self.assertIsNotNone(source_1, "Expects a source object in frame 1")
+
+        # it does not always have a path.
+        source_0_path: str = source_0.get("path", "")
+        source_1_path: str = source_1.get("path", "")
+
         if other_frame_assembly:
             self.assertFalse(
-                frames[0]["source"]["path"].endswith("other.c"),
+                source_0_path.endswith("other.c"),
                 "Expect original source path to not be in unavailable source frame (other.c)",
             )
             self.assertIn(
                 "sourceReference",
-                frames[0]["source"],
+                source_0,
                 "Expect sourceReference to be in unavailable source frame (other.c)",
             )
         else:
             self.assertTrue(
-                frames[0]["source"]["path"].endswith("other.c"),
+                source_0_path.endswith("other.c"),
                 "Expect original source path to be in normal source frame (other.c)",
             )
             self.assertNotIn(
                 "sourceReference",
-                frames[0]["source"],
+                source_0,
                 "Expect sourceReference to not be in normal source frame (other.c)",
             )
 
         if main_frame_assembly:
             self.assertFalse(
-                frames[1]["source"]["path"].endswith("main.c"),
+                source_1_path.endswith("main.c"),
                 "Expect original source path to not be in unavailable source frame (main.c)",
             )
             self.assertIn(
                 "sourceReference",
-                frames[1]["source"],
+                source_1,
                 "Expect sourceReference to be in unavailable source frame (main.c)",
             )
         else:
             self.assertTrue(
-                frames[1]["source"]["path"].endswith("main.c"),
+                source_1_path.endswith("main.c"),
                 "Expect original source path to be in normal source frame (main.c)",
             )
             self.assertNotIn(
                 "sourceReference",
-                frames[1]["source"],
+                source_1,
                 "Expect sourceReference to not be in normal source code frame (main.c)",
             )
 

@da-viper da-viper merged commit ee4b34c into llvm:main Apr 27, 2025
12 checks passed
@da-viper da-viper deleted the fix-failing-test branch April 28, 2025 15:05
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…m#137516)

object indexing causes key error.

Initial commit #290ba2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants