Subject: Re: bug#56528: 29.0.50; Emacs lucid segfaults when X dies

From: Visuwesh <[email-masked]>
Date: Wed, 13 Jul 2022 16:35:26 +0530

[Wednesday July 13, 2022] Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> [email-masked] writes:
>
> Can you type the following commands at the gdb prompt after the crash
> happens, and show me the output?
>
> (gdb) up
> (gdb) p *terminal
> (gdb) p *terminal->display_info.x

(gdb) up
#1  0x0000555555722009 in XTread_socket (terminal=0x5555560163d8, hold_quit=0x7fffffffb6b0) at xterm.c:22348
22348	  while (XPending (dpyinfo->display))
(gdb) p *terminal
$1 = {
  header = {
    size = 4611686018679308292
  },
  param_alist = XIL(0x55555638ee53),
  charset_list = XIL(0),
  Vselection_alist = XIL(0),
  glyph_code_table = XIL(0),
  next_terminal = 0x0,
  id = 1,
  reference_count = 3,
  type = output_x_window,
  name = 0x55555601a0a0 ":1",
  kboard = 0x555556019d70,
  image_cache = 0x5555560cff70,
  display_info = {
    tty = 0x555556038630,
    x = 0x555556038630,
    w32 = 0x555556038630,
    ns = 0x555556038630,
    pgtk = 0x555556038630,
    haiku = 0x555556038630
  },
  terminal_coding = 0x555556019b00,
  keyboard_coding = 0x55555601a0c0,
  rif = 0x555555a9c480 <x_redisplay_interface>,
  cursor_to_hook = 0x0,
  raw_cursor_to_hook = 0x0,
  clear_to_end_hook = 0x0,
  clear_frame_hook = 0x5555557075fe <x_clear_frame>,
  clear_end_of_line_hook = 0x0,
  ins_del_lines_hook = 0x555555707fa5 <x_ins_del_lines>,
  insert_glyphs_hook = 0x0,
  write_glyphs_hook = 0x0,
  delete_glyphs_hook = 0x5555557072a8 <x_delete_glyphs>,
  ring_bell_hook = 0x555555707f2b <XTring_bell>,
  toggle_invisible_pointer_hook = 0x555555708a49 <XTtoggle_invisible_pointer>,
  reset_terminal_modes_hook = 0x0,
  set_terminal_modes_hook = 0x0,
  update_begin_hook = 0x5555556fd0f9 <x_update_begin>,
  update_end_hook = 0x5555556fd780 <x_update_end>,
  set_terminal_window_hook = 0x0,
  defined_color_hook = 0x555555731df5 <x_defined_color>,
  query_frame_background_color = 0x5555557015ac <x_query_frame_background_color>,
  query_colors = 0x5555557012b1 <x_query_colors>,
  mouse_position_hook = 0x55555570cc38 <XTmouse_position>,
  get_focus_frame = 0x555555728058 <x_get_focus_frame>,
  focus_frame_hook = 0x5555557280ff <x_focus_frame>,
  frame_rehighlight_hook = 0x55555570b973 <XTframe_rehighlight>,
  frame_raise_lower_hook = 0x555555727e35 <XTframe_raise_lower>,
  frame_visible_invisible_hook = 0x555555728bdc <x_make_frame_visible_invisible>,
  fullscreen_hook = 0x555555726eaf <XTfullscreen_hook>,
  iconify_frame_hook = 0x555555728c4d <x_iconify_frame>,
  set_window_size_hook = 0x555555727b3e <x_set_window_size>,
  set_frame_offset_hook = 0x555555725837 <x_set_offset>,
  set_frame_alpha_hook = 0x5555556fcdfd <x_set_frame_alpha>,
  set_new_font_hook = 0x555555724ad4 <x_new_font>,
  set_bitmap_icon_hook = 0x555555723172 <x_bitmap_icon>,
  implicit_set_name_hook = 0x5555557359fb <x_implicitly_set_name>,
  menu_show_hook = 0x555555655f37 <x_menu_show>,
  activate_menubar_hook = 0x5555556540a3 <x_activate_menubar>,
  popup_dialog_hook = 0x5555556574a2 <xw_popup_dialog>,
  change_tab_bar_height_hook = 0x55555573461b <x_change_tab_bar_height>,
  change_tool_bar_height_hook = 0x555555734952 <x_change_tool_bar_height>,
  set_vertical_scroll_bar_hook = 0x55555570fd34 <XTset_vertical_scroll_bar>,
  set_horizontal_scroll_bar_hook = 0x55555571069a <XTset_horizontal_scroll_bar>,
  set_scroll_bar_default_width_hook = 0x555555735ac3 <x_set_scroll_bar_default_width>,
  set_scroll_bar_default_height_hook = 0x555555735b0a <x_set_scroll_bar_default_height>,
  condemn_scroll_bars_hook = 0x5555557114b2 <XTcondemn_scroll_bars>,
  redeem_scroll_bar_hook = 0x5555557115a5 <XTredeem_scroll_bar>,
  judge_scroll_bars_hook = 0x555555711cb2 <XTjudge_scroll_bars>,
  read_socket_hook = 0x555555721e8d <XTread_socket>,
  frame_up_to_date_hook = 0x5555556fd7d3 <XTframe_up_to_date>,
  buffer_flipping_unblocked_hook = 0x5555556fda73 <XTbuffer_flipping_unblocked_hook>,
  get_string_resource_hook = 0x5555557557a1 <x_get_string_resource>,
  free_pixmap = 0x55555572a7eb <x_free_pixmap>,
  delete_frame_hook = 0x55555572985b <x_destroy_window>,
  delete_terminal_hook = 0x55555572cf30 <x_delete_terminal>,
  toolkit_position_hook = 0x5555556fb06c <x_toolkit_position>,
  any_grab_hook = 0x55555572d110 <x_have_any_grab>
}
(gdb) p *terminal->display_info.x
$2 = {
  next = 0x0,
  terminal = 0x5555560163d8,
  display = 0x0,
  connection = 5,
  name_list_element = XIL(0x5555560006f3),
  reference_count = 3,
  screen = 0x55555601d350,
  resx = 96,
  resy = 96.252631578947373,
  visual = 0x555556028ee0,
  visual_info = {
    visual = 0x555556028ee0,
    visualid = 32,
    screen = 0,
    depth = 24,
    class = 4,
    red_mask = 16711680,
    green_mask = 65280,
    blue_mask = 255,
    colormap_size = 256,
    bits_per_rgb = 8
  },
  pict_format = 0x55555603bf08,
  cmap = 34,
  n_planes = 24,
  grabbed = 0,
  icon_bitmap_id = 1,
  root_window = 1368,
  client_leader_window = 0,
  vertical_scroll_bar_cursor = 18874370,
  horizontal_scroll_bar_cursor = 18874371,
  invisible_cursor = 18874376,
  fixes_pointer_blanking = false,
  rdb = 0x555556019f40,
  smallest_char_width = 3,
  smallest_font_height = 18,
  scratch_cursor_gc = 0x555556005520,
  mouse_highlight = {
    mouse_face_beg_row = -1,
    mouse_face_beg_col = -1,
    mouse_face_beg_x = 0,
    mouse_face_end_row = -1,
    mouse_face_end_col = -1,
    mouse_face_end_x = 0,
    mouse_face_window = XIL(0),
    mouse_face_face_id = 0,
    mouse_face_overlay = XIL(0),
    mouse_face_mouse_frame = 0x0,
    mouse_face_mouse_x = 0,
    mouse_face_mouse_y = 0,
    mouse_face_past_end = false,
    mouse_face_defer = false,
    mouse_face_hidden = false
  },
  x_id = 1,
  x_id_name = 0x555556019f70 "GNU Emacs at astatine",
  n_fonts = 7,
  bitmaps = 0x5555562a9d50,
  bitmaps_size = 10,
  bitmaps_last = 1,
  meta_mod_mask = 8,
  shift_lock_mask = 0,
  alt_mod_mask = 0,
  super_mod_mask = 64,
  hyper_mod_mask = 0,
  Xatom_wm_protocols = 397,
  Xatom_wm_take_focus = 413,
  Xatom_wm_save_yourself = 512,
  Xatom_wm_delete_window = 398,
  Xatom_wm_change_state = 409,
  Xatom_wm_state = 406,
  Xatom_wm_configure_denied = 513,
  Xatom_wm_window_moved = 514,
  Xatom_wm_client_leader = 411,
  Xatom_wm_transient_for = 68,
  Xatom_editres = 515,
  Xatom_CLIPBOARD = 427,
  Xatom_TIMESTAMP = 431,
  Xatom_TEXT = 458,
  Xatom_DELETE = 516,
  Xatom_COMPOUND_TEXT = 396,
  Xatom_UTF8_STRING = 395,
  Xatom_MULTIPLE = 430,
  Xatom_INCR = 428,
  Xatom_EMACS_TMP = 517,
  Xatom_TARGETS = 429,
  Xatom_NULL = 519,
  Xatom_ATOM = 4,
  Xatom_ATOM_PAIR = 520,
  Xatom_CLIPBOARD_MANAGER = 437,
  Xatom_EMACS_SERVER_TIME_PROP = 518,
  Xatom_PIXEL_SIZE = 163,
  Xatom_AVERAGE_WIDTH = 168,
  Xatom_MULE_BASELINE_OFFSET = 522,
  Xatom_MULE_RELATIVE_COMPOSE = 523,
  Xatom_MULE_DEFAULT_ASCENT = 524,
  Xatom_DONE = 525,
  Xatom_PAGE = 526,
  Xatom_Scrollbar = 527,
  Xatom_Horizontal_Scrollbar = 528,
  Xatom_XEMBED = 399,
  Xatom_XEMBED_INFO = 400,
  Xatom_NET_WM_CM_Sn = 456,
  Xatom_MOTIF_WM_HINTS = 415,
  Xatom_MOTIF_DRAG_WINDOW = 537,
  Xatom_MOTIF_DRAG_TARGETS = 538,
  Xatom_MOTIF_DRAG_AND_DROP_MESSAGE = 539,
  Xatom_MOTIF_DRAG_INITIATOR_INFO = 540,
  Xatom_MOTIF_DRAG_RECEIVER_INFO = 541,
  Xatom_EMACS_DRAG_ATOM = 521,
  Xatom_XmTRANSFER_SUCCESS = 542,
  Xatom_XmTRANSFER_FAILURE = 543,
  Xatom_DndProtocol = 544,
  Xatom_DND_PROTOCOL = 545,
  x_focus_frame = 0x555555fcec00,
  x_focus_event_frame = 0x555555fcec00,
  highlight_frame = 0x555555fcec00,
  x_pending_autoraise_frame = 0x0,
  last_mouse_frame = 0x0,
  last_mouse_glyph_frame = 0x0,
  last_mouse_motion_frame = 0x0,
  last_mouse_scroll_bar = 0x0,
  last_user_time = 130983,
  last_mouse_motion_x = 0,
  last_mouse_motion_y = 0,
  last_mouse_glyph = {
    x = 0,
    y = 0,
    width = 0,
    height = 0
  },
  last_mouse_movement_time = 0,
  last_mouse_movement_time_send_event = false,
  gray = 18874372,
  xim = 0x555556049a60,
  xim_styles = 0x55555603f8f0,
  xim_callback_data = 0x555556046730,
  preferred_xim_style = 0,
  color_names = 0x555556039580,
  color_names_length = 0x555556039d90,
  color_names_size = 256,
  color_cells = 0x0,
  ncolor_cells = 0,
  red_bits = 8,
  blue_bits = 8,
  green_bits = 8,
  alpha_bits = 0,
  red_offset = 16,
  blue_offset = 0,
  green_offset = 8,
  alpha_offset = 0,
  alpha_mask = 0,
  wm_type = X_WMTYPE_UNKNOWN,
  x_dnd_atoms = 0x55555601d1c0,
  x_dnd_atoms_size = 16,
  x_dnd_atoms_length = 7,
  motif_drag_atom = 0,
  motif_drag_atom_name = '\000' <repeats 32 times>,
  motif_drag_atom_time = 0,
  motif_drag_atom_owner = 0x0,
  motif_drag_window = 0,
  Xatom_net_supported = 350,
  Xatom_net_supporting_wm_check = 358,
  net_supported_atoms = 0x55555604bc00,
  nr_net_supported_atoms = 44,
  net_supported_window = 0,
  Xatom_net_window_type = 367,
  Xatom_net_window_type_tooltip = 377,
  Xatom_net_active_window = 357,
  Xatom_net_wm_state = 384,
  Xatom_net_wm_state_fullscreen = 387,
  Xatom_net_wm_state_maximized_horz = 389,
  Xatom_net_wm_state_maximized_vert = 388,
  Xatom_net_wm_state_sticky = 385,
  Xatom_net_wm_state_above = 390,
  Xatom_net_wm_state_below = 391,
  Xatom_net_wm_state_hidden = 393,
  Xatom_net_wm_state_skip_taskbar = 386,
  Xatom_net_wm_state_shaded = 529,
  Xatom_net_frame_extents = 360,
  Xatom_net_current_desktop = 355,
  Xatom_net_workarea = 447,
  Xatom_net_wm_opaque_region = 531,
  Xatom_net_wm_ping = 422,
  Xatom_net_wm_sync_request = 424,
  Xatom_net_wm_sync_request_counter = 425,
  Xatom_net_wm_frame_drawn = 530,
  Xatom_net_wm_user_time = 451,
  Xatom_net_wm_user_time_window = 452,
  Xatom_net_client_list_stacking = 353,
  Xatom_net_wm_pid = 383,
  Xatom_xsettings_sel = 508,
  Xatom_xsettings_prop = 493,
  Xatom_xsettings_mgr = 403,
  xsettings_window = 0,
  Xatom_net_wm_name = 361,
  Xatom_net_wm_icon_name = 365,
  Xatom_net_wm_window_opacity = 407,
  Xatom_SM_CLIENT_ID = 426,
  Xatom_XdndAware = 468,
  Xatom_XdndSelection = 467,
  Xatom_XdndTypeList = 465,
  Xatom_XdndActionCopy = 470,
  Xatom_XdndActionMove = 472,
  Xatom_XdndActionLink = 471,
  Xatom_XdndActionAsk = 473,
  Xatom_XdndActionPrivate = 474,
  Xatom_XdndActionList = 466,
  Xatom_XdndActionDescription = 533,
  Xatom_XdndProxy = 469,
  Xatom_XdndEnter = 459,
  Xatom_XdndPosition = 460,
  Xatom_XdndStatus = 461,
  Xatom_XdndLeave = 462,
  Xatom_XdndDrop = 463,
  Xatom_XdndFinished = 464,
  Xatom_XdndDirectSave0 = 534,
  Xatom_XdndActionDirectSave = 535,
  Xatom_text_plain = 536,
  Xatom_Meta = 201,
  Xatom_Super = 202,
  Xatom_Hyper = 203,
  Xatom_ShiftLock = 532,
  Xatom_Alt = 192,
  modmap = 0x0,
  xrandr_supported_p = true,
  xrandr_event_base = 89,
  xrandr_error_base = 147,
  xrandr_major_version = 1,
  xrandr_minor_version = 6,
  last_monitor_attributes_list = XIL(0x555555fd28c3),
  ext_codes = 0x5555560f3f48,
  xcb_connection = 0x55555601d6a0,
  xcb_visual = 0x555556022a04,
  supports_xdbe = true,
  supports_xi2 = true,
  xi2_version = 4,
  xi2_opcode = 131,
  num_devices = 13,
  devices = 0x5555562ae650,
  pending_keystroke_time = 0,
  pending_keystroke_source = 0,
  supports_xkb = true,
  xkb_event_type = 85,
  xkb_desc = 0x55555603bd40,
  xrender_supported_p = true,
  xrender_major = 0,
  xrender_minor = 11,
  xfixes_supported_p = true,
  xfixes_major = 6,
  xfixes_minor = 0,
  xsync_supported_p = true,
  xsync_major = 3,
  xsync_minor = 1,
  xinerama_supported_p = true,
  composite_supported_p = true,
  composite_major = 0,
  composite_minor = 4,
  xshape_supported_p = true,
  xshape_major = 1,
  xshape_minor = 1,
  xshape_event_base = 64,
  xshape_error_base = 0,
  protected_windows = 0x5555560f3fd0,
  n_protected_windows = 0,
  protected_windows_max = 256,
  screen_width = 1920,
  screen_height = 1080,
  screen_mm_width = 508,
  screen_mm_height = 285,
  failable_requests = {{
      start = 11418,
      end = 11419
    }, {
      start = 10541,
      end = 10542
    }, {
      start = 10565,
      end = 10566
    }, {
      start = 0,
      end = 0
    } <repeats 125 times>},
  next_failable_request = 0x555556038d60,
  pending_dnd_time = 0
}
(gdb)