[Lldb-commits] [lldb] [LLDB] Add SI_USER and SI_KERNEL to Linux signals (PR #144800)
Jacob Lalonde via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 18 14:41:05 PDT 2025
https://github.com/Jlalond created https://github.com/llvm/llvm-project/pull/144800
@dmpots and I were investigating a crash when he was developing LLDB earlier. When I loaded the core I was surprised to see LLDB didn't have information for the SI_CODE. Upon inspection we had an si_code of `128`, which is the decimal of SI_KERNEL at `0x80`.
These were overlooked in my last addition of the negative si_codes, and this patch adds SI_USER and SI_KERNEL to the list, covering us for all the codes available to all signals.
[Linux reference link](https://github.com/torvalds/linux/blob/74b4cc9b8780bfe8a3992c9ac0033bf22ac01f19/include/uapi/asm-generic/siginfo.h#L175)

I kept the code naming the same as what is defined in the Linux source code. SI_KERNEL to my understanding usually indicates something went awry in the Kernel itself, but I think adding that additional detail would not be helpful to most users. @DavidSpickett I'd appreciate your insight into that.
>From 0b55d63aea27df34c5ac5b3d8db30d1bc99b1dd3 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde <jalalonde at fb.com>
Date: Wed, 18 Jun 2025 14:35:37 -0700
Subject: [PATCH] Add SI_USER and SI_KERNEL to Linux signals
---
lldb/source/Plugins/Process/Utility/LinuxSignals.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp
index 15a77ce227ec5..ef3d2f2f845da 100644
--- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp
+++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp
@@ -65,6 +65,10 @@
// See siginfo.h in the Linux Kernel, these codes can be sent for any signal.
#define ADD_LINUX_SIGNAL(signo, name, ...) \
AddSignal(signo, name, __VA_ARGS__); \
+ ADD_SIGCODE(signo, signo, SI_USER, 0, "sent by kill, sigsend or raise", \
+ SignalCodePrintOption::Sender); \
+ ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "Sent by kernel", \
+ SignalCodePrintOption::Sender); \
ADD_SIGCODE(signo, signo, SI_QUEUE, -1, "sent by sigqueue", \
SignalCodePrintOption::Sender); \
ADD_SIGCODE(signo, signo, SI_TIMER, -2, "sent by timer expiration", \
More information about the lldb-commits
mailing list