This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

correct behaviour of next in different threads


Hi,

I debug an application with pthreads and set "stop-on-solib-events" to 1.
Now I 'next' over pthread_create(). The new thread loads a new shared library via dlopen().
Then a shared library event is generated. The thread is set in control.


When I now switch back to my origin thread (#1) and do a 'next', the stepping is again done in thread 2.

Is that the correct behaviour? Shouldn't thread 1 'next'?


I attached a dump of a gdb session with comments:


[Switching to Thread -1208661088 (LWP 8611)]
Stopped due to shared library event

<<Here gdb stands in thread 2, which is correct. Its the first thread with a shared lib event>>
(gdb) info threads
[New Thread -1219150944 (LWP 8613)]
 3 Thread -1219150944 (LWP 8613)  0x45e13a08 in clone () from /lib/libc.so.6
* 2 Thread -1208661088 (LWP 8611)  0x45d3c3c9 in _dl_debug_state ()
  from /lib/ld-linux.so.2
 1 Thread -1208657232 (LWP 8608)  0x45e13a08 in clone () from /lib/libc.so.6

<<Ok. gdb 'next's in thread 2>>
(gdb) n
Single stepping until exit from function _dl_debug_state,
which has no line number information.
0x45d345d6 in _dl_map_object_from_fd () from /lib/ld-linux.so.2

<<Now gdb switches to thread 1>
(gdb) t 1
[Switching to thread 1 (Thread -1208657232 (LWP 8608))]#0  0x4961ba84 in __nptl_create_event () from /lib/libpthread.so.0

<<gdb is now in thread 1>>
(gdb) info threads
 3 Thread -1219150944 (LWP 8613)  0x00342402 in __kernel_vsyscall ()
 2 Thread -1208661088 (LWP 8611)  0x45d345d6 in _dl_map_object_from_fd ()
  from /lib/ld-linux.so.2
* 1 Thread -1208657232 (LWP 8608)  0x4961ba84 in __nptl_create_event ()
  from /lib/libpthread.so.0

<<gdb does a 'next' in thread 1 ?!?>>
(gdb) n
Single stepping until exit from function __nptl_create_event,
which has no line number information.
pthread_create[1] = 0
0x45d345dd in _dl_map_object_from_fd () from /lib/ld-linux.so.2

<<It stands in thread 2 again>>
(gdb) info threads
[New Thread -1229640800 (LWP 8615)]
4 Thread -1229640800 (LWP 8615) 0x45e13a08 in clone () from /lib/libc.so.6
3 Thread -1219150944 (LWP 8613) 0x00342402 in __kernel_vsyscall ()
* 2 Thread -1208661088 (LWP 8611) 0x45d345dd in _dl_map_object_from_fd ()
from /lib/ld-linux.so.2
1 Thread -1208657232 (LWP 8608) 0x45e13a08 in clone () from /lib/libc.so.6
(gdb)


Regards,
Markus

--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]