Subject: bug#62291: 30.0.50; PGTK copy + paste to other app problem

From: Andrew Tropin <[email-masked]>
Date: Thu, 23 Mar 2023 22:22:42 +0400

On 2023-03-23 09:16, Eli Zaretskii wrote:

>> Cc: [email-masked]
>> From: Andrew Tropin <[email-masked]>
>> Date: Thu, 23 Mar 2023 09:18:45 +0400
>> 
>> (gdb) frame 12
>> #12 0x00007ffff798ac04 in gtk_widget_event_internal (widget=widget@entry=0xf04510, even7808    in gtkwidget.c
>> (gdb) p widget
>> $2 = (GtkWidget *) 0xf04510
>> (gdb) p Vframe_list
>> 'Vframe_list' has unknown type; cast it to its declared type
>> (gdb) xcar
>> Undefined command: "xcar".  Try "help".
>> (gdb) xframe
>> Undefined command: "xframe".  Try "help".
>
> To solve the last two problems, do this:
>
>   (gdb) source /path/to/emacs/src/.gdbinit
>
> These are commands we define in .gdbinit which comes with Emacs.

Thank you very much. I updated my debugging setup and will write down a
note for future readers of this thread:

Downloaded latest emacs source code.

guix shell -D emacs-next-pgtk --with-debug-info=glib \ 
--with-debug-info=gtk+ --no-grafts -- \
./configure --enable-checking='yes,glyphs' \
--enable-check-lisp-object-type --with-pgtk \
CFLAGS='-O0 -g3'

guix shell -D emacs-next-pgtk --with-debug-info=glib \ 
--with-debug-info=gtk+ --no-grafts -- make

cd src
gdb emacs

--8<---------------cut here---------------start------------->8---
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from emacs...
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) [answered Y; input not from terminal]
DISPLAY = :0
WAYLAND_DISPLAY = wayland-1
TERM = xterm-256color
Breakpoint 1 at 0x57d3f4: file emacs.c, line 427.
(gdb) r -Q
Starting program: /home/bob/work/gnu/emacs/src/emacs -Q
warning: Unable to find libthread_db matching inferior's thread library, thread debu
[New LWP 9978]
[New LWP 9979]
[New LWP 9980]
Gdk-Message: 22:14:56.365: Unable to load sb_v_double_arrow from the cursor theme
Gdk-Message: 22:14:56.365: Unable to load sb_h_double_arrow from the cursor theme
Gdk-Message: 22:14:56.403: Unable to load hand2 from the cursor theme
Gdk-Message: 22:14:56.403: Unable to load sb_h_double_arrow from the cursor theme
Gdk-Message: 22:14:56.403: Unable to load sb_v_double_arrow from the cursor theme
[New LWP 9981]
[LWP 9981 exited]
[New LWP 9982]
[New LWP 9983]
[LWP 9982 exited]
[LWP 9983 exited]
[New LWP 9984]
[New LWP 9985]
[LWP 9984 exited]
[LWP 9985 exited]
[LWP 9979 exited]

Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
0x00007ffff71b5424 in signal_emit_unlocked_R.isra.0 () from /gnu/store/96srhmpmxa20w
msck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
(gdb) bt
#0  0x00007ffff71b5424 in signal_emit_unlocked_R.isra.0 () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
#1  0x00007ffff71bb21b in g_signal_emit_valist () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
#2  0x00007ffff71bb722 in g_signal_emit () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
#3  0x00007ffff71a7884 in g_object_dispatch_properties_changed () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
#4  0x00007ffff71a9834 in g_object_notify_by_pspec () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
#5  0x00007ffff79afbcd in gtk_window_focus_in_event (event=<optimized out>, widget=0x1014500) at gtkwindow.c:8503
#6  gtk_window_focus_in_event (widget=widget@entry=0x1014500, event=<optimized out>) at gtkwindow.c:8491
#7  0x00007ffff79de357 in _gtk_marshal_BOOLEAN__BOXED (closure=0x10aedd0, return_value=0x7fffffffb570, n_param_values=<optimized out>, param_values=0x7fffffffb620, 
    invocation_hint=<optimized out>, marshal_data=<optimized out>) at gtkmarshalers.c:83
