summaryrefslogtreecommitdiffstats
path: root/gdb-xds.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-12-12 10:15:23 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-12-12 10:15:23 +0100
commit273743466fa39a14bf7abf73f30427406684f3d3 (patch)
treedfdc7f8bcaddcaf69534f4b16052944767a7feb5 /gdb-xds.go
parent752d0492fa653f8485f38b9f6d9a60a3145fd119 (diff)
Fixed crash on xds-agent or server disconnection (IOT-108)
Diffstat (limited to 'gdb-xds.go')
-rw-r--r--gdb-xds.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb-xds.go b/gdb-xds.go
index 406e4c6..15f8b6d 100644
--- a/gdb-xds.go
+++ b/gdb-xds.go
@@ -255,6 +255,25 @@ func (g *GdbXds) Init() (int, error) {
}
})
+ // Monitor XDS server configuration changes (and specifically connected status)
+ iosk.On(xaapiv1.EVTServerConfig, func(ev xaapiv1.EventMsg) {
+ svrCfg, err := ev.DecodeServerCfg()
+ if err == nil && !svrCfg.Connected {
+ // TODO: should wait that server will be connected back
+ if g.cbOnExit != nil {
+ g.cbOnExit(-1, fmt.Errorf("XDS Server disconnected"))
+ } else {
+ fmt.Printf("XDS Server disconnected")
+ os.Exit(-1)
+ }
+ }
+ })
+
+ args := xaapiv1.EventRegisterArgs{Name: xaapiv1.EVTServerConfig}
+ if err := g.httpCli.Post("/events/register", args, nil); err != nil {
+ return 0, err
+ }
+
return 0, nil
}
@@ -304,6 +323,11 @@ func (g *GdbXds) Start(inferiorTTY bool) (int, error) {
// except if XDS_GDBSERVER_OUTPUT_NOFIX is defined
_, gdbserverNoFix := os.LookupEnv("XDS_GDBSERVER_OUTPUT_NOFIX")
+ // SDK ID must be set else $GDB cannot be resolved
+ if g.sdkID == "" {
+ return int(syscall.EINVAL), fmt.Errorf("sdkid must be set")
+ }
+
args := xaapiv1.ExecArgs{
ID: g.prjID,
SdkID: g.sdkID,