On Thu, May 20, 2021 at 02:35:14PM +0200, Mark Kettenis wrote:
> Please use the ports gdb.
> 
> The base gdb is pretty much useless for debugging code built with
> clang, especially userland code that uses threads.

for whatever reason the freeze this time left me with a movable mouse
pointer, but clicking did not produce any reaction. So,

[Thu May 20 15:22:40] peter@zelda:~$ ps waux | grep X
root      1032  3.6  1.1 78312 157100 ??  S       2:49PM    1:47.30 
/usr/X11R6/bin/X :0 vt05 -keepPriv -auth 
/etc/X11/xenodm/authdir/authfiles/A:0-F73aG0 (Xorg)
root     81773  0.0  0.0   800  2012 ??  I       2:49PM    0:00.02 
/usr/X11R6/bin/xenodm
peter    94110  0.0  0.0  1008   948 ??  Ip      2:49PM    0:00.01 /bin/sh 
/etc/X11/xenodm/Xsession
peter     9396  0.0  0.0   628  1628 p4  S+p     3:22PM    0:00.01 grep X
[Thu May 20 15:22:43] peter@zelda:~$ doas egdb /usr/X11R6/bin/Xorg 1032
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 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-openbsd6.9".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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 /usr/X11R6/bin/Xorg...done.
Attaching to program: /usr/X11R6/bin/Xorg, process 1032
Reading symbols from /usr/X11R6/lib/libpciaccess.so.2.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libdrm.so.7.9...done.
Reading symbols from /usr/X11R6/lib/libpixman-1.so.38.4...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libXfont2.so.2.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libfontenc.so.4.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libfreetype.so.30.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/lib/libz.so.5.0...done.
Reading symbols from /usr/X11R6/lib/libXau.so.10.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libxshmfence.so.0.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libXdmcp.so.11.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/lib/libkvm.so.17.0...done.
Reading symbols from /usr/lib/libm.so.10.1...done.
Reading symbols from /usr/lib/libc.so.96.0...done.
Reading symbols from /usr/libexec/ld.so...done.
Reading symbols from /usr/X11R6/lib/modules/extensions/libglx.so...(no 
debugging symbols found)...done.
Reading symbols from /usr/X11R6/lib/libGL.so.17.1...done.
Reading symbols from /usr/lib/libexpat.so.13.0...done.
Reading symbols from /usr/X11R6/lib/libXdamage.so.4.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libXfixes.so.6.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libX11-xcb.so.2.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libxcb-glx.so.1.1...done.
Reading symbols from /usr/X11R6/lib/libxcb-dri2.so.1.1...done.
Reading symbols from /usr/X11R6/lib/libXxf86vm.so.6.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libXext.so.13.0...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libX11.so.17.1...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/libxcb.so.4.1...done.
Reading symbols from /usr/X11R6/lib/libxcb-dri3.so.0.1...done.
Reading symbols from /usr/X11R6/lib/libxcb-xfixes.so.1.2...done.
Reading symbols from /usr/X11R6/lib/libxcb-present.so.0.1...done.
Reading symbols from /usr/X11R6/lib/libxcb-sync.so.1.2...done.
Reading symbols from /usr/X11R6/lib/libglapi.so.0.3...done.
Reading symbols from /usr/X11R6/lib/modules/drivers/ati_drv.so...(no debugging 
symbols found)...done.
Reading symbols from /usr/X11R6/lib/modules/drivers/amdgpu_drv.so...(no 
debugging symbols found)...done.
Reading symbols from /usr/X11R6/lib/libdrm_amdgpu.so.1.10...done.
Reading symbols from /usr/X11R6/lib/libgbm.so.0.4...done.
Reading symbols from /usr/X11R6/lib/modules/libfb.so...(no debugging symbols 
found)...done.
Reading symbols from /usr/X11R6/lib/modules/dri/radeonsi_dri.so...(no debugging 
symbols found)...done.
Reading symbols from /usr/lib/libelf.so.3.0...done.
Reading symbols from /usr/lib/libLLVM.so.5.0...done.
Reading symbols from /usr/X11R6/lib/libdrm_radeon.so.4.0...done.
Reading symbols from /usr/lib/libc++.so.8.0...done.
Reading symbols from /usr/lib/libc++abi.so.5.0...done.
Reading symbols from /usr/X11R6/lib/modules/libglamoregl.so...(no debugging 
symbols found)...done.
Reading symbols from /usr/X11R6/lib/libepoxy.so.4.0...done.
Reading symbols from /usr/X11R6/lib/libEGL.so.1.1...done.
Reading symbols from /usr/X11R6/lib/modules/input/kbd_drv.so...(no debugging 
symbols found)...done.
Reading symbols from /usr/X11R6/lib/modules/input/ws_drv.so...(no debugging 
symbols found)...done.
[New thread 199961]
[New thread 437279]
[New thread 309058]
[New thread 408750]
[New thread 250540]
[New thread 391305]
[New thread 275511]
[New thread 457843]
[New thread 553730]
[New thread 571557]
[New thread 117307]
[New thread 391317]
[New thread 572029]
[New thread 396464]
[New thread 429304]
[New thread 173082]
[New thread 156279]
[New thread 238263]
[Switching to thread 327090]
futex () at /tmp/-:3
3       /tmp/-: No such file or directory.
(gdb) bt
#0  futex () at /tmp/-:3
#1  0x00000609db545557 in ?? () from /usr/X11R6/lib/modules/dri/radeonsi_dri.so
#2  0x00000609db9cddd0 in ?? () from /usr/X11R6/lib/modules/dri/radeonsi_dri.so
#3  0x00000609db1784c2 in ?? () from /usr/X11R6/lib/modules/dri/radeonsi_dri.so
#4  0x0000060a0efcb34a in amdgpu_glamor_flush () from 
/usr/X11R6/lib/modules/drivers/amdgpu_drv.so
#5  0x000006078b8edda3 in _CallCallbacks ()
#6  0x000006078ba861f4 in FlushClient ()
#7  0x000006078ba8683f in WriteToClient ()
#8  0x000006078b8f3e94 in WriteEventsToClient ()
#9  0x000006078b9e8556 in DamageExtNotify ()
#10 0x000006078b9f2639 in DamageReportDamage ()
#11 0x000006078b9f3d8f in damageCopyArea ()
#12 0x000006078b8e3fef in ProcCopyArea ()
#13 0x000006078b8e156d in Dispatch ()
#14 0x000006078b8ec5ec in dix_main ()
#15 0x000006078b8d3180 in _start ()
(gdb) list
1       in /tmp/-
(gdb) list
1       in /tmp/-
(gdb) list
1       in /tmp/-
(gdb) bt
#0  futex () at /tmp/-:3
#1  0x00000609db545557 in ?? () from /usr/X11R6/lib/modules/dri/radeonsi_dri.so
#2  0x00000609db9cddd0 in ?? () from /usr/X11R6/lib/modules/dri/radeonsi_dri.so
#3  0x00000609db1784c2 in ?? () from /usr/X11R6/lib/modules/dri/radeonsi_dri.so
#4  0x0000060a0efcb34a in amdgpu_glamor_flush () from 
/usr/X11R6/lib/modules/drivers/amdgpu_drv.so
#5  0x000006078b8edda3 in _CallCallbacks ()
#6  0x000006078ba861f4 in FlushClient ()
#7  0x000006078ba8683f in WriteToClient ()
#8  0x000006078b8f3e94 in WriteEventsToClient ()
#9  0x000006078b9e8556 in DamageExtNotify ()
#10 0x000006078b9f2639 in DamageReportDamage ()
#11 0x000006078b9f3d8f in damageCopyArea ()
#12 0x000006078b8e3fef in ProcCopyArea ()
#13 0x000006078b8e156d in Dispatch ()
#14 0x000006078b8ec5ec in dix_main ()
#15 0x000006078b8d3180 in _start ()
(gdb) continue
Continuing.

