[Lldb-commits] [lldb] 513c1cd - [LLDB][Platform Linux] Flip uid and pid in get signal description (#142200)
via lldb-commits
lldb-commits at lists.llvm.org
Fri May 30 14:21:36 PDT 2025
Author: Jacob Lalonde
Date: 2025-05-30T14:21:33-07:00
New Revision: 513c1cdfaaa3432dc4674a2d3be3dcaec2b4343e
URL: https://github.com/llvm/llvm-project/commit/513c1cdfaaa3432dc4674a2d3be3dcaec2b4343e
DIFF: https://github.com/llvm/llvm-project/commit/513c1cdfaaa3432dc4674a2d3be3dcaec2b4343e.diff
LOG: [LLDB][Platform Linux] Flip uid and pid in get signal description (#142200)
Despite a great review from @labath, I accidentally landed the signal
with the UID and PID properties flipped. I was actually trying to write
tests for this feature when I discovered it.
This fixes that bug, and add a shell test that runs only on Nix systems.
Added:
lldb/test/Shell/Register/Core/Inputs/tkill.cpp
lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core
lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
Modified:
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index 269105208a87a..da14da44f5939 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -580,7 +580,7 @@ static std::string GetDescriptionFromSiginfo(lldb::ValueObjectSP siginfo_sp) {
}
return linux_signals.GetSignalDescription(signo, code, addr, lower, upper,
- uid, pid);
+ pid, uid);
}
lldb::StopInfoSP PlatformLinux::GetStopInfoFromSiginfo(Thread &thread) {
diff --git a/lldb/test/Shell/Register/Core/Inputs/tkill.cpp b/lldb/test/Shell/Register/Core/Inputs/tkill.cpp
new file mode 100644
index 0000000000000..677bd3e6cf493
--- /dev/null
+++ b/lldb/test/Shell/Register/Core/Inputs/tkill.cpp
@@ -0,0 +1,10 @@
+#include <signal.h>
+#include <sys/syscall.h>
+
+int main() {
+ // Get the current thread ID
+ pid_t tid = syscall(SYS_gettid);
+ // Send a SIGSEGV signal to the current thread
+ syscall(SYS_tkill, tid, SIGSEGV);
+ return 0;
+}
diff --git a/lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core b/lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core
new file mode 100644
index 0000000000000..3d1a05a34e7ca
Binary files /dev/null and b/lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core
diff er
diff --git a/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test b/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
new file mode 100644
index 0000000000000..64b99af2d83fa
--- /dev/null
+++ b/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
@@ -0,0 +1,5 @@
+# REQUIRES: system-linux
+# RUN: %lldb -b -s %s -c %p/Inputs/x86-64-linux-tkill.core | FileCheck %s
+
+thread list
+# CHECK: hread #1: tid = 2667987, 0x00007f9a265076cd, name = 'tkill.out', stop reason = SIGSEGV: sent by tkill system call (sender pid=2667987, uid=649752)
More information about the lldb-commits
mailing list