Skip to content

Commit 110afcd

Browse files
committed
"info recording" command that gives the path to the recording
1 parent fb97ee8 commit 110afcd

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
@@ -4,6 +4,7 @@
44

55
#include "ReplayTask.h"
66
#include "log.h"
7+
#include "util.h"
78

89
using namespace std;
910

@@ -56,6 +57,17 @@ static SimpleDebuggerExtensionCommand when_tid(
5657
return string("Current tid: ") + to_string(t->tid);
5758
});
5859

60+
static SimpleDebuggerExtensionCommand info_recording(
61+
"info recording",
62+
"Print the path of the recording RR is"
63+
" currently replaying.",
64+
[](GdbServer&, Task* t, const vector<string>&) {
65+
auto task = static_cast<ReplayTask*>(t);
66+
auto trace_dir = task->session().as_replay()->trace_reader().dir();
67+
68+
return string("Path of recording: \"") + json_escape(trace_dir) + string("\"");
69+
});
70+
5971
static std::vector<ReplayTimeline::Mark> back_stack;
6072
static ReplayTimeline::Mark current_history_cp;
6173
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)