+
+ // XXX - Workaround due to gdbserver bug that doesn't redirect
+ // inferior output (https://bugs.eclipse.org/bugs/show_bug.cgi?id=437532#c13)
+ if gdbServerTTY == "workaround" && len(stdout) > 1 && stdout[0] == '&' {
+
+ // Extract and cleanup string like &"bla bla\n"
+ re := regexp.MustCompile("&\"(.*)\"")
+ rer := re.FindAllStringSubmatch(stdout, -1)
+ out := ""
+ if rer != nil && len(rer) > 0 {
+ for _, o := range rer {
+ if len(o) >= 1 {
+ out = strings.Replace(o[1], "\\n", "\n", -1)
+ out = strings.Replace(out, "\\r", "\r", -1)
+ out = strings.Replace(out, "\\t", "\t", -1)
+
+ s.log.Debugf("STDOUT INFERIOR: <<%v>>", out)
+ err := (*so).Emit(ExecInferiorOutEvent, ExecOutMsg{
+ CmdID: e.CmdID,
+ Timestamp: time.Now().String(),
+ Stdout: out,
+ Stderr: "",
+ })
+ if err != nil {
+ s.log.Errorf("WS Emit : %v", err)
+ }
+ }
+ }
+ } else {
+ s.log.Errorf("INFERIOR out parsing error: stdout=<%v>", stdout)
+ }
+ }