diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-07-18 09:37:07 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-07-18 09:37:07 +0200 |
| commit | f53c0235fad462c4a1608b9ddfad4aeba7b26d72 (patch) | |
| tree | c2af40f9959c0bb222ac6cc9289423da5a844385 /pkg | |
| parent | 06616a2715795f640ba16b2b4ce18507e732091a (diff) | |
pkg/cover: fix objdump process hang
One instance we observed that objdump hanged due to stdout
pipe overflow due to panic in archCallInsn.
The reason for the original panic is still unclear,
but fix the objdump hang. We need to terminate objdump
and propagate the panic.
Also extend the panic messages.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/cover/report.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/cover/report.go b/pkg/cover/report.go index 1b182b73a..cc064001c 100644 --- a/pkg/cover/report.go +++ b/pkg/cover/report.go @@ -157,7 +157,10 @@ func (rg *ReportGenerator) readPCs() error { if err := cmd.Start(); err != nil { return fmt.Errorf("failed to run objdump on %v: %v", rg.vmlinux, err) } - defer cmd.Wait() + defer func() { + cmd.Process.Kill() + cmd.Wait() + }() s := bufio.NewScanner(stdout) callInsnS, traceFuncS := archCallInsn(rg.arch) callInsn, traceFunc := []byte(callInsnS), []byte(traceFuncS) @@ -310,7 +313,7 @@ func PreviousInstructionPC(arch string, pc uint64) uint64 { case "ppc64le": return pc - 4 default: - panic("unknown arch") + panic(fmt.Sprintf("unknown arch %q", arch)) } } @@ -333,7 +336,7 @@ func archCallInsn(arch string) (string, string) { // c00000000006d904: bl c000000000350780 <.__sanitizer_cov_trace_pc> return "\tbl ", " <.__sanitizer_cov_trace_pc>" default: - panic("unknown arch") + panic(fmt.Sprintf("unknown arch %q", arch)) } } |
