mirror of
https://github.com/go-delve/delve.git
synced 2025-11-02 04:36:29 +08:00
Handle missing line info in printcontext
This commit is contained in:
committed by
Derek Parker
parent
03b5e30bfb
commit
2ce51ab92f
@ -239,8 +239,9 @@ func printcontext(p *proctl.DebuggedProcess) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
f, l, _ := p.GoSymTable.PCToLine(regs.PC())
|
f, l, fn := p.GoSymTable.PCToLine(regs.PC())
|
||||||
|
|
||||||
|
if fn != nil {
|
||||||
fmt.Printf("Stopped at: %s:%d\n", f, l)
|
fmt.Printf("Stopped at: %s:%d\n", f, l)
|
||||||
file, err := os.Open(f)
|
file, err := os.Open(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -274,6 +275,10 @@ func printcontext(p *proctl.DebuggedProcess) error {
|
|||||||
|
|
||||||
context = append(context, fmt.Sprintf("\033[34m%d\033[0m: %s", i, line))
|
context = append(context, fmt.Sprintf("\033[34m%d\033[0m: %s", i, line))
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Printf("Stopped at: 0x%x\n", regs.PC())
|
||||||
|
context = append(context, "\033[34m=>\033[0m no source available")
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Println(strings.Join(context, ""))
|
fmt.Println(strings.Join(context, ""))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user