-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[LLDB][Platform Linux] Flip uid and pid in get signal description #142200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lldb Author: Jacob Lalonde (Jlalond) ChangesDespite 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. Full diff: https://github.com/llvm/llvm-project/pull/142200.diff 3 Files Affected:
diff --git a/lldb/test/Shell/Register/Core/Inputs/tkill.cpp b/lldb/test/Shell/Register/Core/Inputs/tkill.cpp
new file mode 100644
index 0000000000000..79310c7f26b52
--- /dev/null
+++ b/lldb/test/Shell/Register/Core/Inputs/tkill.cpp
@@ -0,0 +1,10 @@
+#include <sys/syscall.h>
+#include <signal.h>
+
+int main() {
+ // Get the current thread ID
+ pid_t tid = syscall(SYS_gettid);
+ // Send a SIGSEGV signal to the current thread
+ syscall(SYS_tkill, tid, SIGSEGV);
+ return 0;
+}
diff --git a/lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core b/lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core
new file mode 100644
index 0000000000000..3d1a05a34e7ca
Binary files /dev/null and b/lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core differ
diff --git a/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test b/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
new file mode 100644
index 0000000000000..240b1e9f8b2d6
--- /dev/null
+++ b/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
@@ -0,0 +1,6 @@
+# XFAIL: system-darwin
+# XFAIL: system-windows
+# RUN: %lldb -b -s %s -c %p/Inputs/x86-64-linux-tkill.test | FileCheck %s
+
+thread list
+# CHECK: * thread #1, name = 'tkill.out', stop reason = SIGSEGV: sent by tkill system call (sender pid=649752, uid=2667987)
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
b19ac1c
to
ac33700
Compare
ac33700
to
05f09fa
Compare
@@ -0,0 +1,10 @@ | |||
#include <signal.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The location of this test is under the "Register" directory, which looks like it is for testing things like register read
. Since this is not about examining registers can we find a more suitable location?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think it's weird. Strangely enough all the existing SIGINFO shell tests also live in this directory. I think it would lead to more confusion to break that, but it's a great refactoring opportunity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strangely enough all the existing SIGINFO shell tests also live in this directory
FWIW, I do see a command-thread-siginfo.test that lives outside this directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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.