X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=gdb-xds.go;h=22e13ed41d1bfe36610165c229a3d41fa61ea665;hb=4db1132c1cb1ffe1425b8ff5266f9f7220aeffe3;hp=bb8ad2fd00f38a1561d6fc4ec4d2e2573c0607a2;hpb=d743acaef6f5f79bdbcb6b8a876b51c967aa6855;p=src%2Fxds%2Fxds-gdb.git diff --git a/gdb-xds.go b/gdb-xds.go index bb8ad2f..22e13ed 100644 --- a/gdb-xds.go +++ b/gdb-xds.go @@ -76,6 +76,9 @@ func (g *GdbXds) SetConfig(name string, value interface{}) error { // Init initializes gdb XDS func (g *GdbXds) Init() (int, error) { + // Reset command ID (also used to enable sending of signals) + g.cmdID = "" + // Define HTTP and WS url baseURL := g.uri if !strings.HasPrefix(g.uri, "http://") { @@ -167,6 +170,7 @@ func (g *GdbXds) Close() error { g.cbOnExit = nil g.cbRead = nil g.cbInferiorRead = nil + g.cmdID = "" return nil } @@ -285,6 +289,10 @@ func (g *GdbXds) Write(args ...interface{}) error { // SendSignal is used to send a signal to remote process/gdb func (g *GdbXds) SendSignal(sig os.Signal) error { + if g.cmdID == "" { + return fmt.Errorf("cmdID not set") + } + var body []byte body, err := json.Marshal(apiv1.ExecSignalArgs{ CmdID: g.cmdID,