Skip to content

Commit

Permalink
Add some logging when we emulate gettid/getpid.
Browse files Browse the repository at this point in the history
  • Loading branch information
khuey committed Mar 29, 2021
1 parent 0bc6138 commit db2dcd1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/DiversionSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,19 @@ static void process_syscall_arch(Task* t, int syscallno) {
}

case Arch::gettid: {
auto tid = t->own_namespace_tid();
LOG(debug) << "Emulating gettid with " << tid;
Registers r = t->regs();
r.set_syscall_result(t->own_namespace_tid());
r.set_syscall_result(tid);
t->set_regs(r);
return;
}

case Arch::getpid: {
auto pid = t->thread_group()->tgid_own_namespace;
LOG(debug) << "Emulating getpid with " << pid;
Registers r = t->regs();
r.set_syscall_result(t->thread_group()->tgid_own_namespace);
r.set_syscall_result(pid);
t->set_regs(r);
return;
}
Expand Down

0 comments on commit db2dcd1

Please sign in to comment.