aboutsummaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
authorsanthoshe447 <150406203+santhoshe447@users.noreply.github.com>2023-11-17 20:45:23 +0530
committerGitHub <noreply@github.com>2023-11-17 10:15:23 -0500
commit06effaf43e9669c55ee4a1e2254166b5e7dc5b29 (patch)
treeae54c14b4eca32b092b20f72bad8064e8c2eb862 /lldb
parent965d301dff1837e2a7a0671c549bcf7ddb350486 (diff)
downloadllvm-06effaf43e9669c55ee4a1e2254166b5e7dc5b29.zip
llvm-06effaf43e9669c55ee4a1e2254166b5e7dc5b29.tar.gz
llvm-06effaf43e9669c55ee4a1e2254166b5e7dc5b29.tar.bz2
[lldb][test] Add the ability to extract the variable value out of the summary. (#72631)
Fix for https://github.com/llvm/llvm-project/issues/71897 When it comes to test infrastructure the test (TestDAP_variables.py: test_scopes_variables_setVariable_evaluate_with_descriptive_summaries) will fail if the variable has a summary along with value. I just tried to add a summary to a variable before we set a value to the variable using below expression from “request_setVariable” function. RunLLDBCommands(llvm::StringRef(), {std::string("type summary add --summary-string "{sample summary}" (const char **) argv")}); As value has nonnumeric characters where we are trying to convert into integer, python is throwing an error. We did not see this issue in upstream as we are not adding summary explicitly, by default we are getting empty summary & value for all children’s of argv parameter (even after auto summary). The test is failing with below error: ERROR: test_scopes_variables_setVariable_evaluate_with_descriptive_summaries (TestDAP_variables.TestDAP_variables) Traceback (most recent call last): File "/llvm/llvm-project/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py", line 372, in test_scopes_variables_setVariable_evaluate_with_descriptive_summaries enableAutoVariableSummaries=True File "/llvm/llvm-project/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py", line 266, in do_test_scopes_variables_setVariable_evaluate argv = self.get_local_as_int("argv") File "//llvm/llvm-project/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py", line 199, in get_local_as_int return int(value, 16) ValueError: invalid literal for int() with base 16: '0x0000000000001234 sample summary' Config=x86_64-//llvm/llvm-build/bin/clang Co-authored-by: Santhosh Kumar Ellendula <sellendu@hu-sellendu-hyd.qualcomm.com>
Diffstat (limited to 'lldb')
-rw-r--r--lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 9d79872..0cf9d4f 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -195,6 +195,9 @@ class DAPTestCaseBase(TestBase):
def get_local_as_int(self, name, threadId=None):
value = self.dap_server.get_local_variable_value(name, threadId=threadId)
+ # 'value' may have the variable value and summary.
+ # Extract the variable value since summary can have nonnumeric characters.
+ value = value.split(" ")[0]
if value.startswith("0x"):
return int(value, 16)
elif value.startswith("0"):