Skip to content

Commit a009e7e

Browse files
timorocallahan
authored andcommitted
"info recording" command that gives the path to the recording
1 parent 39e5c18 commit a009e7e

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

src/DebuggerExtensionCommand.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "ReplayTask.h"
66
#include "TraceFrame.h"
77
#include "log.h"
8+
#include "util.h"
89

910
using namespace std;
1011

@@ -68,6 +69,17 @@ static SimpleDebuggerExtensionCommand when_tid(
6869
return string("Current tid: ") + to_string(t->tid);
6970
});
7071

72+
static SimpleDebuggerExtensionCommand info_recording(
73+
"info recording",
74+
"Print the path of the recording RR is"
75+
" currently replaying.",
76+
[](GdbServer&, Task* t, const vector<string>&) {
77+
auto task = static_cast<ReplayTask*>(t);
78+
auto trace_dir = task->session().as_replay()->trace_reader().dir();
79+
80+
return string("Path of recording: \"") + json_escape(trace_dir) + string("\"");
81+
});
82+
7183
static std::vector<ReplayTimeline::Mark> back_stack;
7284
static ReplayTimeline::Mark current_history_cp;
7385
static std::vector<ReplayTimeline::Mark> forward_stack;

src/test/info_recording.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from util import *
2+
3+
import re
4+
import json
5+
6+
send_gdb('info recording')
7+
expect_gdb(re.compile(r'(?<=Path of recording: ).*'))
8+
path_jsonstr = last_match().group(0)
9+
path_pystr = json.loads(path_jsonstr)
10+
11+
if len(path_pystr) < 6:
12+
failed("ERROR ... Unreasonably short path for recording file found in output")
13+
14+
# Inferior command also has the name of the binary at the end,
15+
# so the pattern matches opening but not closing paren.
16+
send_gdb("inferior")
17+
expect_gdb(f"\\({path_pystr}")
18+
19+
ok()

src/test/info_recording.run

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source `dirname $0`/util.sh
2+
record simple$bitness
3+
debug info_recording

0 commit comments

Comments
 (0)