File tree 3 files changed +21
-15
lines changed
3 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -2157,11 +2157,11 @@ void ReplaySession::load_checkpoint(
2157
2157
Task* child = Task::os_clone (Task::SESSION_CLONE_LEADER, this , remote,
2158
2158
taskInfo.getRecTid (), taskInfo.getSerial (),
2159
2159
SIGCHLD, nullptr );
2160
- cloned_leaders.push_back (( ReplayTask*) child);
2160
+ cloned_leaders.push_back (static_cast < ReplayTask*>( child) );
2161
2161
}
2162
2162
2163
2163
auto clone_leader_index = 0 ;
2164
-
2164
+ LOG (debug) << " Restoring " << addr_spaces. size () << " clone leaders " ;
2165
2165
for (const auto & as : addr_spaces) {
2166
2166
ReplayTask* leader = cloned_leaders[clone_leader_index++];
2167
2167
const auto proc_space = as.getProcessSpace ();
@@ -2272,9 +2272,7 @@ void ReplaySession::load_checkpoint(
2272
2272
auto index = original_exe_name.rfind (' /' );
2273
2273
auto name = " rr:" + original_exe_name.substr (
2274
2274
index == std::string::npos ? 0 : index + 1 );
2275
- AutoRestoreMem mem (remote, name.c_str ());
2276
- remote.infallible_syscall (syscall_number_for_prctl (leader->arch ()),
2277
- PR_SET_NAME, mem.get ());
2275
+ leader->set_name (remote, name);
2278
2276
}
2279
2277
2280
2278
ASSERT (leader, scratch_mem != nullptr )
Original file line number Diff line number Diff line change @@ -2578,21 +2578,23 @@ Task::CapturedState Task::capture_state() {
2578
2578
return state;
2579
2579
}
2580
2580
2581
+ void Task::set_name (AutoRemoteSyscalls& remote, const std::string& name) {
2582
+ char prname[17 ];
2583
+ strncpy (prname, name.c_str (), sizeof (prname));
2584
+ prname[16 ] = 0 ;
2585
+ AutoRestoreMem remote_prname (remote, (const uint8_t *)prname, 16 );
2586
+ LOG (debug) << " setting name to " << prname;
2587
+ remote.infallible_syscall (syscall_number_for_prctl (arch ()), PR_SET_NAME,
2588
+ remote_prname.get ().as_int ());
2589
+ this ->prname = name;
2590
+ }
2591
+
2581
2592
void Task::copy_state (const CapturedState& state) {
2582
2593
set_regs (state.regs );
2583
2594
set_extra_regs (state.extra_regs );
2584
2595
{
2585
2596
AutoRemoteSyscalls remote (this );
2586
- {
2587
- char prname[17 ];
2588
- strncpy (prname, state.prname .c_str (), sizeof (prname));
2589
- prname[16 ] = 0 ;
2590
- AutoRestoreMem remote_prname (remote, (const uint8_t *)prname, 16 );
2591
- LOG (debug) << " setting name to " << prname;
2592
- remote.infallible_syscall (syscall_number_for_prctl (arch ()), PR_SET_NAME,
2593
- remote_prname.get ().as_int ());
2594
- update_prname (remote_prname.get ());
2595
- }
2597
+ set_name (remote, state.prname );
2596
2598
2597
2599
copy_tls (state, remote);
2598
2600
thread_areas_ = state.thread_areas ;
Original file line number Diff line number Diff line change @@ -1049,6 +1049,12 @@ class Task {
1049
1049
*/
1050
1050
void forget ();
1051
1051
1052
+ /* *
1053
+ * Sets the OS-name of this task by injecting system call for PR_SET_NAME.
1054
+ * Also updates |prname| to |name|.
1055
+ */
1056
+ void set_name (AutoRemoteSyscalls& remote_syscalls, const std::string& name);
1057
+
1052
1058
// Used on aarch64 to detect whether we've recorded x0 and x8 on syscall entry
1053
1059
Ticks ticks_at_last_syscall_entry;
1054
1060
remote_code_ptr ip_at_last_syscall_entry;
You can’t perform that action at this time.
0 commit comments