[Lldb-commits] [lldb] [lldb] Print empty enums as if they were unrecognised normal enums (PR #97553)
mstorsjo wrote: This causes build errors with GCC (11): ``` ../../lldb/unittests/ValueObject/DumpValueObjectOptionsTests.cpp: In member function ‘virtual void ValueObjectMockProcessTest_EmptyEnum_Test::TestBody()’: ../../lldb/unittests/ValueObject/DumpValueObjectOptionsTests.cpp:134:22: error: narrowing conversion of ‘-2’ from ‘int’ to ‘unsigned int’ [-Wnarrowing] 134 | TestDumpValueObject(MakeEnumType({}, true), | ~~~^~~~ 135 | {{-2, {}, "(TestEnum) test_var = -2\n"}, | 136 |{-1, {}, "(TestEnum) test_var = -1\n"}, |~~~ 137 |{0, {}, "(TestEnum) test_var = 0\n"}, |~ 138 |{1, {}, "(TestEnum) test_var = 1\n"}, |~ 139 |{2, {}, "(TestEnum) test_var = 2\n"}}); ``` https://github.com/llvm/llvm-project/pull/97553 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Change lldb's breakpoint handling behavior (PR #96260)
mstorsjo wrote: FYI, I also ran into failures due to this change, when debugging on Windows (with DWARF). See the run in https://github.com/mstorsjo/actions-test/actions/runs/10020326811 vs https://github.com/mstorsjo/actions-test/actions/runs/10020393197. Thanks for reverting; hopefully it’s the same root cause as on other platforms. https://github.com/llvm/llvm-project/pull/96260 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Change lldb's breakpoint handling behavior (PR #96260)
mstorsjo wrote: > > FYI, I also ran into failures due to this change, when debugging on Windows > > (with DWARF). See the run in > > https://github.com/mstorsjo/actions-test/actions/runs/10020326811 vs > > https://github.com/mstorsjo/actions-test/actions/runs/10020393197. Thanks > > for reverting; hopefully it’s the same root cause as on other platforms. > > oooh that 10020393197 is surprising. It looks like we hit a breakpoint, did > `finish` up until a recursive function and it resumed execution without > stopping. I haven't seen that one before, and not sure how I could have > introduced it. I'll def need to look at my ProcessWindows changes and again > see if I can't figure out what might be going on. Aleksandr ran a slightly > earlier version of the windows changes against the lldb testsuite and didn't > uncover any problems, but it didn't include this test file. > > @mstorsjo is this test source file on-line somewhere, or can you paste it > into a comment? I'll try to repo on linux or macos too, maybe it is a unique > corner case unrelated to Windows that is a problem. (unlikely, but you never > know if we might get lucky). Thanks for the heads-up. The source to this testcase is https://github.com/mstorsjo/llvm-mingw/blob/master/test/hello-exception.cpp, and I put up a prebuilt binary at https://martin.st/temp/hello-exception-dwarf.exe, if you want to have a look at it in that form. I'm running LLDB with the following input: https://github.com/mstorsjo/llvm-mingw/blob/master/run-lldb-tests.sh#L111-L120 ``` # Test setting a breakpoint in LLDB, checking the backtrace when we hit it, # stepping from the breakpoint, and running to completion. cat > $SCRIPT < $OUT 2>/dev/null ``` FWIW, interestingly, the issue did seem to appear on x86_64, but not on i386. This was with a non-optimized build of it, in case that makes any difference (as it sometimes does for how unwinding etc behaves). https://github.com/llvm/llvm-project/pull/96260 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] SBDebugger: define callback_token_t for win32 (PR #92870)
mstorsjo wrote: +1, this fixes my build errors for Windows targets as well: https://github.com/mstorsjo/llvm-mingw/actions/runs/9167001362/job/25206642195 https://github.com/llvm/llvm-project/pull/92870 ___ 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][NFC] Separated GDBRemoteCommunication::GetDebugserverPath() (PR #107388)
mstorsjo wrote: > Oops, I copied `shared_fd_t` from #104238 by mistake > > ``` > Status GDBRemoteCommunication::StartDebugserverProcess(... , shared_fd_t > pass_comm_fd) { > ``` > > It will break the Windows build. I can replace it with `int` or we can apply > #107553. Please advise. As someone who just ran into this build failure - I would prefer to first push a minimal fixup commit to change it to `int`, to unbreak the build, and then rebase #107553 on top of that. Even if #107553 is meant to be NFC, it's a much larger change. https://github.com/llvm/llvm-project/pull/107388 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] Separated GDBRemoteCommunication::GetDebugserverPath() (PR #107388)
mstorsjo wrote: Thanks for the quick fix! https://github.com/llvm/llvm-project/pull/107388 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Print a warning on checksum mismatch (PR #107968)
mstorsjo wrote: This broke building in mingw configurations, and possibly a few others as well. The `ReportWarning` function takes a pointer to a `std::once_flag`, while this is passing it with a `llvm::once_flag`. In many configurations, these are the same type, but in a couple ones, they're not. LLDB seems to be using a mixture of `std::once_flag` and `llvm::once_flag` throughout, with nontrivial numbers of both, so there's no one obvious preferred way to go here... Or should `ReportWarning` be extended to accept either kinds of flags, until the implementation is settled on either of them? https://github.com/llvm/llvm-project/pull/107968 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Print a warning on checksum mismatch (PR #107968)
mstorsjo wrote: > This broke building in mingw configurations, and possibly a few others as > well. > > The `ReportWarning` function takes a pointer to a `std::once_flag`, while > this is passing it with a `llvm::once_flag`. In many configurations, these > are the same type, but in a couple ones, they're not. > > LLDB seems to be using a mixture of `std::once_flag` and `llvm::once_flag` > throughout, with nontrivial numbers of both, so there's no one obvious > preferred way to go here... Or should `ReportWarning` be extended to accept > either kinds of flags, until the implementation is settled on either of them? If there are no suggestions on a way to go here, I'll push a fix within a couple hours, that fixes compilation - probably switching the newly added code to `std::once_flag` as that's what the existing function takes. https://github.com/llvm/llvm-project/pull/107968 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a81a4b2 - [lldb] Fix building with lldb::once_flag != std::once_flag
Author: Martin Storsjö Date: 2024-09-12T22:26:02+03:00 New Revision: a81a4b2a7ac2d0b8195bb008b2c0f464cfbda223 URL: https://github.com/llvm/llvm-project/commit/a81a4b2a7ac2d0b8195bb008b2c0f464cfbda223 DIFF: https://github.com/llvm/llvm-project/commit/a81a4b2a7ac2d0b8195bb008b2c0f464cfbda223.diff LOG: [lldb] Fix building with lldb::once_flag != std::once_flag This fixes build breakage on e.g. mingw platforms since ffa2f539ae2a4e79c01b3d54f8b12c63d8781a0c. The Debugger::ReportWarning function takes a pointer to a std::once_flag. On many platforms, llvm::once_flag is a typedef for std::once_flag, but on others, llvm::once_flag is a custom reimplementation. Added: Modified: lldb/include/lldb/Core/SourceManager.h Removed: diff --git a/lldb/include/lldb/Core/SourceManager.h b/lldb/include/lldb/Core/SourceManager.h index e38627182a9690..d929f7bd9bf221 100644 --- a/lldb/include/lldb/Core/SourceManager.h +++ b/lldb/include/lldb/Core/SourceManager.h @@ -74,7 +74,7 @@ class SourceManager { const Checksum &GetChecksum() const { return m_checksum; } -llvm::once_flag &GetChecksumWarningOnceFlag() { +std::once_flag &GetChecksumWarningOnceFlag() { return m_checksum_warning_once_flag; } @@ -92,7 +92,7 @@ class SourceManager { Checksum m_checksum; /// Once flag for emitting a checksum mismatch warning. -llvm::once_flag m_checksum_warning_once_flag; +std::once_flag m_checksum_warning_once_flag; // Keep the modification time that this file data is valid for llvm::sys::TimePoint<> m_mod_time; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Print a warning on checksum mismatch (PR #107968)
mstorsjo wrote: I pushed a fix in a81a4b2a7ac2d0b8195bb008b2c0f464cfbda223. https://github.com/llvm/llvm-project/pull/107968 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [clang] [clang][DebugInfo] Revert "emit definitions for constant-initialized static data-members" (PR #74580)
mstorsjo wrote: Could we please land this now? https://github.com/llvm/llvm-project/pull/74580 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [llvm] [clang-tools-extra] [libc] [compiler-rt] [libcxx] [openmp] [mlir] [lldb] [flang] [libcxxabi] [lld] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms
mstorsjo wrote: This commit broken building compiler-rt builtins for Windows on aarch64; building now hits these errors: ``` llvm-project/compiler-rt/lib/builtins/cpu_model.c:1192:2: error: No support for checking for lse atomics on this platfrom yet. 1192 | #error No support for checking for lse atomics on this platfrom yet. | ^ llvm-project/compiler-rt/lib/builtins/cpu_model.c:1571:2: error: No support for checking hwcap on this platform yet. 1571 | #error No support for checking hwcap on this platform yet. | ^ 2 errors generated. ``` Before this change, most of this whole file was ifdeffed out when building on Windows (and Apple platforms, I would presume), but now most of it is included, then hitting this `#error`. I guess it could work to just remove the `#error` cases, but this file suffers from a pretty deep ifdef nesting jungle, so I'm not sure if that's the best solution. (FWIW, if we wanted to add aarch64 CPU feature detection for Windows here, the code would be more of a separate codepath just like the Apple case, it doesn't share the linux/BSD HWCAP style.) I can push a quick fix, either removing the `#error` or reverting this commit, later during the day. BTW, when compiling the file I also get a bunch of warnings in this style: ``` llvm-project/compiler-rt/lib/builtins/cpu_model.c:1448:36: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths] 1448 | getCPUFeature(ID_AA64PFR1_EL1, ftr); |^ llvm-project/compiler-rt/lib/builtins/cpu_model.c:1448:5: note: use constraint modifier "w" 1448 | getCPUFeature(ID_AA64PFR1_EL1, ftr); | ^ llvm-project/compiler-rt/lib/builtins/cpu_model.c:1345:45: note: expanded from macro 'getCPUFeature' 1345 | #define getCPUFeature(id, ftr) __asm__("mrs %0, " #id : "=r"(ftr)) | ``` https://github.com/llvm/llvm-project/pull/73685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [llvm] [libcxxabi] [compiler-rt] [libc] [openmp] [mlir] [clang-tools-extra] [clang] [lldb] [libcxx] [flang] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms
mstorsjo wrote: > > BTW, when compiling the file I also get a bunch of warnings in this style: > > @mstorsjo maybe `unsigned long` is 32 bits on that platform... what's the > target triple? Ah, indeed - yes, Windows has 32 bit `long`s. The triples are `aarch64-windows-gnu` or `aarch64-windows-msvc`. https://github.com/llvm/llvm-project/pull/73685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Define _BSD_SOURCE globally, to get optreset available in mingw's getopt.h (PR #76137)
https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/76137 We previously were defining _BSD_SOURCE right before including getopt.h. However, on mingw-w64, getopt.h is also transitively included by unistd.h, and unistd.h can be transitively included by many headers (recently, by some libc++ headers). Therefore, to be safe, we need to define _BSD_SOURCE before including any header. Thus do this in CMake. This fixes https://github.com/llvm/llvm-project/issues/76050. From 69552a132c6ff99a2a1caf8cd0075f796174d95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 21 Dec 2023 11:23:18 +0200 Subject: [PATCH] [LLDB] Define _BSD_SOURCE globally, to get optreset available in mingw's getopt.h We previously were defining _BSD_SOURCE right before including getopt.h. However, on mingw-w64, getopt.h is also transitively included by unistd.h, and unistd.h can be transitively included by many headers (recently, by some libc++ headers). Therefore, to be safe, we need to define _BSD_SOURCE before including any header. Thus do this in CMake. This fixes https://github.com/llvm/llvm-project/issues/76050. --- lldb/CMakeLists.txt | 4 lldb/include/lldb/Host/HostGetOpt.h | 4 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 4a53d7ef3d0da0..7844d93d78d29a 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -44,6 +44,10 @@ endif() if (WIN32) add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE) + if (NOT MSVC) +# _BSD_SOURCE is required for MinGW's getopt.h to define optreset +add_definitions(-D_BSD_SOURCE) + endif() endif() if (LLDB_ENABLE_PYTHON) diff --git a/lldb/include/lldb/Host/HostGetOpt.h b/lldb/include/lldb/Host/HostGetOpt.h index 746e03e1bd1ee2..52cfdf4dbb89c2 100644 --- a/lldb/include/lldb/Host/HostGetOpt.h +++ b/lldb/include/lldb/Host/HostGetOpt.h @@ -11,10 +11,6 @@ #if !defined(_MSC_VER) && !defined(__NetBSD__) -#ifdef _WIN32 -#define _BSD_SOURCE // Required so that getopt.h defines optreset -#endif - #include #include ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Define _BSD_SOURCE globally, to get optreset available in mingw's getopt.h (PR #76137)
@@ -44,6 +44,10 @@ endif() if (WIN32) add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE) + if (NOT MSVC) mstorsjo wrote: This was never defined for clang-cl/MSVC builds before. Note that the existing define I'm removing is within this context: ``` #if !defined(_MSC_VER) && !defined(__NetBSD__) #ifdef _WIN32 #define _BSD_SOURCE // Required so that getopt.h defines optreset #endif ``` So we previously only defined `_BSD_SOURCE` on `defined(_WIN32) && !defined(_MSC_VER)`, i.e. `if (WIN32 AND NOT MSVC)` in cmake (even if the condition nesting is the other way around there). https://github.com/llvm/llvm-project/pull/76137 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Define _BSD_SOURCE globally, to get optreset available in mingw's getopt.h (PR #76137)
https://github.com/mstorsjo closed https://github.com/llvm/llvm-project/pull/76137 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 68744ff - [lldb] Fix building with latest libc++
Author: Martin Storsjö Date: 2023-08-10T12:59:35+03:00 New Revision: 68744ffbdd7daac41da274eef9ac0d191e11c16d URL: https://github.com/llvm/llvm-project/commit/68744ffbdd7daac41da274eef9ac0d191e11c16d DIFF: https://github.com/llvm/llvm-project/commit/68744ffbdd7daac41da274eef9ac0d191e11c16d.diff LOG: [lldb] Fix building with latest libc++ Since https://reviews.llvm.org/D157058 in libc++, the base template for char_traits has been removed - it is only provided for char, wchar_t, char8_t, char16_t and char32_t. (Thus, to use basic_string with a type other than those, we'd need to supply suitable traits ourselves.) For this particular use, a vector works just as well as basic_string. Differential Revision: https://reviews.llvm.org/D157589 Added: Modified: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Removed: diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index 4efc454967a123..f9d95fc5d2a66d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -631,7 +631,7 @@ static void WriteRegisterValueInHexFixedWidth( } else { // Zero-out any unreadable values. if (reg_info.byte_size > 0) { - std::basic_string zeros(reg_info.byte_size, '\0'); + std::vector zeros(reg_info.byte_size, '\0'); AppendHexValue(response, zeros.data(), zeros.size(), false); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 9a4b3fd - [lldb][windows] _wsopen_s does not accept bits other than `_S_IREAD | _S_IWRITE`
Author: Yuxuan Shui Date: 2023-08-30T15:53:31+03:00 New Revision: 9a4b3fdb82327e808213070fd157be3c557b8b9d URL: https://github.com/llvm/llvm-project/commit/9a4b3fdb82327e808213070fd157be3c557b8b9d DIFF: https://github.com/llvm/llvm-project/commit/9a4b3fdb82327e808213070fd157be3c557b8b9d.diff LOG: [lldb][windows] _wsopen_s does not accept bits other than `_S_IREAD | _S_IWRITE` When sending file from a Linux host to a Windows remote, Linux host will try to copy the source file's permission bits, which will contain `_S_I?GRP` and `_S_I?OTH` bits. Those bits are rejected by `_wsopen_s`, causing it to return EINVAL. This patch masks out the rejected bits. GitHub issue: #64313 Reviewed By: jasonmolenda, DavidSpickett Differential Revision: https://reviews.llvm.org/D156817 Added: Modified: lldb/source/Host/windows/FileSystem.cpp Removed: diff --git a/lldb/source/Host/windows/FileSystem.cpp b/lldb/source/Host/windows/FileSystem.cpp index b919d9bcd9dd4a..4b0cd74b8013b0 100644 --- a/lldb/source/Host/windows/FileSystem.cpp +++ b/lldb/source/Host/windows/FileSystem.cpp @@ -101,6 +101,8 @@ int FileSystem::Open(const char *path, int flags, int mode) { std::wstring wpath; if (!llvm::ConvertUTF8toWide(path, wpath)) return -1; + // All other bits are rejected by _wsopen_s + mode = mode & (_S_IREAD | _S_IWRITE); int result; ::_wsopen_s(&result, wpath.c_str(), flags, _SH_DENYNO, mode); return result; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 1919720 - [lldb] [debugserver] Simplify handling of arch specific files
Author: Martin Storsjö Date: 2022-01-06T10:23:04+02:00 New Revision: 1919720fdd348ca568b235bf3f1357c198eccd15 URL: https://github.com/llvm/llvm-project/commit/1919720fdd348ca568b235bf3f1357c198eccd15 DIFF: https://github.com/llvm/llvm-project/commit/1919720fdd348ca568b235bf3f1357c198eccd15.diff LOG: [lldb] [debugserver] Simplify handling of arch specific files There are no duplicates among the include files, and all the source files are wrapped in architecture ifdefs, so there's no harm in including all of them, always. This fixes builds if TARGET_TRIPLE is set to something else than the build architecture. This also allows building for multiple architectures at once by setting CMAKE_OSX_ARCHITECTURES. Differential Revision: https://reviews.llvm.org/D116625 Added: Modified: lldb/tools/debugserver/source/MacOSX/CMakeLists.txt Removed: diff --git a/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt b/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt index ea4593fcf4511..8f44d1bfbb436 100644 --- a/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt +++ b/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt @@ -1,30 +1,8 @@ -# The debugserver build needs to conditionally include files depending on the -# target architecture. -# -# Switch on the architecture specified by TARGET_TRIPLE, as -# the llvm and swift build systems use this variable to identify the -# target (through LLVM_HOST_TRIPLE). -# -# It would be possible to switch on CMAKE_OSX_ARCHITECTURES, but the swift -# build does not provide it, preferring instead to pass arch-specific -# CFLAGS etc explicitly. Switching on LLVM_HOST_TRIPLE is also an option, -# but it breaks down when cross-compiling. +list(APPEND SOURCES arm/DNBArchImpl.cpp arm64/DNBArchImplARM64.cpp) +include_directories(${CURRENT_SOURCE_DIR}/arm ${CURRENT_SOURCE_DIR}/arm64) -if(TARGET_TRIPLE) - string(REGEX MATCH "^[^-]*" LLDB_DEBUGSERVER_ARCH ${TARGET_TRIPLE}) -else() - set(LLDB_DEBUGSERVER_ARCH ${CMAKE_OSX_ARCHITECTURES}) -endif() - -if("${LLDB_DEBUGSERVER_ARCH}" MATCHES ".*arm.*") - list(APPEND SOURCES arm/DNBArchImpl.cpp arm64/DNBArchImplARM64.cpp) - include_directories(${CURRENT_SOURCE_DIR}/arm ${CURRENT_SOURCE_DIR}/arm64) -endif() - -if(NOT LLDB_DEBUGSERVER_ARCH OR "${LLDB_DEBUGSERVER_ARCH}" MATCHES ".*86.*") - list(APPEND SOURCES i386/DNBArchImplI386.cpp x86_64/DNBArchImplX86_64.cpp) - include_directories(${CURRENT_SOURCE_DIR}/i386 ${CURRENT_SOURCE_DIR}/x86_64) -endif() +list(APPEND SOURCES i386/DNBArchImplI386.cpp x86_64/DNBArchImplX86_64.cpp) +include_directories(${CURRENT_SOURCE_DIR}/i386 ${CURRENT_SOURCE_DIR}/x86_64) include_directories(..) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 4270c9c - [lldb] Stop passing both i386 and i686 in parallel as architectures on Windows
Author: Martin Storsjö Date: 2022-07-06T12:13:36+03:00 New Revision: 4270c9cd44f2703bc5376ff085d0add156af9080 URL: https://github.com/llvm/llvm-project/commit/4270c9cd44f2703bc5376ff085d0add156af9080 DIFF: https://github.com/llvm/llvm-project/commit/4270c9cd44f2703bc5376ff085d0add156af9080.diff LOG: [lldb] Stop passing both i386 and i686 in parallel as architectures on Windows When an object file returns multiple architectures, it is treated as a fat binary - which really isn't the case of i386 vs i686 where the object file actually has one architecture. This allows getting rid of hardcoded architecture triples in PlatformWindows. The parallel i386 and i686 architecture strings stem from 5e6f45201f0b62c1e7a24fc396f3ea6e10dc880d / D7120 and ad587ae4ca143d388c0ec4ef2faa1b5eddedbf67 / D4658. Differential Revision: https://reviews.llvm.org/D128617 Added: Modified: lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/test/Shell/ObjectFile/PECOFF/settings-abi-i686.yaml Removed: diff --git a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp index 1c10efed95640..44c708676e529 100644 --- a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp +++ b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp @@ -137,8 +137,6 @@ size_t ObjectFilePDB::GetModuleSpecifications( case PDB_Machine::x86: module_arch.SetTriple("i386-pc-windows"); specs.Append(module_spec); -module_arch.SetTriple("i686-pc-windows"); -specs.Append(module_spec); break; case PDB_Machine::ArmNT: module_arch.SetTriple("armv7-pc-windows"); diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index fd34ac65970ba..45593e95863a2 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -337,9 +337,6 @@ size_t ObjectFilePECOFF::GetModuleSpecifications( spec.SetTriple("i386-pc-windows"); spec.GetTriple().setEnvironment(env); specs.Append(module_spec); -spec.SetTriple("i686-pc-windows"); -spec.GetTriple().setEnvironment(env); -specs.Append(module_spec); break; case MachineArmNt: spec.SetTriple("armv7-pc-windows"); diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp index 38f387dfdb29d..e5e235881e58a 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -124,11 +124,9 @@ PlatformWindows::PlatformWindows(bool is_host) : RemoteAwarePlatform(is_host) { if (spec.IsValid()) m_supported_architectures.push_back(spec); }; - AddArch(ArchSpec("i686-pc-windows")); AddArch(HostInfo::GetArchitecture(HostInfo::eArchKindDefault)); AddArch(HostInfo::GetArchitecture(HostInfo::eArchKind32)); AddArch(HostInfo::GetArchitecture(HostInfo::eArchKind64)); - AddArch(ArchSpec("i386-pc-windows")); } Status PlatformWindows::ConnectRemote(Args &args) { diff --git a/lldb/test/Shell/ObjectFile/PECOFF/settings-abi-i686.yaml b/lldb/test/Shell/ObjectFile/PECOFF/settings-abi-i686.yaml index ca2bac38027fa..561210455010b 100644 --- a/lldb/test/Shell/ObjectFile/PECOFF/settings-abi-i686.yaml +++ b/lldb/test/Shell/ObjectFile/PECOFF/settings-abi-i686.yaml @@ -18,7 +18,7 @@ # RUN: FileCheck -DABI=gnu -DFILENAME=%basename_t.tmp %s # CHECK-LABEL: image list --triple --basename -# CHECK-NEXT: i686-pc-windows-[[ABI]] [[FILENAME]] +# CHECK-NEXT: i386-pc-windows-[[ABI]] [[FILENAME]] --- !COFF OptionalHeader: ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 66cdd65 - [lldb] Reduce the stack alignment requirements for the Windows x86_64 ABI
Author: Martin Storsjö Date: 2022-07-11T23:41:35+03:00 New Revision: 66cdd6548ac51f2039b9f0bc10ec03f387b210c4 URL: https://github.com/llvm/llvm-project/commit/66cdd6548ac51f2039b9f0bc10ec03f387b210c4 DIFF: https://github.com/llvm/llvm-project/commit/66cdd6548ac51f2039b9f0bc10ec03f387b210c4.diff LOG: [lldb] Reduce the stack alignment requirements for the Windows x86_64 ABI This fixes https://github.com/llvm/llvm-project/issues/56095. Differential Revision: https://reviews.llvm.org/D129455 Added: lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64-asm.s lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64.cpp lldb/test/Shell/Unwind/windows-unaligned-x86_64.test Modified: lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h Removed: diff --git a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h index e74b9126404e1..a9c2ed9c2f141 100644 --- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h +++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h @@ -40,10 +40,15 @@ class ABIWindows_x86_64 : public ABIX86_64 { bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override; - // In Windows_x86_64 ABI, stack will always be maintained 16-byte aligned + // In Windows_x86_64 ABI requires that the stack will be maintained 16-byte + // aligned. + // When ntdll invokes callbacks such as KiUserExceptionDispatcher or + // KiUserCallbackDispatcher, those functions won't have a properly 16-byte + // aligned stack - but tolerate unwinding through them by relaxing the + // requirement to 8 bytes. bool CallFrameAddressIsValid(lldb::addr_t cfa) override { - if (cfa & (16ull - 1ull)) - return false; // Not 16 byte aligned +if (cfa & (8ull - 1ull)) + return false; // Not 8 byte aligned if (cfa == 0) return false; // Zero is not a valid stack address return true; diff --git a/lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64-asm.s b/lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64-asm.s new file mode 100644 index 0..c042901683648 --- /dev/null +++ b/lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64-asm.s @@ -0,0 +1,25 @@ +.globlcall_func +.def call_func; .scl2; .type 32; .endef +.seh_proc call_func +call_func: +subq$32, %rsp +.seh_stackalloc 32 +.seh_endprologue +callrealign_stack +addq$32, %rsp +ret +.seh_endproc + +.globlrealign_stack +.def realign_stack; .scl2; .type 32; .endef +.seh_proc realign_stack +realign_stack: +subq$32, %rsp +.seh_stackalloc 32 +.seh_endprologue +movq%rcx, %rax +movl%edx, %ecx +call*%rax +addq$32, %rsp +ret +.seh_endproc diff --git a/lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64.cpp b/lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64.cpp new file mode 100644 index 0..d310ef7d7ed2f --- /dev/null +++ b/lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64.cpp @@ -0,0 +1,8 @@ +extern "C" void call_func(void (*ptr)(int a), int a); + +extern "C" void func(int arg) { } + +int main(int argc, char **argv) { + call_func(func, 42); + return 0; +} diff --git a/lldb/test/Shell/Unwind/windows-unaligned-x86_64.test b/lldb/test/Shell/Unwind/windows-unaligned-x86_64.test new file mode 100644 index 0..94f1c011ebd2a --- /dev/null +++ b/lldb/test/Shell/Unwind/windows-unaligned-x86_64.test @@ -0,0 +1,26 @@ +# Test unwinding through stack frames that aren't aligned to 16 bytes. +# (In real world code, this happens when unwinding through +# KiUserExceptionDispatcher and KiUserCallbackDispatcher in ntdll.dll.) + +# REQUIRES: target-x86_64, native, system-windows + +# RUN: %build %p/Inputs/windows-unaligned-x86_64.cpp %p/Inputs/windows-unaligned-x86_64-asm.s -o %t +# RUN: %lldb %t -s %s -o exit | FileCheck %s + +# Future TODO: If %build could compile the source file in C mode, the symbol +# name handling would be easier across msvc and mingw build configurations. +# (In mingw mode, the extern C symbol "func" is printed as "::func" while +# it's plain "func" in msvc mode. Without the extern C, it's "func(..." in +# mingw mode, but "void __cdecl func(..." in msvc mode.) + +breakpoint set -n func +# CHECK: Breakpoint 1: where = {{.*}}`{{(::)?}}func + +process launch +# CHECK: stop reason = breakpoint 1.1 + +thread backtrace +# CHECK: frame #0: {{.*}}`{{(::)?}}func +# CHECK: frame #1: {{.*}}`realign_stack +# CHECK: frame #2: {{.*}}`call_func +# CHECK: frame #3: {{.*}}`main ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 306fc2c - [lldb] Fix build with GCC 9 after "[ADT] Use Empty Base Optimization for Allocators"
Author: Martin Storsjö Date: 2022-07-13T12:57:04+03:00 New Revision: 306fc2cd87f2a52c21eb3606eff33d78e25d9368 URL: https://github.com/llvm/llvm-project/commit/306fc2cd87f2a52c21eb3606eff33d78e25d9368 DIFF: https://github.com/llvm/llvm-project/commit/306fc2cd87f2a52c21eb3606eff33d78e25d9368.diff LOG: [lldb] Fix build with GCC 9 after "[ADT] Use Empty Base Optimization for Allocators" This fixes this compilation error, after a565509308f9372c4de1c4c32afde461a42e81c8: In file included from ../tools/lldb/include/lldb/Host/Host.h:14, from ../tools/lldb/source/Host/common/File.cpp:28: ../tools/lldb/include/lldb/Utility/Environment.h: In copy constructor ‘lldb_private::Environment::Environment(const lldb_private::Environment&)’: ../tools/lldb/include/lldb/Utility/Environment.h:60:49: error: call of overloaded ‘StringMap(const lldb_private::Environment&)’ is ambiguous 60 | Environment(const Environment &RHS) : Base(RHS) {} | ^ In file included from ../include/llvm/Support/YAMLTraits.h:16, from ../tools/lldb/include/lldb/Utility/ConstString.h:15, from ../tools/lldb/include/lldb/Utility/FileSpec.h:15, from ../tools/lldb/include/lldb/Host/FileSystem.h:14, from ../tools/lldb/source/Host/common/File.cpp:27: ../include/llvm/ADT/StringMap.h:137:3: note: candidate: ‘llvm::StringMap::StringMap(const llvm::StringMap&) [with ValueTy = std::__cxx11::basic_string; AllocatorTy = llvm::MallocAllocator]’ 137 | StringMap(const StringMap &RHS) | ^ ../include/llvm/ADT/StringMap.h:122:12: note: candidate: ‘llvm::StringMap::StringMap(AllocatorTy) [with ValueTy = std::__cxx11::basic_string; AllocatorTy = llvm::MallocAllocator]’ 122 | explicit StringMap(AllocatorTy A) |^ Added: Modified: lldb/include/lldb/Utility/Environment.h Removed: diff --git a/lldb/include/lldb/Utility/Environment.h b/lldb/include/lldb/Utility/Environment.h index c1549a3d60a64..27d740402c30c 100644 --- a/lldb/include/lldb/Utility/Environment.h +++ b/lldb/include/lldb/Utility/Environment.h @@ -57,7 +57,7 @@ class Environment : private llvm::StringMap { using Base::operator[]; Environment() {} - Environment(const Environment &RHS) : Base(RHS) {} + Environment(const Environment &RHS) : Base(static_cast(RHS)) {} Environment(Environment &&RHS) : Base(std::move(RHS)) {} Environment(char *const *Env) : Environment(const_cast(Env)) {} ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a1568fa - [lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC.
Author: Martin Storsjö Date: 2022-07-13T23:57:01+03:00 New Revision: a1568fa27885d12c504e42dd02b0ce3687863fd8 URL: https://github.com/llvm/llvm-project/commit/a1568fa27885d12c504e42dd02b0ce3687863fd8 DIFF: https://github.com/llvm/llvm-project/commit/a1568fa27885d12c504e42dd02b0ce3687863fd8.diff LOG: [lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC. Added: Modified: lldb/source/Target/TraceCursor.cpp Removed: diff --git a/lldb/source/Target/TraceCursor.cpp b/lldb/source/Target/TraceCursor.cpp index b9f507050603..f99b0d28c154 100644 --- a/lldb/source/Target/TraceCursor.cpp +++ b/lldb/source/Target/TraceCursor.cpp @@ -51,4 +51,5 @@ const char *TraceCursor::EventKindToString(lldb::TraceEvent event_kind) { case lldb::eTraceEventCPUChanged: return "CPU core changed"; } + llvm_unreachable("Fully covered switch above"); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b7c5683 - [lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC.
Author: Martin Storsjö Date: 2022-08-02T10:57:33+03:00 New Revision: b7c5683fac3de2f3349d57b9e133ac53204b1148 URL: https://github.com/llvm/llvm-project/commit/b7c5683fac3de2f3349d57b9e133ac53204b1148 DIFF: https://github.com/llvm/llvm-project/commit/b7c5683fac3de2f3349d57b9e133ac53204b1148.diff LOG: [lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC. Added: Modified: lldb/source/Core/Disassembler.cpp Removed: diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp index 4c57be44dc9c5..cc354636987cb 100644 --- a/lldb/source/Core/Disassembler.cpp +++ b/lldb/source/Core/Disassembler.cpp @@ -599,6 +599,7 @@ const char *Instruction::GetNameForInstructionControlFlowKind( case eInstructionControlFlowKindFarJump: return "far jump"; } + llvm_unreachable("Fully covered switch above!"); } void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a5881e8 - [lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC.
Author: Martin Storsjö Date: 2022-08-12T00:35:32+03:00 New Revision: a5881e8a810bac74af2efcdcf12c741d52a1970a URL: https://github.com/llvm/llvm-project/commit/a5881e8a810bac74af2efcdcf12c741d52a1970a DIFF: https://github.com/llvm/llvm-project/commit/a5881e8a810bac74af2efcdcf12c741d52a1970a.diff LOG: [lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC. Added: Modified: lldb/tools/lldb-test/lldb-test.cpp Removed: diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp index c6f9463dbb6de..466e082534e58 100644 --- a/lldb/tools/lldb-test/lldb-test.cpp +++ b/lldb/tools/lldb-test/lldb-test.cpp @@ -879,6 +879,7 @@ static Mangled::NamePreference opts::symtab::getNamePreference() { case ManglingPreference::MangledWithoutArguments: return Mangled::ePreferDemangledWithoutArguments; } + llvm_unreachable("Fully covered switch above!"); } int opts::symtab::handleSymtabCommand(Debugger &Dbg) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b21de9b - [lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC.
Author: Martin Storsjö Date: 2022-08-22T14:53:29+03:00 New Revision: b21de9b38f4b5f2ae6d49f973b683f118b9d58cb URL: https://github.com/llvm/llvm-project/commit/b21de9b38f4b5f2ae6d49f973b683f118b9d58cb DIFF: https://github.com/llvm/llvm-project/commit/b21de9b38f4b5f2ae6d49f973b683f118b9d58cb.diff LOG: [lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC. Added: Modified: lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h Removed: diff --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h index 39f7c429106bc..65fba83eb14f7 100644 --- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h +++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h @@ -33,6 +33,7 @@ class EmulateInstructionRISCV : public EmulateInstruction { case eInstructionTypeAll: return false; } +llvm_unreachable("Fully covered switch above!"); } static bool SupportsThisArch(const ArchSpec &arch); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] bc13101 - [lldb] Fix building for mingw after changes to sigtstp_handler
Author: Martin Storsjö Date: 2022-03-26T22:32:53+02:00 New Revision: bc13101cf945114f2b573aa66845bec9c20f4e48 URL: https://github.com/llvm/llvm-project/commit/bc13101cf945114f2b573aa66845bec9c20f4e48 DIFF: https://github.com/llvm/llvm-project/commit/bc13101cf945114f2b573aa66845bec9c20f4e48.diff LOG: [lldb] Fix building for mingw after changes to sigtstp_handler Some signal handlers were set up within an !_MSC_VER condition, i.e. omitted in MSVC builds but included in mingw builds. Previously sigtstp_handler was defined in all builds, but since 4bcadd66864bf4af929ac8753a51d7ad408cdef0 / D120320 it's only defined non platforms other than Windows. Change the condition to !_WIN32 for consistency between the MSVC and mingw builds, fixing the build for mingw. Differential Revision: https://reviews.llvm.org/D122486 Added: Modified: lldb/tools/driver/Driver.cpp Removed: diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp index cf396c37fd3a9..16fa2f1393d54 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -829,7 +829,7 @@ int main(int argc, char const *argv[]) { SBHostOS::ThreadCreated(""); signal(SIGINT, sigint_handler); -#if !defined(_MSC_VER) +#if !defined(_WIN32) signal(SIGPIPE, SIG_IGN); signal(SIGWINCH, sigwinch_handler); signal(SIGTSTP, sigtstp_handler); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b548f58 - [lldb] Fix interpreting absolute Windows paths with forward slashes
Author: Martin Storsjö Date: 2022-03-26T22:34:02+02:00 New Revision: b548f5847235118878c15caa8df1b89e75fc965b URL: https://github.com/llvm/llvm-project/commit/b548f5847235118878c15caa8df1b89e75fc965b DIFF: https://github.com/llvm/llvm-project/commit/b548f5847235118878c15caa8df1b89e75fc965b.diff LOG: [lldb] Fix interpreting absolute Windows paths with forward slashes In practice, Windows paths can use either backslashes or forward slashes. This fixes an issue reported downstream at https://github.com/mstorsjo/llvm-mingw/issues/266. Differential Revision: https://reviews.llvm.org/D122389 Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/source/Utility/FileSpec.cpp lldb/unittests/Utility/FileSpecTest.cpp Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index 085c9e9ce1a6e..295433ddb78b9 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -772,7 +772,8 @@ removeHostnameFromPathname(llvm::StringRef path_from_dwarf) { // check whether we have a windows path, and so the first character is a // drive-letter not a hostname. - if (host.size() == 1 && llvm::isAlpha(host[0]) && path.startswith("\\")) + if (host.size() == 1 && llvm::isAlpha(host[0]) && + (path.startswith("\\") || path.startswith("/"))) return path_from_dwarf; return path; diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp index 24f8c2b1c23fc..eed3bbd46026f 100644 --- a/lldb/source/Utility/FileSpec.cpp +++ b/lldb/source/Utility/FileSpec.cpp @@ -311,7 +311,8 @@ llvm::Optional FileSpec::GuessPathStyle(llvm::StringRef absolut if (absolute_path.startswith(R"(\\)")) return Style::windows; if (absolute_path.size() >= 3 && llvm::isAlpha(absolute_path[0]) && - absolute_path.substr(1, 2) == R"(:\)") + (absolute_path.substr(1, 2) == R"(:\)" || + absolute_path.substr(1, 2) == R"(:/)")) return Style::windows; return llvm::None; } diff --git a/lldb/unittests/Utility/FileSpecTest.cpp b/lldb/unittests/Utility/FileSpecTest.cpp index 64b72bec483e5..f92be63892cd9 100644 --- a/lldb/unittests/Utility/FileSpecTest.cpp +++ b/lldb/unittests/Utility/FileSpecTest.cpp @@ -196,9 +196,12 @@ TEST(FileSpecTest, GuessPathStyle) { EXPECT_EQ(FileSpec::Style::posix, FileSpec::GuessPathStyle("//net/bar.txt")); EXPECT_EQ(FileSpec::Style::windows, FileSpec::GuessPathStyle(R"(C:\foo.txt)")); + EXPECT_EQ(FileSpec::Style::windows, +FileSpec::GuessPathStyle(R"(C:/foo.txt)")); EXPECT_EQ(FileSpec::Style::windows, FileSpec::GuessPathStyle(R"(\\net\foo.txt)")); EXPECT_EQ(FileSpec::Style::windows, FileSpec::GuessPathStyle(R"(Z:\)")); + EXPECT_EQ(FileSpec::Style::windows, FileSpec::GuessPathStyle(R"(Z:/)")); EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo.txt")); EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo/bar.txt")); EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("Z:")); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a37cb5e - [lldb-vscode] Avoid a -Wunused-but-set-variable warning. NFC.
Author: Martin Storsjö Date: 2022-03-31T00:10:05+03:00 New Revision: a37cb5ece513cbed9059880a45838331460e42fb URL: https://github.com/llvm/llvm-project/commit/a37cb5ece513cbed9059880a45838331460e42fb DIFF: https://github.com/llvm/llvm-project/commit/a37cb5ece513cbed9059880a45838331460e42fb.diff LOG: [lldb-vscode] Avoid a -Wunused-but-set-variable warning. NFC. Differential Revision: https://reviews.llvm.org/D122710 Added: Modified: lldb/tools/lldb-vscode/lldb-vscode.cpp Removed: diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp index 28c0dfbac40f8..83a9762df6040 100644 --- a/lldb/tools/lldb-vscode/lldb-vscode.cpp +++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -3246,7 +3246,6 @@ int main(int argc, char *argv[]) { g_vsc.output.descriptor = StreamDescriptor::from_file(new_stdout_fd, false); } - uint32_t packet_idx = 0; while (!g_vsc.sent_terminated_event) { llvm::json::Object object; lldb_vscode::PacketStatus status = g_vsc.GetNextObject(object); @@ -3257,7 +3256,6 @@ int main(int argc, char *argv[]) { if (!g_vsc.HandleObject(object)) return 1; -++packet_idx; } return EXIT_SUCCESS; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e546bbf - [lldb] Fix detecting warning options for GCC
Author: Martin Storsjö Date: 2022-04-06T22:50:07+03:00 New Revision: e546bbfda0ab91cf78c096d8c035851cc7c3b9f3 URL: https://github.com/llvm/llvm-project/commit/e546bbfda0ab91cf78c096d8c035851cc7c3b9f3 DIFF: https://github.com/llvm/llvm-project/commit/e546bbfda0ab91cf78c096d8c035851cc7c3b9f3.diff LOG: [lldb] Fix detecting warning options for GCC If testing for a warning option like -Wno- with GCC, GCC won't print any diagnostic at all, leading to the options being accepted incorrectly. However later, if compiling a file that actually prints another warning, GCC will also print warnings about these -Wno- options being unrecognized. This avoids warning spam like this, for every lldb source file that produces build warnings with GCC: At global scope: cc1plus: warning: unrecognized command line option ‘-Wno-vla-extension’ cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-register’ This matches how such warning options are detected and added in llvm/cmake/modules/HandleLLVMOptions.cmake, e.g. like this: check_cxx_compiler_flag("-Wclass-memaccess" CXX_SUPPORTS_CLASS_MEMACCESS_FLAG) append_if(CXX_SUPPORTS_CLASS_MEMACCESS_FLAG "-Wno-class-memaccess" CMAKE_CXX_FLAGS) Differential Revision: https://reviews.llvm.org/D123202 Added: Modified: lldb/cmake/modules/LLDBConfig.cmake Removed: diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 69aaadf29ef64..25d1cc526ab03 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -168,22 +168,27 @@ else () endif () include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include") +# GCC silently accepts any -Wno- option, but warns about those options +# being unrecognized only if the compilation triggers other warnings to be +# printed. Therefore, check for whether the compiler supports options in the +# form -W, and if supported, add the corresponding -Wno- option. + # Disable GCC warnings -check_cxx_compiler_flag("-Wno-deprecated-declarations" CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS) -append_if(CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS "-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) +check_cxx_compiler_flag("-Wdeprecated-declarations" CXX_SUPPORTS_DEPRECATED_DECLARATIONS) +append_if(CXX_SUPPORTS_DEPRECATED_DECLARATIONS "-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) -check_cxx_compiler_flag("-Wno-unknown-pragmas" CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS) -append_if(CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS "-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) +check_cxx_compiler_flag("-Wunknown-pragmas" CXX_SUPPORTS_UNKNOWN_PRAGMAS) +append_if(CXX_SUPPORTS_UNKNOWN_PRAGMAS "-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) -check_cxx_compiler_flag("-Wno-strict-aliasing" CXX_SUPPORTS_NO_STRICT_ALIASING) -append_if(CXX_SUPPORTS_NO_STRICT_ALIASING "-Wno-strict-aliasing" CMAKE_CXX_FLAGS) +check_cxx_compiler_flag("-Wstrict-aliasing" CXX_SUPPORTS_STRICT_ALIASING) +append_if(CXX_SUPPORTS_STRICT_ALIASING "-Wno-strict-aliasing" CMAKE_CXX_FLAGS) # Disable Clang warnings -check_cxx_compiler_flag("-Wno-deprecated-register" CXX_SUPPORTS_NO_DEPRECATED_REGISTER) -append_if(CXX_SUPPORTS_NO_DEPRECATED_REGISTER "-Wno-deprecated-register" CMAKE_CXX_FLAGS) +check_cxx_compiler_flag("-Wdeprecated-register" CXX_SUPPORTS_DEPRECATED_REGISTER) +append_if(CXX_SUPPORTS_DEPRECATED_REGISTER "-Wno-deprecated-register" CMAKE_CXX_FLAGS) -check_cxx_compiler_flag("-Wno-vla-extension" CXX_SUPPORTS_NO_VLA_EXTENSION) -append_if(CXX_SUPPORTS_NO_VLA_EXTENSION "-Wno-vla-extension" CMAKE_CXX_FLAGS) +check_cxx_compiler_flag("-Wvla-extension" CXX_SUPPORTS_VLA_EXTENSION) +append_if(CXX_SUPPORTS_VLA_EXTENSION "-Wno-vla-extension" CMAKE_CXX_FLAGS) # Disable MSVC warnings if( MSVC ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] ae2aa2d - [lldb] Silence GCC warnings about missing returns after fully covered switches. NFC.
Author: Martin Storsjö Date: 2022-04-06T22:50:07+03:00 New Revision: ae2aa2d21b24a912314e618d1ceb8e036449b0b1 URL: https://github.com/llvm/llvm-project/commit/ae2aa2d21b24a912314e618d1ceb8e036449b0b1 DIFF: https://github.com/llvm/llvm-project/commit/ae2aa2d21b24a912314e618d1ceb8e036449b0b1.diff LOG: [lldb] Silence GCC warnings about missing returns after fully covered switches. NFC. This silences warnings like this: lldb/source/Core/DebuggerEvents.cpp: In member function ‘llvm::StringRef lldb_private::DiagnosticEventData::GetPrefix() const’: lldb/source/Core/DebuggerEvents.cpp:55:1: warning: control reaches end of non-void function [-Wreturn-type] 55 | } Differential Revision: https://reviews.llvm.org/D123203 Added: Modified: lldb/source/Breakpoint/Breakpoint.cpp lldb/source/Core/DebuggerEvents.cpp lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp Removed: diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index afadf81e32c8c..578cf14283d92 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -1026,6 +1026,7 @@ const char *Breakpoint::BreakpointEventTypeAsCString(BreakpointEventType type) { case eBreakpointEventTypeThreadChanged: return "thread changed"; case eBreakpointEventTypeAutoContinueChanged: return "autocontinue changed"; }; + llvm_unreachable("Fully covered switch above!"); } Log *Breakpoint::BreakpointEventData::GetLogChannel() { diff --git a/lldb/source/Core/DebuggerEvents.cpp b/lldb/source/Core/DebuggerEvents.cpp index a433ec31738f4..fdf55f68ce8e7 100644 --- a/lldb/source/Core/DebuggerEvents.cpp +++ b/lldb/source/Core/DebuggerEvents.cpp @@ -52,6 +52,7 @@ llvm::StringRef DiagnosticEventData::GetPrefix() const { case Type::Error: return "error"; } + llvm_unreachable("Fully covered switch above!"); } void DiagnosticEventData::Dump(Stream *s) const { diff --git a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp index 4882ab64f16ac..8c10828627971 100644 --- a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp +++ b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp @@ -102,6 +102,7 @@ static Expected ReadIntelPTConfigFile(const char *file, case BitOffset: return 10; } +llvm_unreachable("Fully covered switch above!"); }; auto createError = [&](const char *expected_value_message) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 6e38824 - [lldb] Silence GCC/glibc warnings about ignoring the return value of write(). NFC.
Author: Martin Storsjö Date: 2022-04-06T22:50:07+03:00 New Revision: 6e38824221db2e0d77d334d424331b3cf1ac279a URL: https://github.com/llvm/llvm-project/commit/6e38824221db2e0d77d334d424331b3cf1ac279a DIFF: https://github.com/llvm/llvm-project/commit/6e38824221db2e0d77d334d424331b3cf1ac279a.diff LOG: [lldb] Silence GCC/glibc warnings about ignoring the return value of write(). NFC. This matches how another similar warning is silenced in Host/posix/ProcessLauncherPosixFork.cpp. Differential Revision: https://reviews.llvm.org/D123205 Added: Modified: lldb/source/Core/Debugger.cpp Removed: diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index cac5ae4dacd75..37e54a9abefaa 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -893,7 +893,8 @@ Status Debugger::SetInputString(const char *data) { return result; } - write(fds[WRITE], data, size); + int r = write(fds[WRITE], data, size); + (void)r; // Close the write end of the pipe, so that the command interpreter will exit // when it consumes all the data. llvm::sys::Process::SafelyCloseFileDescriptor(fds[WRITE]); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 5560b9e - [lldb] [CMake] Disable GCC's -Wstringop-truncation warning. NFC.
Author: Martin Storsjö Date: 2022-04-07T12:09:01+03:00 New Revision: 5560b9e88423dbe044f4e82d4dc3d4b6dbd0e678 URL: https://github.com/llvm/llvm-project/commit/5560b9e88423dbe044f4e82d4dc3d4b6dbd0e678 DIFF: https://github.com/llvm/llvm-project/commit/5560b9e88423dbe044f4e82d4dc3d4b6dbd0e678.diff LOG: [lldb] [CMake] Disable GCC's -Wstringop-truncation warning. NFC. This warning gives false positives about lldb's correct use of strncpy to fill fixed length fields that don't need null termination, in lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp, like this: In file included from /usr/include/string.h:495, from /usr/include/c++/9/cstring:42, from ../include/llvm/ADT/StringRef.h:19, from ../tools/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:10: In function ‘char* strncpy(char*, const char*, size_t)’, inlined from ‘lldb::offset_t CreateAllImageInfosPayload(const ProcessSP&, lldb::offset_t, lldb_private::StreamString&, lldb::SaveCoreStyle)’ at ../tools/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:6341:16: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 16 equals destination size [-Wstringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~ The warning could be squelched locally with #pragma GCC diagnostic ignored "-Wstringop-truncation" too, but Clang also interprets those GCC pragmas, and produces a -Wunknown-warning-option warning instead. That could be remedied by wrapping the pragma in an "#ifndef __clang__" - but that makes things even more messy. Instead, just silence this warning entirely. Differential Revision: https://reviews.llvm.org/D123254 Added: Modified: lldb/cmake/modules/LLDBConfig.cmake Removed: diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 25d1cc526ab03..987353517d0d5 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -183,6 +183,9 @@ append_if(CXX_SUPPORTS_UNKNOWN_PRAGMAS "-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) check_cxx_compiler_flag("-Wstrict-aliasing" CXX_SUPPORTS_STRICT_ALIASING) append_if(CXX_SUPPORTS_STRICT_ALIASING "-Wno-strict-aliasing" CMAKE_CXX_FLAGS) +check_cxx_compiler_flag("-Wstringop-truncation" CXX_SUPPORTS_STRINGOP_TRUNCATION) +append_if(CXX_SUPPORTS_STRINGOP_TRUNCATION "-Wno-stringop-truncation" CMAKE_CXX_FLAGS) + # Disable Clang warnings check_cxx_compiler_flag("-Wdeprecated-register" CXX_SUPPORTS_DEPRECATED_REGISTER) append_if(CXX_SUPPORTS_DEPRECATED_REGISTER "-Wno-deprecated-register" CMAKE_CXX_FLAGS) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 3031fa8 - [lldb] Fix building standalone LLDB on Windows.
Author: Mehdi Chinoune Date: 2022-04-07T12:30:33+03:00 New Revision: 3031fa88f01e59dcacb0a3020fb9a27ccf2b7615 URL: https://github.com/llvm/llvm-project/commit/3031fa88f01e59dcacb0a3020fb9a27ccf2b7615 DIFF: https://github.com/llvm/llvm-project/commit/3031fa88f01e59dcacb0a3020fb9a27ccf2b7615.diff LOG: [lldb] Fix building standalone LLDB on Windows. It was broken since https://reviews.llvm.org/D110172 Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D122523 Added: Modified: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp llvm/include/llvm/Config/config.h.cmake llvm/include/llvm/Config/llvm-config.h.cmake Removed: diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp index 16a8ad8a10422..130353dfc67a6 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -57,7 +57,7 @@ #include "Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h" #if defined(_WIN32) -#include "llvm/Config/config.h" +#include "llvm/Config/llvm-config.h" #endif using namespace lldb; diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake index 2098c249e20db..cc514b17f8f0e 100644 --- a/llvm/include/llvm/Config/config.h.cmake +++ b/llvm/include/llvm/Config/config.h.cmake @@ -50,9 +50,6 @@ don't. */ #cmakedefine01 HAVE_DECL_STRERROR_S -/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */ -#cmakedefine01 LLVM_ENABLE_DIA_SDK - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H} diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake index f15eef3a4dea9..7d420bbc71645 100644 --- a/llvm/include/llvm/Config/llvm-config.h.cmake +++ b/llvm/include/llvm/Config/llvm-config.h.cmake @@ -113,4 +113,7 @@ * in non assert builds */ #cmakedefine01 LLVM_UNREACHABLE_OPTIMIZE +/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */ +#cmakedefine01 LLVM_ENABLE_DIA_SDK + #endif ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 373d08a - [lldb] Silence warnings about unused static variables in RegisterInfos_arm64.h
Author: Martin Storsjö Date: 2022-04-11T19:50:48+03:00 New Revision: 373d08adb4454d416bd2232525e5a6fbe45935ab URL: https://github.com/llvm/llvm-project/commit/373d08adb4454d416bd2232525e5a6fbe45935ab DIFF: https://github.com/llvm/llvm-project/commit/373d08adb4454d416bd2232525e5a6fbe45935ab.diff LOG: [lldb] Silence warnings about unused static variables in RegisterInfos_arm64.h Move them to the only source file that included RegisterInfos_arm64.h that actually used these variables. This silences warnings like these: In file included from lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp:42: lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h:790:35: warning: ‘g_register_infos_mte’ defined but not used [-Wunused-variable] 790 | static lldb_private::RegisterInfo g_register_infos_mte[] = { | ^~~~ lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h:787:35: warning: ‘g_register_infos_pauth’ defined but not used [-Wunused-variable] 787 | static lldb_private::RegisterInfo g_register_infos_pauth[] = { | ^~ Differential Revision: https://reviews.llvm.org/D123206 Added: Modified: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h Removed: diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp index d6c4a8687ec5c..579ac6e36d0ba 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp @@ -72,6 +72,12 @@ #include "RegisterInfos_arm64_sve.h" #undef DECLARE_REGISTER_INFOS_ARM64_STRUCT +static lldb_private::RegisterInfo g_register_infos_pauth[] = { +DEFINE_EXTENSION_REG(data_mask), DEFINE_EXTENSION_REG(code_mask)}; + +static lldb_private::RegisterInfo g_register_infos_mte[] = { +DEFINE_EXTENSION_REG(mte_ctrl)}; + // Number of register sets provided by this context. enum { k_num_gpr_registers = gpr_w28 - gpr_x0 + 1, diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h b/lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h index ccfbd6afbefba..d647fcaa600ad 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h +++ b/lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h @@ -784,10 +784,5 @@ static lldb_private::RegisterInfo g_register_infos_arm64_le[] = { {DEFINE_DBG(wcr, 15)} }; // clang-format on -static lldb_private::RegisterInfo g_register_infos_pauth[] = { -DEFINE_EXTENSION_REG(data_mask), DEFINE_EXTENSION_REG(code_mask)}; - -static lldb_private::RegisterInfo g_register_infos_mte[] = { -DEFINE_EXTENSION_REG(mte_ctrl)}; #endif // DECLARE_REGISTER_INFOS_ARM64_STRUCT ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 2a84a86 - [lldb] Fix initialization of LazyBool/bool variables m_overwrite/m_overwrite_lazy. NFCI.
Author: Martin Storsjö Date: 2022-04-29T21:33:37+03:00 New Revision: 2a84a86184392a7e18a958f36db0b2b3da6ae2bd URL: https://github.com/llvm/llvm-project/commit/2a84a86184392a7e18a958f36db0b2b3da6ae2bd DIFF: https://github.com/llvm/llvm-project/commit/2a84a86184392a7e18a958f36db0b2b3da6ae2bd.diff LOG: [lldb] Fix initialization of LazyBool/bool variables m_overwrite/m_overwrite_lazy. NFCI. This silences a GCC warning after 1f7b58f2a50461493f083b2ed807b25e036286f6 / D122680: lldb/source/Commands/CommandObjectCommands.cpp:1650:22: warning: enum constant in boolean context [-Wint-in-bool-context] 1650 | bool m_overwrite = eLazyBoolCalculate; | ^~ Differential Revision: https://reviews.llvm.org/D123204 Added: Modified: lldb/source/Commands/CommandObjectCommands.cpp Removed: diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 1d4687b0650a9..4ea81082a9aed 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -1480,7 +1480,7 @@ class CommandObjectCommandsScriptAdd : public CommandObjectParsed, std::string m_class_name; std::string m_funct_name; std::string m_short_help; -LazyBool m_overwrite_lazy; +LazyBool m_overwrite_lazy = eLazyBoolCalculate; ScriptedCommandSynchronicity m_synchronicity = eScriptedCommandSynchronicitySynchronous; }; @@ -1647,7 +1647,7 @@ class CommandObjectCommandsScriptAdd : public CommandObjectParsed, std::string m_cmd_name; CommandObjectMultiword *m_container = nullptr; std::string m_short_help; - bool m_overwrite = eLazyBoolCalculate; + bool m_overwrite = false; ScriptedCommandSynchronicity m_synchronicity = eScriptedCommandSynchronicitySynchronous; }; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 9191078 - [lldb] Fix cross compiling on macOS
Author: Martin Storsjö Date: 2022-05-28T00:53:25+03:00 New Revision: 9191078707390c32b691ff84633ab9450b380ea5 URL: https://github.com/llvm/llvm-project/commit/9191078707390c32b691ff84633ab9450b380ea5 DIFF: https://github.com/llvm/llvm-project/commit/9191078707390c32b691ff84633ab9450b380ea5.diff LOG: [lldb] Fix cross compiling on macOS When cross compiling, a separate nested cmake is spawned, for building host code generation tools such as lldb-tblgen. When cross compiling on macOS, the nested native build would trigger the lldb check for libc++, if testing is enabled (which it is by default). (Even if `LLDB_INCLUDE_TESTS=OFF` is set on the main build, it has to be passed separately in `CROSS_TOOLCHAIN_FLAGS_NATIVE` to reach the nested build.) Skip this check when building the host tools when cross compiling, as the user won't try to run tests in that nested build. (Alternatively, we could consider disabling all the `*_INCLUDE_TESTS` by default in the nested host tools build.) Differential Revision: https://reviews.llvm.org/D126557 Added: Modified: lldb/test/CMakeLists.txt Removed: diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt index 7a55bf47b5d34..e23ac6651a557 100644 --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -103,7 +103,7 @@ if(TARGET clang) add_lldb_test_dependency(tsan) endif() - if(APPLE) + if(APPLE AND NOT LLVM_TARGET_IS_CROSSCOMPILE_HOST) # FIXME: Standalone builds should import the cxx target as well. if(LLDB_BUILT_STANDALONE) # For now check that the include directory exists. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] c8daf4a - [lldb] Add gnu-debuglink support for Windows PE/COFF
Author: Alvin Wong Date: 2022-06-09T14:39:33+03:00 New Revision: c8daf4a707ad502b9694461246114bba01af5222 URL: https://github.com/llvm/llvm-project/commit/c8daf4a707ad502b9694461246114bba01af5222 DIFF: https://github.com/llvm/llvm-project/commit/c8daf4a707ad502b9694461246114bba01af5222.diff LOG: [lldb] Add gnu-debuglink support for Windows PE/COFF The specification of gnu-debuglink can be found at: https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html The file CRC or the CRC value from the .gnu_debuglink section is now used to calculate the module UUID as a fallback, to allow verifying that the debug object does match the executable. Note that if a CodeView build id exists, it still takes precedence. This works even for MinGW builds because LLD writes a synthetic CodeView build id which does not get stripped from the debug object. The `Minidump/Windows/find-module` test also needs a fix by adding a CodeView record to the exe to match the one in the minidump, otherwise it fails due to the new UUID calculated from the file CRC. Fixes https://github.com/llvm/llvm-project/issues/54344 Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D126367 Added: lldb/source/Plugins/SymbolVendor/PECOFF/CMakeLists.txt lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.h lldb/test/Shell/ObjectFile/PECOFF/dwarf-gnu-debuglink-i686.yaml lldb/test/Shell/ObjectFile/PECOFF/dwarf-gnu-debuglink-mismatched-crc.yaml lldb/test/Shell/ObjectFile/PECOFF/dwarf-gnu-debuglink-pdb-buildid.yaml lldb/test/Shell/ObjectFile/PECOFF/dwarf-gnu-debuglink.yaml Modified: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h lldb/source/Plugins/SymbolVendor/CMakeLists.txt lldb/source/Symbol/LocateSymbolFile.cpp lldb/test/Shell/Minidump/Windows/Inputs/find-module.exe.yaml Removed: diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index e07b2edd2b17..657fcdc5af6d 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -31,6 +31,7 @@ #include "llvm/BinaryFormat/COFF.h" #include "llvm/Object/COFFImportFile.h" +#include "llvm/Support/CRC.h" #include "llvm/Support/Error.h" #include "llvm/Support/MemoryBuffer.h" @@ -44,10 +45,42 @@ using namespace lldb_private; LLDB_PLUGIN_DEFINE(ObjectFilePECOFF) +static bool GetDebugLinkContents(const llvm::object::COFFObjectFile &coff_obj, + std::string &gnu_debuglink_file, + uint32_t &gnu_debuglink_crc) { + static ConstString g_sect_name_gnu_debuglink(".gnu_debuglink"); + for (const auto §ion : coff_obj.sections()) { +auto name = section.getName(); +if (!name) { + llvm::consumeError(name.takeError()); + continue; +} +if (*name == g_sect_name_gnu_debuglink.GetStringRef()) { + auto content = section.getContents(); + if (!content) { +llvm::consumeError(content.takeError()); +return false; + } + DataExtractor data( + content->data(), content->size(), + coff_obj.isLittleEndian() ? eByteOrderLittle : eByteOrderBig, 4); + lldb::offset_t gnu_debuglink_offset = 0; + gnu_debuglink_file = data.GetCStr(&gnu_debuglink_offset); + // Align to the next 4-byte offset + gnu_debuglink_offset = llvm::alignTo(gnu_debuglink_offset, 4); + data.GetU32(&gnu_debuglink_offset, &gnu_debuglink_crc, 1); + return true; +} + } + return false; +} + static UUID GetCoffUUID(llvm::object::COFFObjectFile &coff_obj) { const llvm::codeview::DebugInfo *pdb_info = nullptr; llvm::StringRef pdb_file; + // First, prefer to use the PDB build id. LLD generates this even for mingw + // targets without PDB output, and it does not get stripped either. if (!coff_obj.getDebugPDBInfo(pdb_info, pdb_file) && pdb_info) { if (pdb_info->PDB70.CVSignature == llvm::OMF::Signature::PDB70) { UUID::CvRecordPdb70 info; @@ -57,7 +90,26 @@ static UUID GetCoffUUID(llvm::object::COFFObjectFile &coff_obj) { } } - return UUID(); + std::string gnu_debuglink_file; + uint32_t gnu_debuglink_crc; + + // The GNU linker normally does not write a PDB build id (unless requested + // with the --build-id option), so we should fall back to using the crc + // from .gnu_debuglink if it exists, just like how ObjectFileELF does it. + if (!GetDebugLinkContents(coff_obj, gnu_debuglink_file, gnu_debuglink_crc)) { +// If there is no .gnu_debuglink section, then this may be an object +// containing DWARF debug info for .gnu_debuglink, so calculate the crc of +// the object itself. +
[Lldb-commits] [lldb] 39c4ac1 - [lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC.
Author: Martin Storsjö Date: 2022-06-09T14:39:33+03:00 New Revision: 39c4ac140d1ee67d152c990f5d16a8df98155cbc URL: https://github.com/llvm/llvm-project/commit/39c4ac140d1ee67d152c990f5d16a8df98155cbc DIFF: https://github.com/llvm/llvm-project/commit/39c4ac140d1ee67d152c990f5d16a8df98155cbc.diff LOG: [lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC. Added: Modified: lldb/source/Target/Target.cpp Removed: diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index ca9754d40af0..34dea43a64dd 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3466,6 +3466,7 @@ void Target::PrintDummySignals(Stream &strm, Args &signal_args) { case eLazyBoolYes: return "true "; case eLazyBoolNo: return "false "; } +llvm_unreachable("Fully covered switch above!"); }; size_t num_args = signal_args.GetArgumentCount(); for (const auto &elem : m_dummy_signals) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 25c8a06 - [lldb] Set COFF module ABI from default triple and make it an option
Author: Alvin Wong Date: 2022-06-09T22:43:33+03:00 New Revision: 25c8a061c5739677d2fc0af29a8cc9520207b923 URL: https://github.com/llvm/llvm-project/commit/25c8a061c5739677d2fc0af29a8cc9520207b923 DIFF: https://github.com/llvm/llvm-project/commit/25c8a061c5739677d2fc0af29a8cc9520207b923.diff LOG: [lldb] Set COFF module ABI from default triple and make it an option PE/COFF can use either MSVC or GNU (MinGW) ABI for C++ code, however LLDB had defaulted to MSVC implicitly with no way to override it. This causes issues when debugging modules built with the GNU ABI, sometimes even crashes. This changes the PE/COFF plugin to set the module triple according to the default target triple used to build LLDB. If the default target triple is Windows and a valid environment is specified, then this environment will be used for the module spec. This not only works for MSVC and GNU, but also other environments. A new setting, `plugin.object-file.pe-coff.abi`, has been added to allow overriding this default ABI. * Fixes https://github.com/llvm/llvm-project/issues/50775 * Fixes https://github.com/mstorsjo/llvm-mingw/issues/226 * Fixes https://github.com/mstorsjo/llvm-mingw/issues/282 Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D127048 Added: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFFProperties.td lldb/test/Shell/ObjectFile/PECOFF/default-triple-windows-gnu.yaml lldb/test/Shell/ObjectFile/PECOFF/default-triple-windows-msvc.yaml lldb/test/Shell/ObjectFile/PECOFF/settings-abi.yaml Modified: lldb/include/lldb/Core/PluginManager.h lldb/source/Core/PluginManager.cpp lldb/source/Plugins/ObjectFile/PECOFF/CMakeLists.txt lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h lldb/test/Shell/ObjectFile/PECOFF/basic-info-arm.yaml lldb/test/Shell/ObjectFile/PECOFF/basic-info-arm64.yaml lldb/test/Shell/ObjectFile/PECOFF/basic-info.yaml lldb/test/Shell/lit.cfg.py Removed: diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h index 1ab9d26d3af4f..8322585b2253e 100644 --- a/lldb/include/lldb/Core/PluginManager.h +++ b/lldb/include/lldb/Core/PluginManager.h @@ -174,7 +174,8 @@ class PluginManager { ObjectFileCreateInstance create_callback, ObjectFileCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications, - ObjectFileSaveCore save_core = nullptr); + ObjectFileSaveCore save_core = nullptr, + DebuggerInitializeCallback debugger_init_callback = nullptr); static bool UnregisterPlugin(ObjectFileCreateInstance create_callback); @@ -482,6 +483,13 @@ class PluginManager { Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, ConstString description, bool is_global_property); + static lldb::OptionValuePropertiesSP + GetSettingForObjectFilePlugin(Debugger &debugger, ConstString setting_name); + + static bool CreateSettingForObjectFilePlugin( + Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, + ConstString description, bool is_global_property); + static lldb::OptionValuePropertiesSP GetSettingForSymbolFilePlugin(Debugger &debugger, ConstString setting_name); diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp index 37050494aa2ea..f12efad560b21 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -621,9 +621,10 @@ struct ObjectFileInstance : public PluginInstance { CallbackType create_callback, ObjectFileCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications, - ObjectFileSaveCore save_core) - : PluginInstance(name, description, - create_callback), + ObjectFileSaveCore save_core, + DebuggerInitializeCallback debugger_init_callback) + : PluginInstance( +name, description, create_callback, debugger_init_callback), create_memory_callback(create_memory_callback), get_module_specifications(get_module_specifications), save_core(save_core) {} @@ -644,10 +645,11 @@ bool PluginManager::RegisterPlugin( ObjectFileCreateInstance create_callback, ObjectFileCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications, -ObjectFileSaveCore save_core) { +ObjectFileSaveCore save_core, +DebuggerInitializeCallback debugger_init_callback) { return GetObjectFileInstances().RegisterPlugin( name, description, create_callback, create_memory_callback, - get_module_specifications, save_core); + get_module_specific
[Lldb-commits] [lldb] 87a2dba - [lldb] Fix loading DLL from some ramdisk on Windows
Author: Alvin Wong Date: 2022-06-15T17:02:33+03:00 New Revision: 87a2dba14ec82629317e13c2bce4c93b4d0a837d URL: https://github.com/llvm/llvm-project/commit/87a2dba14ec82629317e13c2bce4c93b4d0a837d DIFF: https://github.com/llvm/llvm-project/commit/87a2dba14ec82629317e13c2bce4c93b4d0a837d.diff LOG: [lldb] Fix loading DLL from some ramdisk on Windows The WinAPI `GetFinalPathNameByHandle` is used to retrieve the DLL file name from the HANDLE provided to `LOAD_DLL_DEBUG_EVENT` in the debug loop. When this API fails, lldb will simply ignore that module. Certain ramdisk (e.g. ImDisk) does not work with this API, which means it is impossible to use lldb to debug a process which loads DLLs located on this type of ramdisk. In order to make this work, we need to use a fallback routine which involves creating a file mapping, using `GetMappedFileName` to get a device path, then substitutes the device path with its drive letter. References: * https://developercommunity.visualstudio.com/t/cannot-debug-program-when-compiled-to-ram-drive/43004#T-N109926 * https://github.com/jrfonseca/drmingw/issues/65 * https://docs.microsoft.com/en-us/windows/win32/memory/obtaining-a-file-name-from-a-file-handle Reviewed By: labath Differential Revision: https://reviews.llvm.org/D126657 Added: Modified: lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp Removed: diff --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp index e442650f0920e..eddda6efa2538 100644 --- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp @@ -13,6 +13,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Host/ThreadLauncher.h" +#include "lldb/Host/windows/AutoHandle.h" #include "lldb/Host/windows/HostProcessWindows.h" #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/ProcessLauncherWindows.h" @@ -29,6 +30,8 @@ #include "llvm/Support/Threading.h" #include "llvm/Support/raw_ostream.h" +#include + #ifndef STATUS_WX86_BREAKPOINT #define STATUS_WX86_BREAKPOINT 0x401FL // For WOW64 #endif @@ -409,6 +412,61 @@ DebuggerThread::HandleExitProcessEvent(const EXIT_PROCESS_DEBUG_INFO &info, return DBG_CONTINUE; } +static llvm::Optional GetFileNameFromHandleFallback(HANDLE hFile) { + // Check that file is not empty as we cannot map a file with zero length. + DWORD dwFileSizeHi = 0; + DWORD dwFileSizeLo = ::GetFileSize(hFile, &dwFileSizeHi); + if (dwFileSizeLo == 0 && dwFileSizeHi == 0) +return llvm::None; + + AutoHandle filemap( + ::CreateFileMappingW(hFile, nullptr, PAGE_READONLY, 0, 1, NULL), nullptr); + if (!filemap.IsValid()) +return llvm::None; + + auto view_deleter = [](void *pMem) { ::UnmapViewOfFile(pMem); }; + std::unique_ptr pMem( + ::MapViewOfFile(filemap.get(), FILE_MAP_READ, 0, 0, 1), view_deleter); + if (!pMem) +return llvm::None; + + std::array mapped_filename; + if (!::GetMappedFileNameW(::GetCurrentProcess(), pMem.get(), +mapped_filename.data(), mapped_filename.size())) +return llvm::None; + + // A series of null-terminated strings, plus an additional null character + std::array drive_strings; + drive_strings[0] = L'\0'; + if (!::GetLogicalDriveStringsW(drive_strings.size(), drive_strings.data())) +return llvm::None; + + std::array drive = {L"_:"}; + for (const wchar_t *it = drive_strings.data(); *it != L'\0'; + it += wcslen(it) + 1) { +// Copy the drive letter to the template string +drive[0] = it[0]; +std::array device_name; +if (::QueryDosDeviceW(drive.data(), device_name.data(), + device_name.size())) { + size_t device_name_len = wcslen(device_name.data()); + if (device_name_len < mapped_filename.size()) { +bool match = _wcsnicmp(mapped_filename.data(), device_name.data(), + device_name_len) == 0; +if (match && mapped_filename[device_name_len] == L'\\') { + // Replace device path with its drive letter + std::wstring rebuilt_path(drive.data()); + rebuilt_path.append(&mapped_filename[device_name_len]); + std::string path_utf8; + llvm::convertWideToUTF8(rebuilt_path, path_utf8); + return path_utf8; +} + } +} + } + return llvm::None; +} + DWORD DebuggerThread::HandleLoadDllEvent(const LOAD_DLL_DEBUG_INFO &info, DWORD thread_id) { @@ -420,6 +478,17 @@ DebuggerThread::HandleLoadDllEvent(const LOAD_DLL_DEBUG_INFO &info, return DBG_CONTINUE; } + auto on_load_dll = [&](llvm::StringRef path) { +FileSpec file_spec(path); +ModuleSpec module_spec(file_spec); +lldb::addr_t load_addr = r
[Lldb-commits] [lldb] c9fc433 - [lldb] Fix building with GCC 7
Author: Martin Storsjö Date: 2022-06-21T00:19:09+03:00 New Revision: c9fc4336d4b35cd1ed8083336c997c159f286794 URL: https://github.com/llvm/llvm-project/commit/c9fc4336d4b35cd1ed8083336c997c159f286794 DIFF: https://github.com/llvm/llvm-project/commit/c9fc4336d4b35cd1ed8083336c997c159f286794.diff LOG: [lldb] Fix building with GCC 7 Added: Modified: lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp Removed: diff --git a/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp b/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp index 7183b213e340f..9e486c15b5302 100644 --- a/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp +++ b/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp @@ -62,5 +62,5 @@ IntelPTPerThreadProcessTrace::Start(const TraceIntelPTStartRequest &request, error = joinErrors(std::move(error), trace->TraceStart(tid)); if (error) return std::move(error); - return trace; + return std::move(trace); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 9846a1f - [lldb] Remove an outdated comment. NFC.
Author: Martin Storsjö Date: 2022-06-22T16:11:59+03:00 New Revision: 9846a1f2d4723a8c060370638bbd52360638d0fc URL: https://github.com/llvm/llvm-project/commit/9846a1f2d4723a8c060370638bbd52360638d0fc DIFF: https://github.com/llvm/llvm-project/commit/9846a1f2d4723a8c060370638bbd52360638d0fc.diff LOG: [lldb] Remove an outdated comment. NFC. This comment became outdated in 053eb35651906e693906fad6c695fce11415ade7 (but was moved along); that commit moved the code and the comment to a separate function, with a separate local variable `num_of_bytes_read`. On error, the possibly garbage value is never copied back to the caller's reference, thus the comment is no longer relevant (and slightly confusing as is). Differential Revision: https://reviews.llvm.org/D128226 Added: Modified: lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp Removed: diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp index 555c19adcfa9a..59f5f6dfe7716 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp @@ -281,10 +281,6 @@ Status ProcessDebugger::ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, SIZE_T num_of_bytes_read = 0; if (!::ReadProcessMemory(process.GetNativeProcess().GetSystemHandle(), addr, buf, size, &num_of_bytes_read)) { -// Reading from the process can fail for a number of reasons - set the -// error code and make sure that the number of bytes read is set back to 0 -// because in some scenarios the value of bytes_read returned from the API -// is garbage. error.SetError(GetLastError(), eErrorTypeWin32); LLDB_LOG(log, "reading failed with error: {0}", error); } else { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 8a64dd5 - [lldb] Fix reading i686-windows executables with GNU environment
Author: Martin Storsjö Date: 2022-06-22T17:16:05+03:00 New Revision: 8a64dd5b06146f073a4a326f0e24fa18e571b281 URL: https://github.com/llvm/llvm-project/commit/8a64dd5b06146f073a4a326f0e24fa18e571b281 DIFF: https://github.com/llvm/llvm-project/commit/8a64dd5b06146f073a4a326f0e24fa18e571b281.diff LOG: [lldb] Fix reading i686-windows executables with GNU environment 25c8a061c5739677d2fc0af29a8cc9520207b923 / D127048 added an option for setting the ABI to GNU. When an object file is loaded, there's only minimal verification done for the architecture spec set for it, if the object file only provides one. However, for i386 object files, the PECOFF object file plugin provides two architectures, i386-pc-windows and i686-pc-windows. This picks a totally different codepath in TargetList::CreateTargetInternal, where it's treated as a fat binary. This goes through more verifications to see if the architectures provided by the object file matches what the platform plugin supports. The PlatformWindows() constructor explicitly adds the "i386-pc-windows" and "i686-pc-windows" architectures (even when running on other architectures), which allows this "fat binary verification" to succeed for the i386 object files that provide two architectures. However, after that commit, if the object file is advertised with the different environment (either when lldb is built in a mingw environment, or if that setting is set), the fat binary validation won't accept the file any longer. Update ArchSpec::IsEqualTo with more logic for the Windows use cases; mismatching vendors is not an issue (they don't have any practical effect on Windows), and GNU and MSVC environments are compatible to the point that PlatformWindows can handle object files for both environments/ABIs. As a separate path forward, one could also consider to stop returning two architecture specs from ObjectFilePECOFF::GetModuleSpecifications for i386 files. Differential Revision: https://reviews.llvm.org/D128268 Added: lldb/test/Shell/ObjectFile/PECOFF/settings-abi-i686.yaml Modified: lldb/source/Utility/ArchSpec.cpp Removed: diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp index c6feacfc7c1e6..a99aed82bc886 100644 --- a/lldb/source/Utility/ArchSpec.cpp +++ b/lldb/source/Utility/ArchSpec.cpp @@ -979,7 +979,16 @@ bool ArchSpec::IsEqualTo(const ArchSpec &rhs, bool exact_match) const { const llvm::Triple::VendorType lhs_triple_vendor = lhs_triple.getVendor(); const llvm::Triple::VendorType rhs_triple_vendor = rhs_triple.getVendor(); - if (lhs_triple_vendor != rhs_triple_vendor) { + + const llvm::Triple::OSType lhs_triple_os = lhs_triple.getOS(); + const llvm::Triple::OSType rhs_triple_os = rhs_triple.getOS(); + + bool both_windows = lhs_triple.isOSWindows() && rhs_triple.isOSWindows(); + + // On Windows, the vendor field doesn't have any practical effect, but + // it is often set to either "pc" or "w64". + if ((lhs_triple_vendor != rhs_triple_vendor) && + (exact_match || !both_windows)) { const bool rhs_vendor_specified = rhs.TripleVendorWasSpecified(); const bool lhs_vendor_specified = TripleVendorWasSpecified(); // Both architectures had the vendor specified, so if they aren't equal @@ -993,8 +1002,6 @@ bool ArchSpec::IsEqualTo(const ArchSpec &rhs, bool exact_match) const { return false; } - const llvm::Triple::OSType lhs_triple_os = lhs_triple.getOS(); - const llvm::Triple::OSType rhs_triple_os = rhs_triple.getOS(); const llvm::Triple::EnvironmentType lhs_triple_env = lhs_triple.getEnvironment(); const llvm::Triple::EnvironmentType rhs_triple_env = @@ -1032,6 +1039,9 @@ bool ArchSpec::IsEqualTo(const ArchSpec &rhs, bool exact_match) const { return true; } + if (!exact_match && both_windows) +return true; // The Windows environments (MSVC vs GNU) are compatible + return IsCompatibleEnvironment(lhs_triple_env, rhs_triple_env); } diff --git a/lldb/test/Shell/ObjectFile/PECOFF/settings-abi-i686.yaml b/lldb/test/Shell/ObjectFile/PECOFF/settings-abi-i686.yaml new file mode 100644 index 0..ca2bac38027fa --- /dev/null +++ b/lldb/test/Shell/ObjectFile/PECOFF/settings-abi-i686.yaml @@ -0,0 +1,61 @@ +## Check that i386 executables can be opened in both ABI modes. +## I386 executables are special in the sense that the PECOFF object +## file plugin returns two architectures for them, i386 and i686, which +## causes more elaborate comparisons to be run against the Platform plugin's +## architecture list. Check that this is accepted despite potential mismatches +## in the environment part of the triple. + +# RUN: yaml2obj %s -o %t + +## Default ABI is msvc: +# RUN: %lldb -O "settings set plugin.object-file.pe-coff.abi msvc" \ +# RUN: -f %t -o "image list --triple --basename" -o exit | \ +# RUN: FileCheck -DABI=msvc -DFILENAME=%basename_t
[Lldb-commits] [lldb] 2bae956 - [lldb] Resolve exe location for `target create`
Author: Alvin Wong Date: 2022-06-22T17:16:05+03:00 New Revision: 2bae9560575362ffd756f193efa1de2d5c2f4cfd URL: https://github.com/llvm/llvm-project/commit/2bae9560575362ffd756f193efa1de2d5c2f4cfd DIFF: https://github.com/llvm/llvm-project/commit/2bae9560575362ffd756f193efa1de2d5c2f4cfd.diff LOG: [lldb] Resolve exe location for `target create` This fixes an issue that, when you start lldb or use `target create` with a program name which is on $PATH, or not specify the .exe suffix of a program in the working directory on Windows, you get a confusing error, for example: (lldb) target create notepad error: 'C:\WINDOWS\SYSTEM32\notepad.exe' doesn't contain any 'host' platform architectures: i686, x86_64, i386, i386 Fixes https://github.com/mstorsjo/llvm-mingw/issues/265 Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D127436 Added: lldb/test/Shell/Commands/command-target-create-resolve-exe.test Modified: lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Target/TargetList.cpp Removed: diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 7789698c1d678..23ebbdb64d028 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -299,12 +299,6 @@ class CommandObjectTargetCreate : public CommandObjectParsed { const char *file_path = command.GetArgumentAtIndex(0); LLDB_SCOPED_TIMERF("(lldb) target create '%s'", file_path); - FileSpec file_spec; - - if (file_path) { -file_spec.SetFile(file_path, FileSpec::Style::native); -FileSystem::Instance().Resolve(file_spec); - } bool must_set_platform_path = false; @@ -333,6 +327,18 @@ class CommandObjectTargetCreate : public CommandObjectParsed { PlatformSP platform_sp = target_sp->GetPlatform(); + FileSpec file_spec; + if (file_path) { +file_spec.SetFile(file_path, FileSpec::Style::native); +FileSystem::Instance().Resolve(file_spec); + +// Try to resolve the exe based on PATH and/or platform-specific +// suffixes, but only if using the host platform. +if (platform_sp && platform_sp->IsHost() && +!FileSystem::Instance().Exists(file_spec)) + FileSystem::Instance().ResolveExecutableLocation(file_spec); + } + if (remote_file) { if (platform_sp) { // I have a remote file.. two possible cases diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index 72b50811b8745..214e98ee91edb 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -121,6 +121,14 @@ Status TargetList::CreateTargetInternal( if (!user_exe_path.empty()) { ModuleSpec module_spec(FileSpec(user_exe_path, FileSpec::Style::native)); FileSystem::Instance().Resolve(module_spec.GetFileSpec()); + +// Try to resolve the exe based on PATH and/or platform-specific suffixes, +// but only if using the host platform. +if (platform_sp->IsHost() && +!FileSystem::Instance().Exists(module_spec.GetFileSpec())) + FileSystem::Instance().ResolveExecutableLocation( + module_spec.GetFileSpec()); + // Resolve the executable in case we are given a path to a application // bundle like a .app bundle on MacOSX. Host::ResolveExecutableInBundle(module_spec.GetFileSpec()); diff --git a/lldb/test/Shell/Commands/command-target-create-resolve-exe.test b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test new file mode 100644 index 0..30263217ede1d --- /dev/null +++ b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test @@ -0,0 +1,28 @@ +# REQUIRES: system-windows + +## This checks that when starting lldb (or using `target create`) with a +## program name which is on $PATH, or not specify the .exe suffix of a program +## in the working directory on Windows, lldb can still detect the target +## architecture correctly instead of producing an error. + +# RUN: mkdir -p "%t.dir" +# RUN: %clang_host -g0 -O0 %S/Inputs/main.c -o %t.dir/testmain.exe + +## Test with full path to exe +# RUN: %lldb %t.dir/testmain.exe -b | FileCheck %s + +## Test with exe on path, with .exe suffix +# RUN: env "PATH=%t.dir;%PATH%" %lldb testmain.exe -b | FileCheck %s + +## Test with exe on path, without .exe suffix +# RUN: env "PATH=%t.dir;%PATH%" %lldb testmain -b | FileCheck %s + +## Test in cwd, with .exe suffix +# RUN: cd "%t.dir" && %lldb testmain.exe -b | FileCheck %s + +## Test in cwd, without .exe suffix +# RUN: cd "%t.dir" && %lldb testmain -b | FileCheck %s + +# CHECK-LABEL: target create +# CHECK-NEXT: Current executable set to '{{.*[/\\]}}testmain.exe' +# CHECK-NOT: Error ___ lldb-commits mailing list lldb-commits@l
[Lldb-commits] [lldb] 4d12378 - [lldb][windows] Fix crash on getting nested exception
Author: Alvin Wong Date: 2022-06-22T17:16:06+03:00 New Revision: 4d123783957e547009e55346bf3a8ae43a88fa14 URL: https://github.com/llvm/llvm-project/commit/4d123783957e547009e55346bf3a8ae43a88fa14 DIFF: https://github.com/llvm/llvm-project/commit/4d123783957e547009e55346bf3a8ae43a88fa14.diff LOG: [lldb][windows] Fix crash on getting nested exception LLDB tries to follow `EXCEPTION_RECORD::ExceptionRecord` to follow the nested exception chain. In practice this code just causes Access Violation whenever there is a nested exception. Since there does not appear to be any code in LLDB that is actually using the nested exceptions, this change just removes the crashing code and adds a comment for future reference. Fixes https://github.com/mstorsjo/llvm-mingw/issues/292 Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D128201 Added: Modified: lldb/source/Plugins/Process/Windows/Common/ExceptionRecord.h Removed: diff --git a/lldb/source/Plugins/Process/Windows/Common/ExceptionRecord.h b/lldb/source/Plugins/Process/Windows/Common/ExceptionRecord.h index d1692a6926b2..4499698369f5 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ExceptionRecord.h +++ b/lldb/source/Plugins/Process/Windows/Common/ExceptionRecord.h @@ -25,11 +25,17 @@ namespace lldb_private { class ExceptionRecord { public: ExceptionRecord(const EXCEPTION_RECORD &record, lldb::tid_t thread_id) { +// Notes about the `record.ExceptionRecord` field: +// In the past, some code tried to parse the nested exception with it, but +// in practice, that code just causes Access Violation. I suspect +// `ExceptionRecord` here actually points to the address space of the +// debuggee process. However, I did not manage to find any official or +// unofficial reference that clarifies this point. If anyone would like to +// reimplement this, please also keep in mind to check how this behaves when +// debugging a WOW64 process. I suspect you may have to use the explicit +// `EXCEPTION_RECORD32` and `EXCEPTION_RECORD64` structs. m_code = record.ExceptionCode; m_continuable = (record.ExceptionFlags == 0); -if (record.ExceptionRecord) - m_next_exception.reset( - new ExceptionRecord(*record.ExceptionRecord, thread_id)); m_exception_addr = reinterpret_cast(record.ExceptionAddress); m_thread_id = thread_id; m_arguments.assign(record.ExceptionInformation, @@ -39,27 +45,16 @@ class ExceptionRecord { // MINIDUMP_EXCEPTIONs are almost identical to EXCEPTION_RECORDs. ExceptionRecord(const MINIDUMP_EXCEPTION &record, lldb::tid_t thread_id) : m_code(record.ExceptionCode), m_continuable(record.ExceptionFlags == 0), -m_next_exception(nullptr), m_exception_addr(static_cast(record.ExceptionAddress)), m_thread_id(thread_id), m_arguments(record.ExceptionInformation, -record.ExceptionInformation + record.NumberParameters) { -// Set up link to nested exception. -if (record.ExceptionRecord) { - m_next_exception.reset(new ExceptionRecord( - *reinterpret_cast(record.ExceptionRecord), - thread_id)); -} - } +record.ExceptionInformation + record.NumberParameters) {} virtual ~ExceptionRecord() {} DWORD GetExceptionCode() const { return m_code; } bool IsContinuable() const { return m_continuable; } - const ExceptionRecord *GetNextException() const { -return m_next_exception.get(); - } lldb::addr_t GetExceptionAddress() const { return m_exception_addr; } lldb::tid_t GetThreadID() const { return m_thread_id; } @@ -69,7 +64,6 @@ class ExceptionRecord { private: DWORD m_code; bool m_continuable; - std::shared_ptr m_next_exception; lldb::addr_t m_exception_addr; lldb::tid_t m_thread_id; std::vector m_arguments; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 3c86789 - [lldb] Add setting to override PE/COFF ABI by module name
Author: Alvin Wong Date: 2022-06-22T17:16:06+03:00 New Revision: 3c867898c7be7ed2b5d119a2478a836a0c85f19b URL: https://github.com/llvm/llvm-project/commit/3c867898c7be7ed2b5d119a2478a836a0c85f19b DIFF: https://github.com/llvm/llvm-project/commit/3c867898c7be7ed2b5d119a2478a836a0c85f19b.diff LOG: [lldb] Add setting to override PE/COFF ABI by module name The setting `plugin.object-file.pe-coff.module-abi` is a string-to-enum map that allows specifying an ABI to a module name. For example: ucrtbase.dll=msvc libstdc++-6.dll=gnu This allows for debugging a process which mixes both modules built using the MSVC ABI and modules built using the MinGW ABI. Depends on D127048 Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D127234 Added: Modified: lldb/include/lldb/Interpreter/OptionValueDictionary.h lldb/source/Interpreter/OptionValueDictionary.cpp lldb/source/Interpreter/Property.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFFProperties.td lldb/test/Shell/ObjectFile/PECOFF/settings-abi.yaml Removed: diff --git a/lldb/include/lldb/Interpreter/OptionValueDictionary.h b/lldb/include/lldb/Interpreter/OptionValueDictionary.h index f96cbc9fe9e75..4c6bcaecd4c78 100644 --- a/lldb/include/lldb/Interpreter/OptionValueDictionary.h +++ b/lldb/include/lldb/Interpreter/OptionValueDictionary.h @@ -12,6 +12,7 @@ #include #include "lldb/Interpreter/OptionValue.h" +#include "lldb/lldb-private-types.h" namespace lldb_private { @@ -19,8 +20,10 @@ class OptionValueDictionary : public Cloneable { public: OptionValueDictionary(uint32_t type_mask = UINT32_MAX, +OptionEnumValues enum_values = OptionEnumValues(), bool raw_value_dump = true) - : m_type_mask(type_mask), m_raw_value_dump(raw_value_dump) {} + : m_type_mask(type_mask), m_enum_values(enum_values), +m_raw_value_dump(raw_value_dump) {} ~OptionValueDictionary() override = default; @@ -75,6 +78,7 @@ class OptionValueDictionary protected: typedef std::map collection; uint32_t m_type_mask; + OptionEnumValues m_enum_values; collection m_values; bool m_raw_value_dump; }; diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp index 26fed4a987e15..6baafc9213e1a 100644 --- a/lldb/source/Interpreter/OptionValueDictionary.cpp +++ b/lldb/source/Interpreter/OptionValueDictionary.cpp @@ -8,11 +8,12 @@ #include "lldb/Interpreter/OptionValueDictionary.h" -#include "llvm/ADT/StringRef.h" #include "lldb/DataFormatters/FormatManager.h" +#include "lldb/Interpreter/OptionValueEnumeration.h" #include "lldb/Interpreter/OptionValueString.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/State.h" +#include "llvm/ADT/StringRef.h" using namespace lldb; using namespace lldb_private; @@ -161,16 +162,26 @@ Status OptionValueDictionary::SetArgs(const Args &args, return error; } - lldb::OptionValueSP value_sp(CreateValueFromCStringForTypeMask( - value.str().c_str(), m_type_mask, error)); - if (value_sp) { + if (m_type_mask == 1u << eTypeEnum) { +auto enum_value = +std::make_shared(m_enum_values, 0); +error = enum_value->SetValueFromString(value); if (error.Fail()) return error; m_value_was_set = true; -SetValueForKey(ConstString(key), value_sp, true); +SetValueForKey(ConstString(key), enum_value, true); } else { -error.SetErrorString("dictionaries that can contain multiple types " - "must subclass OptionValueArray"); +lldb::OptionValueSP value_sp(CreateValueFromCStringForTypeMask( +value.str().c_str(), m_type_mask, error)); +if (value_sp) { + if (error.Fail()) +return error; + m_value_was_set = true; + SetValueForKey(ConstString(key), value_sp, true); +} else { + error.SetErrorString("dictionaries that can contain multiple types " + "must subclass OptionValueArray"); +} } } break; diff --git a/lldb/source/Interpreter/Property.cpp b/lldb/source/Interpreter/Property.cpp index fe3a8a31394b5..681596224d31a 100644 --- a/lldb/source/Interpreter/Property.cpp +++ b/lldb/source/Interpreter/Property.cpp @@ -68,9 +68,10 @@ Property::Property(const PropertyDefinition &definition) } case OptionValue::eTypeDictionary: // "definition.default_uint_value" is always a OptionValue::Type -m_value_sp = -std::make_shared(OptionValue::ConvertTypeToMask( -(OptionValue::Type)definition.default_uint_value)); +m_value_sp = std::make_shared( +OptionValue::ConvertTypeToMask( +
[Lldb-commits] [lldb] 0bc7105 - [lldb] Tentative attempt to fix command-target-create-resolve-exe.test on buildbot
Author: Martin Storsjö Date: 2022-06-22T18:48:04+03:00 New Revision: 0bc7105cd1447c2d85716c3dcd2924595decc939 URL: https://github.com/llvm/llvm-project/commit/0bc7105cd1447c2d85716c3dcd2924595decc939 DIFF: https://github.com/llvm/llvm-project/commit/0bc7105cd1447c2d85716c3dcd2924595decc939.diff LOG: [lldb] Tentative attempt to fix command-target-create-resolve-exe.test on buildbot This test does succeed in my local test environment though, but fails on the buildbot. Added: Modified: lldb/test/Shell/Commands/command-target-create-resolve-exe.test Removed: diff --git a/lldb/test/Shell/Commands/command-target-create-resolve-exe.test b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test index 30263217ede1..1664a45fd32a 100644 --- a/lldb/test/Shell/Commands/command-target-create-resolve-exe.test +++ b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test @@ -12,10 +12,10 @@ # RUN: %lldb %t.dir/testmain.exe -b | FileCheck %s ## Test with exe on path, with .exe suffix -# RUN: env "PATH=%t.dir;%PATH%" %lldb testmain.exe -b | FileCheck %s +# RUN: env PATH="%t.dir;$PATH" %lldb testmain.exe -b | FileCheck %s ## Test with exe on path, without .exe suffix -# RUN: env "PATH=%t.dir;%PATH%" %lldb testmain -b | FileCheck %s +# RUN: env PATH="%t.dir;$PATH" %lldb testmain -b | FileCheck %s ## Test in cwd, with .exe suffix # RUN: cd "%t.dir" && %lldb testmain.exe -b | FileCheck %s ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a1ee0b9 - [lldb] Second attempt at fixing command-target-create-resolve-exe.test on the buildbot
Author: Alvin Wong Date: 2022-06-22T20:49:30+03:00 New Revision: a1ee0b947d46c9be1cc2ea8db21603bac84efb18 URL: https://github.com/llvm/llvm-project/commit/a1ee0b947d46c9be1cc2ea8db21603bac84efb18 DIFF: https://github.com/llvm/llvm-project/commit/a1ee0b947d46c9be1cc2ea8db21603bac84efb18.diff LOG: [lldb] Second attempt at fixing command-target-create-resolve-exe.test on the buildbot Added: Modified: lldb/test/Shell/Commands/command-target-create-resolve-exe.test lldb/test/Shell/Commands/lit.local.cfg Removed: diff --git a/lldb/test/Shell/Commands/command-target-create-resolve-exe.test b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test index 1664a45fd32a5..0ebbaf25e652d 100644 --- a/lldb/test/Shell/Commands/command-target-create-resolve-exe.test +++ b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test @@ -12,10 +12,10 @@ # RUN: %lldb %t.dir/testmain.exe -b | FileCheck %s ## Test with exe on path, with .exe suffix -# RUN: env PATH="%t.dir;$PATH" %lldb testmain.exe -b | FileCheck %s +# RUN: env PATH="%t.dir%{pathsep}%{PATH}" %lldb testmain.exe -b | FileCheck %s ## Test with exe on path, without .exe suffix -# RUN: env PATH="%t.dir;$PATH" %lldb testmain -b | FileCheck %s +# RUN: env PATH="%t.dir%{pathsep}%{PATH}" %lldb testmain -b | FileCheck %s ## Test in cwd, with .exe suffix # RUN: cd "%t.dir" && %lldb testmain.exe -b | FileCheck %s diff --git a/lldb/test/Shell/Commands/lit.local.cfg b/lldb/test/Shell/Commands/lit.local.cfg index 60e87e4624e52..b83eee443fcca 100644 --- a/lldb/test/Shell/Commands/lit.local.cfg +++ b/lldb/test/Shell/Commands/lit.local.cfg @@ -1 +1,4 @@ config.suffixes = ['.s', '.test', '.yaml'] + +# This is needed by command-target-create-resolve-exe.test +config.substitutions.append(('%{PATH}', config.environment['PATH'])) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a8483b9 - [lldb] Fix a log format warning on Windows, don't assume uint64_t is a long type
Author: Martin Storsjö Date: 2023-02-15T14:44:17+02:00 New Revision: a8483b9b30385807790882b3b770fa6d016a0aa4 URL: https://github.com/llvm/llvm-project/commit/a8483b9b30385807790882b3b770fa6d016a0aa4 DIFF: https://github.com/llvm/llvm-project/commit/a8483b9b30385807790882b3b770fa6d016a0aa4.diff LOG: [lldb] Fix a log format warning on Windows, don't assume uint64_t is a long type On Windows, long is 32 bit, and uint64_t is long long. Differential Revision: https://reviews.llvm.org/D144078 Added: Modified: lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp Removed: diff --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp index 06772aaa6e17c..414e53fef7342 100644 --- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp +++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp @@ -636,7 +636,7 @@ std::optional EmulateInstructionRISCV::Decode(uint32_t inst) { if ((inst & pat.type_mask) == pat.eigen && (inst_type & pat.inst_type) != 0) { LLDB_LOGF( - log, "EmulateInstructionRISCV::%s: inst(%x at %lx) was decoded to %s", + log, "EmulateInstructionRISCV::%s: inst(%x at %" PRIx64 ") was decoded to %s", __FUNCTION__, inst, m_addr, pat.name); auto decoded = is_rvc ? pat.decode(try_rvc) : pat.decode(inst); return DecodeResult{decoded, inst, is_rvc, pat}; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b4133a2 - [lldb] [Windows] Fix an incorrect assert in NativeRegisterContextWindows_arm
Author: Martin Storsjö Date: 2021-09-15T15:03:20+03:00 New Revision: b4133a21cef49edb57cf96bb7d7518099d61e910 URL: https://github.com/llvm/llvm-project/commit/b4133a21cef49edb57cf96bb7d7518099d61e910 DIFF: https://github.com/llvm/llvm-project/commit/b4133a21cef49edb57cf96bb7d7518099d61e910.diff LOG: [lldb] [Windows] Fix an incorrect assert in NativeRegisterContextWindows_arm This codepath hadn't been exercised in a build with asserts before. Differential Revision: https://reviews.llvm.org/D109778 Added: Modified: lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp Removed: diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp index d2b1bc1a13c61..5cfd790c624a3 100644 --- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp @@ -80,8 +80,8 @@ enum { k_num_register_sets = 2 }; static RegisterInfoInterface * CreateRegisterInfoInterface(const ArchSpec &target_arch) { - assert((HostInfo::GetArchitecture().GetAddressByteSize() == 8) && - "Register setting path assumes this is a 64-bit host"); + assert((HostInfo::GetArchitecture().GetAddressByteSize() == 4) && + "Register setting path assumes this is a 32-bit host"); return new RegisterInfoPOSIX_arm(target_arch); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 9f34f75 - [lldb] [Windows] Fix continuing from breakpoints and singlestepping on ARM/AArch64
Author: Martin Storsjö Date: 2021-09-22T14:11:41+03:00 New Revision: 9f34f75ff8f49b0efca6e20d916527a2c432d8b4 URL: https://github.com/llvm/llvm-project/commit/9f34f75ff8f49b0efca6e20d916527a2c432d8b4 DIFF: https://github.com/llvm/llvm-project/commit/9f34f75ff8f49b0efca6e20d916527a2c432d8b4.diff LOG: [lldb] [Windows] Fix continuing from breakpoints and singlestepping on ARM/AArch64 Based on suggestions by Eric Youngdale. This fixes https://llvm.org/PR51673. Differential Revision: https://reviews.llvm.org/D109777 Added: Modified: lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/source/Plugins/Platform/Windows/PlatformWindows.h lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp Removed: diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp index fdb6758c8b7a1..69fa94c12d93a 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -312,3 +312,38 @@ ConstString PlatformWindows::GetFullNameForDylib(ConstString basename) { stream.Printf("%s.dll", basename.GetCString()); return ConstString(stream.GetString()); } + +size_t +PlatformWindows::GetSoftwareBreakpointTrapOpcode(Target &target, + BreakpointSite *bp_site) { + ArchSpec arch = target.GetArchitecture(); + assert(arch.IsValid()); + const uint8_t *trap_opcode = nullptr; + size_t trap_opcode_size = 0; + + switch (arch.GetMachine()) { + case llvm::Triple::aarch64: { +static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x3e, 0xd4}; // brk #0xf000 +trap_opcode = g_aarch64_opcode; +trap_opcode_size = sizeof(g_aarch64_opcode); + +if (bp_site->SetTrapOpcode(trap_opcode, trap_opcode_size)) + return trap_opcode_size; +return 0; + } break; + + case llvm::Triple::arm: + case llvm::Triple::thumb: { +static const uint8_t g_thumb_opcode[] = {0xfe, 0xde}; // udf #0xfe +trap_opcode = g_thumb_opcode; +trap_opcode_size = sizeof(g_thumb_opcode); + +if (bp_site->SetTrapOpcode(trap_opcode, trap_opcode_size)) + return trap_opcode_size; +return 0; + } break; + + default: +return Platform::GetSoftwareBreakpointTrapOpcode(target, bp_site); + } +} diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h index aff6924e448d5..9bff68f163197 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h @@ -61,6 +61,9 @@ class PlatformWindows : public RemoteAwarePlatform { void CalculateTrapHandlerSymbolNames() override {} ConstString GetFullNameForDylib(ConstString basename) override; + + size_t GetSoftwareBreakpointTrapOpcode(Target &target, + BreakpointSite *bp_site) override; }; } // namespace lldb_private diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp index 69a5cb20b90b8..5ae878024be17 100644 --- a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp @@ -289,6 +289,30 @@ NativeProcessWindows::GetAuxvData() const { return llvm::errc::not_supported; } +llvm::Expected> +NativeProcessWindows::GetSoftwareBreakpointTrapOpcode(size_t size_hint) { + static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x3e, 0xd4}; // brk #0xf000 + static const uint8_t g_thumb_opcode[] = {0xfe, 0xde}; // udf #0xfe + + switch (GetArchitecture().GetMachine()) { + case llvm::Triple::aarch64: +return llvm::makeArrayRef(g_aarch64_opcode); + + case llvm::Triple::arm: + case llvm::Triple::thumb: +return llvm::makeArrayRef(g_thumb_opcode); + + default: +return NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode(size_hint); + } +} + +size_t NativeProcessWindows::GetSoftwareBreakpointPCOffset() { +// Windows always reports an incremented PC after a breakpoint is hit, +// even on ARM. +return cantFail(GetSoftwareBreakpointTrapOpcode(0)).size(); +} + bool NativeProcessWindows::FindSoftwareBreakpoint(lldb::addr_t addr) { auto it = m_software_breakpoints.find(addr); if (it == m_software_breakpoints.end()) @@ -474,8 +498,9 @@ NativeProcessWindows::OnDebugException(bool first_chance, if (NativeThreadWindows *stop_thread = GetThreadByID(record.GetThreadID())) { auto ®iste
[Lldb-commits] [lldb] 7106f58 - [lldb] Make the thread_local g_global_boundary accessed from a single file
Author: Martin Storsjö Date: 2021-10-14T11:17:20+03:00 New Revision: 7106f588567b59acb17c77f6116ba433b6226333 URL: https://github.com/llvm/llvm-project/commit/7106f588567b59acb17c77f6116ba433b6226333 DIFF: https://github.com/llvm/llvm-project/commit/7106f588567b59acb17c77f6116ba433b6226333.diff LOG: [lldb] Make the thread_local g_global_boundary accessed from a single file This makes the compiler generated code for accessing the thread local variable much simpler (no need for wrapper functions and weak pointers to potential init functions), and can avoid toolchain bugs regarding how to access TLS variables. In particular, this fixes LLDB when built with current GCC/binutils for MinGW, see https://github.com/msys2/MINGW-packages/issues/8868. Differential Revision: https://reviews.llvm.org/D111779 Added: Modified: lldb/include/lldb/Utility/ReproducerInstrumentation.h lldb/source/Utility/ReproducerInstrumentation.cpp Removed: diff --git a/lldb/include/lldb/Utility/ReproducerInstrumentation.h b/lldb/include/lldb/Utility/ReproducerInstrumentation.h index 2b2d273a17a8f..6c5d27879d362 100644 --- a/lldb/include/lldb/Utility/ReproducerInstrumentation.h +++ b/lldb/include/lldb/Utility/ReproducerInstrumentation.h @@ -868,17 +868,14 @@ class Recorder { /// Mark the current thread as a private thread and pretend that everything /// on this thread is behind happening behind the API boundary. - static void PrivateThread() { g_global_boundary = true; } + static void PrivateThread(); private: static unsigned GetNextSequenceNumber() { return g_sequence++; } unsigned GetSequenceNumber() const; template friend struct replay; - void UpdateBoundary() { -if (m_local_boundary) - g_global_boundary = false; - } + void UpdateBoundary(); #ifdef LLDB_REPRO_INSTR_TRACE void Log(unsigned id) { @@ -902,9 +899,6 @@ class Recorder { /// The sequence number for this pair of function and result. unsigned m_sequence; - /// Whether we're currently across the API boundary. - static thread_local bool g_global_boundary; - /// Global mutex to protect concurrent access. static std::mutex g_mutex; diff --git a/lldb/source/Utility/ReproducerInstrumentation.cpp b/lldb/source/Utility/ReproducerInstrumentation.cpp index e5bd2ba4b6259..b3285f4b3776a 100644 --- a/lldb/source/Utility/ReproducerInstrumentation.cpp +++ b/lldb/source/Utility/ReproducerInstrumentation.cpp @@ -16,6 +16,9 @@ using namespace lldb_private; using namespace lldb_private::repro; +// Whether we're currently across the API boundary. +static thread_local bool g_global_boundary = false; + void *IndexToObject::GetObjectForIndexImpl(unsigned idx) { return m_mapping.lookup(idx); } @@ -227,6 +230,13 @@ unsigned Recorder::GetSequenceNumber() const { return m_sequence; } +void Recorder::PrivateThread() { g_global_boundary = true; } + +void Recorder::UpdateBoundary() { + if (m_local_boundary) +g_global_boundary = false; +} + void InstrumentationData::Initialize(Serializer &serializer, Registry ®istry) { InstanceImpl().emplace(serializer, registry); @@ -248,6 +258,5 @@ llvm::Optional &InstrumentationData::InstanceImpl() { return g_instrumentation_data; } -thread_local bool lldb_private::repro::Recorder::g_global_boundary = false; std::atomic lldb_private::repro::Recorder::g_sequence; std::mutex lldb_private::repro::Recorder::g_mutex; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] ea9e9d6 - [lldb] [Host/SerialPort] Fix build with GCC 7
Author: Martin Storsjö Date: 2021-10-23T12:52:55+03:00 New Revision: ea9e9d61b521adaaa2d7f03712f9f6b9e9dfe8a1 URL: https://github.com/llvm/llvm-project/commit/ea9e9d61b521adaaa2d7f03712f9f6b9e9dfe8a1 DIFF: https://github.com/llvm/llvm-project/commit/ea9e9d61b521adaaa2d7f03712f9f6b9e9dfe8a1.diff LOG: [lldb] [Host/SerialPort] Fix build with GCC 7 Added: Modified: lldb/source/Host/common/File.cpp Removed: diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp index 5ad5ae6bb2192..27a47cab78925 100644 --- a/lldb/source/Host/common/File.cpp +++ b/lldb/source/Host/common/File.cpp @@ -837,7 +837,7 @@ SerialPort::Create(int fd, OpenOptions options, Options serial_options, return std::move(error); } - return out; + return std::move(out); } SerialPort::SerialPort(int fd, OpenOptions options, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a2c9cf4 - [lldb] Use is_style_posix() for path style checks
Author: Martin Storsjö Date: 2021-11-05T21:50:45+02:00 New Revision: a2c9cf4c76974086a206c86a172085162a57de9b URL: https://github.com/llvm/llvm-project/commit/a2c9cf4c76974086a206c86a172085162a57de9b DIFF: https://github.com/llvm/llvm-project/commit/a2c9cf4c76974086a206c86a172085162a57de9b.diff LOG: [lldb] Use is_style_posix() for path style checks Since a8b54834a186f5570b49b614e31b961a9cf1cbfe, there are two distinct Windows path styles, `windows_backslash` (with the old `windows` being an alias for it) and `windows_slash`. 4e4883e1f394f7c47ff3adee48039aa8374bb8d0 added helpers for inspecting path styles. The newly added windows_slash path style doesn't end up used in LLDB yet anyway, as LLDB is quite decoupled from most of llvm::sys::path and uses its own FileSpec class. To take it in use, it could be hooked up in `FileSpec::Style::GetNativeStyle` (in lldb/source/Utility/FileSpec.cpp) just like in the `real_style` function in llvm/lib/Support/Path.cpp in df0ba47c36f6bd0865e3286853b76d37e037c2d7. It is not currently clear whether there's a real need for using the Windows path style with forward slashes in LLDB (if there's any other applications interacting with it, expecting that style), and what other changes in LLDB are needed for that to work, but this at least makes some of the checks more ready for the new style, simplifying code a bit. Differential Revision: https://reviews.llvm.org/D113255 Added: Modified: lldb/include/lldb/Utility/FileSpec.h lldb/source/Utility/FileSpec.cpp Removed: diff --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h index 0f4e6505e4337..305cd04f95c01 100644 --- a/lldb/include/lldb/Utility/FileSpec.h +++ b/lldb/include/lldb/Utility/FileSpec.h @@ -202,7 +202,7 @@ class FileSpec { /// \return /// \b true if the file path is case sensitive (POSIX), false /// if case insensitive (Windows). - bool IsCaseSensitive() const { return m_style != Style::windows; } + bool IsCaseSensitive() const { return is_style_posix(m_style); } /// Dump this object to a Stream. /// diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp index bea3c6d6268b3..601edb86c1b0c 100644 --- a/lldb/source/Utility/FileSpec.cpp +++ b/lldb/source/Utility/FileSpec.cpp @@ -43,9 +43,7 @@ static constexpr FileSpec::Style GetNativeStyle() { } bool PathStyleIsPosix(FileSpec::Style style) { - return (style == FileSpec::Style::posix || - (style == FileSpec::Style::native && - GetNativeStyle() == FileSpec::Style::posix)); + return llvm::sys::path::is_style_posix(style); } const char *GetPathSeparators(FileSpec::Style style) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] d918b81 - [lldb] [debugserver] Add spaces between sentences in a CMake warning. NFC.
Author: Martin Storsjö Date: 2023-10-04T14:34:12+03:00 New Revision: d918b813c852fb4632875c683f4b9552eddea30d URL: https://github.com/llvm/llvm-project/commit/d918b813c852fb4632875c683f4b9552eddea30d DIFF: https://github.com/llvm/llvm-project/commit/d918b813c852fb4632875c683f4b9552eddea30d.diff LOG: [lldb] [debugserver] Add spaces between sentences in a CMake warning. NFC. Added: Modified: lldb/tools/debugserver/source/CMakeLists.txt Removed: diff --git a/lldb/tools/debugserver/source/CMakeLists.txt b/lldb/tools/debugserver/source/CMakeLists.txt index 43accc363ef3cb9..f0b9756becab6e6 100644 --- a/lldb/tools/debugserver/source/CMakeLists.txt +++ b/lldb/tools/debugserver/source/CMakeLists.txt @@ -19,8 +19,8 @@ endfunction() function(get_debugserver_codesign_identity result) string(CONCAT not_found_help -"This will cause failures in the test suite." -"Pass '-DLLDB_USE_SYSTEM_DEBUGSERVER=ON' to use the system one instead." +"This will cause failures in the test suite. " +"Pass '-DLLDB_USE_SYSTEM_DEBUGSERVER=ON' to use the system one instead. " "See 'Code Signing on macOS' in the documentation." ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [libc++] Use -nostdlib++ on GCC unconditionally (PR #68832)
@@ -642,18 +642,8 @@ get_sanitizer_flags(SANITIZER_FLAGS "${LLVM_USE_SANITIZER}") # Link system libraries === function(cxx_link_system_libraries target) - -# In order to remove just libc++ from the link step -# we need to use -nostdlib++ whenever it is supported. -# Unfortunately this cannot be used universally because for example g++ supports -# only -nodefaultlibs in which case all libraries will be removed and -# all libraries but c++ have to be added in manually. - if (CXX_SUPPORTS_NOSTDLIBXX_FLAG) -target_add_link_flags_if_supported(${target} PRIVATE "-nostdlib++") - else() -target_add_link_flags_if_supported(${target} PRIVATE "-nodefaultlibs") -target_add_compile_flags_if_supported(${target} PRIVATE "/Zl") -target_add_link_flags_if_supported(${target} PRIVATE "/nodefaultlib") mstorsjo wrote: Interesting; FWIW, it seems like the test for `/Zl` fails because it skips including the CRT glue code that takes the startup from the Windows specific `mainCRTStartup()` to the regular `main()`. I wonder when/if this test passed at some point. As for how this works without those options: In MSVC build configs, the standard libraries usually aren't injected by the compiler when doing the link - on the contrary, in most cases, one doesn't actually do linking by invoking the compiler, but the build usually calls `link.exe` or `lld-link` directly. The info about what libraries should be linked in is conveyed via directives embedded in the object files. So as long as we're not using any MS STL headers that inject such directives, we don't automatically try to link against it. Then secondly - in MSVC configurations, libc++ always builds on top of the MSVC C++ runtime for the base ABI stuff, so we actually do need it linked - and we pass the necessary libraries for that manually when we link our library. https://github.com/llvm/llvm-project/pull/68832 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [libc++] Use -nostdlib++ on GCC unconditionally (PR #68832)
@@ -642,18 +642,8 @@ get_sanitizer_flags(SANITIZER_FLAGS "${LLVM_USE_SANITIZER}") # Link system libraries === function(cxx_link_system_libraries target) - -# In order to remove just libc++ from the link step -# we need to use -nostdlib++ whenever it is supported. -# Unfortunately this cannot be used universally because for example g++ supports -# only -nodefaultlibs in which case all libraries will be removed and -# all libraries but c++ have to be added in manually. - if (CXX_SUPPORTS_NOSTDLIBXX_FLAG) -target_add_link_flags_if_supported(${target} PRIVATE "-nostdlib++") - else() -target_add_link_flags_if_supported(${target} PRIVATE "-nodefaultlibs") -target_add_compile_flags_if_supported(${target} PRIVATE "/Zl") -target_add_link_flags_if_supported(${target} PRIVATE "/nodefaultlib") mstorsjo wrote: Yeah I think it's totally ok to remove. Whatever the setup was when those might have been needed on MSVC-like setups, they're not needed (or usable) currently - and our CI coverage is fairly good at the moment, I would say. So if this patch works, just go ahead! https://github.com/llvm/llvm-project/pull/68832 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 5f0080f - [lldb] Fix warnings about unused variables when building without asserts. NFC.
Author: Martin Storsjö Date: 2022-08-29T13:25:38+03:00 New Revision: 5f0080fbe810caae3750d159da62bac04dbd844f URL: https://github.com/llvm/llvm-project/commit/5f0080fbe810caae3750d159da62bac04dbd844f DIFF: https://github.com/llvm/llvm-project/commit/5f0080fbe810caae3750d159da62bac04dbd844f.diff LOG: [lldb] Fix warnings about unused variables when building without asserts. NFC. Added: Modified: lldb/include/lldb/Utility/SharedCluster.h lldb/source/Host/windows/MainLoopWindows.cpp Removed: diff --git a/lldb/include/lldb/Utility/SharedCluster.h b/lldb/include/lldb/Utility/SharedCluster.h index 9f7aa92420ed0..2992e6c9beec5 100644 --- a/lldb/include/lldb/Utility/SharedCluster.h +++ b/lldb/include/lldb/Utility/SharedCluster.h @@ -34,6 +34,7 @@ class ClusterManager : public std::enable_shared_from_this> { std::lock_guard guard(m_mutex); auto ret = m_objects.insert(new_object); assert(ret.second && "ManageObject called twice for the same object?"); +(void)ret; } std::shared_ptr GetSharedPointer(T *desired_object) { diff --git a/lldb/source/Host/windows/MainLoopWindows.cpp b/lldb/source/Host/windows/MainLoopWindows.cpp index aca8ef21125c7..ec8ca180f8c64 100644 --- a/lldb/source/Host/windows/MainLoopWindows.cpp +++ b/lldb/source/Host/windows/MainLoopWindows.cpp @@ -27,6 +27,7 @@ llvm::Expected MainLoopWindows::Poll() { for (auto &[fd, info] : m_read_fds) { int result = WSAEventSelect(fd, info.event, FD_READ | FD_ACCEPT | FD_CLOSE); assert(result == 0); +(void)result; read_events.push_back(info.event); } @@ -37,6 +38,7 @@ llvm::Expected MainLoopWindows::Poll() { for (auto &fd : m_read_fds) { int result = WSAEventSelect(fd.first, WSA_INVALID_EVENT, 0); assert(result == 0); +(void)result; } if (result >= WSA_WAIT_EVENT_0 && @@ -85,6 +87,7 @@ void MainLoopWindows::UnregisterReadObject(IOObject::WaitableHandle handle) { assert(it != m_read_fds.end()); BOOL result = WSACloseEvent(it->second.event); assert(result == TRUE); + (void)result; m_read_fds.erase(it); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 118038e - [lldb] Use the NativeSock type instead of plain 'int'
Author: Martin Storsjö Date: 2022-08-30T10:07:44+03:00 New Revision: 118038e878cf7c169c74cdf31de019913775e881 URL: https://github.com/llvm/llvm-project/commit/118038e878cf7c169c74cdf31de019913775e881 DIFF: https://github.com/llvm/llvm-project/commit/118038e878cf7c169c74cdf31de019913775e881.diff LOG: [lldb] Use the NativeSock type instead of plain 'int' This fixes a warning when building for Windows: ../tools/lldb/source/Host/common/TCPSocket.cpp:297:16: warning: comparison of integers of different signs: 'int' and 'const NativeSocket' (aka 'const unsigned long long') [-Wsign-compare] if (sock != kInvalidSocketValue) { ^ ~~~ Differential Revision: https://reviews.llvm.org/D132841 Added: Modified: lldb/source/Host/common/TCPSocket.cpp Removed: diff --git a/lldb/source/Host/common/TCPSocket.cpp b/lldb/source/Host/common/TCPSocket.cpp index 91465d2fe4976..82b00ac561f9a 100644 --- a/lldb/source/Host/common/TCPSocket.cpp +++ b/lldb/source/Host/common/TCPSocket.cpp @@ -261,8 +261,8 @@ Status TCPSocket::Accept(Socket *&conn_socket) { return error; } - int sock = kInvalidSocketValue; - int listen_sock = kInvalidSocketValue; + NativeSocket sock = kInvalidSocketValue; + NativeSocket listen_sock = kInvalidSocketValue; lldb_private::SocketAddress AcceptAddr; MainLoop accept_loop; std::vector handles; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 8a3597d - [lldb] Fix CommandInterpreter::DidProcessStopAbnormally() with multiple threads
Author: Martin Storsjö Date: 2022-09-26T11:05:42+03:00 New Revision: 8a3597d73c8f694ca8c991d8cb4bb97a4ac8ba8c URL: https://github.com/llvm/llvm-project/commit/8a3597d73c8f694ca8c991d8cb4bb97a4ac8ba8c DIFF: https://github.com/llvm/llvm-project/commit/8a3597d73c8f694ca8c991d8cb4bb97a4ac8ba8c.diff LOG: [lldb] Fix CommandInterpreter::DidProcessStopAbnormally() with multiple threads If a process has multiple threads, the thread with the stop info might not be the first one in the thread list. On Windows, under certain circumstances, processes seem to have one or more extra threads that haven't been launched by the executable itself, waiting in NtWaitForWorkViaWorkerFactory. If the main (stopped) thread isn't the first one in the list (the order seems nondeterministic), DidProcessStopAbnormally() would return false prematurely, instead of inspecting later threads. The main observable effect of DidProcessStopAbnormally() erroneously returning false, is when running lldb with multiple "-o" parameters to specify multiple commands to execute on the command line. After an abnormal stop, lldb would stop executing "-o" parameters and execute "-k" parameters instead - but due to this issue, it would instead keep executing "-o" parameters as if there was no abnormal stop. (If multiple parameters are specified via a script file via the "-s" option, all of the commands in that file are executed regardless of whether there's an abnormal stop inbetween.) Differential Revision: https://reviews.llvm.org/D134037 Added: lldb/test/Shell/Driver/CommandOnCrashMultiThreaded.test lldb/test/Shell/Driver/Inputs/CommandOnCrashMultiThreaded.cpp Modified: lldb/source/Interpreter/CommandInterpreter.cpp Removed: diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index fa6511635e287..5c11b87dcbe03 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -2471,8 +2471,12 @@ bool CommandInterpreter::DidProcessStopAbnormally() const { for (const auto &thread_sp : process_sp->GetThreadList().Threads()) { StopInfoSP stop_info = thread_sp->GetStopInfo(); -if (!stop_info) - return false; +if (!stop_info) { + // If there's no stop_info, keep iterating through the other threads; + // it's enough that any thread has got a stop_info that indicates + // an abnormal stop, to consider the process to be stopped abnormally. + continue; +} const StopReason reason = stop_info->GetStopReason(); if (reason == eStopReasonException || diff --git a/lldb/test/Shell/Driver/CommandOnCrashMultiThreaded.test b/lldb/test/Shell/Driver/CommandOnCrashMultiThreaded.test new file mode 100644 index 0..b16cfc5763715 --- /dev/null +++ b/lldb/test/Shell/Driver/CommandOnCrashMultiThreaded.test @@ -0,0 +1,5 @@ +# REQUIRES: native && (target-x86 || target-x86_64) +# RUN: %clangxx_host %p/Inputs/CommandOnCrashMultiThreaded.cpp -o %t -pthread +# RUN: %lldb -b -o "process launch" -k "process continue" -k "exit" %t | FileCheck %s + +# CHECK: Process {{[0-9]+}} exited with status = 0 diff --git a/lldb/test/Shell/Driver/Inputs/CommandOnCrashMultiThreaded.cpp b/lldb/test/Shell/Driver/Inputs/CommandOnCrashMultiThreaded.cpp new file mode 100644 index 0..f469d82fbbef9 --- /dev/null +++ b/lldb/test/Shell/Driver/Inputs/CommandOnCrashMultiThreaded.cpp @@ -0,0 +1,13 @@ +#include + +void t_func() { + asm volatile( +"int3\n\t" + ); +} + +int main() { + std::thread t(t_func); + t.join(); + return 0; +} ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a426753 - [lldb] Add newline in output of `target modules lookup`
Author: Alvin Wong Date: 2022-09-27T13:09:45+03:00 New Revision: a426753ef0290362a0268f917dba46d6b9744b02 URL: https://github.com/llvm/llvm-project/commit/a426753ef0290362a0268f917dba46d6b9744b02 DIFF: https://github.com/llvm/llvm-project/commit/a426753ef0290362a0268f917dba46d6b9744b02.diff LOG: [lldb] Add newline in output of `target modules lookup` This adds a line break between each result address in the output of the lldb command `target modules lookup`. Before this change, a new address result will be printed on the same line as the summary of the last result, making the output difficult to view. Also adds a test for this command. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D134111 Added: lldb/test/Shell/Commands/Inputs/symbols.yaml lldb/test/Shell/Commands/command-target-modules-lookup.test Modified: lldb/source/Commands/CommandObjectTarget.cpp Removed: diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 08bdb856d9161..deb7f84f70b70 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1546,6 +1546,7 @@ static uint32_t LookupSymbolInModule(CommandInterpreter &interpreter, DumpAddress( interpreter.GetExecutionContext().GetBestExecutionContextScope(), symbol->GetAddressRef(), verbose, all_ranges, strm); + strm.EOL(); } else { strm.IndentMore(); strm.Indent("Value: "); diff --git a/lldb/test/Shell/Commands/Inputs/symbols.yaml b/lldb/test/Shell/Commands/Inputs/symbols.yaml new file mode 100644 index 0..64200ecd28fef --- /dev/null +++ b/lldb/test/Shell/Commands/Inputs/symbols.yaml @@ -0,0 +1,48 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data:ELFDATA2LSB + Type:ET_REL + Machine: EM_AARCH64 + SectionHeaderStringTable: .strtab +Sections: + - Name:.text +Type:SHT_PROGBITS +Flags: [ SHF_ALLOC, SHF_EXECINSTR ] +AddressAlign:0x4 + - Type:SectionHeaderTable +Sections: + - Name:.text + - Name:.strtab + - Name:.symtab +Symbols: + - Name:_Z8someFunciii +Type:STT_FUNC +Section: .text +Binding: STB_GLOBAL +Size:0x1C + - Name:_Z8someFuncci +Type:STT_FUNC +Section: .text +Binding: STB_GLOBAL +Value: 0x1C +Size:0x18 + - Name:_Z13someOtherFuncv +Type:STT_FUNC +Section: .text +Binding: STB_GLOBAL +Value: 0x34 +Size:0x4 + - Name:_Z13someOtherFuncd +Type:STT_FUNC +Section: .text +Binding: STB_GLOBAL +Value: 0x38 +Size:0x10 + - Name:_Z18ignoreThisFunctionv +Type:STT_FUNC +Section: .text +Binding: STB_GLOBAL +Value: 0x48 +Size:0x8 +... diff --git a/lldb/test/Shell/Commands/command-target-modules-lookup.test b/lldb/test/Shell/Commands/command-target-modules-lookup.test new file mode 100644 index 0..5ac211b007946 --- /dev/null +++ b/lldb/test/Shell/Commands/command-target-modules-lookup.test @@ -0,0 +1,12 @@ +# RUN: yaml2obj %S/Inputs/symbols.yaml -o %t + +# RUN: %lldb %t -b -o "target modules lookup -A -r -s some" | FileCheck %s -DMODULE=%basename_t.tmp --implicit-check-not ignoreThisFunction +# CHECK: 4 symbols match the regular expression 'some' in {{.*}}[[MODULE]]: +# CHECK-NEXT: Address: [[MODULE]][0x] ([[MODULE]]..text + 0) +# CHECK-NEXT: Summary: [[MODULE]]`someFunc(int, int, int) +# CHECK-NEXT: Address: [[MODULE]][0x001c] ([[MODULE]]..text + 28) +# CHECK-NEXT: Summary: [[MODULE]]`someFunc(char, int) +# CHECK-NEXT: Address: [[MODULE]][0x0034] ([[MODULE]]..text + 52) +# CHECK-NEXT: Summary: [[MODULE]]`someOtherFunc() +# CHECK-NEXT: Address: [[MODULE]][0x0038] ([[MODULE]]..text + 56) +# CHECK-NEXT: Summary: [[MODULE]]`someOtherFunc(double) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] f4991bf - [lldb] Improve display of absolute symbol lookup
Author: Alvin Wong Date: 2022-09-27T13:09:59+03:00 New Revision: f4991bfa891eaf9f36aa3b79da6fed4228b69de9 URL: https://github.com/llvm/llvm-project/commit/f4991bfa891eaf9f36aa3b79da6fed4228b69de9 DIFF: https://github.com/llvm/llvm-project/commit/f4991bfa891eaf9f36aa3b79da6fed4228b69de9.diff LOG: [lldb] Improve display of absolute symbol lookup When running `target module lookup` command, show the name of absolute symbols. Also fix indentation issue after printing an absolute symbol. Reviewed By: clayborg, DavidSpickett Differential Revision: https://reviews.llvm.org/D134516 Added: Modified: lldb/source/Commands/CommandObjectTarget.cpp lldb/test/Shell/SymbolFile/absolute-symbol.test Removed: diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index deb7f84f70b70..59b7dfd74e852 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1549,12 +1549,16 @@ static uint32_t LookupSymbolInModule(CommandInterpreter &interpreter, strm.EOL(); } else { strm.IndentMore(); + strm.Indent("Name: "); + strm.PutCString(symbol->GetDisplayName().GetStringRef()); + strm.EOL(); strm.Indent("Value: "); strm.Printf("0x%16.16" PRIx64 "\n", symbol->GetRawValue()); if (symbol->GetByteSizeIsValid()) { strm.Indent("Size: "); strm.Printf("0x%16.16" PRIx64 "\n", symbol->GetByteSize()); } + strm.IndentLess(); } } } diff --git a/lldb/test/Shell/SymbolFile/absolute-symbol.test b/lldb/test/Shell/SymbolFile/absolute-symbol.test index 11feb1f89c10a..edcda7119d567 100644 --- a/lldb/test/Shell/SymbolFile/absolute-symbol.test +++ b/lldb/test/Shell/SymbolFile/absolute-symbol.test @@ -1,6 +1,7 @@ # RUN: yaml2obj %s -o %t.o # RUN: %lldb -b -o 'target modules lookup -s absolute_symbol' %t.o | FileCheck %s # CHECK: 1 symbols match 'absolute_symbol' +# CHECK: Name: absolute_symbol # CHECK: Value: 0x12345678 # Created from: # .globl absolute_symbol ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] bf0cda9 - [lldb][COFF] Rewrite ParseSymtab to list both export and symbol tables
Author: Alvin Wong Date: 2022-09-28T12:57:10+03:00 New Revision: bf0cda9ed2783a34efed3fc9804d784f7d1df242 URL: https://github.com/llvm/llvm-project/commit/bf0cda9ed2783a34efed3fc9804d784f7d1df242 DIFF: https://github.com/llvm/llvm-project/commit/bf0cda9ed2783a34efed3fc9804d784f7d1df242.diff LOG: [lldb][COFF] Rewrite ParseSymtab to list both export and symbol tables This reimplements `ObjectFilePECOFF::ParseSymtab` to replace the manual data extraction with what `COFFObjectFile` already provides. Also use `SymTab::AddSymbol` instead of resizing the SymTab then assigning each elements afterwards. Previously, ParseSymTab loads symbols from both the COFF symbol table and the export table, but if there are any entries in the export table, it overwrites all the symbols already loaded from the COFF symbol table. Due to the change to use AddSymbols, this no longer happens, and so the SymTab now contains all symbols from both tables as expected. The export symbols are now ordered by ordinal, instead of by the name table order. In its current state, it is possible for symbols in the COFF symbol table to be duplicated by those in the export table. This behaviour will be modified in a separate change. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D134196 Added: lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml Modified: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h llvm/include/llvm/Object/COFF.h Removed: diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 5e7a921a2ec0a..3890e8b997fdc 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -30,11 +30,12 @@ #include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" #include "lldb/Utility/UUID.h" -#include "llvm/BinaryFormat/COFF.h" +#include "llvm/BinaryFormat/COFF.h" #include "llvm/Object/COFFImportFile.h" #include "llvm/Support/CRC.h" #include "llvm/Support/Error.h" +#include "llvm/Support/FormatAdapters.h" #include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" @@ -760,131 +761,93 @@ llvm::StringRef ObjectFilePECOFF::GetSectionName(const section_header_t §) { void ObjectFilePECOFF::ParseSymtab(Symtab &symtab) { SectionList *sect_list = GetSectionList(); - const uint32_t num_syms = m_coff_header.nsyms; - if (m_file && num_syms > 0 && m_coff_header.symoff > 0) { -const uint32_t symbol_size = 18; -const size_t symbol_data_size = num_syms * symbol_size; -// Include the 4-byte string table size at the end of the symbols -DataExtractor symtab_data = -ReadImageData(m_coff_header.symoff, symbol_data_size + 4); -lldb::offset_t offset = symbol_data_size; -const uint32_t strtab_size = symtab_data.GetU32(&offset); -if (strtab_size > 0) { - DataExtractor strtab_data = ReadImageData( - m_coff_header.symoff + symbol_data_size, strtab_size); - - offset = 0; - std::string symbol_name; - Symbol *symbols = symtab.Resize(num_syms); - for (uint32_t i = 0; i < num_syms; ++i) { -coff_symbol_t symbol; -const uint32_t symbol_offset = offset; -const char *symbol_name_cstr = nullptr; -// If the first 4 bytes of the symbol string are zero, then they -// are followed by a 4-byte string table offset. Else these -// 8 bytes contain the symbol name -if (symtab_data.GetU32(&offset) == 0) { - // Long string that doesn't fit into the symbol table name, so - // now we must read the 4 byte string table offset - uint32_t strtab_offset = symtab_data.GetU32(&offset); - symbol_name_cstr = strtab_data.PeekCStr(strtab_offset); - symbol_name.assign(symbol_name_cstr); -} else { - // Short string that fits into the symbol table name which is 8 - // bytes - offset += sizeof(symbol.name) - 4; // Skip remaining - symbol_name_cstr = symtab_data.PeekCStr(symbol_offset); - if (symbol_name_cstr == nullptr) -break; - symbol_name.assign(symbol_name_cstr, sizeof(symbol.name)); -} -symbol.value = symtab_data.GetU32(&offset); -symbol.sect = symtab_data.GetU16(&offset); -symbol.type = symtab_data.GetU16(&offset); -symbol.storage = symtab_data.GetU8(&offset); -symbol.naux = symtab_data.GetU8(&offset); -symbols[i].GetMangled().SetValue(ConstString(symbol_name.c_str())); -if ((int16_t)symbol.sect >= 1) { - Address symbol_addr(sect_list->FindSectionByID(symbol.sect), - symbol.value); - symbols[i].GetAddressRef() = symbol_addr; - symbol
[Lldb-commits] [lldb] 0870afc - [lldb][COFF] Improve info of symbols from export table
Author: Alvin Wong Date: 2022-09-28T12:57:10+03:00 New Revision: 0870afc68e1a1ec303af1d0dbf952dd2c41f478a URL: https://github.com/llvm/llvm-project/commit/0870afc68e1a1ec303af1d0dbf952dd2c41f478a DIFF: https://github.com/llvm/llvm-project/commit/0870afc68e1a1ec303af1d0dbf952dd2c41f478a.diff LOG: [lldb][COFF] Improve info of symbols from export table - Skip dummy/invalid export symbols. - Make the export ordinal of export symbols visible when dumping the symtab. - Stop setting the 'Debug' flag and set the 'External' flag instead to better match the meaning of export symbols. - Try to guess the type (code vs data) of the symbol from section flags. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D134265 Added: Modified: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml Removed: diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 3890e8b997fdc..613938161df5d 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -826,6 +826,10 @@ void ObjectFilePECOFF::AppendFromExportTable(SectionList *sect_list, // Note: symbol name may be empty if it is only exported by ordinal. symbol.GetMangled().SetValue(ConstString(sym_name)); +uint32_t ordinal; +llvm::cantFail(entry.getOrdinal(ordinal)); +symbol.SetID(ordinal); + uint32_t function_rva; if (auto err = entry.getExportRVA(function_rva)) { LLDB_LOG(log, @@ -834,10 +838,19 @@ void ObjectFilePECOFF::AppendFromExportTable(SectionList *sect_list, sym_name, llvm::fmt_consume(std::move(err))); continue; } +// Skip the symbol if it doesn't look valid. +if (function_rva == 0 && sym_name.empty()) + continue; symbol.GetAddressRef() = Address(m_coff_header_opt.image_base + function_rva, sect_list); -symbol.SetType(lldb::eSymbolTypeCode); -symbol.SetDebug(true); + +// An exported symbol may be either code or data. Guess by checking whether +// the section containing the symbol is executable. +symbol.SetType(lldb::eSymbolTypeData); +if (auto section_sp = symbol.GetAddressRef().GetSection()) + if (section_sp->GetPermissions() & ePermissionsExecutable) +symbol.SetType(lldb::eSymbolTypeCode); +symbol.SetExternal(true); symtab.AddSymbol(symbol); } } diff --git a/lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml b/lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml index e0298fdf797cf..f136db38f2a1d 100644 --- a/lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml +++ b/lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml @@ -6,10 +6,10 @@ # CHECK: UserID DSX TypeFile Address/Value {{.*}} Size Flags Name # CHECK-NEXT: -- -# CHECK-NEXT: 4294967295 D Code0x0001800010200x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} exportFnAlias -# CHECK-NEXT: 4294967295 D Code0x0001800010100x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} exportFunc -# CHECK-NEXT: 4294967295 D Code0x0001800030000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} exportInt -# CHECK-NEXT: 4294967295 D Code0x0001800030040x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} exportIntAlias +# CHECK-NEXT: 1 X Code0x0001800010200x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} exportFnAlias +# CHECK-NEXT: 2 X Code0x0001800010100x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} exportFunc +# CHECK-NEXT: 3 X Data0x0001800030000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} exportInt +# CHECK-NEXT: 4 X Data0x0001800030040x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} exportIntAlias # CHECK-NEXT: 4294967295 Code0x0001800010000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry # CHECK-NEXT: 4294967295 Code0x0001800010100x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} exportFunc # CHECK-NEXT: 4294967295 Code0x0001800010200x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} aliasFunc ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 20c2f94 - [lldb][COFF] Match symbols from COFF symbol table to export symbols
Author: Alvin Wong Date: 2022-09-28T12:57:11+03:00 New Revision: 20c2f94c3cc10c41ab45e1be156540a06306cdf1 URL: https://github.com/llvm/llvm-project/commit/20c2f94c3cc10c41ab45e1be156540a06306cdf1 DIFF: https://github.com/llvm/llvm-project/commit/20c2f94c3cc10c41ab45e1be156540a06306cdf1.diff LOG: [lldb][COFF] Match symbols from COFF symbol table to export symbols If a symbol is the same as an export symbol, mark it as 'Additional' to prevent the duplicated symbol from being repeated in some commands (e.g. `disas -n func`). If the RVA is the same but exported with a different name, only synchronize the symbol types. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D134426 Added: Modified: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml Removed: diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 613938161df5d..0a2777a193c80 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -761,12 +761,18 @@ llvm::StringRef ObjectFilePECOFF::GetSectionName(const section_header_t §) { void ObjectFilePECOFF::ParseSymtab(Symtab &symtab) { SectionList *sect_list = GetSectionList(); - AppendFromExportTable(sect_list, symtab); - AppendFromCOFFSymbolTable(sect_list, symtab); + rva_symbol_list_t sorted_exports = AppendFromExportTable(sect_list, symtab); + AppendFromCOFFSymbolTable(sect_list, symtab, sorted_exports); } -void ObjectFilePECOFF::AppendFromCOFFSymbolTable(SectionList *sect_list, - Symtab &symtab) { +static bool RVASymbolListCompareRVA(const std::pair &a, +const std::pair &b) { + return a.first < b.first; +} + +void ObjectFilePECOFF::AppendFromCOFFSymbolTable( +SectionList *sect_list, Symtab &symtab, +const ObjectFilePECOFF::rva_symbol_list_t &sorted_exports) { const uint32_t num_syms = m_binary->getNumberOfSymbols(); if (num_syms == 0) return; @@ -795,22 +801,52 @@ void ObjectFilePECOFF::AppendFromCOFFSymbolTable(SectionList *sect_list, if (section_number >= 1) { symbol.GetAddressRef() = Address( sect_list->FindSectionByID(section_number), coff_sym_ref.getValue()); - symbol.SetType(MapSymbolType(coff_sym_ref.getType())); + const auto symbol_type = MapSymbolType(coff_sym_ref.getType()); + symbol.SetType(symbol_type); + + // Check for duplicate of exported symbols: + const uint32_t symbol_rva = symbol.GetAddressRef().GetFileAddress() - + m_coff_header_opt.image_base; + const auto &first_match = std::lower_bound( + sorted_exports.begin(), sorted_exports.end(), + std::make_pair(symbol_rva, 0), RVASymbolListCompareRVA); + for (auto it = first_match; + it != sorted_exports.end() && it->first == symbol_rva; ++it) { +Symbol *exported = symtab.SymbolAtIndex(it->second); +if (symbol_type != lldb::eSymbolTypeInvalid) + exported->SetType(symbol_type); +if (exported->GetMangled() == symbol.GetMangled()) { + symbol.SetExternal(true); + // We don't want the symbol to be duplicated (e.g. when running + // `disas -n func`), but we also don't want to erase this entry (to + // preserve the original symbol order), so we mark it as additional. + symbol.SetType(lldb::eSymbolTypeAdditional); +} else { + // It is possible for a symbol to be exported in a diff erent name + // from its original. In this case keep both entries so lookup using + // either names will work. If this symbol has an invalid type, replace + // it with the type from the export symbol. + if (symbol.GetType() == lldb::eSymbolTypeInvalid) +symbol.SetType(exported->GetType()); +} + } } symtab.AddSymbol(symbol); } } -void ObjectFilePECOFF::AppendFromExportTable(SectionList *sect_list, - Symtab &symtab) { +ObjectFilePECOFF::rva_symbol_list_t +ObjectFilePECOFF::AppendFromExportTable(SectionList *sect_list, +Symtab &symtab) { const auto *export_table = m_binary->getExportTable(); if (!export_table) -return; +return {}; const uint32_t num_syms = export_table->AddressTableEntries; if (num_syms == 0) -return; +return {}; Log *log = GetLog(LLDBLog::Object); + rva_symbol_list_t export_list; symtab.Reserve(symtab.GetNumSymbols() + num_syms); // Read each export table entry, ordered by ordinal instead of by name. for (cons
[Lldb-commits] [lldb] 7ebff6a - [lldb][COFF] Load absolute symbols from COFF symbol table
Author: Alvin Wong Date: 2022-09-28T12:57:11+03:00 New Revision: 7ebff6ab26aa03423c61e0370377f11725184199 URL: https://github.com/llvm/llvm-project/commit/7ebff6ab26aa03423c61e0370377f11725184199 DIFF: https://github.com/llvm/llvm-project/commit/7ebff6ab26aa03423c61e0370377f11725184199.diff LOG: [lldb][COFF] Load absolute symbols from COFF symbol table Reviewed By: labath Differential Revision: https://reviews.llvm.org/D134517 Added: Modified: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml Removed: diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 0a2777a193c8..ff824332bdd8 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -830,6 +830,9 @@ void ObjectFilePECOFF::AppendFromCOFFSymbolTable( symbol.SetType(exported->GetType()); } } +} else if (section_number == llvm::COFF::IMAGE_SYM_ABSOLUTE) { + symbol.GetAddressRef() = Address(coff_sym_ref.getValue()); + symbol.SetType(lldb::eSymbolTypeAbsolute); } symtab.AddSymbol(symbol); } diff --git a/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml b/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml index 8bda82c6b4a0..4a663a84a493 100644 --- a/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml +++ b/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml @@ -4,9 +4,10 @@ ## The .file symbol isn't checked, but is included to test that the symbol ## table iteration handles cases with a symbol with more than one aux symbol. -# CHECK: Type File Address/Value {{.*}} SizeFlags Name -# CHECK: Code 0x400010000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry -# CHECK: 0x400020000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable +# CHECK: Type File Address/Value {{.*}} SizeFlags Name +# CHECK: Code 0x400010000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry +# CHECK: 0x400020000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable +# CHECK: Absolute 0xdeadbeef0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} absolute_symbol --- !COFF OptionalHeader: @@ -123,4 +124,10 @@ symbols: SimpleType: IMAGE_SYM_TYPE_NULL ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass:IMAGE_SYM_CLASS_EXTERNAL + - Name:absolute_symbol +Value: 0xdeadbeef +SectionNumber: -1 +SimpleType: IMAGE_SYM_TYPE_NULL +ComplexType: IMAGE_SYM_DTYPE_NULL +StorageClass:IMAGE_SYM_CLASS_STATIC ... ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] acf7d08 - [lldb][COFF] Add note to forwarder export symbols in symtab
Author: Alvin Wong Date: 2022-09-28T12:57:11+03:00 New Revision: acf7d081198f380d6ad2a1b859930e50a9cf2dae URL: https://github.com/llvm/llvm-project/commit/acf7d081198f380d6ad2a1b859930e50a9cf2dae DIFF: https://github.com/llvm/llvm-project/commit/acf7d081198f380d6ad2a1b859930e50a9cf2dae.diff LOG: [lldb][COFF] Add note to forwarder export symbols in symtab Forwarder exports do not point to a real function or variable. Instead they point to a string describing which DLL and symbol to forward to. Any imports which uses them will be redirected by the loader transparently. These symbols do not have much use in LLDB, but keep them just in case someone find it useful. Also set a synthesized name with the forwarder string for informational purpose. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D134518 Added: lldb/test/Shell/ObjectFile/PECOFF/symbols-forwarder-export.yaml Modified: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Removed: diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index ff824332bdd8..6b6177f49c75 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -869,6 +869,26 @@ ObjectFilePECOFF::AppendFromExportTable(SectionList *sect_list, llvm::cantFail(entry.getOrdinal(ordinal)); symbol.SetID(ordinal); +bool is_forwarder; +llvm::cantFail(entry.isForwarder(is_forwarder)); +if (is_forwarder) { + // Forwarder exports are redirected by the loader transparently, but keep + // it in symtab and make a note using the symbol name. + llvm::StringRef forwarder_name; + if (auto err = entry.getForwardTo(forwarder_name)) { +LLDB_LOG(log, + "ObjectFilePECOFF::AppendFromExportTable - failed to get " + "forwarder name of forwarder export '{0}': {1}", + sym_name, llvm::fmt_consume(std::move(err))); +continue; + } + llvm::SmallString<256> new_name = {symbol.GetDisplayName().GetStringRef(), + " (forwarded to ", forwarder_name, + ")"}; + symbol.GetMangled().SetDemangledName(ConstString(new_name.str())); + symbol.SetDemangledNameIsSynthesized(true); +} + uint32_t function_rva; if (auto err = entry.getExportRVA(function_rva)) { LLDB_LOG(log, @@ -886,9 +906,10 @@ ObjectFilePECOFF::AppendFromExportTable(SectionList *sect_list, // An exported symbol may be either code or data. Guess by checking whether // the section containing the symbol is executable. symbol.SetType(lldb::eSymbolTypeData); -if (auto section_sp = symbol.GetAddressRef().GetSection()) - if (section_sp->GetPermissions() & ePermissionsExecutable) -symbol.SetType(lldb::eSymbolTypeCode); +if (!is_forwarder) + if (auto section_sp = symbol.GetAddressRef().GetSection()) +if (section_sp->GetPermissions() & ePermissionsExecutable) + symbol.SetType(lldb::eSymbolTypeCode); symbol.SetExternal(true); uint32_t idx = symtab.AddSymbol(symbol); export_list.push_back(std::make_pair(function_rva, idx)); diff --git a/lldb/test/Shell/ObjectFile/PECOFF/symbols-forwarder-export.yaml b/lldb/test/Shell/ObjectFile/PECOFF/symbols-forwarder-export.yaml new file mode 100644 index ..70a91c10701e --- /dev/null +++ b/lldb/test/Shell/ObjectFile/PECOFF/symbols-forwarder-export.yaml @@ -0,0 +1,51 @@ +# RUN: yaml2obj %s -o %t +# RUN: lldb-test symbols %t | FileCheck %s + +# CHECK: UserID DSX Type File Address/Value {{.*}} SizeFlags Name +# CHECK-NEXT: -- +# CHECK-NEXT: 1 X Data 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} LoadLibrary (forwarded to kernel32.LoadLibrary) +# CHECK-EMPTY: + +# Test file generated with: +# clang -O2 --target=x86_64-windows-msvc test.c -nostdlib -c -o test.obj +# lld-link -dll -out:test.dll -entry:entry -export:LoadLibrary=kernel32.LoadLibrary test.obj +# test.c: +# void entry(void) {} + +--- !COFF +OptionalHeader: + AddressOfEntryPoint: 4096 + ImageBase: 6442450944 + SectionAlignment: 4096 + FileAlignment: 512 + MajorOperatingSystemVersion: 6 + MinorOperatingSystemVersion: 0 + MajorImageVersion: 0 + MinorImageVersion: 0 + MajorSubsystemVersion: 6 + MinorSubsystemVersion: 0 + Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI + DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT ] + SizeOfStackReserve: 1048576 + SizeOfStackCommit: 4096 + SizeOfHeapReserve: 1048576 + SizeOfHeapCommit: 4096 + ExportTable: +RelativeVirtualAddress: 8192 +Size:110 +header: + Mach
[Lldb-commits] [lldb] 8a67a05 - [lldb][COFF] Map symbols without base+complex type as 'Data' type
Author: Alvin Wong Date: 2022-09-28T12:57:12+03:00 New Revision: 8a67a05e93349e341d1325f1a6428d1373f77177 URL: https://github.com/llvm/llvm-project/commit/8a67a05e93349e341d1325f1a6428d1373f77177 DIFF: https://github.com/llvm/llvm-project/commit/8a67a05e93349e341d1325f1a6428d1373f77177.diff LOG: [lldb][COFF] Map symbols without base+complex type as 'Data' type Both LLD and GNU ld write global/static variables to the COFF symbol table with `IMAGE_SYM_TYPE_NULL` and `IMAGE_SYM_DTYPE_NULL` type. Map these symbols as 'Data' type in the symtab to allow these symbols to be used in expressions and printable. Reviewed By: labath, DavidSpickett Differential Revision: https://reviews.llvm.org/D134585 Added: Modified: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml Removed: diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 6b6177f49c75..61c9b9f84272 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -379,6 +379,13 @@ lldb::SymbolType ObjectFilePECOFF::MapSymbolType(uint16_t coff_symbol_type) { if (complex_type == llvm::COFF::IMAGE_SYM_DTYPE_FUNCTION) { return lldb::eSymbolTypeCode; } + const auto base_type = coff_symbol_type & 0xff; + if (base_type == llvm::COFF::IMAGE_SYM_TYPE_NULL && + complex_type == llvm::COFF::IMAGE_SYM_DTYPE_NULL) { +// Unknown type. LLD and GNU ld uses this for variables on MinGW, so +// consider these symbols to be data to enable printing. +return lldb::eSymbolTypeData; + } return lldb::eSymbolTypeInvalid; } diff --git a/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml b/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml index 4a663a84a493..d80a05e803ac 100644 --- a/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml +++ b/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml @@ -6,7 +6,7 @@ # CHECK: Type File Address/Value {{.*}} SizeFlags Name # CHECK: Code 0x400010000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry -# CHECK: 0x400020000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable +# CHECK: Data 0x400020000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable # CHECK: Absolute 0xdeadbeef0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} absolute_symbol --- !COFF diff --git a/lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml b/lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml index dd21cad5f58d..4b1efd18c2cb 100644 --- a/lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml +++ b/lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml @@ -15,7 +15,7 @@ # CHECK-NEXT: 4294967295 Code 0x000180001020 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} aliasFunc # CHECK-NEXT: 4294967295 X Additional 0x000180003000 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} exportInt # CHECK-NEXT: 4294967295 Data 0x000180003004 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} aliasInt -# CHECK-NEXT: 4294967295 Invalid0x000180003008 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} internalInt +# CHECK-NEXT: 4294967295 Data 0x000180003008 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} internalInt # CHECK-EMPTY: # Test file generated with: ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fe17e02 - [lldb][Windows] Always call SetExecutableModule on debugger connected
Author: Alvin Wong Date: 2022-09-30T13:51:56+03:00 New Revision: fe17e026959cc263c12fafa3a8e9e83503f9a18b URL: https://github.com/llvm/llvm-project/commit/fe17e026959cc263c12fafa3a8e9e83503f9a18b DIFF: https://github.com/llvm/llvm-project/commit/fe17e026959cc263c12fafa3a8e9e83503f9a18b.diff LOG: [lldb][Windows] Always call SetExecutableModule on debugger connected In `ProcessWindows::OnDebuggerConnected` (triggered from `CREATE_PROCESS_DEBUG_EVENT`), we should always call `Target::SetExecutableModule` regardless of whether LLDB has already preloaded the executable modules. `SetExecutableModule` has the side effect of clearing the module list of the Target, which help make sure that module #0 is the executable module and the rest of the modules are listed according to the DLL load order in the process (technically this has no real consequences but it seems to make more sense anyway.) It also fixes an issue where the modules preloaded by LLDB will be duplicated when the debuggee process actually loads the DLL. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D134636 Added: lldb/test/Shell/Target/Inputs/main.c lldb/test/Shell/Target/Inputs/shlib.c lldb/test/Shell/Target/dependent-modules-nodupe-windows.test Modified: lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Removed: diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp index e3d04c9f34491..a84dd62357de7 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -653,28 +653,26 @@ void ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base) { LLDB_LOG(log, "Debugger connected to process {0}. Image base = {1:x}", debugger->GetProcess().GetProcessId(), image_base); - ModuleSP module = GetTarget().GetExecutableModule(); - if (!module) { -// During attach, we won't have the executable module, so find it now. -const DWORD pid = debugger->GetProcess().GetProcessId(); -const std::string file_name = GetProcessExecutableName(pid); -if (file_name.empty()) { - return; -} - -FileSpec executable_file(file_name); -FileSystem::Instance().Resolve(executable_file); -ModuleSpec module_spec(executable_file); -Status error; -module = -GetTarget().GetOrCreateModule(module_spec, true /* notify */, &error); -if (!module) { - return; -} + ModuleSP module; + // During attach, we won't have the executable module, so find it now. + const DWORD pid = debugger->GetProcess().GetProcessId(); + const std::string file_name = GetProcessExecutableName(pid); + if (file_name.empty()) { +return; + } -GetTarget().SetExecutableModule(module, eLoadDependentsNo); + FileSpec executable_file(file_name); + FileSystem::Instance().Resolve(executable_file); + ModuleSpec module_spec(executable_file); + Status error; + module = + GetTarget().GetOrCreateModule(module_spec, true /* notify */, &error); + if (!module) { +return; } + GetTarget().SetExecutableModule(module, eLoadDependentsNo); + if (auto dyld = GetDynamicLoader()) dyld->OnLoadModule(module, ModuleSpec(), image_base); diff --git a/lldb/test/Shell/Target/Inputs/main.c b/lldb/test/Shell/Target/Inputs/main.c new file mode 100644 index 0..761410b1b52fe --- /dev/null +++ b/lldb/test/Shell/Target/Inputs/main.c @@ -0,0 +1,2 @@ +__declspec(dllimport) void exportFunc(void); +int main() { exportFunc(); } diff --git a/lldb/test/Shell/Target/Inputs/shlib.c b/lldb/test/Shell/Target/Inputs/shlib.c new file mode 100644 index 0..b0a8d463fb663 --- /dev/null +++ b/lldb/test/Shell/Target/Inputs/shlib.c @@ -0,0 +1 @@ +__declspec(dllexport) void exportFunc(void) {} diff --git a/lldb/test/Shell/Target/dependent-modules-nodupe-windows.test b/lldb/test/Shell/Target/dependent-modules-nodupe-windows.test new file mode 100644 index 0..52e46cd0c9b21 --- /dev/null +++ b/lldb/test/Shell/Target/dependent-modules-nodupe-windows.test @@ -0,0 +1,24 @@ +# REQUIRES: system-windows + +# Checks that dependent modules preloaded by LLDB are not duplicated when the +# process actually loads the DLL. + +# RUN: %clang_host -g0 -O0 -shared %S/Inputs/shlib.c -o %t.shlib.dll \ +# RUN: %if windows-msvc %{-Wl,-implib:%t.shlib.lib%} \ +# RUN: %else %{-Wl,--out-implib=%t.shlib.lib%} +# RUN: %clang_host -g0 -O0 %S/Inputs/main.c %t.shlib.lib -o %t.main.exe +# RUN: %lldb -b -o "#before" -o "target modules list" -o "b main" -o run \ +# RUN: -o "#after" -o "target modules list" %t.main.exe | FileCheck %s + +# CHECK-LABEL: #before +# CHECK-NEXT: target modules list +# CHECK-NEXT: .main.exe +# CHECK-NEXT: .shlib.dll + +# CHECK-LABEL: #after +# CHECK-NEXT: target modules
[Lldb-commits] [lldb] e9e3a61 - [lldb] Fix warnings about unused variables when building without asserts. NFC.
Author: Martin Storsjö Date: 2022-10-01T14:27:48+03:00 New Revision: e9e3a612ecd18a42f931c09223898128da3142f6 URL: https://github.com/llvm/llvm-project/commit/e9e3a612ecd18a42f931c09223898128da3142f6 DIFF: https://github.com/llvm/llvm-project/commit/e9e3a612ecd18a42f931c09223898128da3142f6.diff LOG: [lldb] Fix warnings about unused variables when building without asserts. NFC. Added: Modified: lldb/source/Host/windows/MainLoopWindows.cpp Removed: diff --git a/lldb/source/Host/windows/MainLoopWindows.cpp b/lldb/source/Host/windows/MainLoopWindows.cpp index 84521227844ee..6e5f45d98208e 100644 --- a/lldb/source/Host/windows/MainLoopWindows.cpp +++ b/lldb/source/Host/windows/MainLoopWindows.cpp @@ -30,6 +30,7 @@ MainLoopWindows::~MainLoopWindows() { assert(m_read_fds.empty()); BOOL result = WSACloseEvent(m_trigger_event); assert(result == TRUE); + (void)result; } llvm::Expected MainLoopWindows::Poll() { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b2a5dd1 - [LLDB] Fix the build for ppc64le linux
Author: Martin Storsjö Date: 2022-10-18T11:54:19+03:00 New Revision: b2a5dd12a47a784f09628f1c10ab369c3b2c3c88 URL: https://github.com/llvm/llvm-project/commit/b2a5dd12a47a784f09628f1c10ab369c3b2c3c88 DIFF: https://github.com/llvm/llvm-project/commit/b2a5dd12a47a784f09628f1c10ab369c3b2c3c88.diff LOG: [LLDB] Fix the build for ppc64le linux 812ad2167bd2e27f5d0dee07bb03a5910616e0b6 changed the signature of RegisterValue::SetFromMemoryData. Added: Modified: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp Removed: diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp index e96a41fe86d01..cb6f81b28f7cc 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp @@ -184,7 +184,7 @@ Status NativeRegisterContextLinux_ppc64le::ReadRegister( uint32_t fpr_offset = CalculateFprOffset(reg_info); assert(fpr_offset < sizeof m_fpr_ppc64le); uint8_t *src = (uint8_t *)&m_fpr_ppc64le + fpr_offset; -reg_value.SetFromMemoryData(reg_info, src, reg_info->byte_size, +reg_value.SetFromMemoryData(*reg_info, src, reg_info->byte_size, eByteOrderLittle, error); } else if (IsVSX(reg)) { uint32_t vsx_offset = CalculateVsxOffset(reg_info); @@ -207,7 +207,7 @@ Status NativeRegisterContextLinux_ppc64le::ReadRegister( dst += 8; src = (uint8_t *)&m_fpr_ppc64le + vsx_offset / 2; ::memcpy(dst, src, 8); - reg_value.SetFromMemoryData(reg_info, &value, reg_info->byte_size, + reg_value.SetFromMemoryData(*reg_info, &value, reg_info->byte_size, eByteOrderLittle, error); } else { error = ReadVMX(); @@ -217,7 +217,7 @@ Status NativeRegisterContextLinux_ppc64le::ReadRegister( // Get pointer to m_vmx_ppc64le variable and set the data from it. uint32_t vmx_offset = vsx_offset - sizeof(m_vsx_ppc64le) / 2; uint8_t *src = (uint8_t *)&m_vmx_ppc64le + vmx_offset; - reg_value.SetFromMemoryData(reg_info, src, reg_info->byte_size, + reg_value.SetFromMemoryData(*reg_info, src, reg_info->byte_size, eByteOrderLittle, error); } } else if (IsVMX(reg)) { @@ -229,7 +229,7 @@ Status NativeRegisterContextLinux_ppc64le::ReadRegister( uint32_t vmx_offset = CalculateVmxOffset(reg_info); assert(vmx_offset < sizeof m_vmx_ppc64le); uint8_t *src = (uint8_t *)&m_vmx_ppc64le + vmx_offset; -reg_value.SetFromMemoryData(reg_info, src, reg_info->byte_size, +reg_value.SetFromMemoryData(*reg_info, src, reg_info->byte_size, eByteOrderLittle, error); } else if (IsGPR(reg)) { error = ReadGPR(); @@ -237,7 +237,7 @@ Status NativeRegisterContextLinux_ppc64le::ReadRegister( return error; uint8_t *src = (uint8_t *) &m_gpr_ppc64le + reg_info->byte_offset; -reg_value.SetFromMemoryData(reg_info, src, reg_info->byte_size, +reg_value.SetFromMemoryData(*reg_info, src, reg_info->byte_size, eByteOrderLittle, error); } else { return Status("failed - register wasn't recognized to be a GPR, FPR, VSX " ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e50f9c4 - [lldb] Rename StringRef _lower() method calls to _insensitive()
Author: Martin Storsjö Date: 2021-06-25T00:22:01+03:00 New Revision: e50f9c419a84d1e58c38aa660c445395ad8056e6 URL: https://github.com/llvm/llvm-project/commit/e50f9c419a84d1e58c38aa660c445395ad8056e6 DIFF: https://github.com/llvm/llvm-project/commit/e50f9c419a84d1e58c38aa660c445395ad8056e6.diff LOG: [lldb] Rename StringRef _lower() method calls to _insensitive() Added: Modified: lldb/source/Commands/CommandObjectMultiword.cpp lldb/source/Host/common/NativeRegisterContext.cpp lldb/source/Host/windows/ProcessLauncherWindows.cpp lldb/source/Initialization/SystemInitializerCommon.cpp lldb/source/Interpreter/CommandInterpreter.cpp lldb/source/Interpreter/CommandObject.cpp lldb/source/Interpreter/OptionArgParser.cpp lldb/source/Interpreter/OptionValueProperties.cpp lldb/source/Interpreter/ScriptInterpreter.cpp lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp lldb/source/Target/Language.cpp lldb/source/Target/RegisterContext.cpp lldb/source/Utility/ArchSpec.cpp lldb/source/Utility/ConstString.cpp lldb/source/Utility/FileSpec.cpp lldb/source/Utility/Log.cpp Removed: diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp index 3eafd00832446..a523fd0b1560c 100644 --- a/lldb/source/Commands/CommandObjectMultiword.cpp +++ b/lldb/source/Commands/CommandObjectMultiword.cpp @@ -98,7 +98,7 @@ bool CommandObjectMultiword::Execute(const char *args_string, return result.Succeeded(); } - if (sub_command.equals_lower("help")) { + if (sub_command.equals_insensitive("help")) { this->CommandObject::GenerateHelpText(result); return result.Succeeded(); } diff --git a/lldb/source/Host/common/NativeRegisterContext.cpp b/lldb/source/Host/common/NativeRegisterContext.cpp index 9bb877fff878b..c534c7ac724b8 100644 --- a/lldb/source/Host/common/NativeRegisterContext.cpp +++ b/lldb/source/Host/common/NativeRegisterContext.cpp @@ -60,8 +60,8 @@ NativeRegisterContext::GetRegisterInfoByName(llvm::StringRef reg_name, for (uint32_t reg = start_idx; reg < num_registers; ++reg) { const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg); -if (reg_name.equals_lower(reg_info->name) || -reg_name.equals_lower(reg_info->alt_name)) +if (reg_name.equals_insensitive(reg_info->name) || +reg_name.equals_insensitive(reg_info->alt_name)) return reg_info; } return nullptr; diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp index bbfe4d0d01755..fc8da143b99fa 100644 --- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp +++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp @@ -86,7 +86,7 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info, const char *hide_console_var = getenv("LLDB_LAUNCH_INFERIORS_WITHOUT_CONSOLE"); if (hide_console_var && - llvm::StringRef(hide_console_var).equals_lower("true")) { + llvm::StringRef(hide_console_var).equals_insensitive("true")) { startupinfo.dwFlags |= STARTF_USESHOWWINDOW; startupinfo.wShowWindow = SW_HIDE; } diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp index 004fdb120682a..f6012ed425fe4 100644 --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -96,7 +96,7 @@ llvm::Error SystemInitializerCommon::Initialize() { #if defined(_WIN32) const char *disable_crash_dialog_var = getenv("LLDB_DISABLE_CRASH_DIALOG"); if (disable_crash_dialog_var && - llvm::StringRef(disable_crash_dialog_var).equals_lower("true")) { + llvm::StringRef(disable_crash_dialog_var).equals_insensitive("true")) { // This will prevent Windows from displaying a dialog box requiring user // interaction when // LLDB crashes. This is mostly useful when automating LLDB, for example diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 8a3a4092c0f61..2e07ff5703ff2 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -2675,7 +2675,7 @@ void CommandInterpreter::FindCommandsForApropos( const bool search_long_help = false; const bool search_syntax = false;
[Lldb-commits] [lldb] 6115bd9 - [LLDB] Fix GCC warnings about extra semicolons. NFC.
Author: Martin Storsjö Date: 2020-02-10T11:20:44+02:00 New Revision: 6115bd9ba2851469d372d0d7b36d87a3e1d8094b URL: https://github.com/llvm/llvm-project/commit/6115bd9ba2851469d372d0d7b36d87a3e1d8094b DIFF: https://github.com/llvm/llvm-project/commit/6115bd9ba2851469d372d0d7b36d87a3e1d8094b.diff LOG: [LLDB] Fix GCC warnings about extra semicolons. NFC. Added: Modified: lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp lldb/source/Plugins/Architecture/Arm/ArchitectureArm.cpp lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataD
[Lldb-commits] [lldb] 7002128 - [LLDB] Fix GCC warnings about extra semicolons. NFC.
Author: Martin Storsjö Date: 2020-02-12T13:40:33+02:00 New Revision: 7002128ca935aa02be104e2a0c5812260990b074 URL: https://github.com/llvm/llvm-project/commit/7002128ca935aa02be104e2a0c5812260990b074 DIFF: https://github.com/llvm/llvm-project/commit/7002128ca935aa02be104e2a0c5812260990b074.diff LOG: [LLDB] Fix GCC warnings about extra semicolons. NFC. Added: Modified: lldb/source/API/SystemInitializerFull.cpp lldb/tools/lldb-test/SystemInitializerTest.cpp Removed: diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp index cde820bbb76b..4290d9ef6f2e 100644 --- a/lldb/source/API/SystemInitializerFull.cpp +++ b/lldb/source/API/SystemInitializerFull.cpp @@ -24,97 +24,97 @@ #include -LLDB_PLUGIN_DECLARE(ABIMacOSX_arm64); -LLDB_PLUGIN_DECLARE(ABISysV_arm64); -LLDB_PLUGIN_DECLARE(ABIMacOSX_arm); -LLDB_PLUGIN_DECLARE(ABISysV_arm); -LLDB_PLUGIN_DECLARE(ABISysV_arc); -LLDB_PLUGIN_DECLARE(ABISysV_hexagon); -LLDB_PLUGIN_DECLARE(ABISysV_mips); -LLDB_PLUGIN_DECLARE(ABISysV_mips64); -LLDB_PLUGIN_DECLARE(ABISysV_ppc); -LLDB_PLUGIN_DECLARE(ABISysV_ppc64); -LLDB_PLUGIN_DECLARE(ABISysV_s390x); -LLDB_PLUGIN_DECLARE(ABIMacOSX_i386); -LLDB_PLUGIN_DECLARE(ABISysV_i386); -LLDB_PLUGIN_DECLARE(ABISysV_x86_64); -LLDB_PLUGIN_DECLARE(ABIWindows_x86_64); -LLDB_PLUGIN_DECLARE(ObjectFileBreakpad); -LLDB_PLUGIN_DECLARE(ObjectFileELF); -LLDB_PLUGIN_DECLARE(ObjectFileMachO); -LLDB_PLUGIN_DECLARE(ObjectFilePECOFF); -LLDB_PLUGIN_DECLARE(ObjectFileWasm); -LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive); -LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO); -LLDB_PLUGIN_DECLARE(ScriptInterpreterNone); +LLDB_PLUGIN_DECLARE(ABIMacOSX_arm64) +LLDB_PLUGIN_DECLARE(ABISysV_arm64) +LLDB_PLUGIN_DECLARE(ABIMacOSX_arm) +LLDB_PLUGIN_DECLARE(ABISysV_arm) +LLDB_PLUGIN_DECLARE(ABISysV_arc) +LLDB_PLUGIN_DECLARE(ABISysV_hexagon) +LLDB_PLUGIN_DECLARE(ABISysV_mips) +LLDB_PLUGIN_DECLARE(ABISysV_mips64) +LLDB_PLUGIN_DECLARE(ABISysV_ppc) +LLDB_PLUGIN_DECLARE(ABISysV_ppc64) +LLDB_PLUGIN_DECLARE(ABISysV_s390x) +LLDB_PLUGIN_DECLARE(ABIMacOSX_i386) +LLDB_PLUGIN_DECLARE(ABISysV_i386) +LLDB_PLUGIN_DECLARE(ABISysV_x86_64) +LLDB_PLUGIN_DECLARE(ABIWindows_x86_64) +LLDB_PLUGIN_DECLARE(ObjectFileBreakpad) +LLDB_PLUGIN_DECLARE(ObjectFileELF) +LLDB_PLUGIN_DECLARE(ObjectFileMachO) +LLDB_PLUGIN_DECLARE(ObjectFilePECOFF) +LLDB_PLUGIN_DECLARE(ObjectFileWasm) +LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive) +LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO) +LLDB_PLUGIN_DECLARE(ScriptInterpreterNone) #if LLDB_ENABLE_PYTHON -LLDB_PLUGIN_DECLARE(OperatingSystemPython); -LLDB_PLUGIN_DECLARE(ScriptInterpreterPython); +LLDB_PLUGIN_DECLARE(OperatingSystemPython) +LLDB_PLUGIN_DECLARE(ScriptInterpreterPython) #endif #if LLDB_ENABLE_LUA -LLDB_PLUGIN_DECLARE(ScriptInterpreterLua); +LLDB_PLUGIN_DECLARE(ScriptInterpreterLua) #endif -LLDB_PLUGIN_DECLARE(PlatformFreeBSD); -LLDB_PLUGIN_DECLARE(PlatformLinux); -LLDB_PLUGIN_DECLARE(PlatformNetBSD); -LLDB_PLUGIN_DECLARE(PlatformOpenBSD); -LLDB_PLUGIN_DECLARE(PlatformWindows); -LLDB_PLUGIN_DECLARE(PlatformAndroid); -LLDB_PLUGIN_DECLARE(PlatformMacOSX); -LLDB_PLUGIN_DECLARE(TypeSystemClang); -LLDB_PLUGIN_DECLARE(ArchitectureArm); -LLDB_PLUGIN_DECLARE(ArchitectureMips); -LLDB_PLUGIN_DECLARE(ArchitecturePPC64); -LLDB_PLUGIN_DECLARE(DisassemblerLLVMC); -LLDB_PLUGIN_DECLARE(JITLoaderGDB); -LLDB_PLUGIN_DECLARE(ProcessElfCore); -LLDB_PLUGIN_DECLARE(ProcessMachCore); -LLDB_PLUGIN_DECLARE(ProcessMinidump); -LLDB_PLUGIN_DECLARE(MemoryHistoryASan); -LLDB_PLUGIN_DECLARE(InstrumentationRuntimeASan); -LLDB_PLUGIN_DECLARE(InstrumentationRuntimeTSan); -LLDB_PLUGIN_DECLARE(InstrumentationRuntimeUBSan); -LLDB_PLUGIN_DECLARE(InstrumentationRuntimeMainThreadChecker); -LLDB_PLUGIN_DECLARE(SymbolVendorELF); -LLDB_PLUGIN_DECLARE(SymbolFileBreakpad); -LLDB_PLUGIN_DECLARE(SymbolFileDWARF); -LLDB_PLUGIN_DECLARE(SymbolFilePDB); -LLDB_PLUGIN_DECLARE(SymbolFileSymtab); -LLDB_PLUGIN_DECLARE(SymbolVendorWasm); -LLDB_PLUGIN_DECLARE(UnwindAssemblyInstEmulation); -LLDB_PLUGIN_DECLARE(UnwindAssembly_x86); -LLDB_PLUGIN_DECLARE(EmulateInstructionARM); -LLDB_PLUGIN_DECLARE(EmulateInstructionARM64); -LLDB_PLUGIN_DECLARE(EmulateInstructionMIPS); -LLDB_PLUGIN_DECLARE(EmulateInstructionMIPS64); -LLDB_PLUGIN_DECLARE(EmulateInstructionPPC64); -LLDB_PLUGIN_DECLARE(SymbolFileDWARFDebugMap); -LLDB_PLUGIN_DECLARE(ItaniumABILanguageRuntime); -LLDB_PLUGIN_DECLARE(AppleObjCRuntime); -LLDB_PLUGIN_DECLARE(SystemRuntimeMacOSX); -LLDB_PLUGIN_DECLARE(RenderScriptRuntime); -LLDB_PLUGIN_DECLARE(CPlusPlusLanguage); -LLDB_PLUGIN_DECLARE(ObjCLanguage); -LLDB_PLUGIN_DECLARE(ObjCPlusPlusLanguage); +LLDB_PLUGIN_DECLARE(PlatformFreeBSD) +LLDB_PLUGIN_DECLARE(PlatformLinux) +LLDB_PLUGIN_DECLARE(PlatformNetBSD) +LLDB_PLUGIN_DECLARE(PlatformOpenBSD) +LLDB_PLUGIN_DECLARE(PlatformWindows) +LLDB_PLUGIN_DECLARE(PlatformAndroid) +LLDB_PLUGIN_DECLARE(PlatformM
[Lldb-commits] [lldb] 0e1da1e - [LLDB] Fix GCC warnings about extra semicolons. NFC.
Author: Martin Storsjö Date: 2020-02-17T14:16:46+02:00 New Revision: 0e1da1ef4af24ece9db4b0467b6c1932088c951e URL: https://github.com/llvm/llvm-project/commit/0e1da1ef4af24ece9db4b0467b6c1932088c951e DIFF: https://github.com/llvm/llvm-project/commit/0e1da1ef4af24ece9db4b0467b6c1932088c951e.diff LOG: [LLDB] Fix GCC warnings about extra semicolons. NFC. Added: Modified: lldb/source/API/SystemInitializerFull.cpp Removed: diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp index 9f68fc7e88c5..b629e53e9dfe 100644 --- a/lldb/source/API/SystemInitializerFull.cpp +++ b/lldb/source/API/SystemInitializerFull.cpp @@ -24,22 +24,22 @@ #include -LLDB_PLUGIN_DECLARE(ABIAArch64); -LLDB_PLUGIN_DECLARE(ABIARM); -LLDB_PLUGIN_DECLARE(ABISysV_arc); -LLDB_PLUGIN_DECLARE(ABISysV_hexagon); -LLDB_PLUGIN_DECLARE(ABIMips); -LLDB_PLUGIN_DECLARE(ABIPowerPC); -LLDB_PLUGIN_DECLARE(ABISysV_s390x); -LLDB_PLUGIN_DECLARE(ABIX86); -LLDB_PLUGIN_DECLARE(ObjectFileBreakpad); -LLDB_PLUGIN_DECLARE(ObjectFileELF); -LLDB_PLUGIN_DECLARE(ObjectFileMachO); -LLDB_PLUGIN_DECLARE(ObjectFilePECOFF); -LLDB_PLUGIN_DECLARE(ObjectFileWasm); -LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive); -LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO); -LLDB_PLUGIN_DECLARE(ScriptInterpreterNone); +LLDB_PLUGIN_DECLARE(ABIAArch64) +LLDB_PLUGIN_DECLARE(ABIARM) +LLDB_PLUGIN_DECLARE(ABISysV_arc) +LLDB_PLUGIN_DECLARE(ABISysV_hexagon) +LLDB_PLUGIN_DECLARE(ABIMips) +LLDB_PLUGIN_DECLARE(ABIPowerPC) +LLDB_PLUGIN_DECLARE(ABISysV_s390x) +LLDB_PLUGIN_DECLARE(ABIX86) +LLDB_PLUGIN_DECLARE(ObjectFileBreakpad) +LLDB_PLUGIN_DECLARE(ObjectFileELF) +LLDB_PLUGIN_DECLARE(ObjectFileMachO) +LLDB_PLUGIN_DECLARE(ObjectFilePECOFF) +LLDB_PLUGIN_DECLARE(ObjectFileWasm) +LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive) +LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO) +LLDB_PLUGIN_DECLARE(ScriptInterpreterNone) #if LLDB_ENABLE_PYTHON LLDB_PLUGIN_DECLARE(OperatingSystemPython) LLDB_PLUGIN_DECLARE(ScriptInterpreterPython) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] aa786b8 - [lldb] [PECOFF] Only use PECallFrameInfo on the one supported architecture
Author: Martin Storsjö Date: 2020-04-01T12:39:21+03:00 New Revision: aa786b881fc89a2a9883bff77912f2053126f95b URL: https://github.com/llvm/llvm-project/commit/aa786b881fc89a2a9883bff77912f2053126f95b DIFF: https://github.com/llvm/llvm-project/commit/aa786b881fc89a2a9883bff77912f2053126f95b.diff LOG: [lldb] [PECOFF] Only use PECallFrameInfo on the one supported architecture The RuntimeFunction struct, which PECallFrameInfo interprets, has a different layout and differnet semantics on all architectures. Differential Revision: https://reviews.llvm.org/D77000 Added: Modified: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Removed: diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 38b4472f50a7..385b291df709 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -782,6 +782,9 @@ std::unique_ptr ObjectFilePECOFF::CreateCallFrameInfo() { if (!data_dir_exception.vmaddr) return {}; + if (m_coff_header.machine != llvm::COFF::IMAGE_FILE_MACHINE_AMD64) +return {}; + return std::make_unique(*this, data_dir_exception.vmaddr, data_dir_exception.vmsize); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D96840: [LLDB] [docs] Update the list of supported architectures on Windows
On Wed, 17 Feb 2021, Omair Javaid wrote: HI mstorsjo, did you manage to run LLDB testsuite with python support enabled on windows. Can you please share steps to build and test LLDB on windows on Arm/AArch64 if you have them handy somewhere. I ll check if there is something missing on our part which needs to be done to get LLDB in reasonable shape on windows on Arm/AArch64. IMO, the biggest hurdle right now is swig/API generation and python support enablement. If you think that is working already with some hack, then please share it with me. I am using MS Surface Arm64 for the build. Hi, I never ran the full testsuite, and I built with python disabled. I did manage to run some testcases, but I'm cross compiling (building on x86_64 linux, targeting aarch64 windows), so I transplanted parts of the testsuite to the target system and ran it via WSL - not very smooth, but it helped create and verify some test cases like test/Shell/Register/aarch64-fp-read.test at least. // Martin ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] ae14f3f - [LLDB] [docs] Update the list of supported architectures on Windows
Author: Martin Storsjö Date: 2021-02-21T22:23:55+02:00 New Revision: ae14f3fdbfa85c92d64f5f38f883a6db4266ca80 URL: https://github.com/llvm/llvm-project/commit/ae14f3fdbfa85c92d64f5f38f883a6db4266ca80 DIFF: https://github.com/llvm/llvm-project/commit/ae14f3fdbfa85c92d64f5f38f883a6db4266ca80.diff LOG: [LLDB] [docs] Update the list of supported architectures on Windows Differential Revision: https://reviews.llvm.org/D96840 Added: Modified: lldb/docs/index.rst Removed: diff --git a/lldb/docs/index.rst b/lldb/docs/index.rst index 6376b0abe09c..100404b00dce 100644 --- a/lldb/docs/index.rst +++ b/lldb/docs/index.rst @@ -74,10 +74,11 @@ are welcome: * iOS, tvOS, and watchOS device debugging on ARM and AArch64 * Linux user-space debugging for i386, x86_64 and PPC64le * FreeBSD user-space debugging for i386 and x86_64 -* Windows user-space debugging for i386 (*) +* Windows user-space debugging for i386, x86_64, ARM and AArch64 (*) (*) Support for Windows is under active development. Basic functionality is -expected to work, with functionality improving rapidly. +expected to work, with functionality improving rapidly. ARM and AArch64 support +is more experimental, with more known issues than the others. Get Involved ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 2f18e51 - [lldb] Silence GCC warnings about format not being a string literal in LLDB_SCOPED_TIMER
Author: Martin Storsjö Date: 2021-03-23T14:11:50+02:00 New Revision: 2f18e51d8b9e02d689efc522a0784caed5b5a386 URL: https://github.com/llvm/llvm-project/commit/2f18e51d8b9e02d689efc522a0784caed5b5a386 DIFF: https://github.com/llvm/llvm-project/commit/2f18e51d8b9e02d689efc522a0784caed5b5a386.diff LOG: [lldb] Silence GCC warnings about format not being a string literal in LLDB_SCOPED_TIMER Pass "%s" as the format string literal and LLVM_PRETTY_FUNCTION as argument to it. Differential Revision: https://reviews.llvm.org/D99120 Added: Modified: lldb/include/lldb/Utility/Timer.h Removed: diff --git a/lldb/include/lldb/Utility/Timer.h b/lldb/include/lldb/Utility/Timer.h index edc064b23b574..32422b34b1adf 100644 --- a/lldb/include/lldb/Utility/Timer.h +++ b/lldb/include/lldb/Utility/Timer.h @@ -76,7 +76,7 @@ class Timer { #define LLDB_SCOPED_TIMER() \ static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION); \ - ::lldb_private::Timer _scoped_timer(_cat, LLVM_PRETTY_FUNCTION) + ::lldb_private::Timer _scoped_timer(_cat, "%s", LLVM_PRETTY_FUNCTION) #define LLDB_SCOPED_TIMERF(...) \ static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION); \ ::lldb_private::Timer _scoped_timer(_cat, __VA_ARGS__) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 476e087 - [LLDB] Fix building for aarch64 windows after d6d3d21cd1cb1567eaf7ff8c0867b07227a19d99
Author: Martin Storsjö Date: 2021-04-06T14:03:42+03:00 New Revision: 476e087939e4c7cda4de9fa3bc998aea62da4096 URL: https://github.com/llvm/llvm-project/commit/476e087939e4c7cda4de9fa3bc998aea62da4096 DIFF: https://github.com/llvm/llvm-project/commit/476e087939e4c7cda4de9fa3bc998aea62da4096.diff LOG: [LLDB] Fix building for aarch64 windows after d6d3d21cd1cb1567eaf7ff8c0867b07227a19d99 Differential Revision: https://reviews.llvm.org/D99847 Added: Modified: lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp Removed: diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp index 8205c8ec98dbf..1294928e09a5d 100644 --- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp @@ -98,7 +98,8 @@ static RegisterInfoInterface * CreateRegisterInfoInterface(const ArchSpec &target_arch) { assert((HostInfo::GetArchitecture().GetAddressByteSize() == 8) && "Register setting path assumes this is a 64-bit host"); - return new RegisterInfoPOSIX_arm64(target_arch); + return new RegisterInfoPOSIX_arm64( + target_arch, RegisterInfoPOSIX_arm64::eRegsetMaskDefault); } static Status GetThreadContextHelper(lldb::thread_t thread_handle, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 127322d - [lldb] Silence GCC warnings about control reaching the end of non-void functions. NFC.
Author: Martin Storsjö Date: 2021-04-14T11:54:45+03:00 New Revision: 127322ddebde9c3a0b1cd5cdc81b36870606b4f6 URL: https://github.com/llvm/llvm-project/commit/127322ddebde9c3a0b1cd5cdc81b36870606b4f6 DIFF: https://github.com/llvm/llvm-project/commit/127322ddebde9c3a0b1cd5cdc81b36870606b4f6.diff LOG: [lldb] Silence GCC warnings about control reaching the end of non-void functions. NFC. Also remove a superfluous semicolon after the braces for a switch statement (that wasn't warned about). Differential Revision: https://reviews.llvm.org/D100447 Added: Modified: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Removed: diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index 752162109468f..2b2d761594eda 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1439,7 +1439,8 @@ AppleObjCRuntimeV2::DynamicClassInfoExtractor::GetClassInfoUtilityFunction( g_get_dynamic_class_info2_name); return m_objc_copyRealizedClassList_helper.utility_function.get(); } - }; + } + llvm_unreachable("Unexpected helper"); } lldb::addr_t & @@ -1450,6 +1451,7 @@ AppleObjCRuntimeV2::DynamicClassInfoExtractor::GetClassInfoArgs(Helper helper) { case objc_copyRealizedClassList: return m_objc_copyRealizedClassList_helper.args; } + llvm_unreachable("Unexpected helper"); } AppleObjCRuntimeV2::DynamicClassInfoExtractor::Helper ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a401870 - [lldb] Remove a superfluous trailing semicolon, fixing warnings. NFC.
Author: Martin Storsjö Date: 2021-04-18T15:56:18+03:00 New Revision: a401870f550cc1fa30f94b9470245c15e1f5a80d URL: https://github.com/llvm/llvm-project/commit/a401870f550cc1fa30f94b9470245c15e1f5a80d DIFF: https://github.com/llvm/llvm-project/commit/a401870f550cc1fa30f94b9470245c15e1f5a80d.diff LOG: [lldb] Remove a superfluous trailing semicolon, fixing warnings. NFC. Added: Modified: lldb/include/lldb/Host/windows/editlinewin.h Removed: diff --git a/lldb/include/lldb/Host/windows/editlinewin.h b/lldb/include/lldb/Host/windows/editlinewin.h index 7575f67ca1129..287972178cd12 100644 --- a/lldb/include/lldb/Host/windows/editlinewin.h +++ b/lldb/include/lldb/Host/windows/editlinewin.h @@ -112,4 +112,4 @@ void el_deletestr(EditLine *, int); History *history_init(void); void history_end(History *); int history(History *, HistEvent *, int, ...); -}; +} ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 3f03877 - [LLDB] Don't use the local python to set a default for LLDB_PYTHON_RELATIVE_PATH when cross compiling.
Author: Martin Storsjö Date: 2021-05-11T14:04:41+03:00 New Revision: 3f03877f5a838973d0d22f6b45c112228319f4da URL: https://github.com/llvm/llvm-project/commit/3f03877f5a838973d0d22f6b45c112228319f4da DIFF: https://github.com/llvm/llvm-project/commit/3f03877f5a838973d0d22f6b45c112228319f4da.diff LOG: [LLDB] Don't use the local python to set a default for LLDB_PYTHON_RELATIVE_PATH when cross compiling. Differential Revision: https://reviews.llvm.org/D101903 Added: Modified: lldb/CMakeLists.txt Removed: diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index b5633e21c56a3..2bb05c1e220b3 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -31,13 +31,22 @@ if (WIN32) endif() if (LLDB_ENABLE_PYTHON) - execute_process( -COMMAND ${Python3_EXECUTABLE} --c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))" -OUTPUT_VARIABLE LLDB_PYTHON_DEFAULT_RELATIVE_PATH -OUTPUT_STRIP_TRAILING_WHITESPACE) + if (NOT CMAKE_CROSSCOMPILING) +execute_process( + COMMAND ${Python3_EXECUTABLE} + -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))" + OUTPUT_VARIABLE LLDB_PYTHON_DEFAULT_RELATIVE_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE) + +file(TO_CMAKE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH} LLDB_PYTHON_DEFAULT_RELATIVE_PATH) + else () +if ("${LLDB_PYTHON_RELATIVE_PATH}" STREQUAL "") + message(FATAL_ERROR +"Crosscompiling LLDB with Python requires manually setting +LLDB_PYTHON_RELATIVE_PATH.") +endif () + endif () - file(TO_CMAKE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH} LLDB_PYTHON_DEFAULT_RELATIVE_PATH) set(LLDB_PYTHON_RELATIVE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH} CACHE STRING "Path where Python modules are installed, relative to install prefix") endif () ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 13cde67 - [lldb] Remove a stray semicolon, fixing pedantic GCC warnings. NFC.
Author: Martin Storsjö Date: 2020-09-03T11:19:40+03:00 New Revision: 13cde6733b5fec9eff5e9652686c3b02055e6169 URL: https://github.com/llvm/llvm-project/commit/13cde6733b5fec9eff5e9652686c3b02055e6169 DIFF: https://github.com/llvm/llvm-project/commit/13cde6733b5fec9eff5e9652686c3b02055e6169.diff LOG: [lldb] Remove a stray semicolon, fixing pedantic GCC warnings. NFC. Added: Modified: lldb/source/API/SBReproducer.cpp Removed: diff --git a/lldb/source/API/SBReproducer.cpp b/lldb/source/API/SBReproducer.cpp index 233e0b5b..ec1c85d24329 100644 --- a/lldb/source/API/SBReproducer.cpp +++ b/lldb/source/API/SBReproducer.cpp @@ -31,7 +31,7 @@ using namespace lldb_private; using namespace lldb_private::repro; SBReplayOptions::SBReplayOptions() -: m_opaque_up(std::make_unique()){}; +: m_opaque_up(std::make_unique()){} SBReplayOptions::SBReplayOptions(const SBReplayOptions &rhs) : m_opaque_up(std::make_unique(*rhs.m_opaque_up)) {} ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] cc76965 - [MinGW] Use lib prefix for libraries
Author: Mateusz Mikuła Date: 2020-09-12T22:01:29+03:00 New Revision: cc76965b19085519278bff1052059e03769b71e8 URL: https://github.com/llvm/llvm-project/commit/cc76965b19085519278bff1052059e03769b71e8 DIFF: https://github.com/llvm/llvm-project/commit/cc76965b19085519278bff1052059e03769b71e8.diff LOG: [MinGW] Use lib prefix for libraries In MinGW world, UNIX like lib prefix is preferred for the libraries. This patch adjusts CMake files to do that. Differential Revision: https://reviews.llvm.org/D87517 Added: Modified: clang/tools/libclang/CMakeLists.txt lldb/source/API/CMakeLists.txt llvm/cmake/modules/AddLLVM.cmake llvm/tools/llvm-config/llvm-config.cpp Removed: diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt index c3b9ab6ffb9b..88279ff7dae6 100644 --- a/clang/tools/libclang/CMakeLists.txt +++ b/clang/tools/libclang/CMakeLists.txt @@ -101,7 +101,7 @@ if (WIN32 AND ENABLE_SHARED AND ENABLE_STATIC) unset(ENABLE_STATIC) endif() -if(WIN32) +if(MSVC) set(output_name "libclang") else() set(output_name "clang") diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index 8a7f28c01a9c..aeb1f15e294b 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -182,10 +182,10 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc") endif() -if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) +if (MSVC) # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs, # so only it needs to explicitly link against ${Python3_LIBRARIES} - if (MSVC AND LLDB_ENABLE_PYTHON) + if (LLDB_ENABLE_PYTHON) target_link_libraries(liblldb PRIVATE ${Python3_LIBRARIES}) endif() else() diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index a40cf17426fe..e57abea42753 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -567,7 +567,7 @@ function(llvm_add_library name) endif() if(ARG_SHARED) -if(WIN32) +if(MSVC) set_target_properties(${name} PROPERTIES PREFIX "" ) diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp index a9d3f64aaa5b..1a2f04552d13 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/tools/llvm-config/llvm-config.cpp @@ -381,6 +381,7 @@ int main(int argc, char **argv) { SharedExt = "dll"; SharedVersionedExt = LLVM_DYLIB_VERSION ".dll"; if (HostTriple.isOSCygMing()) { + SharedPrefix = "lib"; StaticExt = "a"; StaticPrefix = "lib"; } else { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 5d330f4 - [lldb] [Windows] Remove unused functions. NFC.
Author: Martin Storsjö Date: 2020-10-10T20:47:40+03:00 New Revision: 5d330f435e12d4a7f97cde406d29ce7413f96b47 URL: https://github.com/llvm/llvm-project/commit/5d330f435e12d4a7f97cde406d29ce7413f96b47 DIFF: https://github.com/llvm/llvm-project/commit/5d330f435e12d4a7f97cde406d29ce7413f96b47.diff LOG: [lldb] [Windows] Remove unused functions. NFC. These became unused in 51117e3c51754f3732e. Added: Modified: lldb/source/Host/windows/Windows.cpp Removed: diff --git a/lldb/source/Host/windows/Windows.cpp b/lldb/source/Host/windows/Windows.cpp index 172ea29107d3..4e6437f1c9ec 100644 --- a/lldb/source/Host/windows/Windows.cpp +++ b/lldb/source/Host/windows/Windows.cpp @@ -22,26 +22,6 @@ #include #include -namespace { -bool utf8ToWide(const char *utf8, wchar_t *buf, size_t bufSize) { - const llvm::UTF8 *sourceStart = reinterpret_cast(utf8); - size_t sourceLen = strlen(utf8) + 1 /* convert null too */; - llvm::UTF16 *target = reinterpret_cast(buf); - llvm::ConversionFlags flags = llvm::strictConversion; - return llvm::ConvertUTF8toUTF16(&sourceStart, sourceStart + sourceLen, &target, -target + bufSize, flags) == llvm::conversionOK; -} - -bool wideToUtf8(const wchar_t *wide, char *buf, size_t bufSize) { - const llvm::UTF16 *sourceStart = reinterpret_cast(wide); - size_t sourceLen = wcslen(wide) + 1 /* convert null too */; - llvm::UTF8 *target = reinterpret_cast(buf); - llvm::ConversionFlags flags = llvm::strictConversion; - return llvm::ConvertUTF16toUTF8(&sourceStart, sourceStart + sourceLen, &target, -target + bufSize, flags) == llvm::conversionOK; -} -} - int vasprintf(char **ret, const char *fmt, va_list ap) { char *buf; int len; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] abaca23 - [lldb] [Windows] Add missing 'override', silencing warnings. NFC.
Author: Martin Storsjö Date: 2020-10-10T20:47:40+03:00 New Revision: abaca237c519a406ab00606b0464c32079831803 URL: https://github.com/llvm/llvm-project/commit/abaca237c519a406ab00606b0464c32079831803 DIFF: https://github.com/llvm/llvm-project/commit/abaca237c519a406ab00606b0464c32079831803.diff LOG: [lldb] [Windows] Add missing 'override', silencing warnings. NFC. Also remove superfluous 'virtual' in overridden methods. Added: Modified: lldb/include/lldb/Host/windows/HostThreadWindows.h lldb/include/lldb/Host/windows/ProcessLauncherWindows.h lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h Removed: diff --git a/lldb/include/lldb/Host/windows/HostThreadWindows.h b/lldb/include/lldb/Host/windows/HostThreadWindows.h index 63d0d73faad5..a74539543aa6 100644 --- a/lldb/include/lldb/Host/windows/HostThreadWindows.h +++ b/lldb/include/lldb/Host/windows/HostThreadWindows.h @@ -26,10 +26,10 @@ class HostThreadWindows : public HostNativeThreadBase { void SetOwnsHandle(bool owns); - virtual Status Join(lldb::thread_result_t *result); - virtual Status Cancel(); - virtual void Reset(); - virtual bool EqualsThread(lldb::thread_t thread) const; + Status Join(lldb::thread_result_t *result) override; + Status Cancel() override; + void Reset() override; + bool EqualsThread(lldb::thread_t thread) const override; lldb::tid_t GetThreadId() const; diff --git a/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h b/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h index e765f1e9ed54..81aea5b2022a 100644 --- a/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h +++ b/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h @@ -18,8 +18,8 @@ class ProcessLaunchInfo; class ProcessLauncherWindows : public ProcessLauncher { public: - virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, -Status &error); + HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, +Status &error) override; protected: HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd); diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h index 732273a54c13..89888df46756 100644 --- a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h +++ b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h @@ -137,39 +137,41 @@ class NativeDebugDelegate : public IDebugDelegate { public: NativeDebugDelegate(NativeProcessWindows &process) : m_process(process) {} - void OnExitProcess(uint32_t exit_code) { m_process.OnExitProcess(exit_code); } + void OnExitProcess(uint32_t exit_code) override { +m_process.OnExitProcess(exit_code); + } - void OnDebuggerConnected(lldb::addr_t image_base) { + void OnDebuggerConnected(lldb::addr_t image_base) override { m_process.OnDebuggerConnected(image_base); } ExceptionResult OnDebugException(bool first_chance, - const ExceptionRecord &record) { + const ExceptionRecord &record) override { return m_process.OnDebugException(first_chance, record); } - void OnCreateThread(const HostThread &thread) { + void OnCreateThread(const HostThread &thread) override { m_process.OnCreateThread(thread); } - void OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) { + void OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) override { m_process.OnExitThread(thread_id, exit_code); } void OnLoadDll(const lldb_private::ModuleSpec &module_spec, - lldb::addr_t module_addr) { + lldb::addr_t module_addr) override { m_process.OnLoadDll(module_spec, module_addr); } - void OnUnloadDll(lldb::addr_t module_addr) { + void OnUnloadDll(lldb::addr_t module_addr) override { m_process.OnUnloadDll(module_addr); } - void OnDebugString(const std::string &string) { + void OnDebugString(const std::string &string) override { m_process.OnDebugString(string); } - void OnDebuggerError(const Status &error, uint32_t type) { + void OnDebuggerError(const Status &error, uint32_t type) override { return m_process.OnDebuggerError(error, type); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 84ce6b9 - [lldb] Fix building with GCC 7. NFC.
Author: Martin Storsjö Date: 2020-10-24T09:33:01+03:00 New Revision: 84ce6b9991bb6db1c37897aca55978a377ce931a URL: https://github.com/llvm/llvm-project/commit/84ce6b9991bb6db1c37897aca55978a377ce931a DIFF: https://github.com/llvm/llvm-project/commit/84ce6b9991bb6db1c37897aca55978a377ce931a.diff LOG: [lldb] Fix building with GCC 7. NFC. Added: Modified: lldb/source/Target/Target.cpp Removed: diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index ee69c6b70357..6b8a053b972e 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -2266,7 +2266,7 @@ Target::CreateUtilityFunction(std::string expression, std::string name, return llvm::make_error(diagnostics.GetString(), llvm::inconvertibleErrorCode()); - return utility_fn; + return std::move(utility_fn); } void Target::SettingsInitialize() { Process::SettingsInitialize(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 11e74e5 - [lldb] Remove a stray semicolon, fixing GCC warnings. NFC.
Author: Martin Storsjö Date: 2021-02-01T13:45:07+02:00 New Revision: 11e74e512d64ae2a2531156b6f0dde211b1ae19d URL: https://github.com/llvm/llvm-project/commit/11e74e512d64ae2a2531156b6f0dde211b1ae19d DIFF: https://github.com/llvm/llvm-project/commit/11e74e512d64ae2a2531156b6f0dde211b1ae19d.diff LOG: [lldb] Remove a stray semicolon, fixing GCC warnings. NFC. Added: Modified: lldb/tools/lldb-vscode/FifoFiles.cpp Removed: diff --git a/lldb/tools/lldb-vscode/FifoFiles.cpp b/lldb/tools/lldb-vscode/FifoFiles.cpp index 0a36c87d4a94..d56f88085abd 100644 --- a/lldb/tools/lldb-vscode/FifoFiles.cpp +++ b/lldb/tools/lldb-vscode/FifoFiles.cpp @@ -33,7 +33,7 @@ FifoFile::~FifoFile() { #if LLVM_ON_UNIX unlink(m_path.c_str()); #endif -}; +} Expected> CreateFifoFile(StringRef path) { #if !LLVM_ON_UNIX ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] 0bca9a7 - Fix lldb-vscode builds on Windows targeting POSIX
On Thu, 28 Jan 2021, Walter Erquinigo via lldb-commits wrote: Author: Walter Erquinigo Date: 2021-01-28T09:36:13-08:00 New Revision: 0bca9a7ce2eeaa9f1d732ffbc17769560a2b236e URL: https://github.com/llvm/llvm-project/commit/0bca9a7ce2eeaa9f1d732ffbc17769560a2b236e DIFF: https://github.com/llvm/llvm-project/commit/0bca9a7ce2eeaa9f1d732ffbc17769560a2b236e.diff LOG: Fix lldb-vscode builds on Windows targeting POSIX @stella.stamenova found out that lldb-vscode's Win32 macros were failing when building on windows targetings POSIX platforms. I'm changing these macros for LLVM_ON_UNIX, which should be more accurate. Just for the record, the reason for things failing wasn't so much that LLVM_ON_UNIX is more accurate than the macros that the code tried to use before. Before, the code tried to check the define "WIN32" in some files, and "_WIN32" in others (and one case even used the macro "WIN_32"). "_WIN32" is the correct one to check, it's predefined by the compilers when targeting windows. Most build tools don't normally define "WIN32" without a leading underscore (although e.g. some visual studio project file templates include it in the list of user-defined macros). So that's why things broke before. Btw, the checks like "#if LLVM_ON_UNIX" are a bit incorrect too, they should be "#ifdef LLVM_ON_UNIX", as the macro is entirely undefined for non-unix platforms. These commits should be backported to the 12.x release branch too, because building lldb for windows (or in particular, lldb-vscode) is broken there right now. // Martin ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 613d866 - [lldb] Remove a redundant semicolon, fixing GCC warnings. NFC.
Author: Martin Storsjö Date: 2020-04-29T21:00:43+03:00 New Revision: 613d86637434182adb4f2a1f629a2ec94d02b569 URL: https://github.com/llvm/llvm-project/commit/613d86637434182adb4f2a1f629a2ec94d02b569 DIFF: https://github.com/llvm/llvm-project/commit/613d86637434182adb4f2a1f629a2ec94d02b569.diff LOG: [lldb] Remove a redundant semicolon, fixing GCC warnings. NFC. Added: Modified: lldb/source/Plugins/Language/ObjC/CFBasicHash.h Removed: diff --git a/lldb/source/Plugins/Language/ObjC/CFBasicHash.h b/lldb/source/Plugins/Language/ObjC/CFBasicHash.h index e7d9dfb1a663..94c2a1ac8a5f 100644 --- a/lldb/source/Plugins/Language/ObjC/CFBasicHash.h +++ b/lldb/source/Plugins/Language/ObjC/CFBasicHash.h @@ -72,6 +72,6 @@ class CFBasicHash { HashType m_type; }; -}; // namespace lldb_private +} // namespace lldb_private #endif // LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_CFBASICHASH_H ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 0cd9e59 - [ProcessGDBRemote] Fix a typo in an ifdef from 58de2a3851391d
Author: Martin Storsjö Date: 2020-06-24T23:49:33+03:00 New Revision: 0cd9e598291df8c633aaa0c0e1d8eeab95de9680 URL: https://github.com/llvm/llvm-project/commit/0cd9e598291df8c633aaa0c0e1d8eeab95de9680 DIFF: https://github.com/llvm/llvm-project/commit/0cd9e598291df8c633aaa0c0e1d8eeab95de9680.diff LOG: [ProcessGDBRemote] Fix a typo in an ifdef from 58de2a3851391d Added: Modified: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Removed: diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index d2b72de03eac..39e97c92e343 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -17,7 +17,7 @@ #include #endif #include -#ifdef defined(__APPLE__) +#if defined(__APPLE__) #include #endif #include ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 340c376 - [lldb] Fix a CMake warning typo. NFC.
Author: Martin Storsjö Date: 2020-07-13T22:48:17+03:00 New Revision: 340c376b87c72e7eb3670301e4920106615b6689 URL: https://github.com/llvm/llvm-project/commit/340c376b87c72e7eb3670301e4920106615b6689 DIFF: https://github.com/llvm/llvm-project/commit/340c376b87c72e7eb3670301e4920106615b6689.diff LOG: [lldb] Fix a CMake warning typo. NFC. Added: Modified: lldb/tools/debugserver/source/CMakeLists.txt Removed: diff --git a/lldb/tools/debugserver/source/CMakeLists.txt b/lldb/tools/debugserver/source/CMakeLists.txt index 9a7e2eb9a1a0..b29b3ddc3056 100644 --- a/lldb/tools/debugserver/source/CMakeLists.txt +++ b/lldb/tools/debugserver/source/CMakeLists.txt @@ -41,7 +41,7 @@ function(get_debugserver_codesign_identity result) return() endif() - message(WARNING "Development code sign identiy not found: 'lldb_codesign' ${not_found_help}") + message(WARNING "Development code sign identity not found: 'lldb_codesign' ${not_found_help}") # LLVM pendant: fallback if available if(LLVM_CODESIGNING_IDENTITY) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] f07ddbc - [LLDB] [COFF] Fix handling of symbols with more than one aux symbol
Author: Martin Storsjö Date: 2020-07-20T22:42:28+03:00 New Revision: f07ddbc9c4b66e91aa7a106042512ee903b6b3ba URL: https://github.com/llvm/llvm-project/commit/f07ddbc9c4b66e91aa7a106042512ee903b6b3ba DIFF: https://github.com/llvm/llvm-project/commit/f07ddbc9c4b66e91aa7a106042512ee903b6b3ba.diff LOG: [LLDB] [COFF] Fix handling of symbols with more than one aux symbol Differential Revision: https://reviews.llvm.org/D84070 Added: Modified: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml Removed: diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 5feec8167186..9073672740e0 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -686,7 +686,7 @@ Symtab *ObjectFilePECOFF::GetSymtab() { if (symbol.naux > 0) { i += symbol.naux; - offset += symbol_size; + offset += symbol.naux * symbol_size; } } } diff --git a/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml b/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml index 1d79e702333b..9dbc93b9b918 100644 --- a/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml +++ b/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml @@ -1,6 +1,9 @@ # RUN: yaml2obj %s > %t # RUN: lldb-test symbols %t | FileCheck %s +## The .file symbol isn't checked, but is included to test that the symbol +## table iteration handles cases with a symbol with more than one aux symbol. + # CHECK: Type File Address/Value {{.*}} SizeFlags Name # CHECK: Code 0x400010000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry # CHECK: 0x400020000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable @@ -101,6 +104,13 @@ symbols: SimpleType: IMAGE_SYM_TYPE_NULL ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass:IMAGE_SYM_CLASS_STATIC + - Name:.file +Value: 0 +SectionNumber: -2 +SimpleType: IMAGE_SYM_TYPE_NULL +ComplexType: IMAGE_SYM_DTYPE_NULL +StorageClass:IMAGE_SYM_CLASS_FILE +File:longfilenameusingtwoauxsymbols - Name:entry Value: 0 SectionNumber: 1 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [Differential] D84070: [LLDB] [COFF] Fix handling of symbols with more than one aux symbol
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGf07ddbc9c4b6: [LLDB] [COFF] Fix handling of symbols with more than one aux symbol (authored by mstorsjo). Changed prior to commit: https://reviews.llvm.org/D84070?vs=278893&id=279027#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84070/new/ https://reviews.llvm.org/D84070 Files: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml Index: lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml === --- lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml +++ lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml @@ -1,6 +1,9 @@ # RUN: yaml2obj %s > %t # RUN: lldb-test symbols %t | FileCheck %s +## The .file symbol isn't checked, but is included to test that the symbol +## table iteration handles cases with a symbol with more than one aux symbol. + # CHECK: Type File Address/Value {{.*}} SizeFlags Name # CHECK: Code 0x400010000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry # CHECK: 0x400020000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable @@ -101,6 +104,13 @@ SimpleType: IMAGE_SYM_TYPE_NULL ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass:IMAGE_SYM_CLASS_STATIC + - Name:.file +Value: 0 +SectionNumber: -2 +SimpleType: IMAGE_SYM_TYPE_NULL +ComplexType: IMAGE_SYM_DTYPE_NULL +StorageClass:IMAGE_SYM_CLASS_FILE +File:longfilenameusingtwoauxsymbols - Name:entry Value: 0 SectionNumber: 1 Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp === --- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -686,7 +686,7 @@ if (symbol.naux > 0) { i += symbol.naux; - offset += symbol_size; + offset += symbol.naux * symbol_size; } } } Index: lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml === --- lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml +++ lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml @@ -1,6 +1,9 @@ # RUN: yaml2obj %s > %t # RUN: lldb-test symbols %t | FileCheck %s +## The .file symbol isn't checked, but is included to test that the symbol +## table iteration handles cases with a symbol with more than one aux symbol. + # CHECK: Type File Address/Value {{.*}} SizeFlags Name # CHECK: Code 0x400010000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry # CHECK: 0x400020000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable @@ -101,6 +104,13 @@ SimpleType: IMAGE_SYM_TYPE_NULL ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass:IMAGE_SYM_CLASS_STATIC + - Name:.file +Value: 0 +SectionNumber: -2 +SimpleType: IMAGE_SYM_TYPE_NULL +ComplexType: IMAGE_SYM_DTYPE_NULL +StorageClass:IMAGE_SYM_CLASS_FILE +File:longfilenameusingtwoauxsymbols - Name:entry Value: 0 SectionNumber: 1 Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp === --- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -686,7 +686,7 @@ if (symbol.naux > 0) { i += symbol.naux; - offset += symbol_size; + offset += symbol.naux * symbol_size; } } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] 9be5c13 - [lldb/Test] Add check-lldb-repro target
On Wed, 22 Jan 2020, Jonas Devlieghere via lldb-commits wrote: Author: Jonas Devlieghere Date: 2020-01-22T17:35:45-08:00 New Revision: 9be5c13538898c7632c2de7300de9479688a2460 URL: https://github.com/llvm/llvm-project/commit/9be5c13538898c7632c2de7300de9479688a2460 DIFF: https://github.com/llvm/llvm-project/commit/9be5c13538898c7632c2de7300de9479688a2460.diff LOG: [lldb/Test] Add check-lldb-repro target This adds a new target check-lldb-repro which runs the shell tests with the lldb-repo utility. It runs the shell tests twice, once while capturing a reproducer and then again by replaying that reproducer. Added: Modified: lldb/test/Shell/CMakeLists.txt Removed: diff --git a/lldb/test/Shell/CMakeLists.txt b/lldb/test/Shell/CMakeLists.txt index d203f1e093c7..a843f11f3a06 100644 --- a/lldb/test/Shell/CMakeLists.txt +++ b/lldb/test/Shell/CMakeLists.txt @@ -15,3 +15,17 @@ if (CMAKE_GENERATOR STREQUAL "Xcode") ${CMAKE_CURRENT_BINARY_DIR} DEPENDS lldb-test-deps) endif() + +# Add a lit test suite that runs the shell test while capturing a reproducer. +add_lit_testsuite(check-lldb-repro-capture + "Running lldb shell test suite with reproducer capture" + ${CMAKE_CURRENT_BINARY_DIR} + PARAMS "lldb-run-with-repro=capture" + DEPENDS lldb-test-deps) + +# Add a lit test suite that runs the shell test by replaying a reproducer. +add_lit_testsuite(check-lldb + "Running lldb shell test suite with reproducer replay" + ${CMAKE_CURRENT_BINARY_DIR} + PARAMS "lldb-run-with-repro=capture" + DEPENDS lldb-test-deps check-lldb-repro-capture) FYI (the commit mails from my commits don't seem to make it to the list), I made a small tweak to this in https://github.com/llvm/llvm-project/commit/1db1b8b8b35727a01387c1bc0bbf25701ad05d3f as the above construct with add_lit_testsuite(... DEPENDS check-*) will cause that check-* testsuite to be run when just building test dependncies with "ninja test-depends". // Martin ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] 9be5c13 - [lldb/Test] Add check-lldb-repro target
On Wed, 22 Jan 2020, Jonas Devlieghere via lldb-commits wrote: Author: Jonas Devlieghere Date: 2020-01-22T17:35:45-08:00 New Revision: 9be5c13538898c7632c2de7300de9479688a2460 URL: https://github.com/llvm/llvm-project/commit/9be5c13538898c7632c2de7300de9479688a2460 DIFF: https://github.com/llvm/llvm-project/commit/9be5c13538898c7632c2de7300de9479688a2460.diff LOG: [lldb/Test] Add check-lldb-repro target This adds a new target check-lldb-repro which runs the shell tests with the lldb-repo utility. It runs the shell tests twice, once while capturing a reproducer and then again by replaying that reproducer. FYI these new tests leave behind a _lot_ of intermediate files in /tmp. Could we have those files in the normal lit test output directory instead? // Martin ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [flang] [lldb] [llvm] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)
mstorsjo wrote: This breaks a number of tests on Windows. Previously, to have tests working on Windows, one would do `git config --global core.autocrlf false` or similar, before checking out llvm-project - a number of test input files _need_ to be in LF form to work. This was brought up earlier already by @llvm-beanz in https://github.com/llvm/llvm-project/pull/86318#issuecomment-2093160376. Now after this change, due to the added `.gitattributes` which overrides the `core.autocrlf` setting, these files get checked out with CRLF newlines (as the native form for the platform). Based on the comment in the .gitattributes file, it seems like this is both known and intentional behaviour: ``` # Checkout as native, commit as LF except in specific circumstances * text=auto ``` While it was already stated that blanket checkouts with CRLF _will_ fail. Additionally, the old mechanism of getting working newlines in the files is suddenly broken. --- To make things worse, you won't notice this thing if you're updating an existing workdir - files that aren't touched aren't rewritten. (To trigger re-checkout of files to get `.gitattributes` applied, one can do something like `git rm -r subdir && git reset && git checkout subdir`.) So I guess most buildbots will keep chugging along fine, until someone pushes changes that touch those files. If running with a fresh checkout of llvm-project, this has a much bigger impact. --- For compiler-rt tests, a handful of the profile tests depend on the right line endings - I can push a local `.gitattributes` file to fix that (see https://github.com/mstorsjo/llvm-project/commit/99bec81c87dcd2b7a7970954882bc0e42239d381). But the Clang, clang-tools-extra and LLVM testsuites have _many_ tests that are broken - from an initial (unverified) test run, there are around 80 tests failing due to this - sorting that out is a much bigger task that I'm not volunteering to take on right now. CC @AaronBallman as the majority of those failing tests are in Clang. Can we revert this until we figure out these bits? Do we really want checkouts to default to having the majority of files with CRLF on Windows? I would expect that most people working on Windows don't really want this (this wasn't the case so far anyway)? And other than that, we do need to tag the files that rely on being in LF form so that things work on Windows with either setting. https://github.com/llvm/llvm-project/pull/86318 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits