Skip to content

Commit c40b2e6

Browse files
authored
Add child process tracing support to TTD recording (#838)
1 parent 6c85b99 commit c40b2e6

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

docs/guide/dbgeng-ttd.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ all types of recording supported by WinDbg (e.g., attach to a running process an
6565
- Working Directory: the working directory to launch the executable in
6666
- Command Line Arguments: the command line arguments to pass to the executable
6767
- Trace Output Directory: the directory to write the trace. By default, it is equal to the working directory, but can be changed if necessary
68+
- Start application With Recording Off: if checked, starts the application with tracing disabled initially (useful for manual tracing control)
69+
- Trace Child Processes: if checked, includes child processes spawned by the main process in the trace recording
6870
- Click "Record". A UAC dialog will pop up to because the TTD recording requires Administrator privilege
6971
- Accept the elevation. The program will be launched and recorded. Once it exits, find the trace file in the trace output directory
7072

ui/ttdrecord.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ TTDRecordDialog::TTDRecordDialog(QWidget* parent, BinaryView* data) :
4343
m_workingDirectoryEntry = new QLineEdit(this);
4444
m_outputDirectory = new QLineEdit(this);
4545
m_launchWithoutTracing = new QCheckBox(this);
46+
m_traceChildProcesses = new QCheckBox(this);
4647

4748
auto* pathSelector = new QPushButton("...", this);
4849
pathSelector->setMaximumWidth(30);
@@ -82,6 +83,16 @@ TTDRecordDialog::TTDRecordDialog(QWidget* parent, BinaryView* data) :
8283
outputLayout->addWidget(m_outputDirectory);
8384
outputLayout->addWidget(outputDirSelector);
8485

86+
auto launchWithoutTracingLayout = new QHBoxLayout;
87+
launchWithoutTracingLayout->addWidget(m_launchWithoutTracing);
88+
launchWithoutTracingLayout->addWidget(new QLabel("Start application With Recording Off"));
89+
launchWithoutTracingLayout->addStretch();
90+
91+
auto traceChildProcessesLayout = new QHBoxLayout;
92+
traceChildProcessesLayout->addWidget(m_traceChildProcesses);
93+
traceChildProcessesLayout->addWidget(new QLabel("Trace Child Processes"));
94+
traceChildProcessesLayout->addStretch();
95+
8596
QVBoxLayout* contentLayout = new QVBoxLayout;
8697
contentLayout->setSpacing(10);
8798
contentLayout->addWidget(new QLabel("Executable Path"));
@@ -92,8 +103,8 @@ TTDRecordDialog::TTDRecordDialog(QWidget* parent, BinaryView* data) :
92103
contentLayout->addWidget(m_argumentsEntry);
93104
contentLayout->addWidget(new QLabel("Trace Output Directory"));
94105
contentLayout->addLayout(outputLayout);
95-
contentLayout->addWidget(new QLabel("Start application With Recording Off"));
96-
contentLayout->addWidget(m_launchWithoutTracing);
106+
contentLayout->addLayout(launchWithoutTracingLayout);
107+
contentLayout->addLayout(traceChildProcessesLayout);
97108

98109
QHBoxLayout* buttonLayout = new QHBoxLayout;
99110
buttonLayout->setContentsMargins(0, 0, 0, 0);
@@ -122,6 +133,7 @@ TTDRecordDialog::TTDRecordDialog(QWidget* parent, BinaryView* data) :
122133
m_outputDirectory->setText(QString::fromStdString(m_controller->GetWorkingDirectory()));
123134
}
124135
m_launchWithoutTracing->setChecked(false);
136+
m_traceChildProcesses->setChecked(false);
125137

126138
setFixedSize(QDialog::sizeHint());
127139

@@ -197,9 +209,10 @@ void TTDRecordDialog::DoTTDTrace()
197209
LogDebug("TTD Recorder in path %s", ttdPath.c_str());
198210

199211
auto ttdRecorder = fmt::format("\"{}\\TTD.exe\"", ttdPath);
200-
auto ttdCommandLine = fmt::format("-accepteula -out \"{}\" {} -launch \"{}\" {}",
212+
auto ttdCommandLine = fmt::format("-accepteula -out \"{}\" {} {} -launch \"{}\" {}",
201213
m_outputDirectory->text().toStdString(),
202214
m_launchWithoutTracing->isChecked() ? "-tracingOff -recordMode Manual" : "",
215+
m_traceChildProcesses->isChecked() ? "-children" : "",
203216
m_pathEntry->text().toStdString(),
204217
m_argumentsEntry->text().toStdString());
205218
LogWarn("TTD tracer cmd: %s %s", ttdRecorder.c_str(), ttdCommandLine.c_str());

ui/ttdrecord.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class TTDRecordDialog : public QDialog
4141
QLineEdit* m_argumentsEntry;
4242
QLineEdit* m_outputDirectory;
4343
QCheckBox* m_launchWithoutTracing;
44+
QCheckBox* m_traceChildProcesses;
4445

4546
public:
4647
TTDRecordDialog(QWidget* parent, BinaryView* data);

0 commit comments

Comments
 (0)