[Lldb-commits] [PATCH] D146222: [lldb] Add compile time checks for signal codes when on the matching platform

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 16 05:46:42 PDT 2023


DavidSpickett created this revision.
Herald added subscribers: krytarowski, arichardson, emaste.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This adds a new macro to the UnixSignals subclasses, ADD_SIGCODE.

ADD_SIGCODE(4, ILL_ILLOPC, 1, "illegal opcode");

Adds a sigcode to signal 4. That code is ILL_ILLOPC and we expect
its value to be 1. When compiling on a system that matches the class
e.g. FreeBSD for FreeBSDSignals, the macro will check that that is true.

When you're not on FreeBSD we just use the number 1, and ILL_ILLOPC
won't be defined to anything because we don't include csignal.

Example error:
LinuxSignals.cpp:52:3: error: static_assert failed due to requirement
'ILL_COPROC == 9' "Value mismatch for signal code ILL_COPROC"


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146222

Files:
  lldb/include/lldb/Target/UnixSignals.h
  lldb/source/Plugins/Process/Utility/FreeBSDSignals.cpp
  lldb/source/Plugins/Process/Utility/LinuxSignals.cpp
  lldb/source/Plugins/Process/Utility/NetBSDSignals.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146222.505782.patch
Type: text/x-patch
Size: 14366 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230316/63fc2371/attachment.bin>


More information about the lldb-commits mailing list