[Lldb-commits] [lldb] 02e690b - [lldb] [FreeBSD] Fix building on systems without PT_COREDUMP
Michał Górny via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 6 05:05:15 PDT 2021
Author: Michał Górny
Date: 2021-10-06T14:05:07+02:00
New Revision: 02e690ba0b10c422cbec77105eb40835dab57092
URL: https://github.com/llvm/llvm-project/commit/02e690ba0b10c422cbec77105eb40835dab57092
DIFF: https://github.com/llvm/llvm-project/commit/02e690ba0b10c422cbec77105eb40835dab57092.diff
LOG: [lldb] [FreeBSD] Fix building on systems without PT_COREDUMP
PT_COREDUMP is a relatively recent addition. Use an #ifdef to skip it
if the underlying system does not support it.
Differential Revision: https://reviews.llvm.org/D111214
Added:
Modified:
lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
lldb/test/API/tools/lldb-server/TestGdbRemoteSaveCore.py
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
index d795a43375ca7..a62d3c1ba0522 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
@@ -130,9 +130,12 @@ NativeProcessFreeBSD::Factory::Attach(
NativeProcessFreeBSD::Extension
NativeProcessFreeBSD::Factory::GetSupportedExtensions() const {
- return Extension::multiprocess | Extension::fork | Extension::vfork |
- Extension::pass_signals | Extension::auxv | Extension::libraries_svr4 |
- Extension::savecore;
+ return
+#if defined(PT_COREDUMP)
+ Extension::savecore |
+#endif
+ Extension::multiprocess | Extension::fork | Extension::vfork |
+ Extension::pass_signals | Extension::auxv | Extension::libraries_svr4;
}
// Public Instance Methods
@@ -1013,6 +1016,7 @@ void NativeProcessFreeBSD::MonitorClone(::pid_t child_pid, bool is_vfork,
llvm::Expected<std::string>
NativeProcessFreeBSD::SaveCore(llvm::StringRef path_hint) {
+#if defined(PT_COREDUMP)
using namespace llvm::sys::fs;
llvm::SmallString<128> path{path_hint};
@@ -1036,4 +1040,9 @@ NativeProcessFreeBSD::SaveCore(llvm::StringRef path_hint) {
return llvm::createStringError(
close_err, "Unable to close the core dump after writing");
return path.str().str();
+#else // !defined(PT_COREDUMP)
+ return llvm::createStringError(
+ llvm::inconvertibleErrorCode(),
+ "PT_COREDUMP not supported in the FreeBSD version used to build LLDB");
+#endif
}
diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteSaveCore.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteSaveCore.py
index 10ba1e91134f4..995d10534faf2 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteSaveCore.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteSaveCore.py
@@ -15,7 +15,8 @@ def coredump_test(self, core_path=None, expect_path=None):
procs = self.prep_debug_monitor_and_inferior()
self.add_qSupported_packets()
ret = self.expect_gdbremote_sequence()
- self.assertIn("qSaveCore+", ret["qSupported_response"])
+ if "qSaveCore+" not in ret["qSupported_response"]:
+ self.skipTest("qSaveCore not supported by lldb-server")
self.reset_test_sequence()
packet = "$qSaveCore"
More information about the lldb-commits
mailing list