[Lldb-commits] [PATCH] D32340: [LLDB][MIPS] Fix TestMiExec.py failure

Nitesh Jain via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 21 00:40:16 PDT 2017


nitesh.jain created this revision.
Herald added subscribers: arichardson, ki.stfu.

Call to s_MyFunction may not follow immediately after g_MyFunction. There might be some instructions in between to restore caller-saved registers. We need to get past these instructions with a step to reach call to s_MyFunction.


https://reviews.llvm.org/D32340

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
  packages/Python/lldbsuite/test/tools/lldb-mi/control/main.cpp


Index: packages/Python/lldbsuite/test/tools/lldb-mi/control/main.cpp
===================================================================
--- packages/Python/lldbsuite/test/tools/lldb-mi/control/main.cpp
+++ packages/Python/lldbsuite/test/tools/lldb-mi/control/main.cpp
@@ -26,8 +26,8 @@
 main(int argc, char const *argv[])
 {
     printf("start");
-    g_MyFunction();
-    s_MyFunction();
+    g_MyFunction(); // function_line_1
+    s_MyFunction(); // function_line_2
     printf("exit");
     return 0;
 }
Index: packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
===================================================================
--- packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
@@ -284,6 +284,9 @@
         self.runCmd("-file-exec-and-symbols %s" % self.myexe)
         self.expect("\^done")
 
+        self.g_MyFunction_line_no = line_number('main.cpp', "function_line_1")
+        self.s_MyFunction_line_no = line_number('main.cpp', "function_line_2")
+
         # Run to main
         self.runCmd("-break-insert -f main")
         self.expect("\^done,bkpt={number=\"1\"")
@@ -320,7 +323,17 @@
         self.runCmd("-exec-finish --frame 0")
         self.expect("\^running")
         self.expect(
-            "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
+            "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(30|29)\"")
+
+        finish_status = self.child.after
+        string_to_match = 'line="{0}"'.format(self.g_MyFunction_line_no)
+
+        # Call to s_MyFunction may not follow immediately after g_MyFunction.
+        # There might be some instructions in between to restore caller-saved registers.
+        # We need to get past these instructions with a step to reach call to s_MyFunction.
+
+        if (finish_status.find(string_to_match) >= 0):
+            self.runCmd("-exec-step --thread 1")
 
         # Test that -exec-step steps into s_MyFunction
         # (and that --frame is optional)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32340.96105.patch
Type: text/x-patch
Size: 2073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170421/95a34778/attachment-0001.bin>


More information about the lldb-commits mailing list