)]}'
{
  "commit": "749a928d88730e52c978414542697f976a072666",
  "tree": "234c842eb83c8870e2643f14b5793b77f67d829a",
  "parents": [
    "7353f2470c2eda19c31c9fa44c315c7c69dea7c4"
  ],
  "author": {
    "name": "Pedro Alves",
    "email": "palves@redhat.com",
    "time": "Sat Nov 12 00:17:14 2016 +0000"
  },
  "committer": {
    "name": "Pedro Alves",
    "email": "palves@redhat.com",
    "time": "Sat Nov 12 00:17:14 2016 +0000"
  },
  "message": "Fix PR18360 - internal error when using \"interrupt -a\"\n\nv2:\n\n  - add handle_stop_requested and use it in all event waitkinds.\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf you do \"interrupt -a\" just while some thread is stepping over a\nbreakpoint, gdb trips on an internal error.\n\nThe test added by this patch manages to trigger this consistently by\nspawning a few threads that are constantly tripping on a conditional\nbreakpoint whose condition always evaluates to false.  With current\ngdb, you get:\n\n~~~\n interrupt -a\n .../src/gdb/inline-frame.c:343: internal-error: void skip_inline_frames(ptid_t): Assertion `find_inline_frame_state (ptid) \u003d\u003d NULL\u0027 failed.\n A problem internal to GDB has been detected,\n further debugging may prove unreliable.\n Quit this debugging session? (y or n) FAIL: gdb.threads/interrupt-while-step-over.exp: displaced-stepping\u003don: iter\u003d0: interrupt -a (GDB internal error)\n[...]\n .../src/gdb/inline-frame.c:343: internal-error: void skip_inline_frames(ptid_t): Assertion `find_inline_frame_state (ptid) \u003d\u003d NULL\u0027 failed.\n A problem internal to GDB has been detected,\n further debugging may prove unreliable.\n Quit this debugging session? (y or n) FAIL: gdb.threads/interrupt-while-step-over.exp: displaced-stepping\u003doff: iter\u003d0: wait for stops (GDB internal error)\n~~~\n\nThe assertion triggers because we\u0027re processing a stop for a thread\nthat had already stopped before and thus had already its inline-frame\nstate filled in.\n\nCalling handle_inferior_event_1 directly within a\n\"thread_stop_requested\" observer is something that I\u0027ve wanted to get\nrid of before, for being fragile.  Nowadays, infrun is aware of\nthreads with pending events, so we can use that instead, and let the\nnormal fetch_inferior_event -\u003e handle_inferior_event code path handle\nthe forced stop.\n\nThe change to finish_step_over is necessary because sometimes a thread\nthat was told to PTRACE_SINGLESTEP reports back a SIGSTOP instead of a\nSIGTRAP (i.e., we tell it to single-step, and then interrupt it quick\nenough that on the kernel side the thread dequeues the SIGTOP before\never having had a chance of executing the instruction to be stepped).\nSIGSTOP gets translated to a GDB_SIGNAL_0.  And then finish_step_over\nwould miss calling clear_step_over_info, and thus miss restarting the\nother threads (which in this case of threads with pending events,\nmeans setting their \"resumed\" flag, so their pending events can be\nconsumed).\n\nAnd now that we always restart threads in finish_step_over, we no\nlonger need to do that in handle_signal_stop.\n\nTested on x86_64 Fedora 23, native and gdbserver.\n\ngdb/ChangeLog:\nyyyy-mm-dd  Pedro Alves  \u003cpalves@redhat.com\u003e\n\n\tPR gdb/18360\n\t* infrun.c (start_step_over, do_target_resume, resume)\n\t(restart_threads): Assert we\u0027re not resuming a thread that is\n\tmeant to be stopped.\n\t(infrun_thread_stop_requested_callback): Delete.\n\t(infrun_thread_stop_requested): If the thread is internally\n\tstopped, queue a pending stop event and clear the thread\u0027s\n\tinline-frame state.\n\t(handle_syscall_event, handle_inferior_event_1): Use\n\thandle_stop_requested.\n\t(handle_stop_requested): New function.\n\t(handle_signal_stop): Set the thread\u0027s stop_signal here instead of\n\tat caller.\n\t(finish_step_over): Clear step over info unconditionally.\n\t(handle_signal_stop): If the user had interrupted the event\n\tthread, consider the stop a random signal.\n\t(handle_signal_stop)\u003csignal arrived while stepping over\n\tbreakpoint\u003e: Don\u0027t restart threads here.\n\t(stop_waiting): Don\u0027t clear step-over info here.\n\ngdb/testsuite/ChangeLog:\nyyyy-mm-dd  Pedro Alves  \u003cpalves@redhat.com\u003e\n\n\tPR gdb/18360\n\t* gdb.threads/interrupt-while-step-over.c: New file.\n\t* gdb.threads/interrupt-while-step-over.exp: New file.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "bf0632eaad2ea5551d69e4597585ad02d654cdb8",
      "old_mode": 33188,
      "old_path": "gdb/infrun.c",
      "new_id": "87b358f7501f1918036facd22d9937a752c1d9a8",
      "new_mode": 33188,
      "new_path": "gdb/infrun.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "eeb81d43761dffb55406e6cb2c45308bd9e32de8",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.threads/interrupt-while-step-over.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "4407eb1930afae74c0bffab597bdf30b006db729",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.threads/interrupt-while-step-over.exp"
    },
    {
      "type": "modify",
      "old_id": "9e730152b7af63023ed999e4cceeaf58a677a42a",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp",
      "new_id": "ef894c23017f8cc96cc4d2c180b35a52c11371af",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp"
    }
  ]
}
