Skip to content

Commit 513c1cd

Browse files
authored
[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.
1 parent 459de73 commit 513c1cd

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ static std::string GetDescriptionFromSiginfo(lldb::ValueObjectSP siginfo_sp) {
580580
}
581581

582582
return linux_signals.GetSignalDescription(signo, code, addr, lower, upper,
583-
uid, pid);
583+
pid, uid);
584584
}
585585

586586
lldb::StopInfoSP PlatformLinux::GetStopInfoFromSiginfo(Thread &thread) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <signal.h>
2+
#include <sys/syscall.h>
3+
4+
int main() {
5+
// Get the current thread ID
6+
pid_t tid = syscall(SYS_gettid);
7+
// Send a SIGSEGV signal to the current thread
8+
syscall(SYS_tkill, tid, SIGSEGV);
9+
return 0;
10+
}
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# REQUIRES: system-linux
2+
# RUN: %lldb -b -s %s -c %p/Inputs/x86-64-linux-tkill.core | FileCheck %s
3+
4+
thread list
5+
# CHECK: hread #1: tid = 2667987, 0x00007f9a265076cd, name = 'tkill.out', stop reason = SIGSEGV: sent by tkill system call (sender pid=2667987, uid=649752)

0 commit comments

Comments
 (0)