HP-UX HB v13.00 Ch-11 - Software Development

HP-UX Handbook Rev 13.00 Page 89 (of 101)
Chapter 11 Software Development
October 29, 2013
(gdb) r rerun the program
The program being debugged has been started already.
Start it from the beginning? (y or n) y
warning: Temporarily disabling or deleting shared library breakpoints:
warning: Deleting breakpoint #-50
warning: Deleting breakpoint #-51
Starting program: /space/mstreibe/cases/heap/a.out 1234567890
warning: Watched address 0x4042c448 allocated
__rtc_event () at ../../../Src/gnu/gdb/infrtc.c:699
699 ../../../Src/gnu/gdb/infrtc.c: No such file or directory.
in ../../../Src/gnu/gdb/infrtc.c
(gdb)
Now we could check what the program does with this buffer, e.g. by single stepping until we
find the line of code that overwrites the buffer borders.
Or we could set a watchpoint to the buffer borders. This would make gdb stop the program when
the values at these addresses change.
Threads-Library Mismatch
#0 0xc01339a4 in () from /usr/lib/libc.2
#1 0xc0206b2c in __thread_atfork () from /usr/lib/libc.2
#2 0xc02046a4 in __libc_init () from /usr/lib/libc.2
#3 0xc0adfaf4 in hp__pre_init_libc () from /usr/lib/libcma.2
#0 0xc102c3b4 in pthread_mutex_init () from /usr/lib/libpthread.1
#1 0xc02047c4 in libc_init () from /usr/lib/libc.2
#2 0xc0203f0c in __libc_init () from /usr/lib/libc.2
#3 0xc0adfaf4 in hp__pre_init_libc () from /usr/lib/libcma.2
If you see a core file with a stack trace like one of the above which shows things that seem
related to threads initialization, check with ldd(1) which libraries are loaded by the program. If
both libcma (user threads) and libpthread (kernel threads) are listed, you most probably have
found the cause. Both libraries are incompatible and must not be mixed. One of them must be
removed. Which one depends on the program vendor, but most of the time kernel threads are the
ones wanted on 11.X and later.
The threads mismatch can occur with programs that are ported from HP-UX 10.X to 11.X. On
10.X there were no kernel threads, and every multithreaded program used CMA threads. When
ported to 11.X, and if the program uses third party libraries, e.g. the oracle library
libclntsh.sl, the mismatch occurs, if the program is not ported to kernel threads, because the
oracle library uses kernel threads while the program still uses CMA threads.