Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
make missing symbols for coverage tasks more explicit (#554)
Browse files Browse the repository at this point in the history
This moves from:

```
"Error: coverage extraction from C:\users\bcaswell\projects\bugs\andrew-coverage-fail\setup\oft-setup-5c77cfe1b181520ab0b33a16286a690a\fuzz.exe failed when processing file "11f6ad8ec52a2984abaafd7c3b516503785c2072".  target appears to be missing sancov instrumentation",
```

To even more explicit:
```
Error: Target appears to be missing sancov instrumentation.  This error can happen due to missing coverage symbols.
target_exe: C:\users\bcaswell\projects\bugs\andrew-coverage-fail\setup\oft-setup-5c77cfe1b181520ab0b33a16286a690a\fuzz.exe
input: "11f6ad8ec52a2984abaafd7c3b516503785c2072"
debugger stdout:
...
[+] disabling sympath
[+] processing fuzz.exe
[+] no tables  fuzz.exe
[+] processing C:\WINDOWS\SYSTEM32\kernel.appcore.dll
[+] no tables  C:\WINDOWS\SYSTEM32\kernel.appcore.dll
[+] processing C:\WINDOWS\System32\KERNELBASE.dll
[+] no tables  C:\WINDOWS\System32\KERNELBASE.dll
[+] processing C:\WINDOWS\System32\RPCRT4.dll
[+] no tables  C:\WINDOWS\System32\RPCRT4.dll
[+] processing C:\WINDOWS\System32\msvcrt.dll
[+] no tables  C:\WINDOWS\System32\msvcrt.dll
[+] processing C:\WINDOWS\System32\KERNEL32.DLL
[+] no tables  C:\WINDOWS\System32\KERNEL32.DLL
[+] processing ntdll.dll
[+] no tables  ntdll.dll
Error: unable to find sancov counter symbols [at DumpCounters (line 114 col 9)]
...
```
  • Loading branch information
bmc-msft authored Feb 17, 2021
1 parent ce47e49 commit 89d7f06
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions src/agent/onefuzz-agent/src/tasks/coverage/recorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ pub struct CoverageRecorder {
script_dir: OwnedDir,
}

const SYMBOL_EXTRACT_ERROR: &str = "Target appears to be missing sancov instrumentation. This error can also happen if symbols for the target are not available.";

impl CoverageRecorder {
pub fn new(config: Arc<Config>) -> Self {
let script_dir =
Expand Down Expand Up @@ -57,28 +59,19 @@ impl CoverageRecorder {
let script = self.invoke_debugger_script(test_input, &coverage_path)?;
let output = script.wait_with_output().await?;

let stdout = String::from_utf8_lossy(&output.stdout);
let stderr = String::from_utf8_lossy(&output.stderr);

if !output.status.success() {
let err = format_err!("coverage recording failed: {}", output.status);
error!("{}", err);
error!(
"recording stderr: {}",
String::from_utf8_lossy(&output.stderr)
);
error!(
"recording stdout: {}",
String::from_utf8_lossy(&output.stdout)
);
error!("recording stderr: {}", stderr);
error!("recording stdout: {}", stdout);

return Err(err);
} else {
debug!(
"recording stderr: {}",
String::from_utf8_lossy(&output.stderr)
);
debug!(
"recording stdout: {}",
String::from_utf8_lossy(&output.stdout)
);
debug!("recording stderr: {}", stderr);
debug!("recording stdout: {}", stdout);
}

if !has_files(&coverage_path).await? {
Expand All @@ -96,9 +89,12 @@ impl CoverageRecorder {
.ok_or_else(|| format_err!("unable to identify coverage input filename"))?;

bail!(
"coverage extraction from {} failed when processing file {:?}. target appears to be missing sancov instrumentation",
"{}\ntarget_exe: {}\ninput: {:?}\ndebugger stdout: {}\ndebugger stderr: {}",
SYMBOL_EXTRACT_ERROR,
self.config.target_exe.display(),
filename
filename,
stdout,
stderr
);
}

Expand Down

0 comments on commit 89d7f06

Please sign in to comment.