)]}'
{
  "commit": "4e51e5abc5c45332dfddd5a0434f3a4792e9c370",
  "tree": "f185ad3f4e298d90d1babc011e619b87108096de",
  "parents": [
    "a8740b7533b4df34d4d7bc5be9bb2108d019fce5"
  ],
  "author": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Mon May 18 14:20:00 2026 +0100"
  },
  "committer": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Tue May 26 13:42:11 2026 +0100"
  },
  "message": "Sync thread state after infcalls with \"set unwind-on-* on\" (PR gdb/34148)\n\nCommit 519774805a1 (\"Don\u0027t pretend infcalls don\u0027t set the inferior\nrunning (PR gdb/34082)\") removed the special case in proceed that\nskipped set_state(THREAD_RUNNING) for infcalls.  That fixed\ngdb.threads/hand-call-new-thread.exp, but introduced a regression in\ngdb.compile/compile.exp:\n\n ...\n set unwind-on-signal on\n (gdb) PASS: gdb.compile/compile.exp: set unwind-on-signal on\n compile code *(volatile int *) 0 \u003d 0;\n The program being debugged received signal SIGSEGV, Segmentation fault\n while in a function called from GDB.  GDB has restored the context\n to what it was before the call.  To change this behavior use\n \"set unwind-on-signal off\".  Evaluation of the expression containing\n the function (_gdb_expr) will be abandoned.\n (gdb) PASS: gdb.compile/compile.exp: compile code segfault second\n break 132\n Breakpoint 2 at 0x555555555262: file .../compile.c, line 132.\n (gdb) continue\n Cannot execute this command while the selected thread is running.\n (gdb) FAIL: gdb.compile/compile.exp: continue to breakpoint: break-here\n\nThe \"compile code\" command before the FAIL is an infcall under the\nhood.  That hits SIGSEGV with \"set unwind-on-signal on\" in effect, so\nGDB unwinds and abandons the call.  After that, \"continue\" is rejected\nbecause the thread is still marked THREAD_RUNNING from the proceed\nthat started the infcall.\n\nWhen an infcall is unwound due to a signal, timeout, or terminating\nexception, call_thread_fsm::should_notify_stop returns false, and so\nnormal_stop is not called from fetch_inferior_event.  normal_stop is\nwhat would normally call finish_thread_state to sync the public thread\nstate back to THREAD_STOPPED.  run_inferior_call has a fallback\nfinish_thread_state call for that purpose, but it is gated on\nstop_stack_dummy \u003d\u003d STOP_STACK_DUMMY, which is only true for\nsuccessful calls.\n\nBefore the commit mentioned above, proceed never marked an infcall\u0027s\nthread as THREAD_RUNNING, so the missing RUNNING \u003d\u003e STOPPED transition\nwas harmless.  The old comment in infcall.c about the\nfinish_thread_state call claimed \"If the infcall does NOT succeed,\nnormal_stop will have already finished the thread states\", but that\nwas already incorrect for the unwind paths.  It just happened to not\nmatter.\n\nFix this by dropping the STOP_STACK_DUMMY guard and updating the\ncomment to describe the actual rule: sync regardless of how the call\nended.  The !was_running check is kept since it is there to exclude\nthe in-cond-eval case, where the thread is meant to stay marked\nrunning.  finish_thread_state is idempotent, so the call is harmless\non paths where normal_stop also ran.\n\nExtend gdb.base/unwindonsignal.exp to exercise the \"set\nunwind-on-signal on\" path without having to rely on the \"compile code\"\nfeature.  Without the fix, the test fails like so:\n\n info threads\n   Id   Target Id                                           Frame\n * 1    Thread 0x7ffff7f8f740 (LWP 239019) \"unwindonsignal\" (running)\n (gdb) FAIL: gdb.base/unwindonsignal.exp: thread is stopped\n continue\n Cannot execute this command while the selected thread is running.\n (gdb) FAIL: gdb.base/unwindonsignal.exp: continue until exit at after unwound infcall\n\nSimilarly, extend gdb.cp/gdb2495.exp for \"set\nunwind-on-terminating-exception on\", and gdb.base/infcall-timeout.exp\nfor \"set unwind-on-timeout on\".  Both would fail without the code fix,\ntoo.\n\nWith the fix, gdb.compile/compile.exp now passes cleanly.\n\nTested on x86_64-unknown-linux-gnu.\n\nApproved-By: Andrew Burgess \u003caburgess@redhat.com\u003e\nBug: https://sourceware.org/bugzilla/show_bug.cgi?id\u003d34148\nChange-Id: Idef0dcd4dd751b501869c58b752f77d4dadb6c72\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "8b26f541de6b2363a0e15baa16098f0e4d51260f",
      "old_mode": 33188,
      "old_path": "gdb/infcall.c",
      "new_id": "e6b24ff5310e640bdd797c9133983b051c29dd07",
      "new_mode": 33188,
      "new_path": "gdb/infcall.c"
    },
    {
      "type": "modify",
      "old_id": "37aa6c0ef54eed44aa2364a6db8e534424369193",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/infcall-timeout.exp",
      "new_id": "99d29624337942edc8cabe33a6a9ce0b63c14db7",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/infcall-timeout.exp"
    },
    {
      "type": "modify",
      "old_id": "aed8ef6f4c7523f4b62d400a056d266d61621c50",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/unwindonsignal.exp",
      "new_id": "2ae8cc4a6ddb1164db33c51a4425b39aa731d094",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/unwindonsignal.exp"
    },
    {
      "type": "modify",
      "old_id": "aa5a2a16e437a125317c8823a2c0f37b99d42cad",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.cp/gdb2495.exp",
      "new_id": "6039649416124ebd9b14bef683d51fd8a63eec5a",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.cp/gdb2495.exp"
    }
  ]
}
