diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-08-30 18:29:00 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-08-30 18:29:00 +0200 |
commit | 662dd0f910150228ba93096d77637f697c2c3ed7 (patch) | |
tree | e1682766912b5bc074ca2c1040ce55d3b89b3f94 /gdb-xds.go | |
parent | cfe84507a37a65efcb22e7abe3247b4c7704d0a8 (diff) |
Don't try to send signal while gdb is not started.
Diffstat (limited to 'gdb-xds.go')
-rw-r--r-- | gdb-xds.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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, |