File tree Expand file tree Collapse file tree 3 files changed +21
-15
lines changed Expand file tree Collapse file tree 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(
21572157 Task* child = Task::os_clone (Task::SESSION_CLONE_LEADER, this , remote,
21582158 taskInfo.getRecTid (), taskInfo.getSerial (),
21592159 SIGCHLD, nullptr );
2160- cloned_leaders.push_back (( ReplayTask*) child);
2160+ cloned_leaders.push_back (static_cast < ReplayTask*>( child) );
21612161 }
21622162
21632163 auto clone_leader_index = 0 ;
2164-
2164+ LOG (debug) << " Restoring " << addr_spaces. size () << " clone leaders " ;
21652165 for (const auto & as : addr_spaces) {
21662166 ReplayTask* leader = cloned_leaders[clone_leader_index++];
21672167 const auto proc_space = as.getProcessSpace ();
@@ -2272,9 +2272,7 @@ void ReplaySession::load_checkpoint(
22722272 auto index = original_exe_name.rfind (' /' );
22732273 auto name = " rr:" + original_exe_name.substr (
22742274 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);
22782276 }
22792277
22802278 ASSERT (leader, scratch_mem != nullptr )
Original file line number Diff line number Diff line change @@ -2578,21 +2578,23 @@ Task::CapturedState Task::capture_state() {
25782578 return state;
25792579}
25802580
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+
25812592void Task::copy_state (const CapturedState& state) {
25822593 set_regs (state.regs );
25832594 set_extra_regs (state.extra_regs );
25842595 {
25852596 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 );
25962598
25972599 copy_tls (state, remote);
25982600 thread_areas_ = state.thread_areas ;
Original file line number Diff line number Diff line change @@ -1049,6 +1049,12 @@ class Task {
10491049 */
10501050 void forget ();
10511051
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+
10521058 // Used on aarch64 to detect whether we've recorded x0 and x8 on syscall entry
10531059 Ticks ticks_at_last_syscall_entry;
10541060 remote_code_ptr ip_at_last_syscall_entry;
You can’t perform that action at this time.
0 commit comments