NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/58216: gdb breakpoints do not always work



>Number:         58216
>Category:       bin
>Synopsis:       gdb breakpoints do not always work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 30 12:55:00 +0000 2024
>Originator:     Rhialto
>Release:        NetBSD 10.0
>Organization:
>Environment:
System: NetBSD murthe.falu.nl 10.0 NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	I'm not actually sure if this is a bug in gdb (category bin)
	or in the kernel (port-amd64 in that case).

	I have another PR open with a problem in the X server.
	I tried to gain more insights by attaching gdb to the X server
	process, and setting breakpoints on some key functions, such as
	glamor_get_vbo_space and glamor_text. However the breakpoints
	never triggered.            

	On further inspection, the breakpoints were marked as <PENDING> and
	therefore not functional.

	For some other symbols, it doesn't even pretend to set a breakpoint
	and errors out as soon as you try to continue the program.

	Hardware breakpoints (hbreak) do break, but then gdb has an
	assertion failure and exists soon after.

>How-To-Repeat:
	(on an ssh connection into the machine)
	(find out the pid of X, it is 28256 in this case)
	$ sudo gdb -p 28256
	GNU gdb (GDB) 11.0.50.20200914-git
	...
	(gdb) break glamor_get_vbo_space
	Breakpoint 1 at 0x6fb07d40d395: file /usr/xsrc/external/mit/xorg-server/dist/glamor/glamor_vbo.c, line 47.
	(gdb) break glamor_text
	Breakpoint 2 at 0x6fb07d41339e: file /usr/xsrc/external/mit/xorg-server/dist/glamor/glamor_text.c, line 97.
	(gdb) c
	Continuing.

	(trigger a signal to the X server by disconnecting a client)
	(I had set breakpoints on mmap and poll in the mean time,
	to check if breakpoints work at all)

	Thread 5 received signal SIGPIPE, Broken pipe.
	0x00006fb084246fea in poll () from /usr/lib/libc.so.12
	(gdb) info break
	Num     Type           Disp Enb Address            What
	1       breakpoint     keep y   <PENDING>          glamor_get_vbo_space
	2       breakpoint     keep y   <PENDING>          glamor_text
	3       breakpoint     keep y   <MULTIPLE>
	3.1                         y   <PENDING>          mmap
	3.2                         y   <PENDING>          mmap
	4       breakpoint     keep y   <MULTIPLE>
	4.1                         y   <PENDING>          poll
	4.2                         y   <PENDING>          poll
	(gdb) break InputThreadDoWork
	Breakpoint 5 at 0xdcbb0722
	(gdb) c
	Continuing.
	Warning:
	Cannot insert breakpoint 5.
	Cannot access memory at address 0xdcbb0722

	Command aborted.
	(gdb) c
	Continuing.
	Warning:
	Cannot insert breakpoint 5.
	Cannot access memory at address 0xdcbb0722

	Command aborted.
	(gdb) disa 5
	(gdb) hbreak glamor_text
	Hardware assisted breakpoint 6 at 0x6fb07d41339e: file /usr/xsrc/external/mit/xorg-server/dist/glamor/glamor_text.c, line 97.
	(gdb) c
	Continuing.
	[Switching to LWP 28256 of process 28256]

	Thread 4 "" hit Breakpoint 6, glamor_text (
	    drawable=drawable@entry=0x6fb0824c98c0, gc=gc@entry=0x6fb082103ac0,
	    glamor_font=glamor_font@entry=0x6fb086e3bfb0,
	    prog=prog@entry=0x6fb088f24268, x=x@entry=17, y=y@entry=377,
	    count=count@entry=6,
	    s_chars=s_chars@entry=0x6fb086f52940 "        L\006\006",
	    charinfo=charinfo@entry=0x7f7fffd18400, sixteen=sixteen@entry=0)
	    at /usr/xsrc/external/mit/xorg-server/dist/glamor/glamor_text.c:97
	97      {
	(gdb) bt
	#0  glamor_text (drawable=drawable@entry=0x6fb0824c98c0,
	    gc=gc@entry=0x6fb082103ac0, glamor_font=glamor_font@entry=0x6fb086e3bfb0,
	    prog=prog@entry=0x6fb088f24268, x=x@entry=17, y=y@entry=377,
	    count=count@entry=6,
	    s_chars=s_chars@entry=0x6fb086f52940 "        L\006\006",
	    charinfo=charinfo@entry=0x7f7fffd18400, sixteen=sixteen@entry=0)
	    at /usr/xsrc/external/mit/xorg-server/dist/glamor/glamor_text.c:97
	#1  0x00006fb07d413e28 in glamor_image_text (
	    drawable=drawable@entry=0x6fb0824c98c0, gc=gc@entry=0x6fb082103ac0,
	    x=x@entry=17, y=y@entry=377, count=count@entry=6,
	    chars=chars@entry=0x6fb086f52940 "        L\006\006",
	    sixteen=sixteen@entry=0)
	    at /usr/xsrc/external/mit/xorg-server/dist/glamor/glamor_text.c:467
	#2  0x00006fb07d413fa9 in glamor_image_text8 (drawable=0x6fb0824c98c0,
	    gc=0x6fb082103ac0, x=17, y=377, count=6,
	    chars=0x6fb086f52940 "        L\006\006")
	    at /usr/xsrc/external/mit/xorg-server/dist/glamor/glamor_text.c:480
	#3  0x00000000dcb5fbbe in damageImageText8 ()
	#4  0x00000000dca7e6b5 in doImageText ()
	#5  0x00000000dca7f8df in ImageText ()
	#6  0x00000000dca8395b in ProcImageText8 ()
	#7  0x00000000dca85c2e in Dispatch ()
	#8  0x00000000dca55e1f in dix_main ()
	#9  0x00000000dca559cd in ___start ()
	#10 0x00007f7ee6e0baf8 in ?? () from /usr/libexec/ld.elf_so
	#11 0x0000000000000005 in ?? ()
	#12 0x00007f7fffd19480 in ?? ()
	#13 0x00007f7fffd19491 in ?? ()
	#14 0x00007f7fffd19494 in ?? ()
	#15 0x00007f7fffd19499 in ?? ()
	#16 0x00007f7fffd1949f in ?? ()
	#17 0x0000000000000000 in ?? ()
	(gdb) next
	[New process 28256]
	/usr/src/external/gpl3/gdb/lib/libgdb/../../dist/gdb/infrun.c:5683: internal-error: int finish_step_over(execution_control_state*): Assertion `ecs->event_thread->control.trap_expected' failed.
	A problem internal to GDB has been detected,
	further debugging may prove unreliable.
	Quit this debugging session? (y or n) y

	This is a bug, please report it.  For instructions, see:
	<https://www.gnu.org/software/gdb/bugs/>.

	/usr/src/external/gpl3/gdb/lib/libgdb/../../dist/gdb/infrun.c:5683: internal-error: int finish_step_over(execution_control_state*): Assertion `ecs->event_thread->control.trap_expected' failed.
	A problem internal to GDB has been detected,
	further debugging may prove unreliable.
	Unable to dump core, use `ulimit -c unlimited' before executing GDB next time.
	[ 108164.2883624] sorry, pid 28256 was killed: orphaned traced process
	You have mail in /var/mail/rhialto
	murthe.0:~$

>Fix:
	unknown.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert                            <rhialto/at/falu.nl>
\X/ There is no AI. There is just someone else's work.           --I. Rose



Home | Main Index | Thread Index | Old Index