From: "Paul Pluzhnikov" <ppluzhnikov@google.com>
To: ajloft@umich.edu
Cc: gdb@sourceware.org
Subject: Re: "Cannot find new threads" on Fedora 9, but not on CentOS 5 (?)
Date: Wed, 29 Oct 2008 02:21:00 -0000 [thread overview]
Message-ID: <8ac60eac0810281920r4bf71400hc8171bdee3c92ca@mail.gmail.com> (raw)
In-Reply-To: <4907B915.5040101@gmail.com>
On Tue, Oct 28, 2008 at 6:15 PM, Andrew Lofthouse <loftyhauser@gmail.com> wrote:
>> - What does 'ldd /path/to/app' say?
>> - What does 'nm /path/to/libpthread.so.0 | grep _version' say (where
>> /path/to/libpthread.so.0 is the one which ldd prints)?
>
> Hmm, ldd does not list libpthread.so.0:
>
> [andrew@fedora-vm ufs]$ ldd /usr/local/bin/ufs2oogl2D
> linux-gate.so.1 => (0x0012e000)
> libufs2D-0.9.so.2 => /usr/local/lib/libufs2D-0.9.so.2 (0x0012f000)
> libgts-0.7.so.5 => /usr/local/lib/libgts-0.7.so.5 (0x001d8000)
> libgmodule-2.0.so.0 => /lib/libgmodule-2.0.so.0 (0x00228000)
> libdl.so.2 => /lib/libdl.so.2 (0x0022c000)
> libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00231000)
> libm.so.6 => /lib/libm.so.6 (0x00312000)
> libc.so.6 => /lib/libc.so.6 (0x0033b000)
> libselinux.so.1 => /lib/libselinux.so.1 (0x004a4000)
> /lib/ld-linux.so.2 (0x00110000)
>
> But, gdb still seems to use libpthread when debugging the application (see
> below).
The application apparently dynamically loads /tmp/gfsZ54KNU,
which in turn depends (perhaps indirectly) on libpthread.so.0
This is supposed to work in theory, but apparently has glitches on
Fedora 9, though I can't reproduce that on my x86_64 Fedora 9.
See what you get with a test case at the bottom.
As a workaround, you may try to build your ufs2oogl2D with '-pthread'.
The other thing which may provide clues is to 'set verbose on'
before running the program.
> Now I'm confused. It looks like the non-debug library is not stripped, but
> the debug library is stripped (?):
This is good: libpthread.so.0 is not stripped:
> [andrew@fedora-vm ufs]$ file /lib/libpthread-2.8.so
> /lib/libpthread-2.8.so: ELF 32-bit LSB shared object, Intel 80386, version 1
> (SYSV), for GNU/Linux 2.6.9, not stripped
This isn't a library at all; this is just the debug bits for it.
Since these bits do not have a symbol table, file(1) says that it's
stripped. You can ignore that:
> [andrew@fedora-vm ufs]$ file /usr/lib/debug/lib/libpthread-2.8.so.debug
> /usr/lib/debug/lib/libpthread-2.8.so.debug: ELF 32-bit LSB shared object,
> Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, stripped
> Now, looking in gdb, it looks like gdb is using /lib/libpthread.so.0, but
> can't find its symbols:
It can find the symbols all right, but while GDB is adding symbols,
it hits some error, likely having to do with the process "suddenly"
becoming multithreaded.
Anyway, do you get any problems with the test case below.
What does "info threads" at crash point say?
--- cut --- thread-so-main.c ---
// compile with "gcc thread-so-main.c -ldl"
#include <dlfcn.h>
int main()
{
void *h = dlopen("./thread-so.so", RTLD_LAZY);
void (*fn)(void) = dlsym(h, "foo");
fn();
return 0;
}
--- cut ---
--- cut --- thread-so.c ---
// compile with "gcc -g -fPIC -shared -o thread-so.so thread-so.c
/lib/libgthread-2.0.so.0"
#include <pthread.h>
void *fn(void *p)
{
char *cp = (char *)p;
cp[0] = 'a';
return p;
}
void foo()
{
pthread_t tid;
pthread_create(&tid, 0, fn, 0);
pthread_join(tid, 0);
}
--- cut ---
For reference, here is what I see (all good):
GNU gdb Fedora (6.8-1.fc9)
Copyright (C) 2008 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-redhat-linux-gnu"...
(no debugging symbols found)
(gdb) r
Starting program: /mnt/ppluzhnikov/tmp/a.out
[Thread debugging using libthread_db enabled]
[New Thread 0x7f1a2d0136f0 (LWP 3004)]
[New Thread 0x416de950 (LWP 3007)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x416de950 (LWP 3007)]
0x0000000000110628 in fn (p=0x0) at thread-so.c:6
6 cp[0] = 'a';
Missing separate debuginfos, use: debuginfo-install glib2.x86_64
libselinux.x86_64
(gdb) inf thread
* 2 Thread 0x416de950 (LWP 3007) 0x0000000000110628 in fn (p=0x0) at
thread-so.c:6
1 Thread 0x7f1a2d0136f0 (LWP 3004) 0x0000003c9f807b75 in
pthread_join (threadid=<value optimized out>, thread_return=<value
optimized out>)
at pthread_join.c:89
(gdb) bt
#0 0x0000000000110628 in fn (p=0x0) at thread-so.c:6
#1 0x0000003c9f80729a in start_thread (arg=<value optimized out>) at
pthread_create.c:297
#2 0x0000003c9e8e42cd in clone () from /lib64/libc.so.6
(gdb) thread 1
[Switching to thread 1 (Thread 0x7f1a2d0136f0 (LWP 3004))]#0
0x0000003c9f807b75 in pthread_join (threadid=<value optimized out>,
thread_return=<value optimized out>) at pthread_join.c:89
89 lll_wait_tid (pd->tid);
(gdb) bt
#0 0x0000003c9f807b75 in pthread_join (threadid=<value optimized
out>, thread_return=<value optimized out>) at pthread_join.c:89
#1 0x0000000000110661 in foo () at thread-so.c:14
#2 0x000000000040059f in main ()
(gdb) q
The program is running. Exit anyway? (y or n) y
--
Paul Pluzhnikov
next prev parent reply other threads:[~2008-10-29 2:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-28 0:25 Andrew Lofthouse
2008-10-28 0:42 ` Paul Pluzhnikov
[not found] ` <4906615E.50606@gmail.com>
[not found] ` <8ac60eac0810271836saf8c28pb1392b77c7926be0@mail.gmail.com>
2008-10-29 1:16 ` Andrew Lofthouse
2008-10-29 1:52 ` Daniel Jacobowitz
2008-10-29 2:21 ` Paul Pluzhnikov [this message]
2008-10-30 1:11 ` Andrew Lofthouse
2008-10-30 1:30 ` Paul Pluzhnikov
2008-11-01 2:30 ` Andrew Lofthouse
2008-11-01 6:47 ` Paul Pluzhnikov
2008-11-01 15:29 ` Andrew Lofthouse
2008-11-01 21:41 ` Paul Pluzhnikov
2008-11-02 12:54 ` Andrew Lofthouse
2008-11-04 0:50 ` Tom Tromey
2008-12-12 22:50 ` Tom Tromey
2008-12-12 23:04 ` Daniel Jacobowitz
2008-12-12 23:30 ` Tom Tromey
2008-12-18 19:36 ` Michael Snyder
2008-12-12 23:06 ` Paul Pluzhnikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ac60eac0810281920r4bf71400hc8171bdee3c92ca@mail.gmail.com \
--to=ppluzhnikov@google.com \
--cc=ajloft@umich.edu \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox