Skip to content

Commit f147ac3

Browse files
authored
pkg/proc: guard register logging from nil pointer dereferences (#4188)
If we can't read a thread's registers don't try to print them. Fixes #4187
1 parent 1f5252d commit f147ac3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/proc/target_exec.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ func (grp *TargetGroup) Continue() error {
168168
log.Debugf("callInjection protocol on:")
169169
for _, th := range threads {
170170
regs, _ := th.Registers()
171-
log.Debugf("\t%d PC=%#x", th.ThreadID(), regs.PC())
171+
if regs != nil {
172+
log.Debugf("\t%d PC=%#x", th.ThreadID(), regs.PC())
173+
} else {
174+
log.Debugf("\t%d (no registers)", th.ThreadID())
175+
}
172176
}
173177
}
174178
callInjectionDoneThis, callErrThis := callInjectionProtocol(dbp, trapthread, threads)

0 commit comments

Comments
 (0)