[Lldb-commits] [PATCH] D151392: Fix SBValue::FindValue for file static variables
This revision was automatically updated to reflect the committed changes. Closed by commit rG14186773e79b: Fix SBValue::FindValue for file static variables (authored by jingham). Changed prior to commit: https://reviews.llvm.org/D151392?vs=525391&id=526852#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D151392/new/ https://reviews.llvm.org/D151392 Files: lldb/source/API/SBFrame.cpp lldb/test/API/python_api/process/TestProcessAPI.py lldb/test/API/python_api/process/main.cpp Index: lldb/test/API/python_api/process/main.cpp === --- lldb/test/API/python_api/process/main.cpp +++ lldb/test/API/python_api/process/main.cpp @@ -3,7 +3,7 @@ // This simple program is to test the lldb Python API related to process. -char my_char = 'u'; +static char my_char = 'u'; char my_cstring[] = "lldb.SBProcess.ReadCStringFromMemory() works!"; char *my_char_ptr = (char *)"Does it work?"; uint32_t my_uint32 = 12345; Index: lldb/test/API/python_api/process/TestProcessAPI.py === --- lldb/test/API/python_api/process/TestProcessAPI.py +++ lldb/test/API/python_api/process/TestProcessAPI.py @@ -49,8 +49,8 @@ ) frame = thread.GetFrameAtIndex(0) -# Get the SBValue for the global variable 'my_char'. -val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal) +# Get the SBValue for the file static variable 'my_char'. +val = frame.FindValue("my_char", lldb.eValueTypeVariableStatic) self.DebugSBValue(val) # Due to the typemap magic (see lldb.swig), we pass in 1 to ReadMemory and @@ -149,8 +149,8 @@ ) frame = thread.GetFrameAtIndex(0) -# Get the SBValue for the global variable 'my_char'. -val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal) +# Get the SBValue for the static variable 'my_char'. +val = frame.FindValue("my_char", lldb.eValueTypeVariableStatic) self.DebugSBValue(val) # If the variable does not have a load address, there's no sense Index: lldb/source/API/SBFrame.cpp === --- lldb/source/API/SBFrame.cpp +++ lldb/source/API/SBFrame.cpp @@ -602,7 +602,8 @@ stop_if_block_is_inlined_function, [frame](Variable *v) { return v->IsInScope(frame); }, &variable_list); - if (value_type == eValueTypeVariableGlobal) { + if (value_type == eValueTypeVariableGlobal + || value_type == eValueTypeVariableStatic) { const bool get_file_globals = true; VariableList *frame_vars = frame->GetVariableList(get_file_globals, nullptr); Index: lldb/test/API/python_api/process/main.cpp === --- lldb/test/API/python_api/process/main.cpp +++ lldb/test/API/python_api/process/main.cpp @@ -3,7 +3,7 @@ // This simple program is to test the lldb Python API related to process. -char my_char = 'u'; +static char my_char = 'u'; char my_cstring[] = "lldb.SBProcess.ReadCStringFromMemory() works!"; char *my_char_ptr = (char *)"Does it work?"; uint32_t my_uint32 = 12345; Index: lldb/test/API/python_api/process/TestProcessAPI.py === --- lldb/test/API/python_api/process/TestProcessAPI.py +++ lldb/test/API/python_api/process/TestProcessAPI.py @@ -49,8 +49,8 @@ ) frame = thread.GetFrameAtIndex(0) -# Get the SBValue for the global variable 'my_char'. -val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal) +# Get the SBValue for the file static variable 'my_char'. +val = frame.FindValue("my_char", lldb.eValueTypeVariableStatic) self.DebugSBValue(val) # Due to the typemap magic (see lldb.swig), we pass in 1 to ReadMemory and @@ -149,8 +149,8 @@ ) frame = thread.GetFrameAtIndex(0) -# Get the SBValue for the global variable 'my_char'. -val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal) +# Get the SBValue for the static variable 'my_char'. +val = frame.FindValue("my_char", lldb.eValueTypeVariableStatic) self.DebugSBValue(val) # If the variable does not have a load address, there's no sense Index: lldb/source/API/SBFrame.cpp === --- lldb/source/API/SBFrame.cpp +++ lldb/source/API/SBFrame.cpp @@ -602,7 +602,8 @@ stop_if_block_is_inlined_function, [frame](Variable *v) { return v->IsInScope(frame); }, &variable_list); - if (value_type == eValueTypeVariableGlobal) { + if (value_typ
[Lldb-commits] [PATCH] D151392: Fix SBValue::FindValue for file static variables
mib accepted this revision. mib added a comment. LGTM! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D151392/new/ https://reviews.llvm.org/D151392 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D151392: Fix SBValue::FindValue for file static variables
JDevlieghere accepted this revision. JDevlieghere added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D151392/new/ https://reviews.llvm.org/D151392 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D151392: Fix SBValue::FindValue for file static variables
jingham created this revision. jingham added reviewers: JDevlieghere, mib. Herald added a project: All. jingham requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. This was just a thinko. The API StackFrame::GetVariableList takes a bool for "get_file_globals" which if true will also find file statics and file globals. But we only were passing that as true if the ValueType was eValueTypeVariableGlobal, which meant that we never find file statics. It's okay if we cast too wide a net when we do GetVariableList as later on we check against the ValueType to filter globals from statics. There was a test that had a whole bunch of globals and tested FindValue on all of them, but had no statics. So I just made one of the globals a file static, which verifies the fix. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D151392 Files: lldb/source/API/SBFrame.cpp lldb/test/API/python_api/process/TestProcessAPI.py lldb/test/API/python_api/process/main.cpp Index: lldb/test/API/python_api/process/main.cpp === --- lldb/test/API/python_api/process/main.cpp +++ lldb/test/API/python_api/process/main.cpp @@ -3,7 +3,7 @@ // This simple program is to test the lldb Python API related to process. -char my_char = 'u'; +static char my_char = 'u'; char my_cstring[] = "lldb.SBProcess.ReadCStringFromMemory() works!"; char *my_char_ptr = (char *)"Does it work?"; uint32_t my_uint32 = 12345; Index: lldb/test/API/python_api/process/TestProcessAPI.py === --- lldb/test/API/python_api/process/TestProcessAPI.py +++ lldb/test/API/python_api/process/TestProcessAPI.py @@ -52,8 +52,8 @@ "There should be a thread stopped due to breakpoint") frame = thread.GetFrameAtIndex(0) -# Get the SBValue for the global variable 'my_char'. -val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal) +# Get the SBValue for the file static variable 'my_char'. +val = frame.FindValue("my_char", lldb.eValueTypeVariableStatic) self.DebugSBValue(val) # Due to the typemap magic (see lldb.swig), we pass in 1 to ReadMemory and @@ -149,8 +149,8 @@ "There should be a thread stopped due to breakpoint") frame = thread.GetFrameAtIndex(0) -# Get the SBValue for the global variable 'my_char'. -val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal) +# Get the SBValue for the static variable 'my_char'. +val = frame.FindValue("my_char", lldb.eValueTypeVariableStatic) self.DebugSBValue(val) # If the variable does not have a load address, there's no sense Index: lldb/source/API/SBFrame.cpp === --- lldb/source/API/SBFrame.cpp +++ lldb/source/API/SBFrame.cpp @@ -604,7 +604,8 @@ stop_if_block_is_inlined_function, [frame](Variable *v) { return v->IsInScope(frame); }, &variable_list); - if (value_type == eValueTypeVariableGlobal) { + if (value_type == eValueTypeVariableGlobal + || value_type == eValueTypeVariableStatic) { const bool get_file_globals = true; VariableList *frame_vars = frame->GetVariableList(get_file_globals, nullptr); Index: lldb/test/API/python_api/process/main.cpp === --- lldb/test/API/python_api/process/main.cpp +++ lldb/test/API/python_api/process/main.cpp @@ -3,7 +3,7 @@ // This simple program is to test the lldb Python API related to process. -char my_char = 'u'; +static char my_char = 'u'; char my_cstring[] = "lldb.SBProcess.ReadCStringFromMemory() works!"; char *my_char_ptr = (char *)"Does it work?"; uint32_t my_uint32 = 12345; Index: lldb/test/API/python_api/process/TestProcessAPI.py === --- lldb/test/API/python_api/process/TestProcessAPI.py +++ lldb/test/API/python_api/process/TestProcessAPI.py @@ -52,8 +52,8 @@ "There should be a thread stopped due to breakpoint") frame = thread.GetFrameAtIndex(0) -# Get the SBValue for the global variable 'my_char'. -val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal) +# Get the SBValue for the file static variable 'my_char'. +val = frame.FindValue("my_char", lldb.eValueTypeVariableStatic) self.DebugSBValue(val) # Due to the typemap magic (see lldb.swig), we pass in 1 to ReadMemory and @@ -149,8 +149,8 @@ "There should be a thread stopped due to breakpoint") frame = thread.GetFrameAtIndex(0) -# Get the SBValue for the global variable 'my_char'. -val