[Lldb-commits] [PATCH] D122176: [trace] clear any existing tracing sessions before relaunching the binary

Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 21 16:03:52 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa80c6c7d36d2: [trace] clear any existing tracing sessions before relaunching the binary (authored by Walter Erquinigo <wallace at fb.com>).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122176/new/

https://reviews.llvm.org/D122176

Files:
  lldb/source/Target/Target.cpp
  lldb/test/API/commands/trace/TestTraceStartStop.py


Index: lldb/test/API/commands/trace/TestTraceStartStop.py
===================================================================
--- lldb/test/API/commands/trace/TestTraceStartStop.py
+++ lldb/test/API/commands/trace/TestTraceStartStop.py
@@ -166,3 +166,16 @@
 
         self.expect("thread trace stop", error=True,
             substrs=["error: Process must be launched"])
+
+        # We should be able to trace the program if we relaunch it
+        # For this, we'll trace starting at a different point in the new
+        # process.
+        self.expect("breakpoint disable")
+        self.expect("b main.cpp:4")
+        self.expect("r")
+        self.expect("thread trace start")
+        # We can reconstruct the single instruction executed in the first line
+        self.expect("si")
+        self.expect("thread trace dump instructions -c 1",
+            patterns=[f'''thread #1: tid = .*
+  a.out`main \+ 11 at main.cpp:4'''])
Index: lldb/source/Target/Target.cpp
===================================================================
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -185,6 +185,8 @@
 
 void Target::DeleteCurrentProcess() {
   if (m_process_sp) {
+    // We dispose any active tracing sessions on the current process
+    m_trace_sp.reset();
     m_section_load_history.Clear();
     if (m_process_sp->IsAlive())
       m_process_sp->Destroy(false);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122176.417127.patch
Type: text/x-patch
Size: 1397 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220321/d990a1d0/attachment-0001.bin>


More information about the lldb-commits mailing list