[Lldb-commits] [PATCH] D134037: [lldb] Fix CommandInterpreter::DidProcessStopAbnormally() with multiple threads
Martin Storsjö via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 26 01:07:06 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8a3597d73c8f: [lldb] Fix CommandInterpreter::DidProcessStopAbnormally() with multiple threads (authored by mstorsjo).
Changed prior to commit:
https://reviews.llvm.org/D134037?vs=462454&id=462836#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134037/new/
https://reviews.llvm.org/D134037
Files:
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/test/Shell/Driver/CommandOnCrashMultiThreaded.test
lldb/test/Shell/Driver/Inputs/CommandOnCrashMultiThreaded.cpp
Index: lldb/test/Shell/Driver/Inputs/CommandOnCrashMultiThreaded.cpp
===================================================================
--- /dev/null
+++ lldb/test/Shell/Driver/Inputs/CommandOnCrashMultiThreaded.cpp
@@ -0,0 +1,13 @@
+#include <thread>
+
+void t_func() {
+ asm volatile(
+ "int3\n\t"
+ );
+}
+
+int main() {
+ std::thread t(t_func);
+ t.join();
+ return 0;
+}
Index: lldb/test/Shell/Driver/CommandOnCrashMultiThreaded.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/Driver/CommandOnCrashMultiThreaded.test
@@ -0,0 +1,5 @@
+# REQUIRES: native && (target-x86 || target-x86_64)
+# RUN: %clangxx_host %p/Inputs/CommandOnCrashMultiThreaded.cpp -o %t -pthread
+# RUN: %lldb -b -o "process launch" -k "process continue" -k "exit" %t | FileCheck %s
+
+# CHECK: Process {{[0-9]+}} exited with status = 0
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2471,8 +2471,12 @@
for (const auto &thread_sp : process_sp->GetThreadList().Threads()) {
StopInfoSP stop_info = thread_sp->GetStopInfo();
- if (!stop_info)
- return false;
+ if (!stop_info) {
+ // If there's no stop_info, keep iterating through the other threads;
+ // it's enough that any thread has got a stop_info that indicates
+ // an abnormal stop, to consider the process to be stopped abnormally.
+ continue;
+ }
const StopReason reason = stop_info->GetStopReason();
if (reason == eStopReasonException ||
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134037.462836.patch
Type: text/x-patch
Size: 1676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220926/807481cf/attachment-0001.bin>
More information about the lldb-commits
mailing list