Skip to content

Commit

Permalink
no coverage bp if generating rip traces
Browse files Browse the repository at this point in the history
  • Loading branch information
0vercl0k committed May 21, 2024
1 parent f9d9fd0 commit 35c6e52
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/wtf/bochscpu_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1320,4 +1320,4 @@ void BochscpuBackend_t::DumpTenetDelta(const bool Force) {
if (NeedNewLine) {
fmt::print(TraceFile_, "\n");
}
}
}
13 changes: 8 additions & 5 deletions src/wtf/kvm_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,15 @@ bool KvmBackend_t::Initialize(const Options_t &Opts,
}

//
// Set the coverage breakpoints. Note that we
// need to do that after having set-up demand paging.
// Set the coverage breakpoints if we aren't in single step mode.
// Note that we need to do that after having set-up demand paging.
//

if (!SetCoverageBps()) {
fmt::print("Failed to SetCoverageBps\n");
return false;
if (Opts.Run.TraceType != TraceType_t::Rip) {
if (!SetCoverageBps()) {
fmt::print("Failed to SetCoverageBps\n");
return false;
}
}

//
Expand Down Expand Up @@ -2000,6 +2002,7 @@ bool KvmBackend_t::SetTraceFile(const fs::path &TestcaseTracePath,
}

bool KvmBackend_t::EnableSingleStep(CpuState_t &CpuState) {

//
// Turn on what we need to provide a rip trace:
// - Make sure SFMASK has the TF bit to 0 to not strip it on 'SYSCALL'
Expand Down
15 changes: 11 additions & 4 deletions src/wtf/whv_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,11 @@ bool WhvBackend_t::Initialize(const Options_t &Opts,
// we are simply fuzzing.
//

if (!SetCoverageBps()) {
fmt::print("Failed to SetCoverageBps\n");
return false;
if (Opts.Run.TraceType != TraceType_t::Rip) {
if (!SetCoverageBps()) {
fmt::print("Failed to SetCoverageBps\n");
return false;
}
}

//
Expand Down Expand Up @@ -1428,7 +1430,12 @@ bool WhvBackend_t::EnableSingleStep(CpuState_t &CpuState) {
// interrupts/exceptions.
//

return BreakOnIDTEntries(*this, CpuState);
if (!BreakOnIDTEntries(*this, CpuState)) {
fmt::print("Failed to BreakOnIDTEntries\n");
return false;
}

return true;
}

uint64_t WhvBackend_t::GetReg(const Registers_t Reg) const {
Expand Down

0 comments on commit 35c6e52

Please sign in to comment.