[Lldb-commits] [lldb] [llvm] [lldb] [lldb-server] Introduce Host/qnx and NativeProcessQNX (PR #97630)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 8 07:03:10 PDT 2024


================
@@ -36,10 +38,17 @@ using namespace lldb;
 using namespace lldb_private;
 
 static sig_atomic_t g_signal_flags[NSIG];
+#if defined(__QNX__)
+static llvm::DenseMap<int, siginfo_t> g_signal_info;
----------------
labath wrote:

This code is definitely not async-signal-safe. However, before you try to fix that, I'd like clear up a couple of things:
1. Is this absolutely necessary? I see you're using this to get the PID of the process that stopped, but is that the only way to determine that? Could you e.g. iterate through the list of processes (you will only likely have one or two, so it's not like it will be slow) and query each one? (that's how it's done on linux)
2. Is this guaranteed to work all the time? For example, what happens if you're debugging two processes and they both stop simultaneously. Does the OS guarantee to deliver two signals or can it coalesce them? (technically, I believe linux is allowed to do that, which is why this implementation does not rely on the contents/number of signals, just their presence. (plus it's also convenient to not have to worry about how to capture multiple instances of one signal safely)

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


More information about the lldb-commits mailing list