Thread 2 received signal SIGSTOP, Stopped (signal).
[Switching to thread 199961]
ioctl () at /tmp/-:3
3       /tmp/-: No such file or directory.
(gdb) continue
Continuing.

Thread 1 received signal SIGSTOP, Stopped (signal).
[Switching to thread 327090]
<signal handler called>
(gdb) list
1       in /tmp/-
(gdb) continue
Continuing.

Thread 4 received signal SIGSTOP, Stopped (signal).
[Switching to thread 309058]
futex () at /tmp/-:3
3       /tmp/-: No such file or directory.
(gdb) continue
Continuing.

Thread 5 received signal SIGSTOP, Stopped (signal).
[Switching to thread 408750]
futex () at /tmp/-:3
3       in /tmp/-
(gdb) continue
Continuing.

Thread 4 received signal SIGSTOP, Stopped (signal).
[Switching to thread 309058]
_rthread_cond_timedwait (cond=0x609bf81f2f0, mutexp=0x609bf80d690, abs=0x0) at 
/usr/src/lib/libc/thread/rthread_cond.c:121
121             pthread_mutex_lock(mutexp);
(gdb) list
116             if (error == ETIMEDOUT)
117                     rv = ETIMEDOUT;
118             else if (error == EINTR)
119                     canceled = 1;
120     
121             pthread_mutex_lock(mutexp);
122     
123             /* restore the mutex's count */
124             if (mutex->type == PTHREAD_MUTEX_RECURSIVE)
125                     mutex->count = mutex_count;
(gdb) list
126     
127             LEAVE_CANCEL_POINT_INNER(tib, canceled);
128     
129             return rv;
130     }
131     
132     int
133     pthread_cond_timedwait(pthread_cond_t *condp, pthread_mutex_t *mutexp,
134         const struct timespec *abs)
135     {
(gdb) list
136             pthread_cond_t cond;
137             int error;
138     
139             if (*condp == NULL) {
140                     if ((error = pthread_cond_init(condp, NULL)))
141                             return (error);
142             }
143     
144             cond = *condp;
145             if (abs == NULL || abs->tv_sec < 0 || abs->tv_nsec < 0 ||
(gdb) list
146                 abs->tv_nsec >= 1000000000)
147                     return (EINVAL);
148     
149             return (_rthread_cond_timedwait(cond, mutexp, abs));
150     }
151     
152     int
153     pthread_cond_wait(pthread_cond_t *condp, pthread_mutex_t *mutexp)
154     {
155             pthread_cond_t cond;
(gdb) list
156             int error;
157     
158             if (*condp == NULL) {
159                     if ((error = pthread_cond_init(condp, NULL)))
160                             return (error);
161             }
162     
163             cond = *condp;
164             return (_rthread_cond_timedwait(cond, mutexp, NULL));
165     }
(gdb) list
166     
167     int
168     pthread_cond_signal(pthread_cond_t *condp)
169     {
170             pthread_cond_t cond;
171             int count;
172     
173             if (*condp == NULL)
174                     return (0);
175     
(gdb) list
176             cond = *condp;
177     
178             atomic_inc_int(&cond->seq);
179             count = _wake(&cond->seq, 1);
180     
181             _rthread_debug(5, "%p: cond_signal %p, %d awaken\n", 
pthread_self(),
182                 (void *)cond, count);
183     
184             return (0);
185     }
(gdb) list
186     
187     int
188     pthread_cond_broadcast(pthread_cond_t *condp)
189     {
190             pthread_cond_t cond;
191             int count;
192     
193             if (*condp == NULL)
194                     return (0);
195     
(gdb) list
196             cond = *condp;
197     
198             atomic_inc_int(&cond->seq);
199     #if notyet
200             count = _requeue(&cond->seq, 1, INT_MAX, &cond->mutex->lock);
201     #else
202             count = _wake(&cond->seq, INT_MAX);
203     #endif
204     
205             _rthread_debug(5, "%p: cond_broadcast %p, %d awaken\n", 
pthread_self(),
(gdb) list
206                 (void *)cond, count);
207     
208             return (0);
209     }
(gdb) list
Line number 210 out of range; /usr/src/lib/libc/thread/rthread_cond.c has 209 
lines.
(gdb) continue
Continuing.

