[Lldb-commits] [PATCH] D64769: [lldb][test_suite] change the test main.cpp to avoid expression reschedule

Wanyi Ye via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 15 13:53:28 PDT 2019


kusmour created this revision.
kusmour added reviewers: xiaobai, labath.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Added a local variable to hold the return value to avoid delayed calculation on variables
This issue occurred when using NDK 20 clang with `-O0` flag set


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D64769

Files:
  lldb/packages/Python/lldbsuite/test/lang/c/global_variables/main.c


Index: lldb/packages/Python/lldbsuite/test/lang/c/global_variables/main.c
===================================================================
--- lldb/packages/Python/lldbsuite/test/lang/c/global_variables/main.c
+++ lldb/packages/Python/lldbsuite/test/lang/c/global_variables/main.c
@@ -20,5 +20,6 @@
     g_common_1 = g_file_global_int / g_file_static_int;
     static const char *g_func_static_cstr = "g_func_static_cstr";
     printf ("%s %s\n", g_file_global_cstr, g_file_static_cstr);
-    return g_file_global_int + g_a + g_common_1 + *g_ptr; // Set break point at this line.  //// break $source:$line; continue; var -global g_a -global g_global_int
+    int return_val = g_file_global_int + g_a + g_common_1 + *g_ptr;
+    return return_val; // Set break point at this line.  //// break $source:$line; continue; var -global g_a -global g_global_int
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64769.209947.patch
Type: text/x-patch
Size: 860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190715/b34406f2/attachment.bin>


More information about the lldb-commits mailing list