mirror of
https://github.com/go-delve/delve.git
synced 2025-10-28 04:35:19 +08:00
proc: additional checks parsing g structs (#4140)
The fields of the sched structure could be unreadable if what we are parsing isn't a real G struct. Fixes #4138
This commit is contained in:
committed by
GitHub
parent
d390fc62a2
commit
992c46c1b3
@ -898,9 +898,18 @@ func (v *Variable) parseG() (*G, error) {
|
||||
if schedVar == nil {
|
||||
return nil, ErrUnreadableG
|
||||
}
|
||||
pc, _ := constant.Int64Val(schedVar.fieldVariable("pc").Value) // +rtype uintptr
|
||||
sp, _ := constant.Int64Val(schedVar.fieldVariable("sp").Value) // +rtype uintptr
|
||||
var bp, lr int64
|
||||
|
||||
var pc, sp, bp, lr int64
|
||||
if pcvar := schedVar.fieldVariable("pc"); /* +rtype uintptr */ pcvar != nil && pcvar.Value != nil {
|
||||
pc, _ = constant.Int64Val(pcvar.Value)
|
||||
} else {
|
||||
return nil, ErrUnreadableG
|
||||
}
|
||||
if spvar := schedVar.fieldVariable("sp"); /* +rtype uintptr */ spvar != nil && spvar.Value != nil {
|
||||
sp, _ = constant.Int64Val(spvar.Value)
|
||||
} else {
|
||||
return nil, ErrUnreadableG
|
||||
}
|
||||
if bpvar := schedVar.fieldVariable("bp"); /* +rtype -opt uintptr */ bpvar != nil && bpvar.Value != nil {
|
||||
bp, _ = constant.Int64Val(bpvar.Value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user