mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste.
Herald added a subscriber: arichardson.
Herald added a project: All.
mgorny requested review of this revision.

Sponsored by: The FreeBSD Foundation


https://reviews.llvm.org/D126615

Files:
  lldb/test/Shell/Process/Inputs/signal.c
  lldb/test/Shell/Process/TestNonStop.test


Index: lldb/test/Shell/Process/TestNonStop.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/Process/TestNonStop.test
@@ -0,0 +1,30 @@
+# UNSUPPORTED: lldb-repro
+# REQUIRES: native
+# RUN: %clang_host %p/Inputs/signal.c -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+settings set plugin.process.gdb-remote.use-non-stop-protocol true
+log enable gdb-remote packets
+process launch
+
+# CHECK:      lldb             <  14> send packet: $QNonStop:1#8d
+# CHECK-NEXT: lldb             <   6> read packet: $OK#9a
+
+# CHECK:      b-remote.async>  <   5> send packet: $c#63
+# CHECK-NEXT: b-remote.async>  <   6> read packet: $OK#9a
+# CHECK-NEXT: b-remote.async>  <{{[ 0-9]+}}> read packet: %Stop:T{{.*}}
+# CHECK-NEXT: b-remote.async>  <  12> send packet: $vStopped#55
+# CHECK-NEXT: b-remote.async>  <   6> read packet: $OK#9a
+# CHECK-NEXT: b-remote.async>  <  10> send packet: $vCtrlC#4e
+# CHECK-NEXT: b-remote.async>  <   6> read packet: $OK#9a
+
+# CHECK:      * thread #1, name = '{{.*}}', stop reason = signal SIGINT
+
+process continue
+
+# CHECK:      b-remote.async>  <   5> send packet: $c#63
+# CHECK-NEXT: b-remote.async>  <   6> read packet: $OK#9a
+# CHECK-NEXT: b-remote.async>  <  12> read packet: %Stop:W2a#ea
+# CHECK-NEXT: b-remote.async>  <  12> send packet: $vStopped#55
+# CHECK-NEXT: b-remote.async>  <   6> read packet: $OK#9a
+
+# CHECK:      Process {{[0-9]+}} exited with status = 42 (0x0000002a)
Index: lldb/test/Shell/Process/Inputs/signal.c
===================================================================
--- /dev/null
+++ lldb/test/Shell/Process/Inputs/signal.c
@@ -0,0 +1,13 @@
+#include <assert.h>
+#include <signal.h>
+#include <stdio.h>
+
+void handler() {
+  printf("got SIGINT\n");
+}
+
+int main() {
+  assert(signal(SIGINT, handler) != SIG_ERR);
+  raise(SIGINT);
+  return 42;
+}


Index: lldb/test/Shell/Process/TestNonStop.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/Process/TestNonStop.test
@@ -0,0 +1,30 @@
+# UNSUPPORTED: lldb-repro
+# REQUIRES: native
+# RUN: %clang_host %p/Inputs/signal.c -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+settings set plugin.process.gdb-remote.use-non-stop-protocol true
+log enable gdb-remote packets
+process launch
+
+# CHECK:      lldb             <  14> send packet: $QNonStop:1#8d
+# CHECK-NEXT: lldb             <   6> read packet: $OK#9a
+
+# CHECK:      b-remote.async>  <   5> send packet: $c#63
+# CHECK-NEXT: b-remote.async>  <   6> read packet: $OK#9a
+# CHECK-NEXT: b-remote.async>  <{{[ 0-9]+}}> read packet: %Stop:T{{.*}}
+# CHECK-NEXT: b-remote.async>  <  12> send packet: $vStopped#55
+# CHECK-NEXT: b-remote.async>  <   6> read packet: $OK#9a
+# CHECK-NEXT: b-remote.async>  <  10> send packet: $vCtrlC#4e
+# CHECK-NEXT: b-remote.async>  <   6> read packet: $OK#9a
+
+# CHECK:      * thread #1, name = '{{.*}}', stop reason = signal SIGINT
+
+process continue
+
+# CHECK:      b-remote.async>  <   5> send packet: $c#63
+# CHECK-NEXT: b-remote.async>  <   6> read packet: $OK#9a
+# CHECK-NEXT: b-remote.async>  <  12> read packet: %Stop:W2a#ea
+# CHECK-NEXT: b-remote.async>  <  12> send packet: $vStopped#55
+# CHECK-NEXT: b-remote.async>  <   6> read packet: $OK#9a
+
+# CHECK:      Process {{[0-9]+}} exited with status = 42 (0x0000002a)
Index: lldb/test/Shell/Process/Inputs/signal.c
===================================================================
--- /dev/null
+++ lldb/test/Shell/Process/Inputs/signal.c
@@ -0,0 +1,13 @@
+#include <assert.h>
+#include <signal.h>
+#include <stdio.h>
+
+void handler() {
+  printf("got SIGINT\n");
+}
+
+int main() {
+  assert(signal(SIGINT, handler) != SIG_ERR);
+  raise(SIGINT);
+  return 42;
+}
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to