service,terminal: when libraries don't have debug_info print reason (#3419)

Print the reason why libraries don't have debug info in response to the
'libraries' command.
This commit is contained in:
Alessandro Arzilli
2023-06-15 17:00:59 +02:00
committed by GitHub
parent d006538bb6
commit 95dac8f19b
3 changed files with 12 additions and 3 deletions

View File

@ -2547,6 +2547,9 @@ func libraries(t *Term, ctx callContext, args string) error {
d := digits(len(libs))
for i := range libs {
fmt.Fprintf(t.stdout, "%"+strconv.Itoa(d)+"d. %#x %s\n", i, libs[i].Address, libs[i].Path)
if libs[i].LoadError != "" {
fmt.Fprintf(t.stdout, " Load error: %s", libs[i].LoadError)
}
}
return nil
}

View File

@ -431,7 +431,12 @@ func ConvertRegisters(in *op.DwarfRegisters, dwarfRegisterToString func(int, *op
// ConvertImage converts proc.Image to api.Image.
func ConvertImage(image *proc.Image) Image {
return Image{Path: image.Path, Address: image.StaticBase}
err := image.LoadError()
lerr := ""
if err != nil {
lerr = err.Error()
}
return Image{Path: image.Path, Address: image.StaticBase, LoadError: lerr}
}
// ConvertDumpState converts proc.DumpState to api.DumpState.

View File

@ -571,8 +571,9 @@ type Checkpoint struct {
// Image represents a loaded shared object (go plugin or shared library)
type Image struct {
Path string
Address uint64
Path string
Address uint64
LoadError string
}
// Ancestor represents a goroutine ancestor