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
 }


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
 }
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to