)]}'
{
  "commit": "e8b4efc3cf3d5d2c475b3e5c31439aa5bcd277ae",
  "tree": "cde343eebe528f816ddecd6469bdd9d3d4634047",
  "parents": [
    "13cd9508afbe7435b562f75e2440e74ae1747fd3"
  ],
  "author": {
    "name": "Tom Tromey",
    "email": "tromey@adacore.com",
    "time": "Thu Jan 06 08:42:49 2022 -0700"
  },
  "committer": {
    "name": "Tom Tromey",
    "email": "tromey@adacore.com",
    "time": "Fri Feb 25 07:30:30 2022 -0700"
  },
  "message": "Print MI prompt on interrupted command\n\nJoel noticed that if the remote dies unexpectedly during a command --\nyou can simulate this by using \"continue\" and then killing gdbserver\n-- then the CLI will print a new prompt, but MI will not.  Later, we\nfound out that this was also filed in bugzilla as PR mi/23820.\n\nThe output looks something like this:\n\n    | (gdb)\n    | cont\n    | \u0026\"cont\\n\"\n    | ~\"Continuing.\\n\"\n    | ^running\n    | *running,thread-id\u003d\"all\"\n    | (gdb)\n    | [... some output from GDB during program startup...]\n    | \u003dthread-exited,id\u003d\"1\",group-id\u003d\"i1\"\n    | \u003dthread-group-exited,id\u003d\"i1\"\n    | \u0026\"Remote connection closed\\n\"\n\nNow, what about that \"(gdb)\" in the middle?\n\nThat prompt comes from this questionable code in\nmi-interp.c:mi_on_resume_1:\n\n      /* This is what gdb used to do historically -- printing prompt\n\t even if it cannot actually accept any input.  This will be\n\t surely removed for MI3, and may be removed even earlier.  */\n      if (current_ui-\u003eprompt_state \u003d\u003d PROMPT_BLOCKED)\n\tfputs_unfiltered (\"(gdb) \\n\", mi-\u003eraw_stdout);\n\n... which seems like something to remove.  But maybe the intent here\nis that this prompt is sufficient, and MI clients must be ready to\nhandle output coming after a prompt.  On the other hand, if this code\n*is* removed, then nothing would print a prompt in this scenario.\n\nAnyway, the CLI and the TUI handle emitting the prompt here by hooking\ninto gdb::observers::command_error, but MI doesn\u0027t install an observer\nhere.\n\nThis patch adds the missing observer and arranges to show the MI\nprompt.  Regression tested on x86-64 Fedora 34.\n\nIt seems like this area could be improved a bit, by having\nstart_event_loop call the prompt-displaying code directly, rather than\nindirecting through an observer.  However, I haven\u0027t done this.\n\nBug: https://sourceware.org/bugzilla/show_bug.cgi?id\u003d23820\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "f02a7cf3f106e9c1d6fa86810e504c6c49c73677",
      "old_mode": 33188,
      "old_path": "gdb/mi/mi-interp.c",
      "new_id": "2c47024d5e6ad31d24ab7939b285954342074658",
      "new_mode": 33188,
      "new_path": "gdb/mi/mi-interp.c"
    }
  ]
}
