[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
https://github.com/santhoshe447 updated https://github.com/llvm/llvm-project/pull/91570 >From 960351c9abf51f42d92604ac6297aa5b76ddfba5 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 17 Nov 2023 15:09:10 +0530 Subject: [PATCH 01/12] [lldb][test] Add the ability to extract the variable value out of the summary. --- .../Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py | 3 +++ 1 file changed, 3 insertions(+) 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 9d79872b029a3..0cf9d4fde4948 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 @@ def collect_console(self, duration): 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"): >From ab44a6991c5bc8ac5764c3f71cbe3acc747b3776 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 3 May 2024 02:47:05 -0700 Subject: [PATCH 02/12] [lldb-dap] Added "port" property to vscode "attach" command. Adding a "port" property to the VsCode "attach" command likely extends the functionality of the debugger configuratiuon to allow attaching to a process using PID or PORT number. Currently, the "Attach" configuration lets the user specify a pid. We tell the user to use the attachCommands property to run "gdb-remote ". Followed the below conditions for "attach" command with "port" and "pid" We should add a "port" property. If port is specified and pid is not, use that port to attach. If both port and pid are specified, return an error saying that the user can't specify both pid and port. Ex - launch.json { "version": "0.2.0", "configurations": [ { "name": "lldb-dap Debug", "type": "lldb-dap", "request": "attach", "port":1234, "program": "${workspaceFolder}/a.out", "args": [], "stopOnEntry": false, "cwd": "${workspaceFolder}", "env": [], } ] } --- lldb/include/lldb/lldb-defines.h | 1 + .../Python/lldbsuite/test/lldbtest.py | 9 ++ .../test/tools/lldb-dap/dap_server.py | 6 + .../test/tools/lldb-dap/lldbdap_testcase.py | 20 +++ .../attach/TestDAP_attachByPortNum.py | 120 ++ lldb/tools/lldb-dap/lldb-dap.cpp | 36 +- lldb/tools/lldb-dap/package.json | 11 ++ 7 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py diff --git a/lldb/include/lldb/lldb-defines.h b/lldb/include/lldb/lldb-defines.h index c7bd019c5c90e..a1e6ee2ce468c 100644 --- a/lldb/include/lldb/lldb-defines.h +++ b/lldb/include/lldb/lldb-defines.h @@ -96,6 +96,7 @@ #define LLDB_INVALID_QUEUE_ID 0 #define LLDB_INVALID_CPU_ID UINT32_MAX #define LLDB_INVALID_WATCHPOINT_RESOURCE_ID UINT32_MAX +#define LLDB_INVALID_PORT_NUMBER 0 /// CPU Type definitions #define LLDB_ARCH_DEFAULT "systemArch" diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 5fd686c143e9f..fb3cd22959df2 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1572,6 +1572,15 @@ def findBuiltClang(self): return os.environ["CC"] +def getBuiltServerTool(self, server_tool): +# Tries to find simulation/lldb-server/gdbserver tool at the same folder as the lldb. +lldb_dir = os.path.dirname(lldbtest_config.lldbExec) +path = shutil.which(server_tool, path=lldb_dir) +if path is not None: +return path + +return "" + def yaml2obj(self, yaml_path, obj_path, max_size=None): """ Create an object file at the given path from a yaml file. diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 5838281bcb1a1..96d312565f953 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -568,6 +568,8 @@ def request_attach( coreFile=None, postRunCommands=None, sourceMap=None, +port=None, +hostname=None ): args_dict = {} if pid is not None: @@ -597,6 +599,10 @@ def request_attach( args_dict["postRunCommands"] = postRunCo
[Lldb-commits] [lldb] [lldb] Fixed TestEchoCommands.test running on a remote target (PR #94127)
labath wrote: > > > * LLDB_PLATFORM_URL > > > > > > Is that an environment variable or a cmake variable? I don't see a single > > instance of that string in the entire lldb source tree. Are you sure that's > > not some downstream feature? > > Sorry for the confusion, the PR for the remote run of Shell tests is coming > soon. This PR will be relevant after that. Ok, I think we should start with that first. And maybe instead of a PR, starting with an RFC to the dev list might be in order, as I'd like to hear how do you plan to implement it, and what do you hope to gain through this functionality. FWIW, my opinion is that we should not have this functionality, as I don't want to duplicate the remote execution logic for the different kind of tests, and also because I think that most of the tests would not actually be useful in this setup (for example, because a lot of them use hard-coded assembly specific to a single target -- that's one of the criteria I use when choosing what kind of test to write). If you think there are some tests (classes of tests) that are particularly useful to be run in a remote scenario, then we can consider converting them to an API test. https://github.com/llvm/llvm-project/pull/94127 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 6c36bdb - [lldb] Add documentation for the max_children argument (#94192)
Author: Pavel Labath Date: 2024-06-04T09:06:31+02:00 New Revision: 6c36bdb6eab1a3de3bce24ee0285c7745b17e407 URL: https://github.com/llvm/llvm-project/commit/6c36bdb6eab1a3de3bce24ee0285c7745b17e407 DIFF: https://github.com/llvm/llvm-project/commit/6c36bdb6eab1a3de3bce24ee0285c7745b17e407.diff LOG: [lldb] Add documentation for the max_children argument (#94192) Added: Modified: lldb/docs/use/variable.rst lldb/include/lldb/API/SBValue.h Removed: diff --git a/lldb/docs/use/variable.rst b/lldb/docs/use/variable.rst index e9175b25336ba..22c2bee73fa59 100644 --- a/lldb/docs/use/variable.rst +++ b/lldb/docs/use/variable.rst @@ -930,20 +930,27 @@ be implemented by the Python class): class SyntheticChildrenProvider: def __init__(self, valobj, internal_dict): - this call should initialize the Python object using valobj as the variable to provide synthetic children for - def num_children(self): - this call should return the number of children that you want your object to have + this call should initialize the Python object using valobj as the + variable to provide synthetic children for + def num_children(self, max_children): + this call should return the number of children that you want your + object to have[1] def get_child_index(self,name): - this call should return the index of the synthetic child whose name is given as argument + this call should return the index of the synthetic child whose name is + given as argument def get_child_at_index(self,index): - this call should return a new LLDB SBValue object representing the child at the index given as argument + this call should return a new LLDB SBValue object representing the + child at the index given as argument def update(self): - this call should be used to update the internal state of this Python object whenever the state of the variables in LLDB changes.[1] + this call should be used to update the internal state of this Python + object whenever the state of the variables in LLDB changes.[2] Also, this method is invoked before any other method in the interface. def has_children(self): - this call should return True if this object might have children, and False if this object can be guaranteed not to have children.[2] + this call should return True if this object might have children, and + False if this object can be guaranteed not to have children.[3] def get_value(self): - this call can return an SBValue to be presented as the value of the synthetic value under consideration.[3] + this call can return an SBValue to be presented as the value of the + synthetic value under consideration.[4] As a warning, exceptions that are thrown by python formatters are caught silently by LLDB and should be handled appropriately by the formatter itself. @@ -951,7 +958,15 @@ Being more specific, in case of exceptions, LLDB might assume that the given object has no children or it might skip printing some children, as they are printed one by one. -[1] This method is optional. Also, a boolean value must be returned (since lldb +[1] The `max_children` argument is optional (since lldb 3.8.0) and indicates the +maximum number of children that lldb is interested in (at this moment). If the +computation of the number of children is expensive (for example, requires +travesing a linked list to determine its size) your implementation may return +`max_children` rather than the actual number. If the computation is cheap (e.g., the +number is stored as a field of the object), then you can always return the true +number of children (that is, ignore the `max_children` argument). + +[2] This method is optional. Also, a boolean value must be returned (since lldb 3.1.0). If ``False`` is returned, then whenever the process reaches a new stop, this method will be invoked again to generate an updated list of the children for a given variable. Otherwise, if ``True`` is returned, then the value is @@ -959,11 +974,11 @@ cached and this method won't be called again, effectively freezing the state of the value in subsequent stops. Beware that returning ``True`` incorrectly could show misleading information to the user. -[2] This method is optional (since lldb 3.2.0). While implementing it in terms +[3] This method is optional (since lldb 3.2.0). While implementing it in terms of num_children is acceptable, implementors are encouraged to look for optimized coding alternatives whenever reasonable. -[3] This method is optional (since lldb 3.5.2). The `SBValue` you return here +[4] This method is optional (since lldb 3.5.2). The `SBValue` you return here will most likely be a numeric type (int, float, ...) as its value bytes will b
[Lldb-commits] [lldb] [lldb] Add documentation for the max_children argument (PR #94192)
https://github.com/labath closed https://github.com/llvm/llvm-project/pull/94192 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support reading DW_OP_piece from file address (PR #94026)
https://github.com/labath approved this pull request. https://github.com/llvm/llvm-project/pull/94026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
Michael137 wrote: > > You can repro this by running ./bin/lldb-dotest -p > > TestConstStaticIntegralMember.py --dwarf-version 5 > > Could you take a look @ZequanWu ? > > It should be fixed by the following diff. We just need to skip the > declaration DIEs that are struct/class/union. This failure you see is caused > by skipping a declaration DIE `DW_TAG_variable`. > > ``` > diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp > b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp > index 56717bab1ecd..6330470b970e 100644 > --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp > +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp > @@ -87,7 +87,8 @@ bool DebugNamesDWARFIndex::ProcessEntry( > return true; >// Clang erroneously emits index entries for declaration DIEs in case when > the >// definition is in a type unit (llvm.org/pr77696). Weed those out. > - if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) > + if (die.IsStructUnionOrClass() && > + die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) > return true; >return callback(die); > } > ``` > > Can you (or anyone with commit access) commit above fix for me? I somehow > cannot pull/push from github. Ah right, I remember encountering these `DW_AT_declaration`s in the index for DWARFv5 static member variables. Technically this isn't standard conforming right? I thought anything `DW_AT_declaration` shouldn't be indexed (though in the case of these static variables it's very useful that they do, because we don't emit definitions for these constants that the debugger could look for instead). @dwblaikie @felipepiovezan Should we allow such entries in the index? And does this warrant rephrasing in the DWARF spec? https://github.com/llvm/llvm-project/pull/92328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] PR to try to fix Windows CI build (PR #94325)
https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/94325 None >From fe6cde45a5e1f30dc76da872f24ca08d5888e20b Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:45:41 + Subject: [PATCH 1/2] Enable lldb build --- .ci/generate-buildkite-pipeline-premerge | 3 +-- .ci/monolithic-linux.sh | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 033ab804b165e..5f8700efabfab 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -170,7 +170,6 @@ function exclude-windows() { compiler-rt) ;; # tests taking too long openmp) ;; # TODO: having trouble with the Perl installation libc);; # no Windows support -lldb);; # tests failing bolt);; # tests are not supported yet *) echo "${project}" @@ -213,7 +212,7 @@ function check-targets() { echo "check-unwind" ;; lldb) - echo "check-all" # TODO: check-lldb may not include all the LLDB tests? + echo "check-lldb" ;; pstl) echo "check-all" diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index 38d7128f241b6..b78dc59432b65 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -39,6 +39,7 @@ targets="${2}" echo "--- cmake" pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt +pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_PROJECTS="${projects}" \ -G Ninja \ >From 6f90aea93cf1b2d6b8afad985f5f7168a4dc1da9 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:46:45 + Subject: [PATCH 2/2] Touch failing file. --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 24111396b0ac6..e1ea75bd0317c 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -614,3 +614,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } + ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] PR to try to fix Windows CI build (PR #94325)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff eea05c6b3369736b703e2a5e3ca08ba6ad8a51dc 6f90aea93cf1b2d6b8afad985f5f7168a4dc1da9 -- lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index e1ea75bd03..24111396b0 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -614,4 +614,3 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } - `` https://github.com/llvm/llvm-project/pull/94325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] PR to try to fix Windows CI build (PR #94325)
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/94325 >From fe6cde45a5e1f30dc76da872f24ca08d5888e20b Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:45:41 + Subject: [PATCH 1/3] Enable lldb build --- .ci/generate-buildkite-pipeline-premerge | 3 +-- .ci/monolithic-linux.sh | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 033ab804b165e..5f8700efabfab 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -170,7 +170,6 @@ function exclude-windows() { compiler-rt) ;; # tests taking too long openmp) ;; # TODO: having trouble with the Perl installation libc);; # no Windows support -lldb);; # tests failing bolt);; # tests are not supported yet *) echo "${project}" @@ -213,7 +212,7 @@ function check-targets() { echo "check-unwind" ;; lldb) - echo "check-all" # TODO: check-lldb may not include all the LLDB tests? + echo "check-lldb" ;; pstl) echo "check-all" diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index 38d7128f241b6..b78dc59432b65 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -39,6 +39,7 @@ targets="${2}" echo "--- cmake" pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt +pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_PROJECTS="${projects}" \ -G Ninja \ >From 6f90aea93cf1b2d6b8afad985f5f7168a4dc1da9 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:46:45 + Subject: [PATCH 2/3] Touch failing file. --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 24111396b0ac6..e1ea75bd0317c 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -614,3 +614,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } + >From be9cb678e7d96c1e34f3df45ae1138fc52fc888d Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 09:32:22 + Subject: [PATCH 3/3] Work around msvc problem --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index e1ea75bd0317c..0e45dd5f39257 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -593,6 +593,10 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { "E03", false); } +// Prior to this verison, constructing a std::future for a type without a +// default constructor is not possible. +// https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 +#if _MSC_VER >= 1932 TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { FileSpec file_spec("/foo/bar", FileSpec::Style::posix); std::future> async_result = std::async( @@ -614,4 +618,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } - +#endif \ No newline at end of file ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] PR to try to fix Windows CI build (PR #94325)
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/94325 >From fe6cde45a5e1f30dc76da872f24ca08d5888e20b Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:45:41 + Subject: [PATCH 1/4] Enable lldb build --- .ci/generate-buildkite-pipeline-premerge | 3 +-- .ci/monolithic-linux.sh | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 033ab804b165e..5f8700efabfab 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -170,7 +170,6 @@ function exclude-windows() { compiler-rt) ;; # tests taking too long openmp) ;; # TODO: having trouble with the Perl installation libc);; # no Windows support -lldb);; # tests failing bolt);; # tests are not supported yet *) echo "${project}" @@ -213,7 +212,7 @@ function check-targets() { echo "check-unwind" ;; lldb) - echo "check-all" # TODO: check-lldb may not include all the LLDB tests? + echo "check-lldb" ;; pstl) echo "check-all" diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index 38d7128f241b6..b78dc59432b65 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -39,6 +39,7 @@ targets="${2}" echo "--- cmake" pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt +pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_PROJECTS="${projects}" \ -G Ninja \ >From 6f90aea93cf1b2d6b8afad985f5f7168a4dc1da9 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:46:45 + Subject: [PATCH 2/4] Touch failing file. --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 24111396b0ac6..e1ea75bd0317c 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -614,3 +614,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } + >From be9cb678e7d96c1e34f3df45ae1138fc52fc888d Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 09:32:22 + Subject: [PATCH 3/4] Work around msvc problem --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index e1ea75bd0317c..0e45dd5f39257 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -593,6 +593,10 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { "E03", false); } +// Prior to this verison, constructing a std::future for a type without a +// default constructor is not possible. +// https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 +#if _MSC_VER >= 1932 TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { FileSpec file_spec("/foo/bar", FileSpec::Style::posix); std::future> async_result = std::async( @@ -614,4 +618,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } - +#endif \ No newline at end of file >From 137ee24f10e9e62b29bf3ea6ac69cef21f2395ae Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 09:50:37 + Subject: [PATCH 4/4] Build lld to use in tests and maybe avoid the one in program files which has a space in the path. --- .ci/generate-buildkite-pipeline-premerge | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 5f8700efabfab..90cd48359939c 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -141,6 +141,9 @@ function add-dependencies() { lld|mlir|polly) echo llvm ;; +lldb) + echo lld +;; *) # Nothing to do ;; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] PR to try to fix Windows CI build (PR #94325)
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/94325 >From fe6cde45a5e1f30dc76da872f24ca08d5888e20b Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:45:41 + Subject: [PATCH 1/5] Enable lldb build --- .ci/generate-buildkite-pipeline-premerge | 3 +-- .ci/monolithic-linux.sh | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 033ab804b165e..5f8700efabfab 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -170,7 +170,6 @@ function exclude-windows() { compiler-rt) ;; # tests taking too long openmp) ;; # TODO: having trouble with the Perl installation libc);; # no Windows support -lldb);; # tests failing bolt);; # tests are not supported yet *) echo "${project}" @@ -213,7 +212,7 @@ function check-targets() { echo "check-unwind" ;; lldb) - echo "check-all" # TODO: check-lldb may not include all the LLDB tests? + echo "check-lldb" ;; pstl) echo "check-all" diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index 38d7128f241b6..b78dc59432b65 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -39,6 +39,7 @@ targets="${2}" echo "--- cmake" pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt +pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_PROJECTS="${projects}" \ -G Ninja \ >From 6f90aea93cf1b2d6b8afad985f5f7168a4dc1da9 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:46:45 + Subject: [PATCH 2/5] Touch failing file. --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 24111396b0ac6..e1ea75bd0317c 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -614,3 +614,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } + >From be9cb678e7d96c1e34f3df45ae1138fc52fc888d Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 09:32:22 + Subject: [PATCH 3/5] Work around msvc problem --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index e1ea75bd0317c..0e45dd5f39257 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -593,6 +593,10 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { "E03", false); } +// Prior to this verison, constructing a std::future for a type without a +// default constructor is not possible. +// https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 +#if _MSC_VER >= 1932 TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { FileSpec file_spec("/foo/bar", FileSpec::Style::posix); std::future> async_result = std::async( @@ -614,4 +618,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } - +#endif \ No newline at end of file >From 137ee24f10e9e62b29bf3ea6ac69cef21f2395ae Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 09:50:37 + Subject: [PATCH 4/5] Build lld to use in tests and maybe avoid the one in program files which has a space in the path. --- .ci/generate-buildkite-pipeline-premerge | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 5f8700efabfab..90cd48359939c 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -141,6 +141,9 @@ function add-dependencies() { lld|mlir|polly) echo llvm ;; +lldb) + echo lld +;; *) # Nothing to do ;; >From d627dba59a8c01e60589c28ba6c8d9c363ac68f1 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 10:03:49 + Subject: [PATCH 5/5] Correct case order --- .ci/generate-buildkite-pipeline-premerge | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-pre
[Lldb-commits] [lldb] [llvm] PR to try to fix Windows CI build (PR #94325)
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/94325 >From fe6cde45a5e1f30dc76da872f24ca08d5888e20b Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:45:41 + Subject: [PATCH 1/5] Enable lldb build --- .ci/generate-buildkite-pipeline-premerge | 3 +-- .ci/monolithic-linux.sh | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 033ab804b165e..5f8700efabfab 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -170,7 +170,6 @@ function exclude-windows() { compiler-rt) ;; # tests taking too long openmp) ;; # TODO: having trouble with the Perl installation libc);; # no Windows support -lldb);; # tests failing bolt);; # tests are not supported yet *) echo "${project}" @@ -213,7 +212,7 @@ function check-targets() { echo "check-unwind" ;; lldb) - echo "check-all" # TODO: check-lldb may not include all the LLDB tests? + echo "check-lldb" ;; pstl) echo "check-all" diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index 38d7128f241b6..b78dc59432b65 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -39,6 +39,7 @@ targets="${2}" echo "--- cmake" pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt +pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_PROJECTS="${projects}" \ -G Ninja \ >From 6f90aea93cf1b2d6b8afad985f5f7168a4dc1da9 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:46:45 + Subject: [PATCH 2/5] Touch failing file. --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 24111396b0ac6..e1ea75bd0317c 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -614,3 +614,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } + >From be9cb678e7d96c1e34f3df45ae1138fc52fc888d Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 09:32:22 + Subject: [PATCH 3/5] Work around msvc problem --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index e1ea75bd0317c..0e45dd5f39257 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -593,6 +593,10 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { "E03", false); } +// Prior to this verison, constructing a std::future for a type without a +// default constructor is not possible. +// https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 +#if _MSC_VER >= 1932 TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { FileSpec file_spec("/foo/bar", FileSpec::Style::posix); std::future> async_result = std::async( @@ -614,4 +618,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } - +#endif \ No newline at end of file >From 137ee24f10e9e62b29bf3ea6ac69cef21f2395ae Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 09:50:37 + Subject: [PATCH 4/5] Build lld to use in tests and maybe avoid the one in program files which has a space in the path. --- .ci/generate-buildkite-pipeline-premerge | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 5f8700efabfab..90cd48359939c 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -141,6 +141,9 @@ function add-dependencies() { lld|mlir|polly) echo llvm ;; +lldb) + echo lld +;; *) # Nothing to do ;; >From 655950e4bfb016b47e65e75182e7146736462f4c Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 10:11:33 + Subject: [PATCH 5/5] debug generation script --- .ci/generate-buildkite-pipeline-premerge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/generate-buildkite-pipeline-preme
[Lldb-commits] [lldb] [llvm] PR to try to fix Windows CI build (PR #94325)
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/94325 >From fe6cde45a5e1f30dc76da872f24ca08d5888e20b Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:45:41 + Subject: [PATCH 1/6] Enable lldb build --- .ci/generate-buildkite-pipeline-premerge | 3 +-- .ci/monolithic-linux.sh | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 033ab804b165e..5f8700efabfab 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -170,7 +170,6 @@ function exclude-windows() { compiler-rt) ;; # tests taking too long openmp) ;; # TODO: having trouble with the Perl installation libc);; # no Windows support -lldb);; # tests failing bolt);; # tests are not supported yet *) echo "${project}" @@ -213,7 +212,7 @@ function check-targets() { echo "check-unwind" ;; lldb) - echo "check-all" # TODO: check-lldb may not include all the LLDB tests? + echo "check-lldb" ;; pstl) echo "check-all" diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index 38d7128f241b6..b78dc59432b65 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -39,6 +39,7 @@ targets="${2}" echo "--- cmake" pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt +pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_PROJECTS="${projects}" \ -G Ninja \ >From 6f90aea93cf1b2d6b8afad985f5f7168a4dc1da9 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 08:46:45 + Subject: [PATCH 2/6] Touch failing file. --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 24111396b0ac6..e1ea75bd0317c 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -614,3 +614,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } + >From be9cb678e7d96c1e34f3df45ae1138fc52fc888d Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 09:32:22 + Subject: [PATCH 3/6] Work around msvc problem --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index e1ea75bd0317c..0e45dd5f39257 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -593,6 +593,10 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { "E03", false); } +// Prior to this verison, constructing a std::future for a type without a +// default constructor is not possible. +// https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 +#if _MSC_VER >= 1932 TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { FileSpec file_spec("/foo/bar", FileSpec::Style::posix); std::future> async_result = std::async( @@ -614,4 +618,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } - +#endif \ No newline at end of file >From 137ee24f10e9e62b29bf3ea6ac69cef21f2395ae Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 09:50:37 + Subject: [PATCH 4/6] Build lld to use in tests and maybe avoid the one in program files which has a space in the path. --- .ci/generate-buildkite-pipeline-premerge | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 5f8700efabfab..90cd48359939c 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -141,6 +141,9 @@ function add-dependencies() { lld|mlir|polly) echo llvm ;; +lldb) + echo lld +;; *) # Nothing to do ;; >From 655950e4bfb016b47e65e75182e7146736462f4c Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 10:11:33 + Subject: [PATCH 5/6] debug generation script --- .ci/generate-buildkite-pipeline-premerge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/generate-buildkite-pipeline-preme
[Lldb-commits] [lldb] [lldb] Add format eFormatEnumWithValues to ensure raw enum value is always shown (PR #90059)
DavidSpickett wrote: @clayborg ping! https://github.com/llvm/llvm-project/pull/90059 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 93266ec - [lldb][test] Require Python for dwp test
Author: David Spickett Date: 2024-06-04T10:46:31Z New Revision: 93266ecac949efdc6d04620847a1b87bbb4819ce URL: https://github.com/llvm/llvm-project/commit/93266ecac949efdc6d04620847a1b87bbb4819ce DIFF: https://github.com/llvm/llvm-project/commit/93266ecac949efdc6d04620847a1b87bbb4819ce.diff LOG: [lldb][test] Require Python for dwp test This came up when testing the CI build, which is not being build with scripting yet. Added: Modified: lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp Removed: diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp index 1d636ede41b56..888e96bbb10af 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp @@ -1,4 +1,4 @@ -// REQUIRES: lld +// REQUIRES: lld, python // Now test with DWARF5 // RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -c %s -o %t.dwarf5.o ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] PR to try to fix Windows CI build (PR #94325)
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/94325 >From 125112e5864affd45a016a0870a40d2b4f516732 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 09:32:22 + Subject: [PATCH] [lldb][test] Disable MD5 test for old versions of Visual Studio In older versions there is this problem: https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 Which prevents us making a future out of a result type. There's no good workaround so just don't compile this for older versions. --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 5 + 1 file changed, 5 insertions(+) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 24111396b0ac6..7e95b16308321 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -593,6 +593,10 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { "E03", false); } +// Prior to this verison, constructing a std::future for a type without a +// default constructor is not possible. +// https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 +#if _MSC_VER >= 1932 TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { FileSpec file_spec("/foo/bar", FileSpec::Style::posix); std::future> async_result = std::async( @@ -614,3 +618,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } +#endif ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] PR to try to fix Windows CI build (PR #94325)
https://github.com/DavidSpickett edited https://github.com/llvm/llvm-project/pull/94325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Disable MD5 test for old versions of Visual Studio (PR #94325)
https://github.com/DavidSpickett edited https://github.com/llvm/llvm-project/pull/94325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Disable MD5 test for old versions of Visual Studio (PR #94325)
https://github.com/DavidSpickett ready_for_review https://github.com/llvm/llvm-project/pull/94325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Disable MD5 test for old versions of Visual Studio (PR #94325)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: David Spickett (DavidSpickett) Changes In older versions there is this problem: https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 Which prevents us making a future out of a result type. There's no good workaround so just don't compile this for older versions. --- Full diff: https://github.com/llvm/llvm-project/pull/94325.diff 1 Files Affected: - (modified) lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp (+5) ``diff diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 24111396b0ac6..7e95b16308321 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -593,6 +593,10 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { "E03", false); } +// Prior to this verison, constructing a std::future for a type without a +// default constructor is not possible. +// https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 +#if _MSC_VER >= 1932 TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { FileSpec file_spec("/foo/bar", FileSpec::Style::posix); std::future> async_result = std::async( @@ -614,3 +618,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } +#endif `` https://github.com/llvm/llvm-project/pull/94325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RISCV] Add RegisterContextPOSIXCore for RISC-V 64 (PR #93297)
https://github.com/AlexeyMerzlyakov updated https://github.com/llvm/llvm-project/pull/93297 >From d30c3b7017bd9f4b9f442ee728d7e3d7847c60cf Mon Sep 17 00:00:00 2001 From: Alexey Merzlyakov Date: Fri, 24 May 2024 11:54:16 +0300 Subject: [PATCH 1/3] Add RegisterContextPOSIXCore for RISC-V 64 Fix GetRegisterSetCount() method name misprint for RegisterContextPOSIX_riscv64 --- .../Utility/RegisterContextPOSIX_riscv64.cpp | 2 +- .../Plugins/Process/elf-core/CMakeLists.txt | 1 + .../RegisterContextPOSIXCore_riscv64.cpp | 84 +++ .../RegisterContextPOSIXCore_riscv64.h| 60 + .../Process/elf-core/ThreadElfCore.cpp| 8 +- 5 files changed, 153 insertions(+), 2 deletions(-) create mode 100644 lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv64.cpp create mode 100644 lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv64.h diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv64.cpp index 1834a94dc0260..035ce00e11626 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv64.cpp @@ -58,7 +58,7 @@ RegisterContextPOSIX_riscv64::GetRegisterInfoAtIndex(size_t reg) { } size_t RegisterContextPOSIX_riscv64::GetRegisterSetCount() { - return m_register_info_up->GetRegisterCount(); + return m_register_info_up->GetRegisterSetCount(); } const lldb_private::RegisterSet * diff --git a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt index 8ddc671e3ae66..72925c835b5c8 100644 --- a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt +++ b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt @@ -9,6 +9,7 @@ add_lldb_library(lldbPluginProcessElfCore PLUGIN RegisterContextPOSIXCore_ppc64le.cpp RegisterContextPOSIXCore_s390x.cpp RegisterContextPOSIXCore_x86_64.cpp + RegisterContextPOSIXCore_riscv64.cpp RegisterUtilities.cpp LINK_LIBS diff --git a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv64.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv64.cpp new file mode 100644 index 0..2202be4d38082 --- /dev/null +++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv64.cpp @@ -0,0 +1,84 @@ +//===-- RegisterContextPOSIXCore_riscv64.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "RegisterContextPOSIXCore_riscv64.h" + +#include "lldb/Utility/DataBufferHeap.h" + +using namespace lldb_private; + +std::unique_ptr +RegisterContextCorePOSIX_riscv64::Create( +lldb_private::Thread &thread, const lldb_private::ArchSpec &arch, +const lldb_private::DataExtractor &gpregset, +llvm::ArrayRef notes) { + Flags flags = 0; + + auto register_info_up = + std::make_unique(arch, flags); + return std::unique_ptr( + new RegisterContextCorePOSIX_riscv64(thread, std::move(register_info_up), + gpregset, notes)); +} + +RegisterContextCorePOSIX_riscv64::RegisterContextCorePOSIX_riscv64( +Thread &thread, std::unique_ptr register_info, +const DataExtractor &gpregset, llvm::ArrayRef notes) +: RegisterContextPOSIX_riscv64(thread, std::move(register_info)) { + + m_gpr_buffer = std::make_shared(gpregset.GetDataStart(), + gpregset.GetByteSize()); + m_gpr.SetData(m_gpr_buffer); + m_gpr.SetByteOrder(gpregset.GetByteOrder()); + + ArchSpec arch = m_register_info_up->GetTargetArchitecture(); + DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc); + m_fpr_buffer = std::make_shared(fpregset.GetDataStart(), + fpregset.GetByteSize()); + m_fpr.SetData(m_fpr_buffer); + m_fpr.SetByteOrder(fpregset.GetByteOrder()); +} + +RegisterContextCorePOSIX_riscv64::~RegisterContextCorePOSIX_riscv64() = default; + +bool RegisterContextCorePOSIX_riscv64::ReadGPR() { return true; } + +bool RegisterContextCorePOSIX_riscv64::ReadFPR() { return true; } + +bool RegisterContextCorePOSIX_riscv64::WriteGPR() { + assert(0); + return false; +} + +bool RegisterContextCorePOSIX_riscv64::WriteFPR() { + assert(0); + return false; +} + +bool RegisterContextCorePOSIX_riscv64::ReadRegister( +const RegisterInfo *reg_info, RegisterValue &value) { + const uint8_t *src = nullptr; + lldb::offset_t offset = reg_info->byte_offset; + + if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) { +src = m_gpr.GetDataStart(); + } else { // IsFPR +src = m_fpr.GetDataStart(); +offs
[Lldb-commits] [lldb] [lldb][RISCV] Add RegisterContextPOSIXCore for RISC-V 64 (PR #93297)
@@ -0,0 +1,84 @@ +//===-- RegisterContextPOSIXCore_riscv64.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "RegisterContextPOSIXCore_riscv64.h" + +#include "lldb/Utility/DataBufferHeap.h" + +using namespace lldb_private; + +std::unique_ptr +RegisterContextCorePOSIX_riscv64::Create(Thread &thread, const ArchSpec &arch, + const DataExtractor &gpregset, + llvm::ArrayRef notes) { + Flags flags = 0; + + return std::unique_ptr( + new RegisterContextCorePOSIX_riscv64( + thread, std::make_unique(arch, flags), AlexeyMerzlyakov wrote: Done in https://github.com/llvm/llvm-project/pull/93297/commits/071886e99f4cc758789fab1701770a54bd240149 https://github.com/llvm/llvm-project/pull/93297 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Disable MD5 test for old versions of Visual Studio (PR #94325)
@@ -593,6 +593,10 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { "E03", false); } +// Prior to this verison, constructing a std::future for a type without a +// default constructor is not possible. +// https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 +#if _MSC_VER >= 1932 mstorsjo wrote: Shouldn't this have a `!defined(_MSC_VER) ||` part at the beginning, in order to retain the test on all non-MSVC configurations? https://github.com/llvm/llvm-project/pull/94325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RISCV] Add RegisterContextPOSIXCore for RISC-V 64 (PR #93297)
https://github.com/AlexeyMerzlyakov updated https://github.com/llvm/llvm-project/pull/93297 >From d30c3b7017bd9f4b9f442ee728d7e3d7847c60cf Mon Sep 17 00:00:00 2001 From: Alexey Merzlyakov Date: Fri, 24 May 2024 11:54:16 +0300 Subject: [PATCH 1/3] Add RegisterContextPOSIXCore for RISC-V 64 Fix GetRegisterSetCount() method name misprint for RegisterContextPOSIX_riscv64 --- .../Utility/RegisterContextPOSIX_riscv64.cpp | 2 +- .../Plugins/Process/elf-core/CMakeLists.txt | 1 + .../RegisterContextPOSIXCore_riscv64.cpp | 84 +++ .../RegisterContextPOSIXCore_riscv64.h| 60 + .../Process/elf-core/ThreadElfCore.cpp| 8 +- 5 files changed, 153 insertions(+), 2 deletions(-) create mode 100644 lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv64.cpp create mode 100644 lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv64.h diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv64.cpp index 1834a94dc0260..035ce00e11626 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv64.cpp @@ -58,7 +58,7 @@ RegisterContextPOSIX_riscv64::GetRegisterInfoAtIndex(size_t reg) { } size_t RegisterContextPOSIX_riscv64::GetRegisterSetCount() { - return m_register_info_up->GetRegisterCount(); + return m_register_info_up->GetRegisterSetCount(); } const lldb_private::RegisterSet * diff --git a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt index 8ddc671e3ae66..72925c835b5c8 100644 --- a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt +++ b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt @@ -9,6 +9,7 @@ add_lldb_library(lldbPluginProcessElfCore PLUGIN RegisterContextPOSIXCore_ppc64le.cpp RegisterContextPOSIXCore_s390x.cpp RegisterContextPOSIXCore_x86_64.cpp + RegisterContextPOSIXCore_riscv64.cpp RegisterUtilities.cpp LINK_LIBS diff --git a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv64.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv64.cpp new file mode 100644 index 0..2202be4d38082 --- /dev/null +++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv64.cpp @@ -0,0 +1,84 @@ +//===-- RegisterContextPOSIXCore_riscv64.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "RegisterContextPOSIXCore_riscv64.h" + +#include "lldb/Utility/DataBufferHeap.h" + +using namespace lldb_private; + +std::unique_ptr +RegisterContextCorePOSIX_riscv64::Create( +lldb_private::Thread &thread, const lldb_private::ArchSpec &arch, +const lldb_private::DataExtractor &gpregset, +llvm::ArrayRef notes) { + Flags flags = 0; + + auto register_info_up = + std::make_unique(arch, flags); + return std::unique_ptr( + new RegisterContextCorePOSIX_riscv64(thread, std::move(register_info_up), + gpregset, notes)); +} + +RegisterContextCorePOSIX_riscv64::RegisterContextCorePOSIX_riscv64( +Thread &thread, std::unique_ptr register_info, +const DataExtractor &gpregset, llvm::ArrayRef notes) +: RegisterContextPOSIX_riscv64(thread, std::move(register_info)) { + + m_gpr_buffer = std::make_shared(gpregset.GetDataStart(), + gpregset.GetByteSize()); + m_gpr.SetData(m_gpr_buffer); + m_gpr.SetByteOrder(gpregset.GetByteOrder()); + + ArchSpec arch = m_register_info_up->GetTargetArchitecture(); + DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc); + m_fpr_buffer = std::make_shared(fpregset.GetDataStart(), + fpregset.GetByteSize()); + m_fpr.SetData(m_fpr_buffer); + m_fpr.SetByteOrder(fpregset.GetByteOrder()); +} + +RegisterContextCorePOSIX_riscv64::~RegisterContextCorePOSIX_riscv64() = default; + +bool RegisterContextCorePOSIX_riscv64::ReadGPR() { return true; } + +bool RegisterContextCorePOSIX_riscv64::ReadFPR() { return true; } + +bool RegisterContextCorePOSIX_riscv64::WriteGPR() { + assert(0); + return false; +} + +bool RegisterContextCorePOSIX_riscv64::WriteFPR() { + assert(0); + return false; +} + +bool RegisterContextCorePOSIX_riscv64::ReadRegister( +const RegisterInfo *reg_info, RegisterValue &value) { + const uint8_t *src = nullptr; + lldb::offset_t offset = reg_info->byte_offset; + + if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) { +src = m_gpr.GetDataStart(); + } else { // IsFPR +src = m_fpr.GetDataStart(); +offs
[Lldb-commits] [lldb] [lldb][RISCV] Add RegisterContextPOSIXCore for RISC-V 64 (PR #93297)
https://github.com/AlexeyMerzlyakov edited https://github.com/llvm/llvm-project/pull/93297 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RISCV] Add RegisterContextPOSIXCore for RISC-V 64 (PR #93297)
AlexeyMerzlyakov wrote: > Corefiles can be debugged anywhere, so you should add a test case to > `lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py`. I've added two testcases (one general and one checking main RISC-V registers) to `TestLinuxCore.py`. It was used the approach described above with `cat 0x01 > /proc/self/coredump_filter` minimal viable flag set for these tests. https://github.com/llvm/llvm-project/pull/93297 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Disable MD5 test for old versions of Visual Studio (PR #94325)
https://github.com/vgvassilev updated https://github.com/llvm/llvm-project/pull/94325 >From 125112e5864affd45a016a0870a40d2b4f516732 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 09:32:22 + Subject: [PATCH 1/2] [lldb][test] Disable MD5 test for old versions of Visual Studio In older versions there is this problem: https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 Which prevents us making a future out of a result type. There's no good workaround so just don't compile this for older versions. --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 5 + 1 file changed, 5 insertions(+) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 24111396b0ac6..7e95b16308321 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -593,6 +593,10 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { "E03", false); } +// Prior to this verison, constructing a std::future for a type without a +// default constructor is not possible. +// https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 +#if _MSC_VER >= 1932 TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { FileSpec file_spec("/foo/bar", FileSpec::Style::posix); std::future> async_result = std::async( @@ -614,3 +618,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } +#endif >From c790d42ea4fdf6c75cef04504c4366dc9572743b Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 4 Jun 2024 13:55:00 + Subject: [PATCH 2/2] Check for non-msvc compilers --- .../Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 7e95b16308321..11e14f9472164 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -596,7 +596,7 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { // Prior to this verison, constructing a std::future for a type without a // default constructor is not possible. // https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 -#if _MSC_VER >= 1932 +#if !defined(_MSC_VER) || _MSC_VER >= 1932 TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { FileSpec file_spec("/foo/bar", FileSpec::Style::posix); std::future> async_result = std::async( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Disable MD5 test for old versions of Visual Studio (PR #94325)
@@ -593,6 +593,10 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { "E03", false); } +// Prior to this verison, constructing a std::future for a type without a +// default constructor is not possible. +// https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 +#if _MSC_VER >= 1932 DavidSpickett wrote: Done. https://github.com/llvm/llvm-project/pull/94325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RISCV] Add RegisterContextPOSIXCore for RISC-V 64 (PR #93297)
DavidSpickett wrote: Thanks, these look good. This does not include the FP registers, but I'm ok with you adding proper testing (with inline asm to set the registers) later, in the register class refactoring you mentioned. For now, if the core has them, please add checks for the FPU registers (even if they're all 0, it's something at least). If it doesn't contain FPU regs then no worries, the PR is fine as is. https://github.com/llvm/llvm-project/pull/93297 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Disable MD5 test for old versions of Visual Studio (PR #94325)
https://github.com/Endilll approved this pull request. https://github.com/llvm/llvm-project/pull/94325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 8917739 - [lldb][test] Disable MD5 test for old versions of Visual Studio (#94325)
Author: David Spickett Date: 2024-06-04T15:38:11+01:00 New Revision: 8917739b4cb39e6cd2355672ff6e2c140b19aafd URL: https://github.com/llvm/llvm-project/commit/8917739b4cb39e6cd2355672ff6e2c140b19aafd DIFF: https://github.com/llvm/llvm-project/commit/8917739b4cb39e6cd2355672ff6e2c140b19aafd.diff LOG: [lldb][test] Disable MD5 test for old versions of Visual Studio (#94325) In older versions there is this problem: https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 Which prevents us making a future out of a result type. There's no good workaround so just don't compile this for older versions. Added: Modified: lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp Removed: diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 24111396b0ac6..11e14f9472164 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -593,6 +593,10 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { "E03", false); } +// Prior to this verison, constructing a std::future for a type without a +// default constructor is not possible. +// https://developercommunity.visualstudio.com/t/c-shared-state-futuresstate-default-constructs-the/60897 +#if !defined(_MSC_VER) || _MSC_VER >= 1932 TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { FileSpec file_spec("/foo/bar", FileSpec::Style::posix); std::future> async_result = std::async( @@ -614,3 +618,4 @@ TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { EXPECT_EQ(expected_low, result->low()); EXPECT_EQ(expected_high, result->high()); } +#endif ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Disable MD5 test for old versions of Visual Studio (PR #94325)
https://github.com/DavidSpickett closed https://github.com/llvm/llvm-project/pull/94325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
https://github.com/santhoshe447 updated https://github.com/llvm/llvm-project/pull/91570 >From 960351c9abf51f42d92604ac6297aa5b76ddfba5 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 17 Nov 2023 15:09:10 +0530 Subject: [PATCH 01/12] [lldb][test] Add the ability to extract the variable value out of the summary. --- .../Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py | 3 +++ 1 file changed, 3 insertions(+) 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 9d79872b029a3..0cf9d4fde4948 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 @@ def collect_console(self, duration): 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"): >From ab44a6991c5bc8ac5764c3f71cbe3acc747b3776 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 3 May 2024 02:47:05 -0700 Subject: [PATCH 02/12] [lldb-dap] Added "port" property to vscode "attach" command. Adding a "port" property to the VsCode "attach" command likely extends the functionality of the debugger configuratiuon to allow attaching to a process using PID or PORT number. Currently, the "Attach" configuration lets the user specify a pid. We tell the user to use the attachCommands property to run "gdb-remote ". Followed the below conditions for "attach" command with "port" and "pid" We should add a "port" property. If port is specified and pid is not, use that port to attach. If both port and pid are specified, return an error saying that the user can't specify both pid and port. Ex - launch.json { "version": "0.2.0", "configurations": [ { "name": "lldb-dap Debug", "type": "lldb-dap", "request": "attach", "port":1234, "program": "${workspaceFolder}/a.out", "args": [], "stopOnEntry": false, "cwd": "${workspaceFolder}", "env": [], } ] } --- lldb/include/lldb/lldb-defines.h | 1 + .../Python/lldbsuite/test/lldbtest.py | 9 ++ .../test/tools/lldb-dap/dap_server.py | 6 + .../test/tools/lldb-dap/lldbdap_testcase.py | 20 +++ .../attach/TestDAP_attachByPortNum.py | 120 ++ lldb/tools/lldb-dap/lldb-dap.cpp | 36 +- lldb/tools/lldb-dap/package.json | 11 ++ 7 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py diff --git a/lldb/include/lldb/lldb-defines.h b/lldb/include/lldb/lldb-defines.h index c7bd019c5c90e..a1e6ee2ce468c 100644 --- a/lldb/include/lldb/lldb-defines.h +++ b/lldb/include/lldb/lldb-defines.h @@ -96,6 +96,7 @@ #define LLDB_INVALID_QUEUE_ID 0 #define LLDB_INVALID_CPU_ID UINT32_MAX #define LLDB_INVALID_WATCHPOINT_RESOURCE_ID UINT32_MAX +#define LLDB_INVALID_PORT_NUMBER 0 /// CPU Type definitions #define LLDB_ARCH_DEFAULT "systemArch" diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 5fd686c143e9f..fb3cd22959df2 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1572,6 +1572,15 @@ def findBuiltClang(self): return os.environ["CC"] +def getBuiltServerTool(self, server_tool): +# Tries to find simulation/lldb-server/gdbserver tool at the same folder as the lldb. +lldb_dir = os.path.dirname(lldbtest_config.lldbExec) +path = shutil.which(server_tool, path=lldb_dir) +if path is not None: +return path + +return "" + def yaml2obj(self, yaml_path, obj_path, max_size=None): """ Create an object file at the given path from a yaml file. diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 5838281bcb1a1..96d312565f953 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -568,6 +568,8 @@ def request_attach( coreFile=None, postRunCommands=None, sourceMap=None, +port=None, +hostname=None ): args_dict = {} if pid is not None: @@ -597,6 +599,10 @@ def request_attach( args_dict["postRunCommands"] = postRunCo
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
felipepiovezan wrote: >Should we allow such entries in the index? And does this warrant rephrasing in >the DWARF spec? It's fine to have those as _nameless_ entries (which we don't emit today), but the entries that are reaching "process entry" are not nameless by definition. That if statement is a workaround for incorrect dwarf generation. It seems like this test is providing a case where incorrect dwarf is generated? https://github.com/llvm/llvm-project/pull/92328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
Michael137 wrote: > > Should we allow such entries in the index? And does this warrant rephrasing > > in the DWARF spec? > > It's fine to have those as _nameless_ entries (which we don't emit today), > but the entries that are reaching "process entry" have a name by definition. > That if statement is a workaround for incorrect dwarf generation. It seems > like this test is providing a case where incorrect dwarf is generated? Yea i misremembered, dsymutil is the one indexing these inline statics. @ZequanWu could you put up a PR for the proposed patch? https://github.com/llvm/llvm-project/pull/92328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
labath wrote: (Zequan is OOO for three weeks, I can take over this (tomorrow) if needed.) https://github.com/llvm/llvm-project/pull/92328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
Michael137 wrote: > (Zequan is OOO for three weeks, I can take over this (tomorrow) if needed.) Ah no worries! I can put up the patch later today then to unblock the CI https://github.com/llvm/llvm-project/pull/92328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 7dc84e2 - [lldb] Support reading DW_OP_piece from file address (#94026)
Author: Jonas Devlieghere Date: 2024-06-04T10:24:59-07:00 New Revision: 7dc84e225e11e37925db6f4f08269f447d2f2347 URL: https://github.com/llvm/llvm-project/commit/7dc84e225e11e37925db6f4f08269f447d2f2347 DIFF: https://github.com/llvm/llvm-project/commit/7dc84e225e11e37925db6f4f08269f447d2f2347.diff LOG: [lldb] Support reading DW_OP_piece from file address (#94026) We received a bug report where someone was trying to print a global variable without a process. This would succeed in a debug build but fail in a on optimized build. We traced the issue back to the location being described by a DW_OP_addr + DW_OP_piece. The issue is that the DWARF expression evaluator only support reading pieces from a load address. There's no reason it cannot do the same for a file address, and indeed, that solves the problem. I unsuccessfully tried to craft a test case to illustrate the original example, using a global struct and trying to trick the compiler into breaking it apart with SROA. Instead I wrote a unit test that uses a mock target to read memory from. rdar://127435923 Added: Modified: lldb/include/lldb/Target/Target.h lldb/source/Expression/DWARFExpression.cpp lldb/unittests/Expression/DWARFExpressionTest.cpp Removed: diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 7ad9f33586054..5d5ae1bfcd3bd 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -1077,9 +1077,11 @@ class Target : public std::enable_shared_from_this, // section, then read from the file cache // 2 - if there is a process, then read from memory // 3 - if there is no process, then read from the file cache - size_t ReadMemory(const Address &addr, void *dst, size_t dst_len, -Status &error, bool force_live_memory = false, -lldb::addr_t *load_addr_ptr = nullptr); + // + // The method is virtual for mocking in the unit tests. + virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len, +Status &error, bool force_live_memory = false, +lldb::addr_t *load_addr_ptr = nullptr); size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, Status &error, bool force_live_memory = false); @@ -1615,7 +1617,7 @@ class Target : public std::enable_shared_from_this, TargetStats &GetStatistics() { return m_stats; } -private: +protected: /// Construct with optional file and arch. /// /// This member is private. Clients must use diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index c061fd1140fff..7473bb8255d0a 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -2123,23 +2123,29 @@ bool DWARFExpression::Evaluate( const Value::ValueType curr_piece_source_value_type = curr_piece_source_value.GetValueType(); + Scalar &scalar = curr_piece_source_value.GetScalar(); + const lldb::addr_t addr = scalar.ULongLong(LLDB_INVALID_ADDRESS); switch (curr_piece_source_value_type) { case Value::ValueType::Invalid: return false; case Value::ValueType::LoadAddress: -if (process) { + case Value::ValueType::FileAddress: { +if (target) { if (curr_piece.ResizeData(piece_byte_size) == piece_byte_size) { -lldb::addr_t load_addr = -curr_piece_source_value.GetScalar().ULongLong( -LLDB_INVALID_ADDRESS); -if (process->ReadMemory( -load_addr, curr_piece.GetBuffer().GetBytes(), -piece_byte_size, error) != piece_byte_size) { - if (error_ptr) +if (target->ReadMemory(addr, curr_piece.GetBuffer().GetBytes(), + piece_byte_size, error, + /*force_live_memory=*/false) != +piece_byte_size) { + if (error_ptr) { +const char *addr_type = (curr_piece_source_value_type == + Value::ValueType::LoadAddress) +? "load" +: "file"; error_ptr->SetErrorStringWithFormat( "failed to read memory DW_OP_piece(%" PRIu64 -") from 0x%" PRIx64, -piece_byte_size, load_addr); +") from %s address 0x%" PRIx64, +piece_byte_size, addr_type, addr); + } return false; } } else { @@ -2151,2
[Lldb-commits] [lldb] [lldb] Support reading DW_OP_piece from file address (PR #94026)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/94026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
https://github.com/santhoshe447 updated https://github.com/llvm/llvm-project/pull/91570 >From 960351c9abf51f42d92604ac6297aa5b76ddfba5 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 17 Nov 2023 15:09:10 +0530 Subject: [PATCH 01/13] [lldb][test] Add the ability to extract the variable value out of the summary. --- .../Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py | 3 +++ 1 file changed, 3 insertions(+) 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 9d79872b029a3..0cf9d4fde4948 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 @@ def collect_console(self, duration): 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"): >From ab44a6991c5bc8ac5764c3f71cbe3acc747b3776 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 3 May 2024 02:47:05 -0700 Subject: [PATCH 02/13] [lldb-dap] Added "port" property to vscode "attach" command. Adding a "port" property to the VsCode "attach" command likely extends the functionality of the debugger configuratiuon to allow attaching to a process using PID or PORT number. Currently, the "Attach" configuration lets the user specify a pid. We tell the user to use the attachCommands property to run "gdb-remote ". Followed the below conditions for "attach" command with "port" and "pid" We should add a "port" property. If port is specified and pid is not, use that port to attach. If both port and pid are specified, return an error saying that the user can't specify both pid and port. Ex - launch.json { "version": "0.2.0", "configurations": [ { "name": "lldb-dap Debug", "type": "lldb-dap", "request": "attach", "port":1234, "program": "${workspaceFolder}/a.out", "args": [], "stopOnEntry": false, "cwd": "${workspaceFolder}", "env": [], } ] } --- lldb/include/lldb/lldb-defines.h | 1 + .../Python/lldbsuite/test/lldbtest.py | 9 ++ .../test/tools/lldb-dap/dap_server.py | 6 + .../test/tools/lldb-dap/lldbdap_testcase.py | 20 +++ .../attach/TestDAP_attachByPortNum.py | 120 ++ lldb/tools/lldb-dap/lldb-dap.cpp | 36 +- lldb/tools/lldb-dap/package.json | 11 ++ 7 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py diff --git a/lldb/include/lldb/lldb-defines.h b/lldb/include/lldb/lldb-defines.h index c7bd019c5c90e..a1e6ee2ce468c 100644 --- a/lldb/include/lldb/lldb-defines.h +++ b/lldb/include/lldb/lldb-defines.h @@ -96,6 +96,7 @@ #define LLDB_INVALID_QUEUE_ID 0 #define LLDB_INVALID_CPU_ID UINT32_MAX #define LLDB_INVALID_WATCHPOINT_RESOURCE_ID UINT32_MAX +#define LLDB_INVALID_PORT_NUMBER 0 /// CPU Type definitions #define LLDB_ARCH_DEFAULT "systemArch" diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 5fd686c143e9f..fb3cd22959df2 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1572,6 +1572,15 @@ def findBuiltClang(self): return os.environ["CC"] +def getBuiltServerTool(self, server_tool): +# Tries to find simulation/lldb-server/gdbserver tool at the same folder as the lldb. +lldb_dir = os.path.dirname(lldbtest_config.lldbExec) +path = shutil.which(server_tool, path=lldb_dir) +if path is not None: +return path + +return "" + def yaml2obj(self, yaml_path, obj_path, max_size=None): """ Create an object file at the given path from a yaml file. diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 5838281bcb1a1..96d312565f953 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -568,6 +568,8 @@ def request_attach( coreFile=None, postRunCommands=None, sourceMap=None, +port=None, +hostname=None ): args_dict = {} if pid is not None: @@ -597,6 +599,10 @@ def request_attach( args_dict["postRunCommands"] = postRunCo
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
https://github.com/santhoshe447 updated https://github.com/llvm/llvm-project/pull/91570 >From 960351c9abf51f42d92604ac6297aa5b76ddfba5 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 17 Nov 2023 15:09:10 +0530 Subject: [PATCH 01/14] [lldb][test] Add the ability to extract the variable value out of the summary. --- .../Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py | 3 +++ 1 file changed, 3 insertions(+) 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 9d79872b029a3..0cf9d4fde4948 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 @@ def collect_console(self, duration): 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"): >From ab44a6991c5bc8ac5764c3f71cbe3acc747b3776 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 3 May 2024 02:47:05 -0700 Subject: [PATCH 02/14] [lldb-dap] Added "port" property to vscode "attach" command. Adding a "port" property to the VsCode "attach" command likely extends the functionality of the debugger configuratiuon to allow attaching to a process using PID or PORT number. Currently, the "Attach" configuration lets the user specify a pid. We tell the user to use the attachCommands property to run "gdb-remote ". Followed the below conditions for "attach" command with "port" and "pid" We should add a "port" property. If port is specified and pid is not, use that port to attach. If both port and pid are specified, return an error saying that the user can't specify both pid and port. Ex - launch.json { "version": "0.2.0", "configurations": [ { "name": "lldb-dap Debug", "type": "lldb-dap", "request": "attach", "port":1234, "program": "${workspaceFolder}/a.out", "args": [], "stopOnEntry": false, "cwd": "${workspaceFolder}", "env": [], } ] } --- lldb/include/lldb/lldb-defines.h | 1 + .../Python/lldbsuite/test/lldbtest.py | 9 ++ .../test/tools/lldb-dap/dap_server.py | 6 + .../test/tools/lldb-dap/lldbdap_testcase.py | 20 +++ .../attach/TestDAP_attachByPortNum.py | 120 ++ lldb/tools/lldb-dap/lldb-dap.cpp | 36 +- lldb/tools/lldb-dap/package.json | 11 ++ 7 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py diff --git a/lldb/include/lldb/lldb-defines.h b/lldb/include/lldb/lldb-defines.h index c7bd019c5c90e..a1e6ee2ce468c 100644 --- a/lldb/include/lldb/lldb-defines.h +++ b/lldb/include/lldb/lldb-defines.h @@ -96,6 +96,7 @@ #define LLDB_INVALID_QUEUE_ID 0 #define LLDB_INVALID_CPU_ID UINT32_MAX #define LLDB_INVALID_WATCHPOINT_RESOURCE_ID UINT32_MAX +#define LLDB_INVALID_PORT_NUMBER 0 /// CPU Type definitions #define LLDB_ARCH_DEFAULT "systemArch" diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 5fd686c143e9f..fb3cd22959df2 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1572,6 +1572,15 @@ def findBuiltClang(self): return os.environ["CC"] +def getBuiltServerTool(self, server_tool): +# Tries to find simulation/lldb-server/gdbserver tool at the same folder as the lldb. +lldb_dir = os.path.dirname(lldbtest_config.lldbExec) +path = shutil.which(server_tool, path=lldb_dir) +if path is not None: +return path + +return "" + def yaml2obj(self, yaml_path, obj_path, max_size=None): """ Create an object file at the given path from a yaml file. diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 5838281bcb1a1..96d312565f953 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -568,6 +568,8 @@ def request_attach( coreFile=None, postRunCommands=None, sourceMap=None, +port=None, +hostname=None ): args_dict = {} if pid is not None: @@ -597,6 +599,10 @@ def request_attach( args_dict["postRunCommands"] = postRunCo
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
@@ -0,0 +1,142 @@ +""" +Test lldb-dap "port" configuration to "attach" request +""" + + +import dap_server +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil +from lldbsuite.test import lldbplatformutil +import lldbgdbserverutils +import lldbdap_testcase +import os +import shutil +import subprocess +import tempfile +import threading +import time +import sys +import socket + + +class TestDAP_attachByPortNum(lldbdap_testcase.DAPTestCaseBase): +def get_free_port(self): +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.bind(("", 0)) +port = s.getsockname()[1] +s.close() +return port santhoshe447 wrote: Thank you very much for taking the time to review my work. I truly appreciate your suggestions. Your feedback has been very helpful in improving my work. I have pushed latest changes as per your suggestions. https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
@@ -348,6 +348,17 @@ "type": "string", "description": "The time in seconds to wait for a program to stop when attaching using \"attachCommands\". Defaults to 30 seconds." }, + "port": { +"type": [ + "number", + "string" +], +"description": "TCP/IP port to attach to. Specifying both pid and port is an error." + }, santhoshe447 wrote: Renamed "port" and "hostname" to "gdb-remote-port" and "gdb-remote-hostname" https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
dwblaikie wrote: > > > You can repro this by running ./bin/lldb-dotest -p > > > TestConstStaticIntegralMember.py --dwarf-version 5 > > > Could you take a look @ZequanWu ? > > > > > > It should be fixed by the following diff. We just need to skip the > > declaration DIEs that are struct/class/union. This failure you see is > > caused by skipping a declaration DIE `DW_TAG_variable`. > > ``` > > diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp > > b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp > > index 56717bab1ecd..6330470b970e 100644 > > --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp > > +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp > > @@ -87,7 +87,8 @@ bool DebugNamesDWARFIndex::ProcessEntry( > > return true; > >// Clang erroneously emits index entries for declaration DIEs in case > > when the > >// definition is in a type unit (llvm.org/pr77696). Weed those out. > > - if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) > > + if (die.IsStructUnionOrClass() && > > + die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) > > return true; > >return callback(die); > > } > > ``` > > > > > > > > > > > > > > > > > > > > > > > > Can you (or anyone with commit access) commit above fix for me? I somehow > > cannot pull/push from github. > > Ah right, I remember encountering these `DW_AT_declaration`s in the index for > DWARFv5 static member variables. Technically this isn't standard conforming > right? I thought anything `DW_AT_declaration` shouldn't be indexed (though in > the case of these static variables it's very useful that they do, because we > don't emit definitions for these constants that the debugger could look for > instead). @dwblaikie @felipepiovezan Should we allow such entries in the > index? And does this warrant rephrasing in the DWARF spec? At least we aren't producing that on x86 from the compiler: https://godbolt.org/z/ereKsasWf ``` ... 0x0029: DW_TAG_variable DW_AT_name("i") DW_AT_type(0x0033 "const int") DW_AT_decl_file ("/app/example.cpp") DW_AT_decl_line (2) DW_AT_external(true) DW_AT_declaration (true) DW_AT_const_value (3) ... ``` and the `.debug_names` only includes `t1`, `main`, and `int`, nothing for `i`. Ah, right - some of the previous context on this is https://github.com/llvm/llvm-project/pull/70639 (which got reverted in https://github.com/llvm/llvm-project/pull/74580 )- though I guess we probably had some discourse and dwarf workgroup discussions about how to do this that aren't likned from the PR... maybe it was all private chat, not sure. https://github.com/llvm/llvm-project/pull/92328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DebugNames] Only skip processing of DW_AT_declarations for claโฆ (PR #94400)
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/94400 โฆss/union types This is a follow-up of https://github.com/llvm/llvm-project/pull/92328#issuecomment-2145849441 Clang attaches `DW_AT_declaration` to static inline data members and `dsymutil` indexes these constants. Skipping these caused the expression evaluator to fail to find such constants when using DWARFv5. Fixes `TestConstStaticIntegralMember.py` on DWARFv5. >From ddf20047e2868eed14c9691d72eb4c45ac582840 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Tue, 4 Jun 2024 21:52:26 +0100 Subject: [PATCH] [lldb][DebugNames] Only skip processing of DW_AT_declarations for class/union types This is a follow-up of https://github.com/llvm/llvm-project/pull/92328#issuecomment-2145849441 Clang attaches `DW_AT_declaration` to static inline data members and `dsymutil` indexes these constants. Skipping these caused the expression evaluator to fail to find such constants when using DWARFv5. Fixes `TestConstStaticIntegralMember.py` on DWARFv5. --- lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp index 56717bab1ecd8..6330470b970e7 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -87,7 +87,8 @@ bool DebugNamesDWARFIndex::ProcessEntry( return true; // Clang erroneously emits index entries for declaration DIEs in case when the // definition is in a type unit (llvm.org/pr77696). Weed those out. - if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) + if (die.IsStructUnionOrClass() && + die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) return true; return callback(die); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DebugNames] Only skip processing of DW_AT_declarations for claโฆ (PR #94400)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/94400 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DebugNames] Only skip processing of DW_AT_declarations for class/union types (PR #94400)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/94400 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DebugNames] Only skip processing of DW_AT_declarations for class/union types (PR #94400)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Michael Buch (Michael137) Changes This is a follow-up of https://github.com/llvm/llvm-project/pull/92328#issuecomment-2145849441 Clang attaches `DW_AT_declaration` to static inline data members and `dsymutil` indexes these constants. Skipping these caused the expression evaluator to fail to find such constants when using DWARFv5. Fixes `TestConstStaticIntegralMember.py` on DWARFv5. --- Full diff: https://github.com/llvm/llvm-project/pull/94400.diff 1 Files Affected: - (modified) lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp (+2-1) ``diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp index 56717bab1ecd8..6330470b970e7 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -87,7 +87,8 @@ bool DebugNamesDWARFIndex::ProcessEntry( return true; // Clang erroneously emits index entries for declaration DIEs in case when the // definition is in a type unit (llvm.org/pr77696). Weed those out. - if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) + if (die.IsStructUnionOrClass() && + die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) return true; return callback(die); } `` https://github.com/llvm/llvm-project/pull/94400 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DebugNames] Only skip processing of DW_AT_declarations for class/union types (PR #94400)
Michael137 wrote: We might want to consider not omitting these constants into the index with dsymutil (since it's not spec conforming). And instead fix the expression evaluator to find the constants from context (but iirc that was a non-trivial undertaking). https://github.com/llvm/llvm-project/pull/94400 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DebugNames] Only skip processing of DW_AT_declarations for class/union types (PR #94400)
https://github.com/felipepiovezan approved this pull request. https://github.com/llvm/llvm-project/pull/94400 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 679f75e - [easy] Fix spacing in help message of 'process save-core' command (#89445)
Author: Michael Christensen Date: 2024-06-04T14:02:41-07:00 New Revision: 679f75e24b81c3ba4a7666ad1f08aa40a6fdddfa URL: https://github.com/llvm/llvm-project/commit/679f75e24b81c3ba4a7666ad1f08aa40a6fdddfa DIFF: https://github.com/llvm/llvm-project/commit/679f75e24b81c3ba4a7666ad1f08aa40a6fdddfa.diff LOG: [easy] Fix spacing in help message of 'process save-core' command (#89445) Very minor change to help message on `process save-core`. Adds space between two sentences explaining the `-p` option: "Specify a plugin name to create the core file.This allows core files to be saved in different formats." --> "Specify a plugin name to create the core file. This allows core files to be saved in different formats." Before: ``` (lldb) help process save-core Save the current process as a core file using an appropriate file type. Syntax: process save-core [-s corefile-style -p plugin-name] FILE Command Options Usage: process save-core [-p[]] [-s ] -p[] ( --plugin-name=[] ) Specify a plugin name to create the core file.This allows core files to be saved in different formats. -s ( --style ) Request a specific style of corefile to be saved. Values: full | modified-memory | stack This command takes options and free-form arguments. If your arguments resemble option specifiers (i.e., they start with a - or --), you must use ' -- ' between the end of the command options and the beginning of the arguments. ``` After: ``` michristensen@devbig356 build/Debug ยป $HOME/llvm-sand/build/Debug/bin/lldb -x (lldb) help process save-core Save the current process as a core file using an appropriate file type. Syntax: process save-core [-s corefile-style -p plugin-name] FILE Command Options Usage: process save-core [-p[]] [-s ] -p[] ( --plugin-name=[] ) Specify a plugin name to create the core file. This allows core files to be saved in different formats. -s ( --style ) Request a specific style of corefile to be saved. Values: full | modified-memory | stack This command takes options and free-form arguments. If your arguments resemble option specifiers (i.e., they start with a - or --), you must use ' -- ' between the end of the command options and the beginning of the arguments. ``` Added: Modified: lldb/source/Commands/Options.td Removed: diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td index 194902abdce49..cee5a81d3796b 100644 --- a/lldb/source/Commands/Options.td +++ b/lldb/source/Commands/Options.td @@ -784,7 +784,7 @@ let Command = "process save_core" in { EnumArg<"SaveCoreStyle">, Desc<"Request a specific style " "of corefile to be saved.">; def process_save_core_plugin_name : Option<"plugin-name", "p">, -OptionalArg<"Plugin">, Desc<"Specify a plugin name to create the core file." +OptionalArg<"Plugin">, Desc<"Specify a plugin name to create the core file. " "This allows core files to be saved in diff erent formats.">; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [easy] Fix spacing in help message of 'process save-core' command (PR #89445)
https://github.com/GeorgeHuyubo closed https://github.com/llvm/llvm-project/pull/89445 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DebugNames] Only skip processing of DW_AT_declarations for class/union types (PR #94400)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/94400 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] afe6ab7 - [lldb][DebugNames] Only skip processing of DW_AT_declarations for class/union types (#94400)
Author: Michael Buch Date: 2024-06-04T22:17:51+01:00 New Revision: afe6ab7586f7078cc410f6162bd9851e48e2a286 URL: https://github.com/llvm/llvm-project/commit/afe6ab7586f7078cc410f6162bd9851e48e2a286 DIFF: https://github.com/llvm/llvm-project/commit/afe6ab7586f7078cc410f6162bd9851e48e2a286.diff LOG: [lldb][DebugNames] Only skip processing of DW_AT_declarations for class/union types (#94400) This is a follow-up of https://github.com/llvm/llvm-project/pull/92328#issuecomment-2145849441 Clang attaches `DW_AT_declaration` to static inline data members and `dsymutil` indexes these constants. Skipping these caused the expression evaluator to fail to find such constants when using DWARFv5. Fixes `TestConstStaticIntegralMember.py` on DWARFv5. Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp index 56717bab1ecd8..6330470b970e7 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -87,7 +87,8 @@ bool DebugNamesDWARFIndex::ProcessEntry( return true; // Clang erroneously emits index entries for declaration DIEs in case when the // definition is in a type unit (llvm.org/pr77696). Weed those out. - if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) + if (die.IsStructUnionOrClass() && + die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) return true; return callback(die); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix formatter tests for clang version 15 (PR #93710)
https://github.com/mbucko closed https://github.com/llvm/llvm-project/pull/93710 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix formatter tests for clang version 15 (PR #93710)
mbucko wrote: No longer needed, failing tests were due to local version override https://github.com/llvm/llvm-project/pull/93710 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] Refactor GDB Index into a new file (PR #94405)
https://github.com/sayhaan created https://github.com/llvm/llvm-project/pull/94405 Create a new class and file for functions that update GDB index. >From f3533c92b6b64f50a933a9eb2f9cc4229bbd8da3 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Tue, 1 Jun 2021 11:37:41 -0700 Subject: [PATCH 1/7] Rebase: [Facebook] Add clang driver options to test debug info and BOLT Summary: This is an essential piece of infrastructure for us to be continuously testing debug info with BOLT. We can't only make changes to a test repo because we need to change debuginfo tests to call BOLT, hence, this diff needs to sit in our opensource repo. But when upstreaming to LLVM, this should be kept BOLT-only outside of LLVM. When upstreaming, we need to git diff and check all folders that are being modified by our commits and discard this one (and leave as an internal diff). To test BOLT in debuginfo tests, configure it with -DLLVM_TEST_BOLT=ON. Then run check-lldb and check-debuginfo. Manual rebase conflict history: https://phabricator.intern.facebook.com/D29205224 https://phabricator.intern.facebook.com/D29564078 https://phabricator.intern.facebook.com/D33289118 https://phabricator.intern.facebook.com/D34957174 https://phabricator.intern.facebook.com/D35317341 Test Plan: tested locally Configured with: -DLLVM_ENABLE_PROJECTS="clang;lld;lldb;compiler-rt;bolt;debuginfo-tests" -DLLVM_TEST_BOLT=ON Ran test suite with: ninja check-debuginfo ninja check-lldb Reviewers: maks, #llvm-bolt Reviewed By: maks Subscribers: ayermolo, phabricatorlinter Differential Revision: https://phabricator.intern.facebook.com/D46256657 Tasks: T92898286 --- clang/include/clang/Driver/Options.td | 4 clang/lib/Driver/ToolChains/Gnu.cpp| 29 ++ cross-project-tests/lit.cfg.py | 14 - cross-project-tests/lit.site.cfg.py.in | 4 lldb/test/API/lit.cfg.py | 5 + lldb/test/API/lit.site.cfg.py.in | 8 +++ lldb/test/Shell/helper/toolchain.py| 5 + lldb/test/Shell/lit.site.cfg.py.in | 9 llvm/CMakeLists.txt| 4 9 files changed, 81 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 57f37c5023110f..7469db06839e3b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5465,6 +5465,10 @@ def pg : Flag<["-"], "pg">, HelpText<"Enable mcount instrumentation">, MarshallingInfoFlag>; def pipe : Flag<["-", "--"], "pipe">, HelpText<"Use pipes between commands, when possible">; +// Facebook T92898286 +def post_link_optimize : Flag<["--"], "post-link-optimize">, + HelpText<"Apply post-link optimizations using BOLT">; +// End Facebook T92898286 def prebind__all__twolevel__modules : Flag<["-"], "prebind_all_twolevel_modules">; def prebind : Flag<["-"], "prebind">; def preload : Flag<["-"], "preload">; diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index b141e5f2adfab1..f7611af5763ab7 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -672,12 +672,41 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, } } + // Facebook T92898286 + if (Args.hasArg(options::OPT_post_link_optimize)) +CmdArgs.push_back("-q"); + // End Facebook T92898286 + Args.AddAllArgs(CmdArgs, options::OPT_T); const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath()); C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs, Output)); + // Facebook T92898286 + if (!Args.hasArg(options::OPT_post_link_optimize) || !Output.isFilename()) +return; + + const char *MvExec = Args.MakeArgString(ToolChain.GetProgramPath("mv")); + ArgStringList MoveCmdArgs; + MoveCmdArgs.push_back(Output.getFilename()); + const char *PreBoltBin = + Args.MakeArgString(Twine(Output.getFilename()) + ".pre-bolt"); + MoveCmdArgs.push_back(PreBoltBin); + C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::None(), + MvExec, MoveCmdArgs, std::nullopt)); + + ArgStringList BoltCmdArgs; + const char *BoltExec = + Args.MakeArgString(ToolChain.GetProgramPath("llvm-bolt")); + BoltCmdArgs.push_back(PreBoltBin); + BoltCmdArgs.push_back("-reorder-blocks=reverse"); + BoltCmdArgs.push_back("-update-debug-sections"); + BoltCmdArgs.push_back("-o"); + BoltCmdArgs.push_back(Output.getFilename()); + C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::None(), + BoltExec, BoltCmdArgs, std::nullopt)); + // End Facebook T92898286 } void tools::gnutools::Assembler::ConstructJob(Compilation &C, diff --git a/cross-project-tests/lit.cfg.py b/cross-project-tests/lit.cfg.py index 774c4eaf4d
[Lldb-commits] [clang] [lldb] [llvm] Refactor GDB Index into a new file (PR #94405)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Sayhaan Siddiqui (sayhaan) Changes Create a new class and file for functions that update GDB index. --- Patch is 40.93 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/94405.diff 24 Files Affected: - (added) bolt/include/bolt/Core/GDBIndex.h (+60) - (modified) bolt/lib/Core/BinaryEmitter.cpp (+1) - (modified) bolt/lib/Core/CMakeLists.txt (+1) - (added) bolt/lib/Core/GDBIndex.cpp (+182) - (modified) bolt/lib/Passes/ValidateMemRefs.cpp (+5-6) - (modified) clang/include/clang/Driver/Options.td (+4) - (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+29) - (modified) cross-project-tests/lit.cfg.py (+13-1) - (modified) cross-project-tests/lit.site.cfg.py.in (+4) - (modified) lldb/test/API/lit.cfg.py (+5) - (modified) lldb/test/API/lit.site.cfg.py.in (+8) - (modified) lldb/test/Shell/helper/toolchain.py (+5) - (modified) lldb/test/Shell/lit.site.cfg.py.in (+9) - (modified) llvm/CMakeLists.txt (+4) - (modified) llvm/include/llvm/MC/MCFragment.h (+22) - (modified) llvm/include/llvm/MC/MCObjectStreamer.h (+2) - (modified) llvm/include/llvm/MC/MCStreamer.h (+6) - (modified) llvm/lib/MC/MCAssembler.cpp (+81-37) - (modified) llvm/lib/MC/MCExpr.cpp (+2-8) - (modified) llvm/lib/MC/MCFragment.cpp (+12) - (modified) llvm/lib/MC/MCObjectStreamer.cpp (+5) - (modified) llvm/lib/MC/MCStreamer.cpp (+2) - (modified) llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp (+24) - (added) llvm/test/MC/X86/directive-avoid_end_align.s (+208) ``diff diff --git a/bolt/include/bolt/Core/GDBIndex.h b/bolt/include/bolt/Core/GDBIndex.h new file mode 100644 index 00..0ea588e9cba465 --- /dev/null +++ b/bolt/include/bolt/Core/GDBIndex.h @@ -0,0 +1,60 @@ +//===-- bolt/Core/GDBIndex.h - GDB Index support ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +/// +/// This file contains declaration of classes required for generation of +/// .gdb_index section. +/// +//===--===// + +#ifndef BOLT_CORE_GDB_INDEX_H +#define BOLT_CORE_GDB_INDEX_H + +#include "bolt/Core/BinaryContext.h" +#include + +namespace llvm { +namespace bolt { + +class GDBIndex { +public: + /// Contains information about TU so we can write out correct entries in GDB + /// index. + struct GDBIndexTUEntry { +uint64_t UnitOffset; +uint64_t TypeHash; +uint64_t TypeDIERelativeOffset; + }; + +private: + BinaryContext &BC; + + /// Entries for GDB Index Types CU List + using GDBIndexTUEntryType = std::vector; + GDBIndexTUEntryType GDBIndexTUEntryVector; + +public: + GDBIndex(BinaryContext &BC) : BC(BC) {} + + /// Adds an GDBIndexTUEntry if .gdb_index section exists. + void addGDBTypeUnitEntry(const GDBIndexTUEntry &Entry); + + /// Rewrite .gdb_index section if present. + void updateGdbIndexSection( + CUOffsetMap &CUMap, uint32_t NumCUs, + std::unique_ptr &ARangesSectionWriter); + + /// Returns all entries needed for Types CU list + const GDBIndexTUEntryType &getGDBIndexTUEntryVector() const { +return GDBIndexTUEntryVector; + } +}; + +} // namespace bolt +} // namespace llvm + +#endif diff --git a/bolt/lib/Core/BinaryEmitter.cpp b/bolt/lib/Core/BinaryEmitter.cpp index 0b44acb0816f2f..e09b9ff92de064 100644 --- a/bolt/lib/Core/BinaryEmitter.cpp +++ b/bolt/lib/Core/BinaryEmitter.cpp @@ -485,6 +485,7 @@ void BinaryEmitter::emitFunctionBody(BinaryFunction &BF, FunctionFragment &FF, // This assumes the second instruction in the macro-op pair will get // assigned to its own MCRelaxableFragment. Since all JCC instructions // are relaxable, we should be safe. +Streamer.emitNeverAlignCodeAtEnd(/*Alignment to avoid=*/64, *BC.STI); } if (!EmitCodeOnly) { diff --git a/bolt/lib/Core/CMakeLists.txt b/bolt/lib/Core/CMakeLists.txt index 441df9fe084648..873cf67a56291f 100644 --- a/bolt/lib/Core/CMakeLists.txt +++ b/bolt/lib/Core/CMakeLists.txt @@ -25,6 +25,7 @@ add_llvm_library(LLVMBOLTCore DynoStats.cpp Exceptions.cpp FunctionLayout.cpp + GDBIndex.cpp HashUtilities.cpp JumpTable.cpp MCPlusBuilder.cpp diff --git a/bolt/lib/Core/GDBIndex.cpp b/bolt/lib/Core/GDBIndex.cpp new file mode 100644 index 00..fda19a2c8cb3ef --- /dev/null +++ b/bolt/lib/Core/GDBIndex.cpp @@ -0,0 +1,182 @@ +//===- bolt/Rewrite/GDBIndex.cpp -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===-
[Lldb-commits] [clang] [lldb] [llvm] Refactor GDB Index into a new file (PR #94405)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Sayhaan Siddiqui (sayhaan) Changes Create a new class and file for functions that update GDB index. --- Patch is 40.93 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/94405.diff 24 Files Affected: - (added) bolt/include/bolt/Core/GDBIndex.h (+60) - (modified) bolt/lib/Core/BinaryEmitter.cpp (+1) - (modified) bolt/lib/Core/CMakeLists.txt (+1) - (added) bolt/lib/Core/GDBIndex.cpp (+182) - (modified) bolt/lib/Passes/ValidateMemRefs.cpp (+5-6) - (modified) clang/include/clang/Driver/Options.td (+4) - (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+29) - (modified) cross-project-tests/lit.cfg.py (+13-1) - (modified) cross-project-tests/lit.site.cfg.py.in (+4) - (modified) lldb/test/API/lit.cfg.py (+5) - (modified) lldb/test/API/lit.site.cfg.py.in (+8) - (modified) lldb/test/Shell/helper/toolchain.py (+5) - (modified) lldb/test/Shell/lit.site.cfg.py.in (+9) - (modified) llvm/CMakeLists.txt (+4) - (modified) llvm/include/llvm/MC/MCFragment.h (+22) - (modified) llvm/include/llvm/MC/MCObjectStreamer.h (+2) - (modified) llvm/include/llvm/MC/MCStreamer.h (+6) - (modified) llvm/lib/MC/MCAssembler.cpp (+81-37) - (modified) llvm/lib/MC/MCExpr.cpp (+2-8) - (modified) llvm/lib/MC/MCFragment.cpp (+12) - (modified) llvm/lib/MC/MCObjectStreamer.cpp (+5) - (modified) llvm/lib/MC/MCStreamer.cpp (+2) - (modified) llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp (+24) - (added) llvm/test/MC/X86/directive-avoid_end_align.s (+208) ``diff diff --git a/bolt/include/bolt/Core/GDBIndex.h b/bolt/include/bolt/Core/GDBIndex.h new file mode 100644 index 00..0ea588e9cba465 --- /dev/null +++ b/bolt/include/bolt/Core/GDBIndex.h @@ -0,0 +1,60 @@ +//===-- bolt/Core/GDBIndex.h - GDB Index support ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +/// +/// This file contains declaration of classes required for generation of +/// .gdb_index section. +/// +//===--===// + +#ifndef BOLT_CORE_GDB_INDEX_H +#define BOLT_CORE_GDB_INDEX_H + +#include "bolt/Core/BinaryContext.h" +#include + +namespace llvm { +namespace bolt { + +class GDBIndex { +public: + /// Contains information about TU so we can write out correct entries in GDB + /// index. + struct GDBIndexTUEntry { +uint64_t UnitOffset; +uint64_t TypeHash; +uint64_t TypeDIERelativeOffset; + }; + +private: + BinaryContext &BC; + + /// Entries for GDB Index Types CU List + using GDBIndexTUEntryType = std::vector; + GDBIndexTUEntryType GDBIndexTUEntryVector; + +public: + GDBIndex(BinaryContext &BC) : BC(BC) {} + + /// Adds an GDBIndexTUEntry if .gdb_index section exists. + void addGDBTypeUnitEntry(const GDBIndexTUEntry &Entry); + + /// Rewrite .gdb_index section if present. + void updateGdbIndexSection( + CUOffsetMap &CUMap, uint32_t NumCUs, + std::unique_ptr &ARangesSectionWriter); + + /// Returns all entries needed for Types CU list + const GDBIndexTUEntryType &getGDBIndexTUEntryVector() const { +return GDBIndexTUEntryVector; + } +}; + +} // namespace bolt +} // namespace llvm + +#endif diff --git a/bolt/lib/Core/BinaryEmitter.cpp b/bolt/lib/Core/BinaryEmitter.cpp index 0b44acb0816f2f..e09b9ff92de064 100644 --- a/bolt/lib/Core/BinaryEmitter.cpp +++ b/bolt/lib/Core/BinaryEmitter.cpp @@ -485,6 +485,7 @@ void BinaryEmitter::emitFunctionBody(BinaryFunction &BF, FunctionFragment &FF, // This assumes the second instruction in the macro-op pair will get // assigned to its own MCRelaxableFragment. Since all JCC instructions // are relaxable, we should be safe. +Streamer.emitNeverAlignCodeAtEnd(/*Alignment to avoid=*/64, *BC.STI); } if (!EmitCodeOnly) { diff --git a/bolt/lib/Core/CMakeLists.txt b/bolt/lib/Core/CMakeLists.txt index 441df9fe084648..873cf67a56291f 100644 --- a/bolt/lib/Core/CMakeLists.txt +++ b/bolt/lib/Core/CMakeLists.txt @@ -25,6 +25,7 @@ add_llvm_library(LLVMBOLTCore DynoStats.cpp Exceptions.cpp FunctionLayout.cpp + GDBIndex.cpp HashUtilities.cpp JumpTable.cpp MCPlusBuilder.cpp diff --git a/bolt/lib/Core/GDBIndex.cpp b/bolt/lib/Core/GDBIndex.cpp new file mode 100644 index 00..fda19a2c8cb3ef --- /dev/null +++ b/bolt/lib/Core/GDBIndex.cpp @@ -0,0 +1,182 @@ +//===- bolt/Rewrite/GDBIndex.cpp -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===
[Lldb-commits] [clang] [lldb] [llvm] Refactor GDB Index into a new file (PR #94405)
https://github.com/sayhaan updated https://github.com/llvm/llvm-project/pull/94405 >From f3533c92b6b64f50a933a9eb2f9cc4229bbd8da3 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Tue, 1 Jun 2021 11:37:41 -0700 Subject: [PATCH 1/2] Rebase: [Facebook] Add clang driver options to test debug info and BOLT Summary: This is an essential piece of infrastructure for us to be continuously testing debug info with BOLT. We can't only make changes to a test repo because we need to change debuginfo tests to call BOLT, hence, this diff needs to sit in our opensource repo. But when upstreaming to LLVM, this should be kept BOLT-only outside of LLVM. When upstreaming, we need to git diff and check all folders that are being modified by our commits and discard this one (and leave as an internal diff). To test BOLT in debuginfo tests, configure it with -DLLVM_TEST_BOLT=ON. Then run check-lldb and check-debuginfo. Manual rebase conflict history: https://phabricator.intern.facebook.com/D29205224 https://phabricator.intern.facebook.com/D29564078 https://phabricator.intern.facebook.com/D33289118 https://phabricator.intern.facebook.com/D34957174 https://phabricator.intern.facebook.com/D35317341 Test Plan: tested locally Configured with: -DLLVM_ENABLE_PROJECTS="clang;lld;lldb;compiler-rt;bolt;debuginfo-tests" -DLLVM_TEST_BOLT=ON Ran test suite with: ninja check-debuginfo ninja check-lldb Reviewers: maks, #llvm-bolt Reviewed By: maks Subscribers: ayermolo, phabricatorlinter Differential Revision: https://phabricator.intern.facebook.com/D46256657 Tasks: T92898286 --- clang/include/clang/Driver/Options.td | 4 clang/lib/Driver/ToolChains/Gnu.cpp| 29 ++ cross-project-tests/lit.cfg.py | 14 - cross-project-tests/lit.site.cfg.py.in | 4 lldb/test/API/lit.cfg.py | 5 + lldb/test/API/lit.site.cfg.py.in | 8 +++ lldb/test/Shell/helper/toolchain.py| 5 + lldb/test/Shell/lit.site.cfg.py.in | 9 llvm/CMakeLists.txt| 4 9 files changed, 81 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 57f37c5023110f..7469db06839e3b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5465,6 +5465,10 @@ def pg : Flag<["-"], "pg">, HelpText<"Enable mcount instrumentation">, MarshallingInfoFlag>; def pipe : Flag<["-", "--"], "pipe">, HelpText<"Use pipes between commands, when possible">; +// Facebook T92898286 +def post_link_optimize : Flag<["--"], "post-link-optimize">, + HelpText<"Apply post-link optimizations using BOLT">; +// End Facebook T92898286 def prebind__all__twolevel__modules : Flag<["-"], "prebind_all_twolevel_modules">; def prebind : Flag<["-"], "prebind">; def preload : Flag<["-"], "preload">; diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index b141e5f2adfab1..f7611af5763ab7 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -672,12 +672,41 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, } } + // Facebook T92898286 + if (Args.hasArg(options::OPT_post_link_optimize)) +CmdArgs.push_back("-q"); + // End Facebook T92898286 + Args.AddAllArgs(CmdArgs, options::OPT_T); const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath()); C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs, Output)); + // Facebook T92898286 + if (!Args.hasArg(options::OPT_post_link_optimize) || !Output.isFilename()) +return; + + const char *MvExec = Args.MakeArgString(ToolChain.GetProgramPath("mv")); + ArgStringList MoveCmdArgs; + MoveCmdArgs.push_back(Output.getFilename()); + const char *PreBoltBin = + Args.MakeArgString(Twine(Output.getFilename()) + ".pre-bolt"); + MoveCmdArgs.push_back(PreBoltBin); + C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::None(), + MvExec, MoveCmdArgs, std::nullopt)); + + ArgStringList BoltCmdArgs; + const char *BoltExec = + Args.MakeArgString(ToolChain.GetProgramPath("llvm-bolt")); + BoltCmdArgs.push_back(PreBoltBin); + BoltCmdArgs.push_back("-reorder-blocks=reverse"); + BoltCmdArgs.push_back("-update-debug-sections"); + BoltCmdArgs.push_back("-o"); + BoltCmdArgs.push_back(Output.getFilename()); + C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::None(), + BoltExec, BoltCmdArgs, std::nullopt)); + // End Facebook T92898286 } void tools::gnutools::Assembler::ConstructJob(Compilation &C, diff --git a/cross-project-tests/lit.cfg.py b/cross-project-tests/lit.cfg.py index 774c4eaf4d976b..619634578dfe60 100644 --- a/cross-project-tests/lit.cfg.py +
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
santhoshe447 wrote: > FWIW, I think this feature would be more useful and easier to implement if > there was just a single setting called "connection url" or something, which > accepted all of the usual lldb connection urls (unix-abstract-connect://, > listen://, ...). > > Since a simple tcp port connection is definitely going to be the most > commonly used connection, you can, if you want, treat a simple number (or > `:number`) as an alias to `connect://localhost:number`. lldb-server does > something similar. > > PS: I'm clicking request changes because I don't believe the test for the > feature can go in in this form. I don't consider myself an owner for the > rest, so you can consider my comments as suggestions. I apologize for missing your earlier comment. To clarify. Using the URL "connect://localhost:12345" or "connect://:12345" with the "connect" scheme helps invoke the appropriate function to establish a connection. Pls ref: https://github.com/llvm/llvm-project/blob/main/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp#L148 $gdb-remote number - would work from the command-line, because lldb is taking care of adding "connect://". Please let me know if my understating is incorrect. https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb] Return an llvm::Expected from DWARFExpression::Evaluate (NFCI) (PR #94420)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/94420 Change the interface of DWARFExpression::Evaluate and DWARFExpressionList::Evaluate to return an llvm::Expected instead of a boolean. This eliminates the Status output parameter and improves error handling. >From 22bb28a5e3fc84c75e1013c3b0c15654e7b786da Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 4 Jun 2024 17:04:15 -0700 Subject: [PATCH 1/2] [Support] Add variadic createStringError overload (NFC) --- llvm/include/llvm/Support/Error.h | 5 + 1 file changed, 5 insertions(+) diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h index 662c3ea46e3c1..1fa0d8cb709cc 100644 --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -1277,6 +1277,11 @@ inline Error createStringError(const Twine &S) { return createStringError(llvm::inconvertibleErrorCode(), S); } +template +inline Error createStringError(char const *Fmt, const Ts &...Vals) { + return createStringError(llvm::inconvertibleErrorCode(), Fmt, Vals...); +} + template inline Error createStringError(std::errc EC, char const *Fmt, const Ts &... Vals) { >From d5c288ddb9473a52a8635a32d3a5cc057c9cb986 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 4 Jun 2024 19:04:07 -0700 Subject: [PATCH 2/2] [lldb] Return an llvm::Expected from DWARFExpression::Evaluate (NFCI) Change the interface of DWARFExpression::Evaluate and DWARFExpressionList::Evaluate to return an llvm::Expected instead of a boolean. This eliminates the Status output parameter and improves error handling. --- .../include/lldb/Expression/DWARFExpression.h | 13 +- .../lldb/Expression/DWARFExpressionList.h | 10 +- lldb/source/Core/ValueObjectVariable.cpp | 8 +- lldb/source/Expression/DWARFExpression.cpp| 747 +++--- .../source/Expression/DWARFExpressionList.cpp | 28 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 20 +- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 16 +- lldb/source/Symbol/Function.cpp | 17 +- lldb/source/Target/RegisterContextUnwind.cpp | 23 +- lldb/source/Target/StackFrame.cpp | 19 +- .../Expression/DWARFExpressionTest.cpp| 78 +- 11 files changed, 401 insertions(+), 578 deletions(-) diff --git a/lldb/include/lldb/Expression/DWARFExpression.h b/lldb/include/lldb/Expression/DWARFExpression.h index 1d85308d1caa7..e85ba464dea6b 100644 --- a/lldb/include/lldb/Expression/DWARFExpression.h +++ b/lldb/include/lldb/Expression/DWARFExpression.h @@ -132,13 +132,12 @@ class DWARFExpression { /// \return /// True on success; false otherwise. If error_ptr is non-NULL, /// details of the failure are provided through it. - static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, - lldb::ModuleSP module_sp, const DataExtractor &opcodes, - const plugin::dwarf::DWARFUnit *dwarf_cu, - const lldb::RegisterKind reg_set, - const Value *initial_value_ptr, - const Value *object_address_ptr, Value &result, - Status *error_ptr); + static llvm::Expected + Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, + lldb::ModuleSP module_sp, const DataExtractor &opcodes, + const plugin::dwarf::DWARFUnit *dwarf_cu, + const lldb::RegisterKind reg_set, const Value *initial_value_ptr, + const Value *object_address_ptr); static bool ParseDWARFLocationList(const plugin::dwarf::DWARFUnit *dwarf_cu, const DataExtractor &data, diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h index c2218ad4af0a7..f711a1cbe9bbd 100644 --- a/lldb/include/lldb/Expression/DWARFExpressionList.h +++ b/lldb/include/lldb/Expression/DWARFExpressionList.h @@ -9,6 +9,7 @@ #ifndef LLDB_EXPRESSION_DWARFEXPRESSIONLIST_H #define LLDB_EXPRESSION_DWARFEXPRESSIONLIST_H +#include "lldb/Core/Value.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Utility/RangeMap.h" #include "lldb/lldb-private.h" @@ -113,10 +114,11 @@ class DWARFExpressionList { void SetModule(const lldb::ModuleSP &module) { m_module_wp = module; } - bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, -lldb::addr_t func_load_addr, const Value *initial_value_ptr, -const Value *object_address_ptr, Value &result, -Status *error_ptr) const; + llvm::Expected Evaluate(ExecutionContext *exe_ctx, + RegisterContext *reg_ctx, + lldb::addr_t func_load_addr, + const Value *initial_value_ptr, + const Value *object_address_ptr) const; private: // RangeDa
[Lldb-commits] [lldb] [llvm] [lldb] Return an llvm::Expected from DWARFExpression::Evaluate (NFCI) (PR #94420)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes Change the interface of DWARFExpression::Evaluate and DWARFExpressionList::Evaluate to return an llvm::Expected instead of a boolean. This eliminates the Status output parameter and improves error handling. --- Patch is 78.24 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/94420.diff 12 Files Affected: - (modified) lldb/include/lldb/Expression/DWARFExpression.h (+6-7) - (modified) lldb/include/lldb/Expression/DWARFExpressionList.h (+6-4) - (modified) lldb/source/Core/ValueObjectVariable.cpp (+6-2) - (modified) lldb/source/Expression/DWARFExpression.cpp (+286-461) - (modified) lldb/source/Expression/DWARFExpressionList.cpp (+10-18) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (+12-8) - (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+9-7) - (modified) lldb/source/Symbol/Function.cpp (+9-8) - (modified) lldb/source/Target/RegisterContextUnwind.cpp (+12-11) - (modified) lldb/source/Target/StackFrame.cpp (+7-12) - (modified) lldb/unittests/Expression/DWARFExpressionTest.cpp (+38-40) - (modified) llvm/include/llvm/Support/Error.h (+5) ``diff diff --git a/lldb/include/lldb/Expression/DWARFExpression.h b/lldb/include/lldb/Expression/DWARFExpression.h index 1d85308d1caa7..e85ba464dea6b 100644 --- a/lldb/include/lldb/Expression/DWARFExpression.h +++ b/lldb/include/lldb/Expression/DWARFExpression.h @@ -132,13 +132,12 @@ class DWARFExpression { /// \return /// True on success; false otherwise. If error_ptr is non-NULL, /// details of the failure are provided through it. - static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, - lldb::ModuleSP module_sp, const DataExtractor &opcodes, - const plugin::dwarf::DWARFUnit *dwarf_cu, - const lldb::RegisterKind reg_set, - const Value *initial_value_ptr, - const Value *object_address_ptr, Value &result, - Status *error_ptr); + static llvm::Expected + Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, + lldb::ModuleSP module_sp, const DataExtractor &opcodes, + const plugin::dwarf::DWARFUnit *dwarf_cu, + const lldb::RegisterKind reg_set, const Value *initial_value_ptr, + const Value *object_address_ptr); static bool ParseDWARFLocationList(const plugin::dwarf::DWARFUnit *dwarf_cu, const DataExtractor &data, diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h index c2218ad4af0a7..f711a1cbe9bbd 100644 --- a/lldb/include/lldb/Expression/DWARFExpressionList.h +++ b/lldb/include/lldb/Expression/DWARFExpressionList.h @@ -9,6 +9,7 @@ #ifndef LLDB_EXPRESSION_DWARFEXPRESSIONLIST_H #define LLDB_EXPRESSION_DWARFEXPRESSIONLIST_H +#include "lldb/Core/Value.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Utility/RangeMap.h" #include "lldb/lldb-private.h" @@ -113,10 +114,11 @@ class DWARFExpressionList { void SetModule(const lldb::ModuleSP &module) { m_module_wp = module; } - bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, -lldb::addr_t func_load_addr, const Value *initial_value_ptr, -const Value *object_address_ptr, Value &result, -Status *error_ptr) const; + llvm::Expected Evaluate(ExecutionContext *exe_ctx, + RegisterContext *reg_ctx, + lldb::addr_t func_load_addr, + const Value *initial_value_ptr, + const Value *object_address_ptr) const; private: // RangeDataVector requires a comparator for DWARFExpression, but it doesn't diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index 67d71c90a959d..51eb11d3a189e 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -164,8 +164,11 @@ bool ValueObjectVariable::UpdateValue() { target); } Value old_value(m_value); -if (expr_list.Evaluate(&exe_ctx, nullptr, loclist_base_load_addr, nullptr, - nullptr, m_value, &m_error)) { +llvm::Expected maybe_value = expr_list.Evaluate( +&exe_ctx, nullptr, loclist_base_load_addr, nullptr, nullptr); + +if (maybe_value) { + m_value = *maybe_value; m_resolved_value = m_value; m_value.SetContext(Value::ContextType::Variable, variable); @@ -246,6 +249,7 @@ bool ValueObjectVariable::UpdateValue() { SetValueIsValid(m_error.Success()); } else { + m_error = maybe_value.takeError(); // could not find location, won't allow editing m_res
[Lldb-commits] [lldb] [llvm] [lldb] Return an llvm::Expected from DWARFExpression::Evaluate (NFCI) (PR #94420)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/94420 >From 22bb28a5e3fc84c75e1013c3b0c15654e7b786da Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 4 Jun 2024 17:04:15 -0700 Subject: [PATCH 1/3] [Support] Add variadic createStringError overload (NFC) --- llvm/include/llvm/Support/Error.h | 5 + 1 file changed, 5 insertions(+) diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h index 662c3ea46e3c1..1fa0d8cb709cc 100644 --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -1277,6 +1277,11 @@ inline Error createStringError(const Twine &S) { return createStringError(llvm::inconvertibleErrorCode(), S); } +template +inline Error createStringError(char const *Fmt, const Ts &...Vals) { + return createStringError(llvm::inconvertibleErrorCode(), Fmt, Vals...); +} + template inline Error createStringError(std::errc EC, char const *Fmt, const Ts &... Vals) { >From d5c288ddb9473a52a8635a32d3a5cc057c9cb986 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 4 Jun 2024 19:04:07 -0700 Subject: [PATCH 2/3] [lldb] Return an llvm::Expected from DWARFExpression::Evaluate (NFCI) Change the interface of DWARFExpression::Evaluate and DWARFExpressionList::Evaluate to return an llvm::Expected instead of a boolean. This eliminates the Status output parameter and improves error handling. --- .../include/lldb/Expression/DWARFExpression.h | 13 +- .../lldb/Expression/DWARFExpressionList.h | 10 +- lldb/source/Core/ValueObjectVariable.cpp | 8 +- lldb/source/Expression/DWARFExpression.cpp| 747 +++--- .../source/Expression/DWARFExpressionList.cpp | 28 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 20 +- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 16 +- lldb/source/Symbol/Function.cpp | 17 +- lldb/source/Target/RegisterContextUnwind.cpp | 23 +- lldb/source/Target/StackFrame.cpp | 19 +- .../Expression/DWARFExpressionTest.cpp| 78 +- 11 files changed, 401 insertions(+), 578 deletions(-) diff --git a/lldb/include/lldb/Expression/DWARFExpression.h b/lldb/include/lldb/Expression/DWARFExpression.h index 1d85308d1caa7..e85ba464dea6b 100644 --- a/lldb/include/lldb/Expression/DWARFExpression.h +++ b/lldb/include/lldb/Expression/DWARFExpression.h @@ -132,13 +132,12 @@ class DWARFExpression { /// \return /// True on success; false otherwise. If error_ptr is non-NULL, /// details of the failure are provided through it. - static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, - lldb::ModuleSP module_sp, const DataExtractor &opcodes, - const plugin::dwarf::DWARFUnit *dwarf_cu, - const lldb::RegisterKind reg_set, - const Value *initial_value_ptr, - const Value *object_address_ptr, Value &result, - Status *error_ptr); + static llvm::Expected + Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, + lldb::ModuleSP module_sp, const DataExtractor &opcodes, + const plugin::dwarf::DWARFUnit *dwarf_cu, + const lldb::RegisterKind reg_set, const Value *initial_value_ptr, + const Value *object_address_ptr); static bool ParseDWARFLocationList(const plugin::dwarf::DWARFUnit *dwarf_cu, const DataExtractor &data, diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h index c2218ad4af0a7..f711a1cbe9bbd 100644 --- a/lldb/include/lldb/Expression/DWARFExpressionList.h +++ b/lldb/include/lldb/Expression/DWARFExpressionList.h @@ -9,6 +9,7 @@ #ifndef LLDB_EXPRESSION_DWARFEXPRESSIONLIST_H #define LLDB_EXPRESSION_DWARFEXPRESSIONLIST_H +#include "lldb/Core/Value.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Utility/RangeMap.h" #include "lldb/lldb-private.h" @@ -113,10 +114,11 @@ class DWARFExpressionList { void SetModule(const lldb::ModuleSP &module) { m_module_wp = module; } - bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, -lldb::addr_t func_load_addr, const Value *initial_value_ptr, -const Value *object_address_ptr, Value &result, -Status *error_ptr) const; + llvm::Expected Evaluate(ExecutionContext *exe_ctx, + RegisterContext *reg_ctx, + lldb::addr_t func_load_addr, + const Value *initial_value_ptr, + const Value *object_address_ptr) const; private: // RangeDataVector requires a comparator for DWARFExpression, but it doesn't diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index 67d71c90a959d..51eb11d3a189e 100644 -
[Lldb-commits] [lldb] [llvm] [lldb] Return an llvm::Expected from DWARFExpression::Evaluate (NFCI) (PR #94420)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/94420 >From 22bb28a5e3fc84c75e1013c3b0c15654e7b786da Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 4 Jun 2024 17:04:15 -0700 Subject: [PATCH 1/4] [Support] Add variadic createStringError overload (NFC) --- llvm/include/llvm/Support/Error.h | 5 + 1 file changed, 5 insertions(+) diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h index 662c3ea46e3c1..1fa0d8cb709cc 100644 --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -1277,6 +1277,11 @@ inline Error createStringError(const Twine &S) { return createStringError(llvm::inconvertibleErrorCode(), S); } +template +inline Error createStringError(char const *Fmt, const Ts &...Vals) { + return createStringError(llvm::inconvertibleErrorCode(), Fmt, Vals...); +} + template inline Error createStringError(std::errc EC, char const *Fmt, const Ts &... Vals) { >From d5c288ddb9473a52a8635a32d3a5cc057c9cb986 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 4 Jun 2024 19:04:07 -0700 Subject: [PATCH 2/4] [lldb] Return an llvm::Expected from DWARFExpression::Evaluate (NFCI) Change the interface of DWARFExpression::Evaluate and DWARFExpressionList::Evaluate to return an llvm::Expected instead of a boolean. This eliminates the Status output parameter and improves error handling. --- .../include/lldb/Expression/DWARFExpression.h | 13 +- .../lldb/Expression/DWARFExpressionList.h | 10 +- lldb/source/Core/ValueObjectVariable.cpp | 8 +- lldb/source/Expression/DWARFExpression.cpp| 747 +++--- .../source/Expression/DWARFExpressionList.cpp | 28 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 20 +- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 16 +- lldb/source/Symbol/Function.cpp | 17 +- lldb/source/Target/RegisterContextUnwind.cpp | 23 +- lldb/source/Target/StackFrame.cpp | 19 +- .../Expression/DWARFExpressionTest.cpp| 78 +- 11 files changed, 401 insertions(+), 578 deletions(-) diff --git a/lldb/include/lldb/Expression/DWARFExpression.h b/lldb/include/lldb/Expression/DWARFExpression.h index 1d85308d1caa7..e85ba464dea6b 100644 --- a/lldb/include/lldb/Expression/DWARFExpression.h +++ b/lldb/include/lldb/Expression/DWARFExpression.h @@ -132,13 +132,12 @@ class DWARFExpression { /// \return /// True on success; false otherwise. If error_ptr is non-NULL, /// details of the failure are provided through it. - static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, - lldb::ModuleSP module_sp, const DataExtractor &opcodes, - const plugin::dwarf::DWARFUnit *dwarf_cu, - const lldb::RegisterKind reg_set, - const Value *initial_value_ptr, - const Value *object_address_ptr, Value &result, - Status *error_ptr); + static llvm::Expected + Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, + lldb::ModuleSP module_sp, const DataExtractor &opcodes, + const plugin::dwarf::DWARFUnit *dwarf_cu, + const lldb::RegisterKind reg_set, const Value *initial_value_ptr, + const Value *object_address_ptr); static bool ParseDWARFLocationList(const plugin::dwarf::DWARFUnit *dwarf_cu, const DataExtractor &data, diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h index c2218ad4af0a7..f711a1cbe9bbd 100644 --- a/lldb/include/lldb/Expression/DWARFExpressionList.h +++ b/lldb/include/lldb/Expression/DWARFExpressionList.h @@ -9,6 +9,7 @@ #ifndef LLDB_EXPRESSION_DWARFEXPRESSIONLIST_H #define LLDB_EXPRESSION_DWARFEXPRESSIONLIST_H +#include "lldb/Core/Value.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Utility/RangeMap.h" #include "lldb/lldb-private.h" @@ -113,10 +114,11 @@ class DWARFExpressionList { void SetModule(const lldb::ModuleSP &module) { m_module_wp = module; } - bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, -lldb::addr_t func_load_addr, const Value *initial_value_ptr, -const Value *object_address_ptr, Value &result, -Status *error_ptr) const; + llvm::Expected Evaluate(ExecutionContext *exe_ctx, + RegisterContext *reg_ctx, + lldb::addr_t func_load_addr, + const Value *initial_value_ptr, + const Value *object_address_ptr) const; private: // RangeDataVector requires a comparator for DWARFExpression, but it doesn't diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index 67d71c90a959d..51eb11d3a189e 100644 -
[Lldb-commits] [lldb] [lldb/crashlog] Always load Application Specific Backtrace Thread images (PR #94259)
https://github.com/medismailben updated https://github.com/llvm/llvm-project/pull/94259 >From d7bd20eb22896ff43ed2c840b1ede23c0f36aff9 Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Tue, 4 Jun 2024 23:41:26 -0700 Subject: [PATCH] [lldb/crashlog] Always load Application Specific Backtrace Thread images This patch changes the crashlog image loading default behaviour to not only load images from the crashed thread but also for the application specific backtrace thread. This patch also move the Application Specific Backtrace / Last Exception Backtrace tag from the thread queue field to the thread name. rdar://128276576 Signed-off-by: Med Ismail Bennani --- lldb/examples/python/crashlog.py | 10 ++ lldb/examples/python/crashlog_scripted_process.py | 5 + .../Crashlog/app_specific_backtrace_crashlog.test | 2 +- .../Crashlog/last_exception_backtrace_crashlog.test| 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py index 641b2e64d53b1..6d5a1a74818de 100755 --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -545,9 +545,9 @@ def load_images(self, options, loaded_images=None): for image in self.images: image.resolve = True elif options.crashed_only: +images_to_load = [] for thread in self.threads: -if thread.did_crash(): -images_to_load = [] +if thread.did_crash() or thread.app_specific_backtrace: for ident in thread.idents: for image in self.find_images_with_identifier(ident): image.resolve = True @@ -858,7 +858,7 @@ def parse_app_specific_backtraces(self, json_app_specific_bts): thread = self.crashlog.Thread( len(self.crashlog.threads), True, self.crashlog.process_arch ) -thread.queue = "Application Specific Backtrace" +thread.name = "Application Specific Backtrace" if self.parse_asi_backtrace(thread, json_app_specific_bts[0]): self.crashlog.threads.append(thread) else: @@ -868,7 +868,7 @@ def parse_last_exception_backtraces(self, json_last_exc_bts): thread = self.crashlog.Thread( len(self.crashlog.threads), True, self.crashlog.process_arch ) -thread.queue = "Last Exception Backtrace" +thread.name = "Last Exception Backtrace" self.parse_frames(thread, json_last_exc_bts) self.crashlog.threads.append(thread) @@ -1168,11 +1168,13 @@ def parse_normal(self, line): self.thread = self.crashlog.Thread( idx, True, self.crashlog.process_arch ) +self.thread.name = "Application Specific Backtrace" elif line.startswith("Last Exception Backtrace:"): # iOS self.parse_mode = self.CrashLogParseMode.THREAD self.app_specific_backtrace = True idx = 1 self.thread = self.crashlog.Thread(idx, True, self.crashlog.process_arch) +self.thread.name = "Last Exception Backtrace" self.crashlog.info_lines.append(line.strip()) def parse_thread(self, line): diff --git a/lldb/examples/python/crashlog_scripted_process.py b/lldb/examples/python/crashlog_scripted_process.py index 26c5c37b7371d..4bc816e333a69 100644 --- a/lldb/examples/python/crashlog_scripted_process.py +++ b/lldb/examples/python/crashlog_scripted_process.py @@ -165,10 +165,7 @@ def __init__(self, process, args, crashlog_thread): self.backing_thread = crashlog_thread self.idx = self.backing_thread.index self.tid = self.backing_thread.id -if self.backing_thread.app_specific_backtrace: -self.name = "Application Specific Backtrace" -else: -self.name = self.backing_thread.name +self.name = self.backing_thread.name self.queue = self.backing_thread.queue self.has_crashed = self.originating_process.crashed_thread_idx == self.idx self.create_stackframes() diff --git a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/app_specific_backtrace_crashlog.test b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/app_specific_backtrace_crashlog.test index c57cefdaf32d2..430febb096252 100644 --- a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/app_specific_backtrace_crashlog.test +++ b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/app_specific_backtrace_crashlog.test @@ -3,7 +3,7 @@ # RUN: mkdir -p %t.dir # RUN: yaml2obj %S/Inputs/application_specific_info/asi.yaml > %t.dir/asi # RUN: %lldb -o 'command script import lldb.macosx.crashlog' \ -# RUN: -o 'crashlog -a -i -t %t.dir/asi %S/Inputs/application_specific_info/asi.txt' \ +# RUN: -o 'crashlog -i -t %t.dir/asi %S/Inputs/application_specific_info/asi.txt' \