[PATCH] D46220: Remove premature caching of the global variables list in CompileUnit.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 30 14:59:12 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL331230: Remove premature caching of the global variables list in CompileUnit. (authored by adrian, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D46220?vs=144418&id=144642#toc
Repository:
rL LLVM
https://reviews.llvm.org/D46220
Files:
lldb/trunk/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/global_variables/main.c
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -4194,7 +4194,6 @@
variable_list_sp = sc.comp_unit->GetVariableList(false);
if (variable_list_sp.get() == NULL) {
variable_list_sp.reset(new VariableList());
- sc.comp_unit->SetVariableList(variable_list_sp);
}
} else {
GetObjectFile()->GetModule()->ReportError(
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
@@ -39,6 +39,12 @@
environment = self.registerSharedLibrariesWithTarget(
target, self.shlib_names)
+ # Test that static initialized variables can be inspected without process.
+ self.expect("target variable g_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['(int *)'])
+ self.expect("target variable *g_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['42'])
+
# Now launch the process, and do not stop at entry point.
process = target.LaunchSimple(
None, environment, self.get_process_working_directory())
@@ -54,17 +60,21 @@
substrs=[' resolved, hit count = 1'])
# Check that GLOBAL scopes are indicated for the variables.
+ self.runCmd("frame variable --show-types --scope --show-globals --no-args")
self.expect(
"frame variable --show-types --scope --show-globals --no-args",
VARIABLES_DISPLAYED_CORRECTLY,
substrs=[
- 'GLOBAL: (int) g_file_global_int = 42',
'STATIC: (const int) g_file_static_int = 2',
+ 'STATIC: (const char *) g_func_static_cstr',
'GLOBAL: (const char *) g_file_global_cstr',
'"g_file_global_cstr"',
+ 'GLOBAL: (int) g_file_global_int = 42',
+ 'GLOBAL: (int) g_common_1 = 21',
+ 'GLOBAL: (int *) g_ptr',
'STATIC: (const char *) g_file_static_cstr',
- '"g_file_static_cstr"',
- 'GLOBAL: (int) g_common_1 = 21'])
+ '"g_file_static_cstr"'
+ ])
# 'frame variable' should support address-of operator.
self.runCmd("frame variable &g_file_global_int")
@@ -95,3 +105,8 @@
VARIABLES_DISPLAYED_CORRECTLY,
matching=False,
substrs=["can't be resolved"])
+
+ # Test that the statically initialized variable can also be
+ # inspected *with* a process.
+ self.expect("target variable *g_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['42'])
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/global_variables/main.c
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/global_variables/main.c
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/global_variables/main.c
@@ -13,12 +13,13 @@
static const int g_file_static_int = 2;
const char *g_file_global_cstr = "g_file_global_cstr";
static const char *g_file_static_cstr = "g_file_static_cstr";
+int *g_ptr = &g_file_global_int;
extern int g_a;
int main (int argc, char const *argv[])
{
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; // Set break point at this line. //// break $source:$line; continue; var -global g_a -global g_global_int
+ 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
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46220.144642.patch
Type: text/x-patch
Size: 4236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180430/59484d7f/attachment-0001.bin>
More information about the llvm-commits
mailing list