Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
To: gdb@sourceware.org
Subject: generic error with a statically linked multithreaded program
Date: Thu, 05 Apr 2007 05:58:00 -0000	[thread overview]
Message-ID: <20070405.145806.89068923.nemoto@toshiba-tops.co.jp> (raw)

I found gdb can not run a statically linked multithreaded program on
Fedora Core 6.

Tested with gdb 6.5-15.fc6rh (FC6), gdb-6.6 vanilla and
gdb-6.6.50.20070405 snapshot.  All behave same.

$ gcc -o ./hello -g hello.c -lpthread -static
$ gdb-6.6.50.20070405/gdb/gdb ./hello
GNU gdb 6.6.50.20070405
Copyright (C) 2007 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: ./hello 
[Thread debugging using libthread_db enabled]
Cannot find new threads: generic error
(gdb)

And gdb can not exit normally with "quit" command.

(gdb) quit
The program is running.  Exit anyway? (y or n) y

Then gdb hangs.  At this point, the target program is still stopped.

$ ps l
F   UID   PID  PPID PRI  NI    VSZ   RSS WCHAN  STAT TTY        TIME COMMAND
0 11389 12286  3594  20   0   8628  3332 wait   S+   pts/2      0:00 gdb-6.6.50.20070405/gdb/gdb ./hello
0 11389 12287 12286  15   0  10960   140 utrace Tl   pts/2      0:00 ./hello

--- hello.c ---
#include <stdio.h>
#include <pthread.h>
void *func(void *data)
{
	return NULL;
}
int main(int argc, char **argv)
{
	pthread_t tid;
	pthread_create(&tid, NULL, func, NULL);
	printf("hello world\n");
	pthread_join(tid, NULL);
	return 0;
}
--- --- ---

My environment is:
kernel-2.6.20-1.2933.fc6
glibc-2.5-10.fc6
gcc-4.1.1-51.fc6

If I compiled the program without -static, gdb can run it normally.

Is this gdb problem, or limitation, or problem at somewhere else?

---
Atsushi Nemoto


             reply	other threads:[~2007-04-05  5:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-05  5:58 Atsushi Nemoto [this message]
2007-04-05 10:51 ` Atsushi Nemoto
2007-04-05 14:29 ` Daniel Jacobowitz
2007-04-05 14:39   ` Atsushi Nemoto
2007-04-05 14:45     ` Daniel Jacobowitz
2007-04-06  9:40       ` Atsushi Nemoto
2007-04-19  9:19         ` Atsushi Nemoto

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=20070405.145806.89068923.nemoto@toshiba-tops.co.jp \
    --to=anemo@mba.ocn.ne.jp \
    --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