[Lldb-commits] [lldb] [LLDB][ELF Core] Support all the Generic (Negative) SI Codes. (PR #140150)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri May 23 01:13:47 PDT 2025


================
@@ -480,3 +481,111 @@ CompilerType PlatformLinux::GetSiginfoType(const llvm::Triple &triple) {
   ast->CompleteTagDeclarationDefinition(siginfo_type);
   return siginfo_type;
 }
+
+static std::string GetDescriptionFromSiginfo(lldb::ValueObjectSP siginfo_sp) {
+  if (!siginfo_sp)
+    return "";
+
+  lldb_private::LinuxSignals linux_signals;
+  int code = siginfo_sp->GetChildMemberWithName("si_code")->GetValueAsSigned(0);
+  int signo =
+      siginfo_sp->GetChildMemberWithName("si_signo")->GetValueAsSigned(-1);
+  // si_code = 0 is SI_NOINFO, we just want the description with nothing
----------------
labath wrote:

I don't think it is. The only reference I can find is https://github.com/torvalds/linux/blob/94305e83eccb3120c921cd3a015cd74731140bac/arch/sparc/include/uapi/asm/siginfo.h#L14 and there it's set to 32767.

0 is [SI_USER](https://github.com/torvalds/linux/blob/94305e83eccb3120c921cd3a015cd74731140bac/include/uapi/asm-generic/siginfo.h#L174), which is used by `kill`, so in theory uid/pid should be set. However, it's also used as a default value, so maybe not printing the uid/pid in this case is actually correct:
https://github.com/torvalds/linux/blob/94305e83eccb3120c921cd3a015cd74731140bac/kernel/signal.c#L589-L599

https://github.com/llvm/llvm-project/pull/140150


More information about the lldb-commits mailing list