Refactor: condense code for looking at current fn

This commit is contained in:
Derek Parker
2015-07-10 15:42:09 -05:00
parent 53fc891157
commit b31575b54c

View File

@ -386,13 +386,12 @@ func (dbp *Process) Continue() error {
if dbp.CurrentThread != thread { if dbp.CurrentThread != thread {
dbp.SwitchThread(thread.Id) dbp.SwitchThread(thread.Id)
} }
pc, err := thread.PC() loc, err := thread.Location()
if err != nil { if err != nil {
return err return err
} }
// Check to see if we hit a runtime.breakpoint // Check to see if we hit a runtime.breakpoint
fn := dbp.goSymTable.PCToFunc(pc) if loc.Fn != nil && loc.Fn.Name == "runtime.breakpoint" {
if fn != nil && fn.Name == "runtime.breakpoint" {
// step twice to get back to user code // step twice to get back to user code
for i := 0; i < 2; i++ { for i := 0; i < 2; i++ {
if err = thread.Step(); err != nil { if err = thread.Step(); err != nil {