Thread 5 received signal SIGSTOP, Stopped (signal).
[Switching to thread 408750]
_rthread_cond_timedwait (cond=0x609bf81f2f0, mutexp=0x609bf80d690, abs=0x0) at 
/usr/src/lib/libc/thread/rthread_cond.c:121
121             pthread_mutex_lock(mutexp);
(gdb) list
116             if (error == ETIMEDOUT)
117                     rv = ETIMEDOUT;
118             else if (error == EINTR)
119                     canceled = 1;
120     
121             pthread_mutex_lock(mutexp);
122     
123             /* restore the mutex's count */
124             if (mutex->type == PTHREAD_MUTEX_RECURSIVE)
125                     mutex->count = mutex_count;
(gdb) list
126     
127             LEAVE_CANCEL_POINT_INNER(tib, canceled);
128     
129             return rv;
130     }
131     
132     int
133     pthread_cond_timedwait(pthread_cond_t *condp, pthread_mutex_t *mutexp,
134         const struct timespec *abs)
135     {
(gdb) list
136             pthread_cond_t cond;
137             int error;
138     
139             if (*condp == NULL) {
140                     if ((error = pthread_cond_init(condp, NULL)))
141                             return (error);
142             }
143     
144             cond = *condp;
145             if (abs == NULL || abs->tv_sec < 0 || abs->tv_nsec < 0 ||
(gdb) list
146                 abs->tv_nsec >= 1000000000)
147                     return (EINVAL);
148     
149             return (_rthread_cond_timedwait(cond, mutexp, abs));
150     }
151     
152     int
153     pthread_cond_wait(pthread_cond_t *condp, pthread_mutex_t *mutexp)
154     {
155             pthread_cond_t cond;
(gdb) list
156             int error;
157     
158             if (*condp == NULL) {
159                     if ((error = pthread_cond_init(condp, NULL)))
160                             return (error);
161             }
162     
163             cond = *condp;
164             return (_rthread_cond_timedwait(cond, mutexp, NULL));
165     }
(gdb) list
166     
167     int
168     pthread_cond_signal(pthread_cond_t *condp)
169     {
170             pthread_cond_t cond;
171             int count;
172     
173             if (*condp == NULL)
174                     return (0);
175     
(gdb) list
176             cond = *condp;
177     
178             atomic_inc_int(&cond->seq);
179             count = _wake(&cond->seq, 1);
180     
181             _rthread_debug(5, "%p: cond_signal %p, %d awaken\n", 
pthread_self(),
182                 (void *)cond, count);
183     
184             return (0);
185     }
(gdb) list
186     
187     int
188     pthread_cond_broadcast(pthread_cond_t *condp)
189     {
190             pthread_cond_t cond;
191             int count;
192     
193             if (*condp == NULL)
194                     return (0);
195     
(gdb) list
196             cond = *condp;
197     
198             atomic_inc_int(&cond->seq);
199     #if notyet
200             count = _requeue(&cond->seq, 1, INT_MAX, &cond->mutex->lock);
201     #else
202             count = _wake(&cond->seq, INT_MAX);
203     #endif
204     
205             _rthread_debug(5, "%p: cond_broadcast %p, %d awaken\n", 
pthread_self(),
(gdb) list
206                 (void *)cond, count);
207     
208             return (0);
209     }
(gdb) list
Line number 210 out of range; /usr/src/lib/libc/thread/rthread_cond.c has 209 
lines.
(gdb) continue
Continuing.

Thread 6 received signal SIGSTOP, Stopped (signal).
[Switching to thread 250540]
futex () at /tmp/-:3
3       /tmp/-: No such file or directory.
(gdb) 

Again, it goes back to the same lines.

All the best,
Peter


-- 
Peter N. M. Hansteen, member of the first RFC 1149 implementation team
http://bsdly.blogspot.com/ http://www.bsdly.net/ http://www.nuug.no/
"Remember to set the evil bit on all malicious network traffic"
delilah spamd[29949]: 85.152.224.147: disconnected after 42673 seconds.

Reply via email to