From 1f4e2b5e60c9680d550f6de80219a931922354e0 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 21 Dec 2023 14:21:46 +0000 Subject: [PATCH] Update codelldb to v1.10.0 and allow local build run --- python3/vimspector/gadgets.py | 14 +++---- .../rust/vimspector_test/.vimspector.json | 17 +++++++- support/test/rust/vimspector_test/src/main.rs | 8 +++- tests/testdata/cpp/simple/.vimspector.json | 12 ++++++ tests/testdata/cpp/simple/Makefile | 2 +- tests/testdata/cpp/simple/buffer.cpp | 40 +++++++++++++++++++ 6 files changed, 83 insertions(+), 10 deletions(-) create mode 100644 tests/testdata/cpp/simple/buffer.cpp diff --git a/python3/vimspector/gadgets.py b/python3/vimspector/gadgets.py index fb0630c54..82b6882c7 100644 --- a/python3/vimspector/gadgets.py +++ b/python3/vimspector/gadgets.py @@ -546,12 +546,12 @@ '${version}/${file_name}', }, 'all': { - 'version': 'v1.9.2', + 'version': 'v1.10.0', }, 'macos': { 'file_name': 'codelldb-x86_64-darwin.vsix', 'checksum': - '0b36e91930bca3344cf9b78984ee85ccacc6dc97ab9be5da935d4596f0dba05c', + '91b10d5670a40434c308c09cb511a5b3e096c82b446a0bbbe4224af33204f5cf', 'make_executable': [ 'adapter/codelldb', 'lldb/bin/debugserver', @@ -562,12 +562,12 @@ 'macos_arm64': { 'file_name': 'codelldb-aarch64-darwin.vsix', 'checksum': - '5db25c0b1277795e2196a9118a38e6984b4787ac2c1e3e3adfeefe537296fc51', + '4ab0795a726bc52d6e2fa8ebc610baa3f262ebea89adac478cf4a34c72167a41', }, 'linux': { 'file_name': 'codelldb-x86_64-linux.vsix', 'checksum': - '898bd22b2505b12671fee7d2fe1abb384dc60d13f5fec2b4b650d0dac3f83d75', + 'd12bff19811974e14688e9754d8d7b9a2430868c3bac883d695032a4acd012ca', 'make_executable': [ 'adapter/codelldb', 'lldb/bin/lldb', @@ -578,17 +578,17 @@ 'linux_arm64': { 'file_name': 'codelldb-aarch64-linux.vsix', 'checksum': - '90c23169d5c32b6c3c6c040622f5f181af3e8a0a7d47e01219ce0af4a70aadb4', + '0a81f6617834754537520b7bae2ea9ad50d26b372f8c8bd967dae099e4b27d06', }, 'linux_armv7': { 'file_name': 'codelldb-arm-linux.vsix', 'checksum': - '971a9def71f8093ee63c1944dd69e3fbada97fc2804d312ab22e75f6d7e4e207', + '4bfc5ee753d4359c9ba3cf8fc726f4245a62fd283b718b5120ef1b404baf68c9', }, 'windows': { 'file_name': 'codelldb-x86_64-windows.vsix', 'checksum': - '1c23239941165d051b904a95c0bbf0853d3ff9b9149cdf36c6763fd4937c95f1', + '2f251384e4356edcffe168439714d00de5ca434b263719cbdaf63c9d2f0ffe64', 'make_executable': [] }, 'adapters': { diff --git a/support/test/rust/vimspector_test/.vimspector.json b/support/test/rust/vimspector_test/.vimspector.json index 6918e47f7..13ad74995 100644 --- a/support/test/rust/vimspector_test/.vimspector.json +++ b/support/test/rust/vimspector_test/.vimspector.json @@ -1,12 +1,27 @@ { "$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json", + "adapters": { + "CodeLLDB-localbuild": { + "extends": "CodeLLDB", + "command": [ + "$HOME/Development/vimspector/CodeLLDB/build/adapter/codelldb", + "--port", + "${unusedLocalPort}" + ] + } + }, "configurations": { "Run - CodeLLDB": { "adapter": "CodeLLDB", "configuration": { "request": "launch", - "program": "${workspaceRoot}/target/debug/vimspector_test" + "program": "${workspaceRoot}/target/debug/vimspector_test", + "expressions": "native" } + }, + "CodeLLDB-localbuild": { + "extends": "Run - CodeLLDB", + "adapter": "CodeLLDB-localbuild" } } } diff --git a/support/test/rust/vimspector_test/src/main.rs b/support/test/rust/vimspector_test/src/main.rs index f6fc72db3..509a6d43c 100644 --- a/support/test/rust/vimspector_test/src/main.rs +++ b/support/test/rust/vimspector_test/src/main.rs @@ -1,4 +1,10 @@ +struct Foo { + x: i32, +} + fn main() { let s = "World!"; - println!("Hello, {}!", s); + let f = Foo { x: 42 }; + let g = &f; + println!("Hello, {} {} {}!", s, g.x, f.x); } diff --git a/tests/testdata/cpp/simple/.vimspector.json b/tests/testdata/cpp/simple/.vimspector.json index 6bd104046..3cf58c2d0 100644 --- a/tests/testdata/cpp/simple/.vimspector.json +++ b/tests/testdata/cpp/simple/.vimspector.json @@ -104,6 +104,10 @@ "cpp_catch": "" } } + }, + "CodeLLDB-localbuild": { + "extends": "CodeLLDB", + "adapter": "CodeLLDB-localbuild" } }, "adapters": { @@ -124,6 +128,14 @@ "LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY": "YES" }, "name": "lldb" + }, + "CodeLLDB-localbuild": { + "extends": "CodeLLDB", + "command": [ + "$HOME/Development/vimspector/CodeLLDB/build/adapter/codelldb", + "--port", + "${unusedLocalPort}" + ] } } } diff --git a/tests/testdata/cpp/simple/Makefile b/tests/testdata/cpp/simple/Makefile index 548e883b1..f918050cc 100644 --- a/tests/testdata/cpp/simple/Makefile +++ b/tests/testdata/cpp/simple/Makefile @@ -1,4 +1,4 @@ -TARGETS=simple variables struct printer threads tiny +TARGETS=simple variables struct printer threads tiny buffer CXXFLAGS=-g -O0 -std=c++17 CFLAGS=-g -O0 diff --git a/tests/testdata/cpp/simple/buffer.cpp b/tests/testdata/cpp/simple/buffer.cpp new file mode 100644 index 000000000..a55be93ef --- /dev/null +++ b/tests/testdata/cpp/simple/buffer.cpp @@ -0,0 +1,40 @@ +#include +#include +#include +#include + +#include + +struct Foo +{ + uint32_t a; + uint64_t b; + float d; +}; + +static void handle_data(const unsigned char* data, size_t length) +{ + if (length < sizeof(Foo)) + return; + + Foo f; + memcpy(&f, data, sizeof(Foo)); + + std::cout << "a: " << f.a << ", b: " << f.b << ", d: " << f.d << std::endl; +} + +int main(int , char**) +{ + unsigned char data[1024]; + Foo f{ 10, 20, 30.7f }; + + memcpy(data + 3, &f, sizeof(Foo)); + + void *ptr = mmap(nullptr, 2048, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + memcpy(ptr, data+3, sizeof(Foo)); + + handle_data((unsigned char*)ptr, sizeof(f)); + munmap(ptr, 2048); + + return 0; +}