)]}'
{
  "commit": "e705ee1621d35af5d05bf40b8653fe9d4be2be09",
  "tree": "b389f66b554325f4d882bc4ff58b40e3d491a055",
  "parents": [
    "94f7532ed2eba5251e5c2b8868563f1169ad5b6d"
  ],
  "author": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Sat Apr 27 17:48:22 2024 +0200"
  },
  "committer": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Sat Apr 27 17:48:22 2024 +0200"
  },
  "message": "[gdb/remote] Fix abort on REMOTE_CLOSE_ERROR\n\nWhen running test-case gdb.server/connect-with-no-symbol-file.exp on\naarch64-linux (specifically, an opensuse leap 15.5 container on a\nfedora asahi 39 system), I run into:\n...\n(gdb) detach^M\nDetaching from program: target:connect-with-no-symbol-file, process 185104^M\nEnding remote debugging.^M\nterminate called after throwing an instance of \u0027gdb_exception_error\u0027^M\n...\n\nThe detailed backtrace of the corefile is:\n...\n (gdb) bt\n #0  0x0000ffff75504f54 in raise () from /lib64/libpthread.so.0\n #1  0x00000000007a86b4 in handle_fatal_signal (sig\u003d6)\n     at gdb/event-top.c:926\n #2  \u003csignal handler called\u003e\n #3  0x0000ffff74b977b4 in raise () from /lib64/libc.so.6\n #4  0x0000ffff74b98c18 in abort () from /lib64/libc.so.6\n #5  0x0000ffff74ea26f4 in __gnu_cxx::__verbose_terminate_handler() ()\n    from /usr/lib64/libstdc++.so.6\n #6  0x0000ffff74ea011c in ?? () from /usr/lib64/libstdc++.so.6\n #7  0x0000ffff74ea0180 in std::terminate() () from /usr/lib64/libstdc++.so.6\n #8  0x0000ffff74ea0464 in __cxa_throw () from /usr/lib64/libstdc++.so.6\n #9  0x0000000001548870 in throw_it (reason\u003dRETURN_ERROR,\n     error\u003dTARGET_CLOSE_ERROR, fmt\u003d0x16c7810 \"Remote connection closed\", ap\u003d...)\n     at gdbsupport/common-exceptions.cc:203\n #10 0x0000000001548920 in throw_verror (error\u003dTARGET_CLOSE_ERROR,\n     fmt\u003d0x16c7810 \"Remote connection closed\", ap\u003d...)\n     at gdbsupport/common-exceptions.cc:211\n #11 0x0000000001548a00 in throw_error (error\u003dTARGET_CLOSE_ERROR,\n     fmt\u003d0x16c7810 \"Remote connection closed\")\n     at gdbsupport/common-exceptions.cc:226\n #12 0x0000000000ac8f2c in remote_target::readchar (this\u003d0x233d3d90, timeout\u003d2)\n     at gdb/remote.c:9856\n #13 0x0000000000ac9f04 in remote_target::getpkt (this\u003d0x233d3d90,\n     buf\u003d0x233d40a8, forever\u003dfalse, is_notif\u003d0x0) at gdb/remote.c:10326\n #14 0x0000000000acf3d0 in remote_target::remote_hostio_send_command\n     (this\u003d0x233d3d90, command_bytes\u003d13, which_packet\u003d17,\n     remote_errno\u003d0xfffff1a3cf38, attachment\u003d0xfffff1a3ce88,\n     attachment_len\u003d0xfffff1a3ce90) at gdb/remote.c:12567\n #15 0x0000000000ad03bc in remote_target::fileio_fstat (this\u003d0x233d3d90, fd\u003d3,\n     st\u003d0xfffff1a3d020, remote_errno\u003d0xfffff1a3cf38)\n     at gdb/remote.c:12979\n #16 0x0000000000c39878 in target_fileio_fstat (fd\u003d0, sb\u003d0xfffff1a3d020,\n     target_errno\u003d0xfffff1a3cf38) at gdb/target.c:3315\n #17 0x00000000007eee5c in target_fileio_stream::stat (this\u003d0x233d4400,\n     abfd\u003d0x2323fc40, sb\u003d0xfffff1a3d020) at gdb/gdb_bfd.c:467\n #18 0x00000000007f012c in \u003clambda(bfd*, void*, stat*)\u003e::operator()(bfd *,\n     void *, stat *) const (__closure\u003d0x0, abfd\u003d0x2323fc40, stream\u003d0x233d4400,\n     sb\u003d0xfffff1a3d020) at gdb/gdb_bfd.c:955\n #19 0x00000000007f015c in \u003clambda(bfd*, void*, stat*)\u003e::_FUN(bfd *, void *,\n     stat *) () at gdb/gdb_bfd.c:956\n #20 0x0000000000f9b838 in opncls_bstat (abfd\u003d0x2323fc40, sb\u003d0xfffff1a3d020)\n     at bfd/opncls.c:665\n #21 0x0000000000f90adc in bfd_stat (abfd\u003d0x2323fc40, statbuf\u003d0xfffff1a3d020)\n     at bfd/bfdio.c:431\n #22 0x000000000065fe20 in reopen_exec_file () at gdb/corefile.c:52\n #23 0x0000000000c3a3e8 in generic_mourn_inferior ()\n     at gdb/target.c:3642\n #24 0x0000000000abf3f0 in remote_unpush_target (target\u003d0x233d3d90)\n     at gdb/remote.c:6067\n #25 0x0000000000aca8b0 in remote_target::mourn_inferior (this\u003d0x233d3d90)\n     at gdb/remote.c:10587\n #26 0x0000000000c387cc in target_mourn_inferior (\n     ptid\u003d\u003cerror reading variable: Cannot access memory at address 0x2d310\u003e)\n     at gdb/target.c:2738\n #27 0x0000000000abfff0 in remote_target::remote_detach_1 (this\u003d0x233d3d90,\n     inf\u003d0x22fce540, from_tty\u003d1) at gdb/remote.c:6421\n #28 0x0000000000ac0094 in remote_target::detach (this\u003d0x233d3d90,\n     inf\u003d0x22fce540, from_tty\u003d1) at gdb/remote.c:6436\n #29 0x0000000000c37c3c in target_detach (inf\u003d0x22fce540, from_tty\u003d1)\n     at gdb/target.c:2526\n #30 0x0000000000860424 in detach_command (args\u003d0x0, from_tty\u003d1)\n    at gdb/infcmd.c:2817\n #31 0x000000000060b594 in do_simple_func (args\u003d0x0, from_tty\u003d1, c\u003d0x231431a0)\n     at gdb/cli/cli-decode.c:94\n #32 0x00000000006108c8 in cmd_func (cmd\u003d0x231431a0, args\u003d0x0, from_tty\u003d1)\n     at gdb/cli/cli-decode.c:2741\n #33 0x0000000000c65a94 in execute_command (p\u003d0x232e52f6 \"\", from_tty\u003d1)\n     at gdb/top.c:570\n #34 0x00000000007a7d2c in command_handler (command\u003d0x232e52f0 \"\")\n     at gdb/event-top.c:566\n #35 0x00000000007a8290 in command_line_handler (rl\u003d...)\n     at gdb/event-top.c:802\n #36 0x0000000000c9092c in tui_command_line_handler (rl\u003d...)\n     at gdb/tui/tui-interp.c:103\n #37 0x00000000007a750c in gdb_rl_callback_handler (rl\u003d0x23385330 \"detach\")\n     at gdb/event-top.c:258\n #38 0x0000000000d910f4 in rl_callback_read_char ()\n     at readline/readline/callback.c:290\n #39 0x00000000007a7338 in gdb_rl_callback_read_char_wrapper_noexcept ()\n     at gdb/event-top.c:194\n #40 0x00000000007a73f0 in gdb_rl_callback_read_char_wrapper\n     (client_data\u003d0x22fbf640) at gdb/event-top.c:233\n #41 0x0000000000cbee1c in stdin_event_handler (error\u003d0, client_data\u003d0x22fbf640)\n     at gdb/ui.c:154\n #42 0x000000000154ed60 in handle_file_event (file_ptr\u003d0x232be730, ready_mask\u003d1)\n     at gdbsupport/event-loop.cc:572\n #43 0x000000000154f21c in gdb_wait_for_event (block\u003d1)\n     at gdbsupport/event-loop.cc:693\n #44 0x000000000154dec4 in gdb_do_one_event (mstimeout\u003d-1)\n    at gdbsupport/event-loop.cc:263\n #45 0x0000000000910f98 in start_event_loop () at gdb/main.c:400\n #46 0x0000000000911130 in captured_command_loop () at gdb/main.c:464\n #47 0x0000000000912b5c in captured_main (data\u003d0xfffff1a3db58)\n     at gdb/main.c:1338\n #48 0x0000000000912bf4 in gdb_main (args\u003d0xfffff1a3db58)\n     at gdb/main.c:1357\n #49 0x00000000004170f4 in main (argc\u003d10, argv\u003d0xfffff1a3dcc8)\n     at gdb/gdb.c:38\n (gdb)\n...\n\nThe abort happens because a c++ exception escapes to c code, specifically\nopncls_bstat in bfd/opncls.c.  Compiling with -fexceptions works around this.\n\nFix this by catching the exception just before it escapes, in stat_trampoline\nand likewise in few similar spot.\n\nAdd a new template catch_exceptions to do so in a consistent way.\n\nTested on aarch64-linux.\n\nApproved-by: Pedro Alves \u003cpedro@palves.net\u003e\n\nPR remote/31577\nBug: https://sourceware.org/bugzilla/show_bug.cgi?id\u003d31577\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "6d7b7fa84e5a21a88a9cd763584dedf3b649546c",
      "old_mode": 33188,
      "old_path": "gdb/gdb_bfd.c",
      "new_id": "cb9a91d09232beab2e7fda37cffd560fc6e2e082",
      "new_mode": 33188,
      "new_path": "gdb/gdb_bfd.c"
    }
  ]
}