#8  0x00007ffff71a34af in g_closure_invoke () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
#9  0x00007ffff71b49e9 in signal_emit_unlocked_R.isra.0 () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
#10 0x00007ffff71bad65 in g_signal_emit_valist () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
#11 0x00007ffff71bb722 in g_signal_emit () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
#12 0x00007ffff798ac04 in gtk_widget_event_internal (widget=widget@entry=0x1014500, event=event@entry=0x7fffe4007b50) at gtkwidget.c:7808
#13 0x00007ffff798d472 in gtk_widget_event_internal (event=0x7fffe4007b50, widget=0x1014500) at gtkwidget.c:7379
#14 0x00007ffff784b37a in gtk_main_do_event (event=0x7fffe4007b50) at gtkmain.c:1861
#15 gtk_main_do_event (event=<optimized out>) at gtkmain.c:1691
#16 0x00007ffff7efc3c5 in _gdk_event_emit (event=event@entry=0x7fffe4007b50) at gdkevents.c:73
#17 0x00007ffff7f59352 in gdk_event_source_dispatch (base=<optimized out>, callback=<optimized out>, data=<optimized out>) at gdkeventsource.c:124
#18 0x00007ffff70af4cb in g_main_context_dispatch () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libglib-2.0.so.0
#19 0x00000000007771e4 in pgtk_read_socket (terminal=0x1079530, hold_quit=0x7fffffffba10) at pgtkterm.c:3840
#20 0x000000000059703c in gobble_input () at keyboard.c:7424
#21 0x0000000000597580 in handle_async_input () at keyboard.c:7655
#22 0x000000000059759f in process_pending_signals () at keyboard.c:7669
#23 0x00000000005975df in unblock_input_to (level=0) at keyboard.c:7684
#24 0x0000000000597603 in unblock_input () at keyboard.c:7703
#25 0x000000000058fe19 in timer_check () at keyboard.c:4749
#26 0x000000000058ce8a in readable_events (flags=1) at keyboard.c:3531
#27 0x0000000000596f04 in get_input_pending (flags=1) at keyboard.c:7374
#28 0x00000000005a0201 in detect_input_pending_run_timers (do_display=true) at keyboard.c:10904
#29 0x00000000006de504 in wait_reading_process_output (time_limit=30, nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=XIL(0), wait_proc=0x0, just_wait_proc=0)
    at process.c:5779
#30 0x0000000000431ef3 in sit_for (timeout=make_fixnum(30), reading=true, display_option=1) at dispnew.c:6256
#31 0x000000000058a731 in read_char (commandflag=1, map=XIL(0x7ffff41b4703), prev_event=XIL(0), used_mouse_menu=0x7fffffffc42f, end_time=0x0) at keyboard.c:2879
#32 0x000000000059e2ee in read_key_sequence (keybuf=0x7fffffffc5c0, prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, 
--Type <RET> for more, q to quit, c to continue without paging--c
    prevent_redisplay=false) at keyboard.c:10081
#33 0x0000000000585bc7 in command_loop_1 () at keyboard.c:1382
#34 0x0000000000667131 in internal_condition_case (bfun=0x5857bc <command_loop_1>, handlers=XIL(0x90), hfun=0x584c7f <cmd_error>) at eval.c:1474
#35 0x00000000005853cc in command_loop_2 (handlers=XIL(0x90)) at keyboard.c:1131
#36 0x00000000006663ad in internal_catch (tag=XIL(0xff60), func=0x5853a9 <command_loop_2>, arg=XIL(0x90)) at eval.c:1197
#37 0x0000000000585365 in command_loop () at keyboard.c:1109
#38 0x000000000058476d in recursive_edit_1 () at keyboard.c:718
#39 0x0000000000584974 in Frecursive_edit () at keyboard.c:801
#40 0x000000000058034c in main (argc=2, argv=0x7fffffffcb08) at emacs.c:2530
(gdb) frame 12
#12 0x00007ffff798ac04 in gtk_widget_event_internal (widget=widget@entry=0x1014500, event=event@entry=0x7fffe4007b50) at gtkwidget.c:7808
7808    gtkwidget.c: No such file or directory.
(gdb) frame 12
#12 0x00007ffff798ac04 in gtk_widget_event_internal (widget=widget@entry=0x1014500, event=event@entry=0x7fffe4007b50) at gtkwidget.c:7808
7808    in gtkwidget.c
(gdb) p widget
$1 = (GtkWidget *) 0x1014500
(gdb) p Vframe_list 
$2 = XIL(0x7ffff41d3213)
(gdb) xcar
$3 = XIL(0x107975d)
(gdb) xframe
$4 = (struct frame *) 0x1079758
"*scratch* - GNU Emacs at ixy"
--8<---------------cut here---------------end--------------->8---

-- 
Best regards,
Andrew Tropin