)]}'
{
  "commit": "a9deee17d33235eeba401eebed55c85a742e3358",
  "tree": "3dbd67fe9ee0566ceab74a4692c7abf42ce7fc60",
  "parents": [
    "9117c7b452ef76304f4394a97c887d0c4af439f5"
  ],
  "author": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Mon Jun 27 20:41:50 2022 +0100"
  },
  "committer": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Tue Jun 28 18:11:29 2022 +0100"
  },
  "message": "gdb+gdbserver/Linux: avoid reading registers while going through shell\n\nFor every stop, Linux GDB and GDBserver save the stopped thread\u0027s PC,\nin lwp-\u003estop_pc.  This is done in save_stop_reason, in both\ngdb/linux-nat.c and gdbserver/linux-low.cc.  However, while we\u0027re\ngoing through the shell after \"run\", in startup_inferior, we shouldn\u0027t\nbe reading registers, as we haven\u0027t yet determined the target\u0027s\narchitecture -- the shell\u0027s architecture may not even be the same as\nthe final inferior\u0027s.\n\nIn gdb/linux-nat.c, lwp-\u003estop_pc is only needed when the thread has\nstopped for a breakpoint, and since when going through the shell, no\nbreakpoint is going to hit, we could simply teach save_stop_reason to\nonly record the stop pc when the thread stopped for a breakpoint.\n\nHowever, in gdbserver/linux-low.cc, lwp-\u003estop_pc is used in more cases\nthan breakpoint hits (e.g., it\u0027s used in tracepoints \u0026 the\n\"while-stepping\" feature).\n\nSo to avoid GDB vs GDBserver divergence, we apply the same approach to\nboth implementations.\n\nWe set a flag in the inferior (process in GDBserver) whenever it is\nbeing nursed through the shell, and when that flag is set,\nsave_stop_reason bails out early.  While going through the shell,\nwe\u0027ll only ever get process exits (normal or signalled), random\nsignals, and exec events, so nothing is lost.\n\nChange-Id: If0f01831514d3a74d17efd102875de7d2c6401ad\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "89003fa617d0a349d37c2d0111349c8eb263714e",
      "old_mode": 33188,
      "old_path": "gdb/fork-child.c",
      "new_id": "66b523e118d397867451e0633fc08448bf0c3be9",
      "new_mode": 33188,
      "new_path": "gdb/fork-child.c"
    },
    {
      "type": "modify",
      "old_id": "f6e26a32febab7aae163b2458237bc8fadce7db7",
      "old_mode": 33188,
      "old_path": "gdb/inferior.h",
      "new_id": "c376d780de0c9ff4104dbe1ee5f08373d03a01a1",
      "new_mode": 33188,
      "new_path": "gdb/inferior.h"
    },
    {
      "type": "modify",
      "old_id": "b9164e621db966b1adf7ddb4bd1d00fadf3e2ef8",
      "old_mode": 33188,
      "old_path": "gdb/linux-nat.c",
      "new_id": "0a93ab5c6ae534125d161eb59859be1fc2c48df1",
      "new_mode": 33188,
      "new_path": "gdb/linux-nat.c"
    },
    {
      "type": "modify",
      "old_id": "96dd4d009ab8ce49e281e795fa51b5834d40de0f",
      "old_mode": 33188,
      "old_path": "gdbserver/fork-child.cc",
      "new_id": "7ea66f2a4357c67368a8751b2765edf8035864fe",
      "new_mode": 33188,
      "new_path": "gdbserver/fork-child.cc"
    },
    {
      "type": "modify",
      "old_id": "f3ba4d82f71f9bad219b56fc15f50f52022d166e",
      "old_mode": 33188,
      "old_path": "gdbserver/inferiors.h",
      "new_id": "6de746cb228f9d705541a3ae667f7807b813d450",
      "new_mode": 33188,
      "new_path": "gdbserver/inferiors.h"
    },
    {
      "type": "modify",
      "old_id": "8b8614f6ed4769c404c016f0101c6c583cf50e8e",
      "old_mode": 33188,
      "old_path": "gdbserver/linux-low.cc",
      "new_id": "2f71360d3bdeebe44b37e5c786e9b53eaadabfd4",
      "new_mode": 33188,
      "new_path": "gdbserver/linux-low.cc"
    }
  ]
}
