[Lldb-commits] [PATCH] D148752: lldb: Fix usage of sve functions on arm64
omjavaid added a comment. HI Manoj Which linux distro are you using for your cross build? I am wondering which version of gcc (aarch64-linux-gnu) are you using for your cross compilation build. I believe sve headers are not defined in older versions of gcc or its packaged sysroot causing cross compilation build to break. All sve:: functions and defines are just a make shift arrangement to accommodate build environment which dont have SVE headers/functions defined. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148752/new/ https://reviews.llvm.org/D148752 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D148776: [Modules] Move modulemaps to header search directories. NFC intended.
vsapsai updated this revision to Diff 515194. vsapsai added a comment. Don't touch HeaderSearch.cpp as the actual change in header search will be a separate patch. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148776/new/ https://reviews.llvm.org/D148776 Files: clang/include/clang-c/module.modulemap clang/include/clang/module.modulemap clang/include/module.modulemap lldb/include/lldb/module.modulemap lldb/include/module.modulemap llvm/CMakeLists.txt llvm/include/CMakeLists.txt llvm/include/llvm-c/module.modulemap llvm/include/llvm/CMakeLists.txt llvm/include/llvm/module.extern.modulemap llvm/include/llvm/module.install.modulemap llvm/include/llvm/module.modulemap llvm/include/llvm/module.modulemap.build llvm/include/module.extern.modulemap llvm/include/module.install.modulemap llvm/include/module.modulemap llvm/include/module.modulemap.build Index: llvm/include/module.modulemap.build === --- llvm/include/module.modulemap.build +++ llvm/include/module.modulemap.build @@ -1,13 +1,13 @@ // This is copied into the build area for a $src != $build compilation. module LLVM_Support_DataTypes { - header "Support/DataTypes.h" + header "llvm/Support/DataTypes.h" export * } module LLVM_Config_ABI_Breaking { - header "Config/abi-breaking.h" + header "llvm/Config/abi-breaking.h" export * } module LLVM_Config_Config { - header "Config/llvm-config.h" + header "llvm/Config/llvm-config.h" export * } Index: llvm/include/module.modulemap === --- /dev/null +++ llvm/include/module.modulemap @@ -0,0 +1,481 @@ +module LLVM_C { + umbrella "llvm-c" + module * { export * } +} + +module LLVM_Analysis { + requires cplusplus + umbrella "llvm/Analysis" + module * { export * } + + // This is intended for (repeated) textual inclusion. + textual header "llvm/Analysis/ScalarFuncs.def" + textual header "llvm/Analysis/TargetLibraryInfo.def" + textual header "llvm/Analysis/VecFuncs.def" +} + +module LLVM_AsmParser { + requires cplusplus + umbrella "llvm/AsmParser" + module * { export * } +} + +// A module covering CodeGen/ and Target/. These are intertwined +// and codependent, and thus notionally form a single module. +module LLVM_Backend { + requires cplusplus + + module CodeGen { +umbrella "llvm/CodeGen" +module * { export * } + +// Exclude these; they're intended to be included into only a single +// translation unit (or none) and aren't part of this module. +exclude header "llvm/CodeGen/LinkAllAsmWriterComponents.h" +exclude header "llvm/CodeGen/LinkAllCodegenComponents.h" + +exclude header "llvm/CodeGen/CodeGenPassBuilder.h" + +// These are intended for (repeated) textual inclusion. +textual header "llvm/CodeGen/DIEValue.def" +textual header "llvm/CodeGen/MachinePassRegistry.def" + } +} + +// FIXME: Make this as a submodule of LLVM_Backend again. +//Doing so causes a linker error in clang-format. +module LLVM_Backend_Target { + umbrella "llvm/Target" + module * { export * } +} + +module LLVM_Bitcode { + requires cplusplus + umbrella "llvm/Bitcode" + module * { export * } +} + +module LLVM_Bitstream { + requires cplusplus + umbrella "llvm/Bitstream" + module * { export * } +} + +module LLVM_BinaryFormat { +requires cplusplus +umbrella "llvm/BinaryFormat" module * { export * } +textual header "llvm/BinaryFormat/Dwarf.def" +textual header "llvm/BinaryFormat/DXContainerConstants.def" +textual header "llvm/BinaryFormat/DynamicTags.def" +textual header "llvm/BinaryFormat/MachO.def" +textual header "llvm/BinaryFormat/MinidumpConstants.def" +textual header "llvm/BinaryFormat/Swift.def" +textual header "llvm/BinaryFormat/ELFRelocs/AArch64.def" +textual header "llvm/BinaryFormat/ELFRelocs/AMDGPU.def" +textual header "llvm/BinaryFormat/ELFRelocs/ARM.def" +textual header "llvm/BinaryFormat/ELFRelocs/ARC.def" +textual header "llvm/BinaryFormat/ELFRelocs/AVR.def" +textual header "llvm/BinaryFormat/ELFRelocs/BPF.def" +textual header "llvm/BinaryFormat/ELFRelocs/CSKY.def" +textual header "llvm/BinaryFormat/ELFRelocs/Hexagon.def" +textual header "llvm/BinaryFormat/ELFRelocs/i386.def" +textual header "llvm/BinaryFormat/ELFRelocs/Lanai.def" +textual header "llvm/BinaryFormat/ELFRelocs/LoongArch.def" +textual header "llvm/BinaryFormat/ELFRelocs/M68k.def" +textual header "llvm/BinaryFormat/ELFRelocs/Mips.def" +textual header "llvm/BinaryFormat/ELFRelocs/MSP430.def" +textual header "llvm/BinaryFormat/ELFRelocs/PowerPC64.def" +textual header "llvm/BinaryFormat/ELFRelocs/PowerPC.def" +textual header "llvm/BinaryFormat/ELFRelocs/RISCV.def" +textual header "llvm/BinaryFormat/ELFRelocs/Sparc.def" +textual header "llvm/BinaryFormat/ELFRelocs/SystemZ.def" +te
[Lldb-commits] [PATCH] D148776: [Modules] Move modulemaps to header search directories. NFC intended.
vsapsai added inline comments. Comment at: clang/lib/Lex/HeaderSearch.cpp:358-373 +#if ALLOW_SUBDIRECTORY_MODULE_MAP_SEARCH // If we've already performed the exhaustive search for module maps in this // search directory, don't do it again. if (Dir.haveSearchedAllModuleMaps()) continue; // Load all module maps in the immediate subdirectories of this search Disabling the code with the macro is not intended. Want to show which code is responsible for module map search in subdirectories and which code to disable in case you want to test locally. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148776/new/ https://reviews.llvm.org/D148776 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D148776: [Modules] Move modulemaps to header search directories. NFC intended.
vsapsai created this revision. vsapsai added reviewers: EricWF, aprantl, chapuni. Herald added subscribers: ributzka, s.egerton, simoncook, asb, fedor.sergeev, dschuff. Herald added a reviewer: deadalnix. Herald added a project: All. vsapsai requested review of this revision. Herald added subscribers: llvm-commits, lldb-commits, cfe-commits, jplehr, pcwang-thead, sstefan1, aheejin. Herald added a reviewer: jdoerfert. Herald added projects: clang, LLDB, LLVM. In code we use `#include "llvm/Lib/Header.h"` which is located in "llvm/include/llvm/Lib/Header.h", so we use "llvm/include/" as a header search path. We should put modulemaps in the same directory and shouldn't rely on clang to search in immediate subdirectories. rdar://106677321 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D148776 Files: clang/include/clang-c/module.modulemap clang/include/clang/module.modulemap clang/include/module.modulemap clang/lib/Lex/HeaderSearch.cpp lldb/include/lldb/module.modulemap lldb/include/module.modulemap llvm/CMakeLists.txt llvm/include/CMakeLists.txt llvm/include/llvm-c/module.modulemap llvm/include/llvm/CMakeLists.txt llvm/include/llvm/module.extern.modulemap llvm/include/llvm/module.install.modulemap llvm/include/llvm/module.modulemap llvm/include/llvm/module.modulemap.build llvm/include/module.extern.modulemap llvm/include/module.install.modulemap llvm/include/module.modulemap llvm/include/module.modulemap.build Index: llvm/include/module.modulemap.build === --- llvm/include/module.modulemap.build +++ llvm/include/module.modulemap.build @@ -1,13 +1,13 @@ // This is copied into the build area for a $src != $build compilation. module LLVM_Support_DataTypes { - header "Support/DataTypes.h" + header "llvm/Support/DataTypes.h" export * } module LLVM_Config_ABI_Breaking { - header "Config/abi-breaking.h" + header "llvm/Config/abi-breaking.h" export * } module LLVM_Config_Config { - header "Config/llvm-config.h" + header "llvm/Config/llvm-config.h" export * } Index: llvm/include/module.modulemap === --- /dev/null +++ llvm/include/module.modulemap @@ -0,0 +1,481 @@ +module LLVM_C { + umbrella "llvm-c" + module * { export * } +} + +module LLVM_Analysis { + requires cplusplus + umbrella "llvm/Analysis" + module * { export * } + + // This is intended for (repeated) textual inclusion. + textual header "llvm/Analysis/ScalarFuncs.def" + textual header "llvm/Analysis/TargetLibraryInfo.def" + textual header "llvm/Analysis/VecFuncs.def" +} + +module LLVM_AsmParser { + requires cplusplus + umbrella "llvm/AsmParser" + module * { export * } +} + +// A module covering CodeGen/ and Target/. These are intertwined +// and codependent, and thus notionally form a single module. +module LLVM_Backend { + requires cplusplus + + module CodeGen { +umbrella "llvm/CodeGen" +module * { export * } + +// Exclude these; they're intended to be included into only a single +// translation unit (or none) and aren't part of this module. +exclude header "llvm/CodeGen/LinkAllAsmWriterComponents.h" +exclude header "llvm/CodeGen/LinkAllCodegenComponents.h" + +exclude header "llvm/CodeGen/CodeGenPassBuilder.h" + +// These are intended for (repeated) textual inclusion. +textual header "llvm/CodeGen/DIEValue.def" +textual header "llvm/CodeGen/MachinePassRegistry.def" + } +} + +// FIXME: Make this as a submodule of LLVM_Backend again. +//Doing so causes a linker error in clang-format. +module LLVM_Backend_Target { + umbrella "llvm/Target" + module * { export * } +} + +module LLVM_Bitcode { + requires cplusplus + umbrella "llvm/Bitcode" + module * { export * } +} + +module LLVM_Bitstream { + requires cplusplus + umbrella "llvm/Bitstream" + module * { export * } +} + +module LLVM_BinaryFormat { +requires cplusplus +umbrella "llvm/BinaryFormat" module * { export * } +textual header "llvm/BinaryFormat/Dwarf.def" +textual header "llvm/BinaryFormat/DXContainerConstants.def" +textual header "llvm/BinaryFormat/DynamicTags.def" +textual header "llvm/BinaryFormat/MachO.def" +textual header "llvm/BinaryFormat/MinidumpConstants.def" +textual header "llvm/BinaryFormat/Swift.def" +textual header "llvm/BinaryFormat/ELFRelocs/AArch64.def" +textual header "llvm/BinaryFormat/ELFRelocs/AMDGPU.def" +textual header "llvm/BinaryFormat/ELFRelocs/ARM.def" +textual header "llvm/BinaryFormat/ELFRelocs/ARC.def" +textual header "llvm/BinaryFormat/ELFRelocs/AVR.def" +textual header "llvm/BinaryFormat/ELFRelocs/BPF.def" +textual header "llvm/BinaryFormat/ELFRelocs/CSKY.def" +textual header "llvm/BinaryFormat/ELFRelocs/Hexagon.def" +textual header "llvm/BinaryFormat/ELFRelocs/i386.def" +textual header "llvm/BinaryFormat/ELFRelocs/Lanai.def" +text
[Lldb-commits] [PATCH] D148400: [lldb] Fix bug to update process public run lock with process state
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGa4f160dfc1aa: [lldb] Fix bug to update process public run lock with process state (authored by mib). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148400/new/ https://reviews.llvm.org/D148400 Files: lldb/include/lldb/Target/Process.h lldb/source/Target/Process.cpp lldb/source/Target/Target.cpp Index: lldb/source/Target/Target.cpp === --- lldb/source/Target/Target.cpp +++ lldb/source/Target/Target.cpp @@ -3157,8 +3157,8 @@ // its own hijacking listener or if the process is created by the target // manually, without the platform). if (!launch_info.GetHijackListener()) -launch_info.SetHijackListener( -Listener::MakeListener("lldb.Target.Launch.hijack")); +launch_info.SetHijackListener(Listener::MakeListener( +Process::LaunchSynchronousHijackListenerName.data())); // If we're not already connected to the process, and if we have a platform // that can launch a process for debugging, go ahead and do that here. @@ -3334,8 +3334,8 @@ ListenerSP hijack_listener_sp; const bool async = attach_info.GetAsync(); if (!async) { -hijack_listener_sp = -Listener::MakeListener("lldb.Target.Attach.attach.hijack"); +hijack_listener_sp = Listener::MakeListener( +Process::AttachSynchronousHijackListenerName.data()); attach_info.SetHijackListener(hijack_listener_sp); } Index: lldb/source/Target/Process.cpp === --- lldb/source/Target/Process.cpp +++ lldb/source/Target/Process.cpp @@ -1355,8 +1355,6 @@ return error; } -static const char *g_resume_sync_name = "lldb.Process.ResumeSynchronous.hijack"; - Status Process::ResumeSynchronous(Stream *stream) { Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); LLDB_LOGF(log, "Process::ResumeSynchronous -- locking run lock"); @@ -1367,7 +1365,7 @@ } ListenerSP listener_sp( - Listener::MakeListener(g_resume_sync_name)); + Listener::MakeListener(ResumeSynchronousHijackListenerName.data())); HijackProcessEvents(listener_sp); Status error = PrivateResume(); @@ -1393,9 +1391,8 @@ bool Process::StateChangedIsExternallyHijacked() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -const char *hijacking_name = GetHijackingListenerName(); -if (hijacking_name && -strcmp(hijacking_name, g_resume_sync_name)) +llvm::StringRef hijacking_name = GetHijackingListenerName(); +if (!hijacking_name.starts_with("lldb.internal")) return true; } return false; @@ -1403,9 +1400,8 @@ bool Process::StateChangedIsHijackedForSynchronousResume() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -const char *hijacking_name = GetHijackingListenerName(); -if (hijacking_name && -strcmp(hijacking_name, g_resume_sync_name) == 0) +llvm::StringRef hijacking_name = GetHijackingListenerName(); +if (hijacking_name == ResumeSynchronousHijackListenerName) return true; } return false; Index: lldb/include/lldb/Target/Process.h === --- lldb/include/lldb/Target/Process.h +++ lldb/include/lldb/Target/Process.h @@ -386,6 +386,13 @@ static ConstString &GetStaticBroadcasterClass(); + static constexpr llvm::StringRef AttachSynchronousHijackListenerName = + "lldb.internal.Process.AttachSynchronous.hijack"; + static constexpr llvm::StringRef LaunchSynchronousHijackListenerName = + "lldb.internal.Process.LaunchSynchronous.hijack"; + static constexpr llvm::StringRef ResumeSynchronousHijackListenerName = + "lldb.internal.Process.ResumeSynchronous.hijack"; + ConstString &GetBroadcasterClass() const override { return GetStaticBroadcasterClass(); } Index: lldb/source/Target/Target.cpp === --- lldb/source/Target/Target.cpp +++ lldb/source/Target/Target.cpp @@ -3157,8 +3157,8 @@ // its own hijacking listener or if the process is created by the target // manually, without the platform). if (!launch_info.GetHijackListener()) -launch_info.SetHijackListener( -Listener::MakeListener("lldb.Target.Launch.hijack")); +launch_info.SetHijackListener(Listener::MakeListener( +Process::LaunchSynchronousHijackListenerName.data())); // If we're not already connected to the process, and if we have a platform // that can launch a process for debugging, go ahead and do that here. @@ -3334,8 +3334,8 @@ ListenerSP hijack_listener_sp; const bool async = attach_info.GetAsync(); if (!async) { -hijack_listener_sp = -Listener::MakeListener("lldb.Target.Attach.attach.hijack"); +hijack_listener_sp = Listener
[Lldb-commits] [lldb] a4f160d - [lldb] Fix bug to update process public run lock with process state
Author: Med Ismail Bennani Date: 2023-04-19T16:54:57-07:00 New Revision: a4f160dfc1aa508a88a83a9cb1420d762f863408 URL: https://github.com/llvm/llvm-project/commit/a4f160dfc1aa508a88a83a9cb1420d762f863408 DIFF: https://github.com/llvm/llvm-project/commit/a4f160dfc1aa508a88a83a9cb1420d762f863408.diff LOG: [lldb] Fix bug to update process public run lock with process state This patch should address an issue that caused the process public run lock to not be updated during a process launch/attach when the process stops. That caused the public run lock to report its state as running while the process state is stopped. This prevents the users to interact with the process (through the command line or via the SBAPI) since it's considered still running. To address that, this patch refactors the name of the internal hijack listeners to a specific pattern `lldb.internal..hijack` that are used to ensure that we've attached to or launched a process successfully. Then, when updating the process public state, after updating the state value, if the process is not hijacked externally, meaning if the process doens't have a hijack listener that matches the internal hijack listeners pattern, we can update the public run lock accordingly. rdar://108283017 Differential Revision: https://reviews.llvm.org/D148400 Signed-off-by: Med Ismail Bennani Added: Modified: lldb/include/lldb/Target/Process.h lldb/source/Target/Process.cpp lldb/source/Target/Target.cpp Removed: diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 255ba8cd4a92..0c90078accfc 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -386,6 +386,13 @@ class Process : public std::enable_shared_from_this, static ConstString &GetStaticBroadcasterClass(); + static constexpr llvm::StringRef AttachSynchronousHijackListenerName = + "lldb.internal.Process.AttachSynchronous.hijack"; + static constexpr llvm::StringRef LaunchSynchronousHijackListenerName = + "lldb.internal.Process.LaunchSynchronous.hijack"; + static constexpr llvm::StringRef ResumeSynchronousHijackListenerName = + "lldb.internal.Process.ResumeSynchronous.hijack"; + ConstString &GetBroadcasterClass() const override { return GetStaticBroadcasterClass(); } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index ad076476f5ba..53b7f9816620 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -1355,8 +1355,6 @@ Status Process::Resume() { return error; } -static const char *g_resume_sync_name = "lldb.Process.ResumeSynchronous.hijack"; - Status Process::ResumeSynchronous(Stream *stream) { Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); LLDB_LOGF(log, "Process::ResumeSynchronous -- locking run lock"); @@ -1367,7 +1365,7 @@ Status Process::ResumeSynchronous(Stream *stream) { } ListenerSP listener_sp( - Listener::MakeListener(g_resume_sync_name)); + Listener::MakeListener(ResumeSynchronousHijackListenerName.data())); HijackProcessEvents(listener_sp); Status error = PrivateResume(); @@ -1393,9 +1391,8 @@ Status Process::ResumeSynchronous(Stream *stream) { bool Process::StateChangedIsExternallyHijacked() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -const char *hijacking_name = GetHijackingListenerName(); -if (hijacking_name && -strcmp(hijacking_name, g_resume_sync_name)) +llvm::StringRef hijacking_name = GetHijackingListenerName(); +if (!hijacking_name.starts_with("lldb.internal")) return true; } return false; @@ -1403,9 +1400,8 @@ bool Process::StateChangedIsExternallyHijacked() { bool Process::StateChangedIsHijackedForSynchronousResume() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -const char *hijacking_name = GetHijackingListenerName(); -if (hijacking_name && -strcmp(hijacking_name, g_resume_sync_name) == 0) +llvm::StringRef hijacking_name = GetHijackingListenerName(); +if (hijacking_name == ResumeSynchronousHijackListenerName) return true; } return false; diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 473b23e90e57..c2f82094cc4b 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3157,8 +3157,8 @@ Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { // its own hijacking listener or if the process is created by the target // manually, without the platform). if (!launch_info.GetHijackListener()) -launch_info.SetHijackListener( -Listener::MakeListener("lldb.Target.Launch.hijack")); +launch_info.SetHijackListener(Listener::MakeListener( +Process::LaunchSynchronousHijackListenerName.data())); // If we're not already connected to the process, and if we have a p
[Lldb-commits] [PATCH] D148400: [lldb] Fix bug to update process public run lock with process state
mib updated this revision to Diff 515137. mib edited the summary of this revision. mib added a comment. Fix condition typo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148400/new/ https://reviews.llvm.org/D148400 Files: lldb/include/lldb/Target/Process.h lldb/source/Target/Process.cpp lldb/source/Target/Target.cpp Index: lldb/source/Target/Target.cpp === --- lldb/source/Target/Target.cpp +++ lldb/source/Target/Target.cpp @@ -3157,8 +3157,8 @@ // its own hijacking listener or if the process is created by the target // manually, without the platform). if (!launch_info.GetHijackListener()) -launch_info.SetHijackListener( -Listener::MakeListener("lldb.Target.Launch.hijack")); +launch_info.SetHijackListener(Listener::MakeListener( +Process::LaunchSynchronousHijackListenerName.data())); // If we're not already connected to the process, and if we have a platform // that can launch a process for debugging, go ahead and do that here. @@ -3334,8 +3334,8 @@ ListenerSP hijack_listener_sp; const bool async = attach_info.GetAsync(); if (!async) { -hijack_listener_sp = -Listener::MakeListener("lldb.Target.Attach.attach.hijack"); +hijack_listener_sp = Listener::MakeListener( +Process::AttachSynchronousHijackListenerName.data()); attach_info.SetHijackListener(hijack_listener_sp); } Index: lldb/source/Target/Process.cpp === --- lldb/source/Target/Process.cpp +++ lldb/source/Target/Process.cpp @@ -1355,8 +1355,6 @@ return error; } -static const char *g_resume_sync_name = "lldb.Process.ResumeSynchronous.hijack"; - Status Process::ResumeSynchronous(Stream *stream) { Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); LLDB_LOGF(log, "Process::ResumeSynchronous -- locking run lock"); @@ -1367,7 +1365,7 @@ } ListenerSP listener_sp( - Listener::MakeListener(g_resume_sync_name)); + Listener::MakeListener(ResumeSynchronousHijackListenerName.data())); HijackProcessEvents(listener_sp); Status error = PrivateResume(); @@ -1393,9 +1391,8 @@ bool Process::StateChangedIsExternallyHijacked() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -const char *hijacking_name = GetHijackingListenerName(); -if (hijacking_name && -strcmp(hijacking_name, g_resume_sync_name)) +llvm::StringRef hijacking_name = GetHijackingListenerName(); +if (!hijacking_name.starts_with("lldb.internal")) return true; } return false; @@ -1403,9 +1400,8 @@ bool Process::StateChangedIsHijackedForSynchronousResume() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -const char *hijacking_name = GetHijackingListenerName(); -if (hijacking_name && -strcmp(hijacking_name, g_resume_sync_name) == 0) +llvm::StringRef hijacking_name = GetHijackingListenerName(); +if (hijacking_name == ResumeSynchronousHijackListenerName) return true; } return false; Index: lldb/include/lldb/Target/Process.h === --- lldb/include/lldb/Target/Process.h +++ lldb/include/lldb/Target/Process.h @@ -386,6 +386,13 @@ static ConstString &GetStaticBroadcasterClass(); + static constexpr llvm::StringRef AttachSynchronousHijackListenerName = + "lldb.internal.Process.AttachSynchronous.hijack"; + static constexpr llvm::StringRef LaunchSynchronousHijackListenerName = + "lldb.internal.Process.LaunchSynchronous.hijack"; + static constexpr llvm::StringRef ResumeSynchronousHijackListenerName = + "lldb.internal.Process.ResumeSynchronous.hijack"; + ConstString &GetBroadcasterClass() const override { return GetStaticBroadcasterClass(); } Index: lldb/source/Target/Target.cpp === --- lldb/source/Target/Target.cpp +++ lldb/source/Target/Target.cpp @@ -3157,8 +3157,8 @@ // its own hijacking listener or if the process is created by the target // manually, without the platform). if (!launch_info.GetHijackListener()) -launch_info.SetHijackListener( -Listener::MakeListener("lldb.Target.Launch.hijack")); +launch_info.SetHijackListener(Listener::MakeListener( +Process::LaunchSynchronousHijackListenerName.data())); // If we're not already connected to the process, and if we have a platform // that can launch a process for debugging, go ahead and do that here. @@ -3334,8 +3334,8 @@ ListenerSP hijack_listener_sp; const bool async = attach_info.GetAsync(); if (!async) { -hijack_listener_sp = -Listener::MakeListener("lldb.Target.Attach.attach.hijack"); +hijack_listener_sp = Listener::MakeListener( +Process::AttachSynchronousHijackListenerName.data()); attach_info.SetHijackListener(hijack_listener_sp); } Index: lldb/source/Targ
[Lldb-commits] [PATCH] D148400: [lldb] Fix bug to update process public run lock with process state
mib added inline comments. Comment at: lldb/source/Target/Process.cpp:1395 +llvm::StringRef hijacking_name = GetHijackingListenerName(); +if (hijacking_name.starts_with("lldb.internal")) return true; I think I forgot to negate this: if `hijacking_name` DOES NOT start with `"lldb.internal"`, then it mean that the process state change is externally hijacked. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148400/new/ https://reviews.llvm.org/D148400 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D148752: lldb: Fix usage of sve functions on arm64
manojgupta created this revision. Herald added subscribers: ctetreau, omjavaid, kristof.beyls, tschuett. Herald added a project: All. manojgupta requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. Use correct internal sve functions for arm64. Otherwise, when cross-compling lld for AArch64 there are build errors like: NativeRegisterContextLinux_arm64.cpp:936:11: error: use of undeclared identifier 'sve_vl_valid NativeRegisterContextLinux_arm64.cpp:63:28: error: variable has incomplete type 'struct user_sve_header' Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D148752 Files: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp === --- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp +++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp @@ -61,7 +61,7 @@ case llvm::Triple::aarch64: { // Configure register sets supported by this AArch64 target. // Read SVE header to check for SVE support. -struct user_sve_header sve_header; +struct sve::user_sve_header sve_header; struct iovec ioVec; ioVec.iov_base = &sve_header; ioVec.iov_len = sizeof(sve_header); @@ -380,7 +380,7 @@ if (GetRegisterInfo().IsSVERegVG(reg)) { uint64_t vg_value = reg_value.GetAsUInt64(); -if (sve_vl_valid(vg_value * 8)) { +if (sve::vl_valid(vg_value * 8)) { if (m_sve_header_is_valid && vg_value == GetSVERegVG()) return error; @@ -566,7 +566,7 @@ if (contains_sve_reg_data) { // We have SVE register data first write SVE header. ::memcpy(GetSVEHeader(), src, GetSVEHeaderSize()); -if (!sve_vl_valid(m_sve_header.vl)) { +if (!sve::vl_valid(m_sve_header.vl)) { m_sve_header_is_valid = false; error.SetErrorStringWithFormat("NativeRegisterContextLinux_arm64::%s " "Invalid SVE header in data_sp", @@ -934,7 +934,7 @@ // On every stop we configure SVE vector length by calling // ConfigureVectorLength regardless of current SVEState of this thread. uint32_t vq = RegisterInfoPOSIX_arm64::eVectorQuadwordAArch64SVE; - if (sve_vl_valid(m_sve_header.vl)) + if (sve::vl_valid(m_sve_header.vl)) vq = sve::vq_from_vl(m_sve_header.vl); GetRegisterInfo().ConfigureVectorLength(vq); Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp === --- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp +++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp @@ -61,7 +61,7 @@ case llvm::Triple::aarch64: { // Configure register sets supported by this AArch64 target. // Read SVE header to check for SVE support. -struct user_sve_header sve_header; +struct sve::user_sve_header sve_header; struct iovec ioVec; ioVec.iov_base = &sve_header; ioVec.iov_len = sizeof(sve_header); @@ -380,7 +380,7 @@ if (GetRegisterInfo().IsSVERegVG(reg)) { uint64_t vg_value = reg_value.GetAsUInt64(); -if (sve_vl_valid(vg_value * 8)) { +if (sve::vl_valid(vg_value * 8)) { if (m_sve_header_is_valid && vg_value == GetSVERegVG()) return error; @@ -566,7 +566,7 @@ if (contains_sve_reg_data) { // We have SVE register data first write SVE header. ::memcpy(GetSVEHeader(), src, GetSVEHeaderSize()); -if (!sve_vl_valid(m_sve_header.vl)) { +if (!sve::vl_valid(m_sve_header.vl)) { m_sve_header_is_valid = false; error.SetErrorStringWithFormat("NativeRegisterContextLinux_arm64::%s " "Invalid SVE header in data_sp", @@ -934,7 +934,7 @@ // On every stop we configure SVE vector length by calling // ConfigureVectorLength regardless of current SVEState of this thread. uint32_t vq = RegisterInfoPOSIX_arm64::eVectorQuadwordAArch64SVE; - if (sve_vl_valid(m_sve_header.vl)) + if (sve::vl_valid(m_sve_header.vl)) vq = sve::vq_from_vl(m_sve_header.vl); GetRegisterInfo().ConfigureVectorLength(vq); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D148715: [LLDB] Discard register flags where the size doesn't match the register
jasonmolenda accepted this revision. jasonmolenda added a comment. This revision is now accepted and ready to land. LGTM. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148715/new/ https://reviews.llvm.org/D148715 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D148679: [lldb] Change setting descriptions to use StringRef instead of ConstString
This revision was automatically updated to reflect the committed changes. Closed by commit rG96a800c07f02: [lldb] Change setting descriptions to use StringRef instead of ConstString (authored by bulbazord). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148679/new/ https://reviews.llvm.org/D148679 Files: lldb/include/lldb/Core/PluginManager.h lldb/include/lldb/Interpreter/OptionValueProperties.h lldb/source/Core/Debugger.cpp lldb/source/Core/PluginManager.cpp lldb/source/Interpreter/OptionValueProperties.cpp lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp lldb/source/Target/Process.cpp lldb/source/Target/Target.cpp lldb/unittests/Interpreter/TestOptionValue.cpp Index: lldb/unittests/Interpreter/TestOptionValue.cpp === --- lldb/unittests/Interpreter/TestOptionValue.cpp +++ lldb/unittests/Interpreter/TestOptionValue.cpp @@ -84,11 +84,10 @@ const bool is_global = false; auto dict_sp = std::make_shared(1 << eTypeUInt64); -props_sp->AppendProperty(ConstString("dict"), ConstString(), is_global, - dict_sp); +props_sp->AppendProperty(ConstString("dict"), "", is_global, dict_sp); auto file_list_sp = std::make_shared(); -props_sp->AppendProperty(ConstString("file-list"), ConstString(), is_global, +props_sp->AppendProperty(ConstString("file-list"), "", is_global, file_list_sp); return props_sp; } Index: lldb/source/Target/Target.cpp === --- lldb/source/Target/Target.cpp +++ lldb/source/Target/Target.cpp @@ -4088,8 +4088,8 @@ std::make_unique(); m_collection_sp->AppendProperty( ConstString(Properties::GetExperimentalSettingsName()), -ConstString("Experimental settings - setting these won't produce " -"errors if the setting is not present."), +"Experimental settings - setting these won't produce " +"errors if the setting is not present.", true, m_experimental_properties_up->GetValueProperties()); } else { m_collection_sp = @@ -4099,12 +4099,12 @@ std::make_unique(); m_collection_sp->AppendProperty( ConstString(Properties::GetExperimentalSettingsName()), -ConstString("Experimental settings - setting these won't produce " -"errors if the setting is not present."), +"Experimental settings - setting these won't produce " +"errors if the setting is not present.", true, m_experimental_properties_up->GetValueProperties()); m_collection_sp->AppendProperty( -ConstString("process"), ConstString("Settings specific to processes."), -true, Process::GetGlobalProperties().GetValueProperties()); +ConstString("process"), "Settings specific to processes.", true, +Process::GetGlobalProperties().GetValueProperties()); m_collection_sp->SetValueChangedCallback( ePropertySaveObjectsDir, [this] { CheckJITObjectsDir(); }); } Index: lldb/source/Target/Process.cpp === --- lldb/source/Target/Process.cpp +++ lldb/source/Target/Process.cpp @@ -167,8 +167,8 @@ std::make_shared(ConstString("process")); m_collection_sp->Initialize(g_process_properties); m_collection_sp->AppendProperty( -ConstString("thread"), ConstString("Settings specific to threads."), -true, Thread::GetGlobalProperties().GetValueProperties()); +ConstString("thread"), "Settings specific to threads.", true, +Thread::GetGlobalProperties().GetValueProperties()); } else { m_collection_sp = OptionValueProperties::CreateLocalCopy(Process::GetGlobalProperties()); @@ -181,8 +181,8 @@ std::make_unique(); m_collection_sp->AppendProperty( ConstString(Properties::GetExperimentalSettingsName()), - ConstString("Experimental settings - setting these won't produce " - "errors if the setting is not present."), + "Experimental settings - setting these won't produce " + "errors if the setting is not present.", true, m_experimental_properties_up->GetValueProperties()); } Index: lldb/source/P
[Lldb-commits] [lldb] 96a800c - [lldb] Change setting descriptions to use StringRef instead of ConstString
Author: Alex Langford Date: 2023-04-19T14:45:02-07:00 New Revision: 96a800c07f0220f840560e78bbd77104121d24cf URL: https://github.com/llvm/llvm-project/commit/96a800c07f0220f840560e78bbd77104121d24cf DIFF: https://github.com/llvm/llvm-project/commit/96a800c07f0220f840560e78bbd77104121d24cf.diff LOG: [lldb] Change setting descriptions to use StringRef instead of ConstString These probably do not need to be in the ConstString StringPool as they don't really need any of the advantages that ConstStrings offer. Lifetime for these things is always static and we never need to perform comparisons for setting descriptions. Differential Revision: https://reviews.llvm.org/D148679 Added: Modified: lldb/include/lldb/Core/PluginManager.h lldb/include/lldb/Interpreter/OptionValueProperties.h lldb/source/Core/Debugger.cpp lldb/source/Core/PluginManager.cpp lldb/source/Interpreter/OptionValueProperties.cpp lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp lldb/source/Target/Process.cpp lldb/source/Target/Target.cpp lldb/unittests/Interpreter/TestOptionValue.cpp Removed: diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h index 82cee28a01212..214b7d2f21cce 100644 --- a/lldb/include/lldb/Core/PluginManager.h +++ b/lldb/include/lldb/Core/PluginManager.h @@ -481,46 +481,46 @@ class PluginManager { static bool CreateSettingForDynamicLoaderPlugin( Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, - ConstString description, bool is_global_property); + llvm::StringRef description, bool is_global_property); static lldb::OptionValuePropertiesSP GetSettingForPlatformPlugin(Debugger &debugger, ConstString setting_name); static bool CreateSettingForPlatformPlugin( Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, - ConstString description, bool is_global_property); + llvm::StringRef description, bool is_global_property); static lldb::OptionValuePropertiesSP GetSettingForProcessPlugin(Debugger &debugger, ConstString setting_name); static bool CreateSettingForProcessPlugin( Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, - ConstString description, bool is_global_property); + llvm::StringRef description, bool is_global_property); static bool CreateSettingForTracePlugin( Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, - ConstString description, bool is_global_property); + llvm::StringRef 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); + llvm::StringRef description, bool is_global_property); static lldb::OptionValuePropertiesSP GetSettingForSymbolFilePlugin(Debugger &debugger, ConstString setting_name); static bool CreateSettingForSymbolFilePlugin( Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, - ConstString description, bool is_global_property); + llvm::StringRef description, bool is_global_property); static lldb::OptionValuePropertiesSP GetSettingForJITLoaderPlugin(Debugger &debugger, ConstString setting_name); static bool CreateSettingForJITLoaderPlugin( Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, - ConstString description, bool is_global_property); + llvm::StringRef description, bool is_global_property); static lldb::OptionValuePropertiesSP GetSettingForOperatingSystemPlugin(Debugger &debugger, @@ -528,7 +528,7 @@ class PluginManager { static bool CreateSettingForOperatingSystemPlugin( Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, - ConstString description, bool is_global_property); + llvm::StringRef description, bool is_global_property); static lldb::OptionValuePropertiesSP GetSettingForStructuredDataPlugin(Debugger &debugger, @@ -536,7 +536,7 @@ cl
[Lldb-commits] [PATCH] D148676: [lldb][NFCI] Stop creating additional temporary string in Log::VAPrintf
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG77e3914be7c9: [lldb][NFCI] Stop creating additional temporary string in Log::VAPrintf (authored by bulbazord). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148676/new/ https://reviews.llvm.org/D148676 Files: lldb/include/lldb/Utility/Log.h lldb/source/Utility/Log.cpp Index: lldb/source/Utility/Log.cpp === --- lldb/source/Utility/Log.cpp +++ lldb/source/Utility/Log.cpp @@ -146,8 +146,8 @@ // callback registered, then we call the logging callback. If we have a valid // file handle, we also log to the file. void Log::VAPrintf(const char *format, va_list args) { - llvm::SmallString<64> FinalMessage; - llvm::raw_svector_ostream Stream(FinalMessage); + std::string FinalMessage; + llvm::raw_string_ostream Stream(FinalMessage); WriteHeader(Stream, "", ""); llvm::SmallString<64> Content; @@ -155,7 +155,7 @@ Stream << Content << "\n"; - WriteMessage(std::string(FinalMessage.str())); + WriteMessage(FinalMessage); } // Printing of errors that are not fatal. @@ -344,7 +344,7 @@ } } -void Log::WriteMessage(const std::string &message) { +void Log::WriteMessage(llvm::StringRef message) { // Make a copy of our stream shared pointer in case someone disables our log // while we are logging and releases the stream auto handler_sp = GetHandler(); Index: lldb/include/lldb/Utility/Log.h === --- lldb/include/lldb/Utility/Log.h +++ lldb/include/lldb/Utility/Log.h @@ -265,7 +265,7 @@ void WriteHeader(llvm::raw_ostream &OS, llvm::StringRef file, llvm::StringRef function); - void WriteMessage(const std::string &message); + void WriteMessage(llvm::StringRef message); void Format(llvm::StringRef file, llvm::StringRef function, const llvm::formatv_object_base &payload); Index: lldb/source/Utility/Log.cpp === --- lldb/source/Utility/Log.cpp +++ lldb/source/Utility/Log.cpp @@ -146,8 +146,8 @@ // callback registered, then we call the logging callback. If we have a valid // file handle, we also log to the file. void Log::VAPrintf(const char *format, va_list args) { - llvm::SmallString<64> FinalMessage; - llvm::raw_svector_ostream Stream(FinalMessage); + std::string FinalMessage; + llvm::raw_string_ostream Stream(FinalMessage); WriteHeader(Stream, "", ""); llvm::SmallString<64> Content; @@ -155,7 +155,7 @@ Stream << Content << "\n"; - WriteMessage(std::string(FinalMessage.str())); + WriteMessage(FinalMessage); } // Printing of errors that are not fatal. @@ -344,7 +344,7 @@ } } -void Log::WriteMessage(const std::string &message) { +void Log::WriteMessage(llvm::StringRef message) { // Make a copy of our stream shared pointer in case someone disables our log // while we are logging and releases the stream auto handler_sp = GetHandler(); Index: lldb/include/lldb/Utility/Log.h === --- lldb/include/lldb/Utility/Log.h +++ lldb/include/lldb/Utility/Log.h @@ -265,7 +265,7 @@ void WriteHeader(llvm::raw_ostream &OS, llvm::StringRef file, llvm::StringRef function); - void WriteMessage(const std::string &message); + void WriteMessage(llvm::StringRef message); void Format(llvm::StringRef file, llvm::StringRef function, const llvm::formatv_object_base &payload); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 77e3914 - [lldb][NFCI] Stop creating additional temporary string in Log::VAPrintf
Author: Alex Langford Date: 2023-04-19T14:16:12-07:00 New Revision: 77e3914be7c99a76a2f728adbb2a169d7cfc5a10 URL: https://github.com/llvm/llvm-project/commit/77e3914be7c99a76a2f728adbb2a169d7cfc5a10 DIFF: https://github.com/llvm/llvm-project/commit/77e3914be7c99a76a2f728adbb2a169d7cfc5a10.diff LOG: [lldb][NFCI] Stop creating additional temporary string in Log::VAPrintf Instead of creating a std::string from the `SmallString`, let's just use a std::string from the start. I initially tried to make `SmallString` work but getting it right proved complicated because `LogHandler::Emit` will take its `StringRef` parameter and touch the raw `const char *` from it directly, which isn't guaranteed to be null-terminated with a `SmallString`. I changed `WriteMessage` to take a `StringRef` instead of a `const std::string &` for flexibility. Differential Revision: https://reviews.llvm.org/D148676 Added: Modified: lldb/include/lldb/Utility/Log.h lldb/source/Utility/Log.cpp Removed: diff --git a/lldb/include/lldb/Utility/Log.h b/lldb/include/lldb/Utility/Log.h index 5d8530483594e..2984a4bd43bb7 100644 --- a/lldb/include/lldb/Utility/Log.h +++ b/lldb/include/lldb/Utility/Log.h @@ -265,7 +265,7 @@ class Log final { void WriteHeader(llvm::raw_ostream &OS, llvm::StringRef file, llvm::StringRef function); - void WriteMessage(const std::string &message); + void WriteMessage(llvm::StringRef message); void Format(llvm::StringRef file, llvm::StringRef function, const llvm::formatv_object_base &payload); diff --git a/lldb/source/Utility/Log.cpp b/lldb/source/Utility/Log.cpp index 045e0f2cb68a2..7d94a89a8c974 100644 --- a/lldb/source/Utility/Log.cpp +++ b/lldb/source/Utility/Log.cpp @@ -146,8 +146,8 @@ void Log::Printf(const char *format, ...) { // callback registered, then we call the logging callback. If we have a valid // file handle, we also log to the file. void Log::VAPrintf(const char *format, va_list args) { - llvm::SmallString<64> FinalMessage; - llvm::raw_svector_ostream Stream(FinalMessage); + std::string FinalMessage; + llvm::raw_string_ostream Stream(FinalMessage); WriteHeader(Stream, "", ""); llvm::SmallString<64> Content; @@ -155,7 +155,7 @@ void Log::VAPrintf(const char *format, va_list args) { Stream << Content << "\n"; - WriteMessage(std::string(FinalMessage.str())); + WriteMessage(FinalMessage); } // Printing of errors that are not fatal. @@ -344,7 +344,7 @@ void Log::WriteHeader(llvm::raw_ostream &OS, llvm::StringRef file, } } -void Log::WriteMessage(const std::string &message) { +void Log::WriteMessage(llvm::StringRef message) { // Make a copy of our stream shared pointer in case someone disables our log // while we are logging and releases the stream auto handler_sp = GetHandler(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D148400: [lldb] Fix bug to update process public run lock with process state
mib added a comment. Reverting this because it introduced some failures on the linux bot: https://lab.llvm.org/buildbot/#/builders/68/builds/51397/steps/6/logs/stdio Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148400/new/ https://reviews.llvm.org/D148400 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] f2f3755 - Revert "[lldb] Fix bug to update process public run lock with process state"
Author: Med Ismail Bennani Date: 2023-04-19T10:46:33-07:00 New Revision: f2f37557e722a4d41378bd53c119ee89cb3ec93d URL: https://github.com/llvm/llvm-project/commit/f2f37557e722a4d41378bd53c119ee89cb3ec93d DIFF: https://github.com/llvm/llvm-project/commit/f2f37557e722a4d41378bd53c119ee89cb3ec93d.diff LOG: Revert "[lldb] Fix bug to update process public run lock with process state" This reverts commit 14f00213b202a82b895a6ab749262d4382435012. Added: Modified: lldb/include/lldb/Target/Process.h lldb/source/Target/Process.cpp lldb/source/Target/Target.cpp Removed: diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 0c90078accfcb..255ba8cd4a923 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -386,13 +386,6 @@ class Process : public std::enable_shared_from_this, static ConstString &GetStaticBroadcasterClass(); - static constexpr llvm::StringRef AttachSynchronousHijackListenerName = - "lldb.internal.Process.AttachSynchronous.hijack"; - static constexpr llvm::StringRef LaunchSynchronousHijackListenerName = - "lldb.internal.Process.LaunchSynchronous.hijack"; - static constexpr llvm::StringRef ResumeSynchronousHijackListenerName = - "lldb.internal.Process.ResumeSynchronous.hijack"; - ConstString &GetBroadcasterClass() const override { return GetStaticBroadcasterClass(); } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index ff28d02891cca..af5b0d0920102 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -1355,6 +1355,8 @@ Status Process::Resume() { return error; } +static const char *g_resume_sync_name = "lldb.Process.ResumeSynchronous.hijack"; + Status Process::ResumeSynchronous(Stream *stream) { Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); LLDB_LOGF(log, "Process::ResumeSynchronous -- locking run lock"); @@ -1365,7 +1367,7 @@ Status Process::ResumeSynchronous(Stream *stream) { } ListenerSP listener_sp( - Listener::MakeListener(ResumeSynchronousHijackListenerName.data())); + Listener::MakeListener(g_resume_sync_name)); HijackProcessEvents(listener_sp); Status error = PrivateResume(); @@ -1391,8 +1393,9 @@ Status Process::ResumeSynchronous(Stream *stream) { bool Process::StateChangedIsExternallyHijacked() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -llvm::StringRef hijacking_name = GetHijackingListenerName(); -if (hijacking_name.starts_with("lldb.internal")) +const char *hijacking_name = GetHijackingListenerName(); +if (hijacking_name && +strcmp(hijacking_name, g_resume_sync_name)) return true; } return false; @@ -1400,8 +1403,9 @@ bool Process::StateChangedIsExternallyHijacked() { bool Process::StateChangedIsHijackedForSynchronousResume() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -llvm::StringRef hijacking_name = GetHijackingListenerName(); -if (hijacking_name == ResumeSynchronousHijackListenerName) +const char *hijacking_name = GetHijackingListenerName(); +if (hijacking_name && +strcmp(hijacking_name, g_resume_sync_name) == 0) return true; } return false; diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 03379796a4e51..a6e6f21001625 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3157,8 +3157,8 @@ Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { // its own hijacking listener or if the process is created by the target // manually, without the platform). if (!launch_info.GetHijackListener()) -launch_info.SetHijackListener(Listener::MakeListener( -Process::LaunchSynchronousHijackListenerName.data())); +launch_info.SetHijackListener( +Listener::MakeListener("lldb.Target.Launch.hijack")); // If we're not already connected to the process, and if we have a platform // that can launch a process for debugging, go ahead and do that here. @@ -3334,8 +3334,8 @@ Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { ListenerSP hijack_listener_sp; const bool async = attach_info.GetAsync(); if (!async) { -hijack_listener_sp = Listener::MakeListener( -Process::AttachSynchronousHijackListenerName.data()); +hijack_listener_sp = +Listener::MakeListener("lldb.Target.Attach.attach.hijack"); attach_info.SetHijackListener(hijack_listener_sp); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D148400: [lldb] Fix bug to update process public run lock with process state
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG14f00213b202: [lldb] Fix bug to update process public run lock with process state (authored by mib). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148400/new/ https://reviews.llvm.org/D148400 Files: lldb/include/lldb/Target/Process.h lldb/source/Target/Process.cpp lldb/source/Target/Target.cpp Index: lldb/source/Target/Target.cpp === --- lldb/source/Target/Target.cpp +++ lldb/source/Target/Target.cpp @@ -3157,8 +3157,8 @@ // its own hijacking listener or if the process is created by the target // manually, without the platform). if (!launch_info.GetHijackListener()) -launch_info.SetHijackListener( -Listener::MakeListener("lldb.Target.Launch.hijack")); +launch_info.SetHijackListener(Listener::MakeListener( +Process::LaunchSynchronousHijackListenerName.data())); // If we're not already connected to the process, and if we have a platform // that can launch a process for debugging, go ahead and do that here. @@ -3334,8 +3334,8 @@ ListenerSP hijack_listener_sp; const bool async = attach_info.GetAsync(); if (!async) { -hijack_listener_sp = -Listener::MakeListener("lldb.Target.Attach.attach.hijack"); +hijack_listener_sp = Listener::MakeListener( +Process::AttachSynchronousHijackListenerName.data()); attach_info.SetHijackListener(hijack_listener_sp); } Index: lldb/source/Target/Process.cpp === --- lldb/source/Target/Process.cpp +++ lldb/source/Target/Process.cpp @@ -1355,8 +1355,6 @@ return error; } -static const char *g_resume_sync_name = "lldb.Process.ResumeSynchronous.hijack"; - Status Process::ResumeSynchronous(Stream *stream) { Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); LLDB_LOGF(log, "Process::ResumeSynchronous -- locking run lock"); @@ -1367,7 +1365,7 @@ } ListenerSP listener_sp( - Listener::MakeListener(g_resume_sync_name)); + Listener::MakeListener(ResumeSynchronousHijackListenerName.data())); HijackProcessEvents(listener_sp); Status error = PrivateResume(); @@ -1393,9 +1391,8 @@ bool Process::StateChangedIsExternallyHijacked() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -const char *hijacking_name = GetHijackingListenerName(); -if (hijacking_name && -strcmp(hijacking_name, g_resume_sync_name)) +llvm::StringRef hijacking_name = GetHijackingListenerName(); +if (hijacking_name.starts_with("lldb.internal")) return true; } return false; @@ -1403,9 +1400,8 @@ bool Process::StateChangedIsHijackedForSynchronousResume() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -const char *hijacking_name = GetHijackingListenerName(); -if (hijacking_name && -strcmp(hijacking_name, g_resume_sync_name) == 0) +llvm::StringRef hijacking_name = GetHijackingListenerName(); +if (hijacking_name == ResumeSynchronousHijackListenerName) return true; } return false; Index: lldb/include/lldb/Target/Process.h === --- lldb/include/lldb/Target/Process.h +++ lldb/include/lldb/Target/Process.h @@ -386,6 +386,13 @@ static ConstString &GetStaticBroadcasterClass(); + static constexpr llvm::StringRef AttachSynchronousHijackListenerName = + "lldb.internal.Process.AttachSynchronous.hijack"; + static constexpr llvm::StringRef LaunchSynchronousHijackListenerName = + "lldb.internal.Process.LaunchSynchronous.hijack"; + static constexpr llvm::StringRef ResumeSynchronousHijackListenerName = + "lldb.internal.Process.ResumeSynchronous.hijack"; + ConstString &GetBroadcasterClass() const override { return GetStaticBroadcasterClass(); } Index: lldb/source/Target/Target.cpp === --- lldb/source/Target/Target.cpp +++ lldb/source/Target/Target.cpp @@ -3157,8 +3157,8 @@ // its own hijacking listener or if the process is created by the target // manually, without the platform). if (!launch_info.GetHijackListener()) -launch_info.SetHijackListener( -Listener::MakeListener("lldb.Target.Launch.hijack")); +launch_info.SetHijackListener(Listener::MakeListener( +Process::LaunchSynchronousHijackListenerName.data())); // If we're not already connected to the process, and if we have a platform // that can launch a process for debugging, go ahead and do that here. @@ -3334,8 +3334,8 @@ ListenerSP hijack_listener_sp; const bool async = attach_info.GetAsync(); if (!async) { -hijack_listener_sp = -Listener::MakeListener("lldb.Target.Attach.attach.hijack"); +hijack_listener_sp = Listener:
[Lldb-commits] [lldb] 14f0021 - [lldb] Fix bug to update process public run lock with process state
Author: Med Ismail Bennani Date: 2023-04-19T10:04:56-07:00 New Revision: 14f00213b202a82b895a6ab749262d4382435012 URL: https://github.com/llvm/llvm-project/commit/14f00213b202a82b895a6ab749262d4382435012 DIFF: https://github.com/llvm/llvm-project/commit/14f00213b202a82b895a6ab749262d4382435012.diff LOG: [lldb] Fix bug to update process public run lock with process state This patch should address an issue that caused the process public run lock to not be updated during a process launch/attach when the process stops. That caused the public run lock to report its state as running while the process state is stopped. This prevents the users to interact with the process (through the command line or via the SBAPI) since it's considered still running. To address that, this patch refactors the name of the internal hijack listeners to a specific pattern `lldb.internal..hijack` that are used to ensure that we've attached to or launched a process successfully. Then, when updating the process public state, after updating the state value, if the process is not hijacked externally, meaning if the process doens't have a hijack listener that matches the internal hijack listeners pattern, we can update the public run lock accordingly. Differential Revision: https://reviews.llvm.org/D148400 Signed-off-by: Med Ismail Bennani Added: Modified: lldb/include/lldb/Target/Process.h lldb/source/Target/Process.cpp lldb/source/Target/Target.cpp Removed: diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 255ba8cd4a923..0c90078accfcb 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -386,6 +386,13 @@ class Process : public std::enable_shared_from_this, static ConstString &GetStaticBroadcasterClass(); + static constexpr llvm::StringRef AttachSynchronousHijackListenerName = + "lldb.internal.Process.AttachSynchronous.hijack"; + static constexpr llvm::StringRef LaunchSynchronousHijackListenerName = + "lldb.internal.Process.LaunchSynchronous.hijack"; + static constexpr llvm::StringRef ResumeSynchronousHijackListenerName = + "lldb.internal.Process.ResumeSynchronous.hijack"; + ConstString &GetBroadcasterClass() const override { return GetStaticBroadcasterClass(); } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index af5b0d0920102..ff28d02891cca 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -1355,8 +1355,6 @@ Status Process::Resume() { return error; } -static const char *g_resume_sync_name = "lldb.Process.ResumeSynchronous.hijack"; - Status Process::ResumeSynchronous(Stream *stream) { Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); LLDB_LOGF(log, "Process::ResumeSynchronous -- locking run lock"); @@ -1367,7 +1365,7 @@ Status Process::ResumeSynchronous(Stream *stream) { } ListenerSP listener_sp( - Listener::MakeListener(g_resume_sync_name)); + Listener::MakeListener(ResumeSynchronousHijackListenerName.data())); HijackProcessEvents(listener_sp); Status error = PrivateResume(); @@ -1393,9 +1391,8 @@ Status Process::ResumeSynchronous(Stream *stream) { bool Process::StateChangedIsExternallyHijacked() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -const char *hijacking_name = GetHijackingListenerName(); -if (hijacking_name && -strcmp(hijacking_name, g_resume_sync_name)) +llvm::StringRef hijacking_name = GetHijackingListenerName(); +if (hijacking_name.starts_with("lldb.internal")) return true; } return false; @@ -1403,9 +1400,8 @@ bool Process::StateChangedIsExternallyHijacked() { bool Process::StateChangedIsHijackedForSynchronousResume() { if (IsHijackedForEvent(eBroadcastBitStateChanged)) { -const char *hijacking_name = GetHijackingListenerName(); -if (hijacking_name && -strcmp(hijacking_name, g_resume_sync_name) == 0) +llvm::StringRef hijacking_name = GetHijackingListenerName(); +if (hijacking_name == ResumeSynchronousHijackListenerName) return true; } return false; diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index a6e6f21001625..03379796a4e51 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3157,8 +3157,8 @@ Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { // its own hijacking listener or if the process is created by the target // manually, without the platform). if (!launch_info.GetHijackListener()) -launch_info.SetHijackListener( -Listener::MakeListener("lldb.Target.Launch.hijack")); +launch_info.SetHijackListener(Listener::MakeListener( +Process::LaunchSynchronousHijackListenerName.data())); // If we're not already connected to the process, and if we have a platform //
[Lldb-commits] [PATCH] D148400: [lldb] Fix bug to update process public run lock with process state
JDevlieghere accepted this revision. JDevlieghere added a comment. Ship it CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148400/new/ https://reviews.llvm.org/D148400 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D148679: [lldb] Change setting descriptions to use StringRef instead of ConstString
JDevlieghere accepted this revision. JDevlieghere added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148679/new/ https://reviews.llvm.org/D148679 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D148715: [LLDB] Discard register flags where the size doesn't match the register
DavidSpickett created this revision. Herald added a project: All. DavidSpickett requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. In the particular case I was looking at I autogenerated a 128 bit set of flags that is only 64 bit. This doesn't crash lldb but it was certainly not expected. I suspect that we would have crashed if the top 64 bits weren't marked as unused (or at least invoked some very undefined behaviour). When this happens, log the details and ignore the flags. Like this: Size of register flags TTBR0_EL1_flags (16 bytes) for register TTBR0_EL1 does not match the register size (8 bytes). Ignoring this set of flags. Turns out a few of the tests relied on this bug so I have updated them and added a specific test for this case. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D148715 Files: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py Index: lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py === --- lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py +++ lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py @@ -319,6 +319,20 @@ self.expect("register read cpsr", substrs=["(C = 1)"]) +@skipIfXmlSupportMissing +@skipIfRemote +def test_flags_register_size_mismatch(self): +# If the size of the flag set found does not match the size of the +# register, we discard the flags. +self.setup_register_test("""\ + + + + + """) + +self.expect("register read cpsr", substrs=["(C = 1)"], matching=False) + @skipIfXmlSupportMissing @skipIfRemote def test_flags_set_even_if_format_set(self): @@ -439,7 +453,7 @@ 'core.xml' : dedent("""\ - + @@ -475,23 +489,23 @@ 'core.xml' : dedent("""\ - + """), -# The my_flags here is ignored, so cpsr will use the my_flags from above. +# The my_flags here is ignored, so x1 will use the my_flags from above. 'core-2.xml' : dedent("""\ - + - + """), }) self.expect("register read x0", substrs=["(correct = 1)"]) -self.expect("register read cpsr", substrs=["(correct = 1)"]) +self.expect("register read x1", substrs=["(correct = 1)"]) Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp === --- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -4342,8 +4342,19 @@ // gdb_type could reference some flags type defined in XML. llvm::StringMap>::iterator it = registers_flags_types.find(gdb_type); - if (it != registers_flags_types.end()) -reg_info.flags_type = it->second.get(); + if (it != registers_flags_types.end()) { +auto flags_type = it->second.get(); +if (reg_info.byte_size == flags_type->GetSize()) + reg_info.flags_type = flags_type; +else + LLDB_LOGF(log, +"ProcessGDBRemote::ParseRegisters Size of register " +"flags %s (%d bytes) for " +"register %s does not match the register size (%d " +"bytes). Ignoring this set of flags.", +flags_type->GetID().c_str(), flags_type->GetSize(), +reg_info.name.AsCString(), reg_info.byte_size); + } // There's a slim chance that the gdb_type name is both a flags type // and a simple type. Just in case, look for that too (setting both Index: lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py === --- lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py +++ lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py @@ -319,6 +319,20 @@ self.expect("register read cpsr", substrs=["(C = 1)"]) +@skipIfXmlSupportMissing +@skipIfRemote +def test_flags_register_size_mismatch(self): +# If the size of the flag set found does not match the size of the +# register, we discard
[Lldb-commits] [PATCH] D143374: [LLDB][RISCV] Add RVV register infos
DavidSpickett added a comment. In the time since this was written and landed, I added an extra field to register information. Fixed that here: https://github.com/llvm/llvm-project/commit/ee9a646192db1cc5d1df57d69232fdd2a5c89fc5 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D143374/new/ https://reviews.llvm.org/D143374 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] ee9a646 - [lldb][RISCV] Add missing flags pointer to register infos
Author: David Spickett Date: 2023-04-19T11:42:14Z New Revision: ee9a646192db1cc5d1df57d69232fdd2a5c89fc5 URL: https://github.com/llvm/llvm-project/commit/ee9a646192db1cc5d1df57d69232fdd2a5c89fc5 DIFF: https://github.com/llvm/llvm-project/commit/ee9a646192db1cc5d1df57d69232fdd2a5c89fc5.diff LOG: [lldb][RISCV] Add missing flags pointer to register infos efd64c2f2506df3e2ed6d9da68e49f03fc31763c added these. Added: Modified: lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h Removed: diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h b/lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h index 8ea2046279256..720d900c7b97e 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h +++ b/lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h @@ -74,7 +74,7 @@ using namespace riscv_dwarf; #define DEFINE_VPR_ALT(reg, alt, generic_kind) \ { \ #reg, #alt, 16, 0, lldb::eEncodingVector, lldb::eFormatVectorOfUInt8, \ -VPR_KIND(vpr_##reg, generic_kind), nullptr, nullptr \ +VPR_KIND(vpr_##reg, generic_kind), nullptr, nullptr, nullptr \ } // clang-format on ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D148546: Reland: [Demangle] replace use of llvm::StringView w/ std::string_view
DavidSpickett accepted this revision. DavidSpickett added a comment. This revision is now accepted and ready to land. I don't know enough to review the other patches but I understand the layering issue. So assuming the other patches are ok, this one LGTM. Comment at: llvm/include/llvm/Demangle/ItaniumDemangle.h:1586 // The instantiations are typedefs that drop the "basic_" prefix. - assert(SV.startsWith("basic_")); + assert(llvm::itanium_demangle::starts_with(SV, "basic_")); SV.remove_prefix(sizeof("basic_") - 1); DavidSpickett wrote: > Is this right? Not sure `itanium_demangle` makes sense here. Answered. Comment at: llvm/include/llvm/Demangle/ItaniumDemangle.h:2486 + bool consumeIf(std::string_view S) { +if (llvm::itanium_demangle::starts_with(std::string_view(First, Last - First), S)) { First += S.size(); DavidSpickett wrote: > Same here, namespace doesn't sound right. Answered. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148546/new/ https://reviews.llvm.org/D148546 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D143374: [LLDB][RISCV] Add RVV register infos
This revision was automatically updated to reflect the committed changes. Closed by commit rGefd64c2f2506: [LLDB][RISCV] Add RVV register infos (authored by Emmmer). Herald added a subscriber: lldb-commits. Changed prior to commit: https://reviews.llvm.org/D143374?vs=495161&id=514857#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D143374/new/ https://reviews.llvm.org/D143374 Files: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h Index: lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h === --- lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h +++ lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h @@ -42,6 +42,9 @@ // FPR register kinds array for vector registers #define FPR64_KIND(reg, generic_kind) KIND_HELPER(reg, generic_kind) +// VPR register kinds array for vector registers +#define VPR_KIND(reg, generic_kind) KIND_HELPER(reg, generic_kind) + // Defines a 64-bit general purpose register #define DEFINE_GPR64(reg, generic_kind) DEFINE_GPR64_ALT(reg, reg, generic_kind) @@ -64,6 +67,16 @@ FPR64_KIND(fpr_##reg, generic_kind), nullptr, nullptr, nullptr, \ } +#define DEFINE_VPR(reg, generic_kind) DEFINE_VPR_ALT(reg, reg, generic_kind) + +// Defines a scalable vector register, with default size 128 bits +// The byte offset 0 is a placeholder, which should be corrected at runtime. +#define DEFINE_VPR_ALT(reg, alt, generic_kind) \ + { \ +#reg, #alt, 16, 0, lldb::eEncodingVector, lldb::eFormatVectorOfUInt8, \ +VPR_KIND(vpr_##reg, generic_kind), nullptr, nullptr \ + } + // clang-format on static lldb_private::RegisterInfo g_register_infos_riscv64_le[] = { @@ -135,6 +148,39 @@ DEFINE_FPR64_ALT(ft10, f30, LLDB_INVALID_REGNUM), DEFINE_FPR64_ALT(ft11, f31, LLDB_INVALID_REGNUM), DEFINE_FPR_ALT(fcsr, nullptr, 4, LLDB_INVALID_REGNUM), + +DEFINE_VPR(v0, LLDB_INVALID_REGNUM), +DEFINE_VPR(v1, LLDB_INVALID_REGNUM), +DEFINE_VPR(v2, LLDB_INVALID_REGNUM), +DEFINE_VPR(v3, LLDB_INVALID_REGNUM), +DEFINE_VPR(v4, LLDB_INVALID_REGNUM), +DEFINE_VPR(v5, LLDB_INVALID_REGNUM), +DEFINE_VPR(v6, LLDB_INVALID_REGNUM), +DEFINE_VPR(v7, LLDB_INVALID_REGNUM), +DEFINE_VPR(v8, LLDB_INVALID_REGNUM), +DEFINE_VPR(v9, LLDB_INVALID_REGNUM), +DEFINE_VPR(v10, LLDB_INVALID_REGNUM), +DEFINE_VPR(v11, LLDB_INVALID_REGNUM), +DEFINE_VPR(v12, LLDB_INVALID_REGNUM), +DEFINE_VPR(v13, LLDB_INVALID_REGNUM), +DEFINE_VPR(v14, LLDB_INVALID_REGNUM), +DEFINE_VPR(v15, LLDB_INVALID_REGNUM), +DEFINE_VPR(v16, LLDB_INVALID_REGNUM), +DEFINE_VPR(v17, LLDB_INVALID_REGNUM), +DEFINE_VPR(v18, LLDB_INVALID_REGNUM), +DEFINE_VPR(v19, LLDB_INVALID_REGNUM), +DEFINE_VPR(v20, LLDB_INVALID_REGNUM), +DEFINE_VPR(v21, LLDB_INVALID_REGNUM), +DEFINE_VPR(v22, LLDB_INVALID_REGNUM), +DEFINE_VPR(v23, LLDB_INVALID_REGNUM), +DEFINE_VPR(v24, LLDB_INVALID_REGNUM), +DEFINE_VPR(v25, LLDB_INVALID_REGNUM), +DEFINE_VPR(v26, LLDB_INVALID_REGNUM), +DEFINE_VPR(v27, LLDB_INVALID_REGNUM), +DEFINE_VPR(v28, LLDB_INVALID_REGNUM), +DEFINE_VPR(v29, LLDB_INVALID_REGNUM), +DEFINE_VPR(v30, LLDB_INVALID_REGNUM), +DEFINE_VPR(v31, LLDB_INVALID_REGNUM), }; #endif // DECLARE_REGISTER_INFOS_RISCV64_STRUCT Index: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h === --- lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h +++ lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h @@ -35,6 +35,11 @@ uint32_t fcsr; }; + struct VPR { +// The size should be VLEN*32 in bits, but we don't have VLEN here. +void *vpr; + }; + RegisterInfoPOSIX_riscv64(const lldb_private::ArchSpec &target_arch, lldb_private::Flags flags); Index: lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h === --- lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h +++ lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h @@ -42,6 +42,9 @@ // FPR register kinds array for vector registers #define FPR64_KIND(reg, generic_kind) KIND_HELPER(reg, generic_kind) +// VPR register kinds array for vector registers +#define VPR_KIND(reg, generic_kind) KIND_HELPER(reg, generic_kind) + // Defines a 64-bit general purpose register #define DEFINE_GPR64(reg, generic_kind) DEFINE_GPR64_ALT(reg, reg, generic_kind) @@ -64,6 +67,16 @@ FPR64_KIND(fpr_##reg, generic_kind), nullptr, nullptr, nullptr, \ } +#define DEFINE_VPR(reg, generic_kind) DEFINE_VPR_ALT(reg, reg, generi
[Lldb-commits] [lldb] efd64c2 - [LLDB][RISCV] Add RVV register infos
Author: Emmmer Date: 2023-04-19T16:26:33+08:00 New Revision: efd64c2f2506df3e2ed6d9da68e49f03fc31763c URL: https://github.com/llvm/llvm-project/commit/efd64c2f2506df3e2ed6d9da68e49f03fc31763c DIFF: https://github.com/llvm/llvm-project/commit/efd64c2f2506df3e2ed6d9da68e49f03fc31763c.diff LOG: [LLDB][RISCV] Add RVV register infos RVV stands for "RISC-V V Extension", which adds 32 vector registers, and seven unprivileged CSRs (vstart, vxsat, vxrm, vcsr, vtype, vl, vlenb) to a base scalar RISC-V ISA. The base vector extension is intended to provide general support for data-parallel execution within the 32-bit instruction encoding space, with later vector extensions supporting richer functionality for certain domains. This patch adds the definitions of RVV registers in `RegisterInfos_riscv64.h`, whose purpose is to provide support (such as reading, writing, and calculating the offsets) for future register-related functions. Reviewed By: kito-cheng Differential Revision: https://reviews.llvm.org/D143374 Added: Modified: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h Removed: diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h index c5b955f93af63..4bf4bede01328 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h +++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h @@ -35,6 +35,11 @@ class RegisterInfoPOSIX_riscv64 uint32_t fcsr; }; + struct VPR { +// The size should be VLEN*32 in bits, but we don't have VLEN here. +void *vpr; + }; + RegisterInfoPOSIX_riscv64(const lldb_private::ArchSpec &target_arch, lldb_private::Flags flags); diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h b/lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h index 42c73abc4a1ae..8ea2046279256 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h +++ b/lldb/source/Plugins/Process/Utility/RegisterInfos_riscv64.h @@ -42,6 +42,9 @@ using namespace riscv_dwarf; // FPR register kinds array for vector registers #define FPR64_KIND(reg, generic_kind) KIND_HELPER(reg, generic_kind) +// VPR register kinds array for vector registers +#define VPR_KIND(reg, generic_kind) KIND_HELPER(reg, generic_kind) + // Defines a 64-bit general purpose register #define DEFINE_GPR64(reg, generic_kind) DEFINE_GPR64_ALT(reg, reg, generic_kind) @@ -64,6 +67,16 @@ using namespace riscv_dwarf; FPR64_KIND(fpr_##reg, generic_kind), nullptr, nullptr, nullptr, \ } +#define DEFINE_VPR(reg, generic_kind) DEFINE_VPR_ALT(reg, reg, generic_kind) + +// Defines a scalable vector register, with default size 128 bits +// The byte offset 0 is a placeholder, which should be corrected at runtime. +#define DEFINE_VPR_ALT(reg, alt, generic_kind) \ + { \ +#reg, #alt, 16, 0, lldb::eEncodingVector, lldb::eFormatVectorOfUInt8, \ +VPR_KIND(vpr_##reg, generic_kind), nullptr, nullptr \ + } + // clang-format on static lldb_private::RegisterInfo g_register_infos_riscv64_le[] = { @@ -135,6 +148,39 @@ static lldb_private::RegisterInfo g_register_infos_riscv64_le[] = { DEFINE_FPR64_ALT(ft10, f30, LLDB_INVALID_REGNUM), DEFINE_FPR64_ALT(ft11, f31, LLDB_INVALID_REGNUM), DEFINE_FPR_ALT(fcsr, nullptr, 4, LLDB_INVALID_REGNUM), + +DEFINE_VPR(v0, LLDB_INVALID_REGNUM), +DEFINE_VPR(v1, LLDB_INVALID_REGNUM), +DEFINE_VPR(v2, LLDB_INVALID_REGNUM), +DEFINE_VPR(v3, LLDB_INVALID_REGNUM), +DEFINE_VPR(v4, LLDB_INVALID_REGNUM), +DEFINE_VPR(v5, LLDB_INVALID_REGNUM), +DEFINE_VPR(v6, LLDB_INVALID_REGNUM), +DEFINE_VPR(v7, LLDB_INVALID_REGNUM), +DEFINE_VPR(v8, LLDB_INVALID_REGNUM), +DEFINE_VPR(v9, LLDB_INVALID_REGNUM), +DEFINE_VPR(v10, LLDB_INVALID_REGNUM), +DEFINE_VPR(v11, LLDB_INVALID_REGNUM), +DEFINE_VPR(v12, LLDB_INVALID_REGNUM), +DEFINE_VPR(v13, LLDB_INVALID_REGNUM), +DEFINE_VPR(v14, LLDB_INVALID_REGNUM), +DEFINE_VPR(v15, LLDB_INVALID_REGNUM), +DEFINE_VPR(v16, LLDB_INVALID_REGNUM), +DEFINE_VPR(v17, LLDB_INVALID_REGNUM), +DEFINE_VPR(v18, LLDB_INVALID_REGNUM), +DEFINE_VPR(v19, LLDB_INVALID_REGNUM), +DEFINE_VPR(v20, LLDB_INVALID_REGNUM), +DEFINE_VPR(v21, LLDB_INVALID_REGNUM), +DEFINE_VPR(v22, LLDB_INVALID_REGNUM), +DEFINE_VPR(v23, LLDB_INVALID_REGNUM), +DEFINE_VPR(v24, LLDB_INVALID_REGNUM), +DEFINE_VPR(v25, LLDB_INVALID_REGNUM), +DEFINE_VPR(v26, LLDB_INVALID_REGNUM), +DEFINE_VPR(v27, LLDB_INVALID_REGNUM), +DEFINE_VPR(v28, LLDB_INVALID_REGNUM), +DEFINE_VPR(v29, LLDB_INVALID_REGNUM)