)]}'
{
  "commit": "74bbacbbde46b30fed2f26164246677d7bd74251",
  "tree": "9c80c4326d6724efa3de6f9132e11a4e9745a805",
  "parents": [
    "5730d2aea8814ddf76666878565b3748e250033f"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Tue Apr 28 07:40:11 2026 +0100"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Mon Jul 27 13:56:44 2026 +0100"
  },
  "message": "gdb/tui: fix for debuginfod prompt while enabling the TUI\n\nPR tui/31449 reports a SIGFPE when the debuginfod query happens while\nenabling TUI using the \"tui enable\" command:\n\n  Thread 1 \"gdb\" received signal SIGFPE, Arithmetic exception.\n  0x0000000001021084 in tui_inject_newline_into_command_window () at /data/vries/gdb/src/gdb/tui/tui-io.c:1096\n  1096        py +\u003d px / tui_cmd_win ()-\u003ewidth;\n\ndue to divide-by-zero because tui_cmd_win ()-\u003ewidth \u003d\u003d 0.\n\nThe corresponding backtrace is:\n\n  (gdb) bt\n  #0  0x0000000001021084 in tui_inject_newline_into_command_window () at gdb/tui/tui-io.c:1096\n  #1  0x0000000000fe65fd in gdb_readline_wrapper_line (line\u003d...) at gdb/top.c:939\n  #2  0x0000000000944eef in gdb_rl_callback_handler (rl\u003d0x2cc865a0 \"n\") at gdb/event-top.c:288\n  #3  0x0000000001175779 in rl_callback_read_char () at readline/readline/callback.c:302\n  #4  0x0000000000944bc3 in gdb_rl_callback_read_char_wrapper_sjlj () at gdb/event-top.c:197\n  #5  0x0000000000944cd4 in gdb_rl_callback_read_char_wrapper_noexcept () at gdb/event-top.c:240\n  #6  0x0000000000944d52 in gdb_rl_callback_read_char_wrapper (...) at gdb/event-top.c:252\n  #7  0x0000000001062352 in stdin_event_handler (error\u003d0, client_data\u003d0x2c865150) at gdb/ui.c:154\n  #8  0x0000000001a04edf in handle_file_event (file_ptr\u003d0x2ccf8850, ready_mask\u003d1) at gdbsupport/event-loop.cc:551\n  #9  0x0000000001a05522 in gdb_wait_for_event (block\u003d1) at gdbsupport/event-loop.cc:672\n  #10 0x0000000001a043ff in gdb_do_one_event (mstimeout\u003d-1) at gdbsupport/event-loop.cc:263\n  #11 0x00000000006d5480 in interp::do_one_event (this\u003d0x2cc2af20, mstimeout\u003d-1) at gdb/interps.h:93\n  #12 0x0000000000fe670d in gdb_readline_wrapper (prompt\u003d0x2ccca4e0 \"Enable debuginfod for this session? (y or [n]) \") at gdb/top.c:1033\n  #13 0x00000000010c6853 in defaulted_query(...) (...) at gdb/utils.c:844\n  #14 0x00000000010c6b8a in nquery (...) at gdb/utils.c:901\n  #15 0x00000000007a9324 in debuginfod_is_enabled () at gdb/debuginfod-support.c:268\n  #16 0x00000000007a950d in debuginfod_source_query (...) at gdb/debuginfod-support.c:311\n  #17 0x0000000000efc2c7 in open_source_file (s\u003d0x2cc8f4b0) at gdb/source.c:1152\n  #18 0x0000000000efc619 in symtab_to_fullname (...) at gdb/source.c:1214\n  #19 0x0000000000f5ebb3 in find_line_symtab (...) at gdb/symtab.c:3287\n  #20 0x0000000000f5f0e5 in find_pc_for_line (...) at gdb/symtab.c:3391\n  #21 0x0000000001011f54 in tui_get_begin_asm_address (...) at gdb/tui/tui-disasm.c:404\n  #22 0x000000000104888d in tui_source_window_base::rerender (this\u003d0x2cbdc570) at gdb/tui/tui-winsource.c:474\n  #23 0x0000000001028e81 in tui_win_info::resize (this\u003d0x2cbdc570, height_\u003d21, width_\u003d127, origin_x_\u003d0, origin_y_\u003d0) at gdb/tui/tui-layout.c:299\n  #24 0x00000000010297d0 in tui_layout_window::apply (this\u003d0x2cc50350, x_\u003d0, y_\u003d0, width_\u003d127, height_\u003d21, preserve_cmd_win_size_p\u003dfalse) at gdb/tui/tui-layout.c:432\n  #25 0x000000000102bfea in tui_layout_split::apply (this\u003d0x2caea920, x_\u003d0, y_\u003d0, width_\u003d127, height_\u003d33, preserve_cmd_win_size_p\u003dfalse) at gdb/tui/tui-layout.c:1026\n  #26 0x0000000001028267 in tui_apply_current_layout (...) at gdb/tui/tui-layout.c:68\n  #27 0x0000000001028737 in tui_set_layout (layout\u003d0x2c9b9e90) at gdb/tui/tui-layout.c:133\n  #28 0x0000000001028af5 in tui_set_initial_layout () at gdb/tui/tui-layout.c:209\n  #29 0x000000000104b795 in tui_enable () at gdb/tui/tui.c:496\n  #30 0x000000000104bab3 in tui_enable_command (args\u003d0x0, from_tty\u003d1) at gdb/tui/tui.c:591\n  #31 0x00000000006c5ffe in do_simple_func (args\u003d0x0, from_tty\u003d1, c\u003d0x2c9bb2f0) at gdb/cli/cli-decode.c:94\n  #32 0x00000000006cc94f in cmd_func (cmd\u003d0x2c9bb2f0, args\u003d0x0, from_tty\u003d1) at gdb/cli/cli-decode.c:2831\n  #33 0x0000000000fe53ad in execute_command (p\u003d0x2c86699a \"\", from_tty\u003d1) at gdb/top.c:563\n  #34 0x000000000094584d in command_handler (command\u003d0x2c866990 \"tui enable\") at gdb/event-top.c:611\n  #35 0x0000000000945dfe in command_line_handler (rl\u003d...) at gdb/event-top.c:844\n  #36 0x000000000101e916 in tui_command_line_handler (rl\u003d...) at gdb/tui/tui-interp.c:101\n  #37 0x0000000000944eef in gdb_rl_callback_handler (rl\u003d0x2cc86a30 \"tui enable\") at gdb/event-top.c:288\n  #38 0x0000000001175779 in rl_callback_read_char () at readline/readline/callback.c:302\n  #39 0x0000000000944bc3 in gdb_rl_callback_read_char_wrapper_sjlj () at gdb/event-top.c:197\n  #40 0x0000000000944cd4 in gdb_rl_callback_read_char_wrapper_noexcept () at gdb/event-top.c:240\n  #41 0x0000000000944d52 in gdb_rl_callback_read_char_wrapper (...) at gdb/event-top.c:252\n  #42 0x0000000001062352 in stdin_event_handler (error\u003d0, client_data\u003d0x2c865150) at gdb/ui.c:154\n  #43 0x0000000001a04edf in handle_file_event (file_ptr\u003d0x2ccf8850, ready_mask\u003d1) at gdbsupport/event-loop.cc:551\n  #44 0x0000000001a05522 in gdb_wait_for_event (block\u003d1) at gdbsupport/event-loop.cc:672\n  #45 0x0000000001a043ff in gdb_do_one_event (mstimeout\u003d-1) at gdbsupport/event-loop.cc:263\n  #46 0x00000000006d5480 in interp::do_one_event (this\u003d0x2cc2af20, mstimeout\u003d-1) at gdb/interps.h:93\n  #47 0x0000000000b77f25 in start_event_loop () at gdb/main.c:403\n  #48 0x0000000000b78113 in captured_command_loop () at gdb/main.c:468\n  #49 0x0000000000b7a07c in captured_main (context\u003d0x7fff660b9e60) at gdb/main.c:1381\n  #50 0x0000000000b7a178 in gdb_main (args\u003d0x7fff660b9e60) at gdb/main.c:1400\n  #51 0x0000000000419705 in main (argc\u003d5, argv\u003d0x7fff660b9f98) at gdb/gdb.c:38\n  (gdb)\n\nThe problem is that while the TUI is being enabled for the first time,\nnone of the TUI windows yet exist.  As each window is created its\ncontents are rendered (i.e. filled in based on GDB\u0027s state), which for\nsome windows can trigger an interactive prompt, in this case a missing\nsource file triggers a debuginfod prompt while trying to render the\n`src` window.\n\nThe interactive prompt will be written to the `cmd` window, but at\nthis point the `cmd` window has not yet been created.\n\nThere have been several different attempts to fix this issue:\n\n  1. https://inbox.sourceware.org/gdb-patches/20240312215334.37888-1-amerey@redhat.com\n  2. https://inbox.sourceware.org/gdb-patches/20260114172833.1824823-1-tdevries@suse.de\n  3. https://inbox.sourceware.org/gdb-patches/20260116104313.2704994-1-tdevries@suse.de\n  4. https://inbox.sourceware.org/gdb-patches/20260221101818.2678136-1-tdevries@suse.de\n  5. https://inbox.sourceware.org/gdb-patches/20260314173737.1436116-1-tdevries@suse.de\n  6. https://inbox.sourceware.org/gdb-patches/20260417075719.852558-1-tdevries@suse.de\n\nThe patch presented here is similar to what was presented in (3)\nabove, but I think the implementation is maybe a little simpler.\n\nAdditionally, all but (6) of the above patches don\u0027t address issues\nrelated to using multi-key combinations like \u0027C-x C-a\u0027 to enable TUI\nmode, and that patch just takes the (admittedly safe) approach of\npreventing the user from activating the TUI using a multi-key\ncombination if debuginfod is in ASK mode (and so could trigger an\ninteractive prompt).\n\nThis patch doesn\u0027t address the multi-key problem, that is left for the\nnext patch in this series.\n\nThis patch ensures that the `cmd` window always exists before\nrendering the windows (i.e. filling in their content).  This is done\nby introducing a tui_defer_rerender global which is set in tui_enable,\nand checked in tui_win_info::resize.  Then, prior to the prompt being\ndisplayed, if the flag is set, we render the contents of all visible\nwindows.  This can trigger a secondary prompt (e.g. the debuginfod\nprompt), but by this point the `cmd` window exists, and can display\nthe prompt.\n\nThe debuginfod-query.exp test included here is based on the test Tom\nde Vries wrote for one of his patches listed above, but extended to\ncover some additional cases.  The activate-with-key-combo.exp test is\nnew for this series.\n\nBug: https://sourceware.org/bugzilla/show_bug.cgi?id\u003d31449\nCo-Authored-By: Tom de Vries \u003ctdevries@suse.de\u003e\n",
  "tree_diff": [
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "6a0e311ef418989934d03a0e2835a4c80a598ab3",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.tui/activate-with-key-combo.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "b411c6b6b6e70212aedbe017f34816acf6fe927f",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.tui/activate-with-key-combo.exp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "6a0e311ef418989934d03a0e2835a4c80a598ab3",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.tui/debuginfod-query.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "89cd9d38f2869da73b096bfd25b0fe2d6bb408fd",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.tui/debuginfod-query.exp"
    },
    {
      "type": "modify",
      "old_id": "f3d3cbe87a687314fe1390f671de76a24e0a996d",
      "old_mode": 33188,
      "old_path": "gdb/tui/tui-hooks.c",
      "new_id": "f8578c1f732e0bc72e6063f89403ff777e706777",
      "new_mode": 33188,
      "new_path": "gdb/tui/tui-hooks.c"
    },
    {
      "type": "modify",
      "old_id": "40db5f160ca8c5d6bd4863c57615db476664d1a9",
      "old_mode": 33188,
      "old_path": "gdb/tui/tui-layout.c",
      "new_id": "01208e0551335a6eed60962d3ba8c11c200ce703",
      "new_mode": 33188,
      "new_path": "gdb/tui/tui-layout.c"
    },
    {
      "type": "modify",
      "old_id": "4c61e4b879ca4fe6e596b52874a5bd8d90069b95",
      "old_mode": 33188,
      "old_path": "gdb/tui/tui.c",
      "new_id": "275d5c528d79b985571caf43c0fd58520769213e",
      "new_mode": 33188,
      "new_path": "gdb/tui/tui.c"
    },
    {
      "type": "modify",
      "old_id": "7daefe2c9bbd73b9ae9ec46fabed46500163fc94",
      "old_mode": 33188,
      "old_path": "gdb/tui/tui.h",
      "new_id": "b24fed2b32249c07e609154af6461e9b9ae4d5b8",
      "new_mode": 33188,
      "new_path": "gdb/tui/tui.h"
    }
  ]
}
