service: add backend to GetVersion response (#1641)

Implements #1640
This commit is contained in:
Alessandro Arzilli 2019-07-28 01:44:48 +02:00 committed by Derek Parker
parent 7bcb9ace88
commit dc3fca3f7b
3 changed files with 23 additions and 1 deletions

@ -415,6 +415,7 @@ type GetVersionIn struct {
type GetVersionOut struct {
DelveVersion string
APIVersion int
Backend string // backend currently in use
}
// SetAPIVersionIn is the input for SetAPIVersion.

@ -1207,6 +1207,27 @@ func (d *Debugger) ListDynamicLibraries() []api.Image {
return r
}
func (d *Debugger) GetVersion(out *api.GetVersionOut) error {
if d.config.CoreFile != "" {
if d.config.Backend == "rr" {
out.Backend = "rr"
} else {
out.Backend = "core"
}
} else {
if d.config.Backend == "default" {
if runtime.GOOS == "darwin" {
out.Backend = "lldb"
} else {
out.Backend = "native"
}
} else {
out.Backend = d.config.Backend
}
}
return nil
}
func go11DecodeErrorCheck(err error) error {
if _, isdecodeerr := err.(dwarf.DecodeError); !isdecodeerr {
return err

@ -387,7 +387,7 @@ func (cb *RPCCallback) Return(out interface{}, err error) {
func (s *RPCServer) GetVersion(args api.GetVersionIn, out *api.GetVersionOut) error {
out.DelveVersion = version.DelveVersion.String()
out.APIVersion = s.s.config.APIVersion
return nil
return s.s.debugger.GetVersion(out)
}
// Changes version of the API being served.