From: Vladimir Vorobyov <vladimir.vorobyov@iss.org.ua>
To: Daniel Jacobowitz <drow@false.org>
Cc: Andreas Schwab <schwab@suse.de>, gdb@sources.redhat.com
Subject: Re: pthreads debug with gdbserver
Date: Tue, 23 Nov 2004 19:33:00 -0000 [thread overview]
Message-ID: <200411231857.31740.vladimir.vorobyov@iss.org.ua> (raw)
In-Reply-To: <20041122140643.GA402@nevyn.them.org>
On Monday 22 November 2004 04:06 pm, Daniel Jacobowitz wrote:
> On Mon, Nov 22, 2004 at 02:40:21PM +0200, Vladimir Vorobyov wrote:
> > I think I've added all missing routines and it ALMOST work. First, I
> > have to specify 'set remotetimeout 60' otherwise gdb reports timeout
> > error (Ignoring packet error, continuing...).
> > - Is it normal ?
> > Second, after I set any break point (e.g. break main) I cant use
> > 'continue' command. Program stops after any instruction with SIGTRAP.
> > When I force gdbserver to ignore 'stepping' variable, everything works
> > fine. But Im sure it is wrong correction. Who is responsible for reseting
> > stepping? And why we need it?
>
> Try CVS; Andreas has also just implemented m68k support.
I've downloaded the CVS version and have some questions:
1) When I try to debug following example:
*************************************************************************************
3 #define NUM_THREADS 5
4
5 void *thread_function(void *arg)
6 {
7 printf("Hello World from %d!\n", arg);
8 sleep(10);
9 printf("Exited %d!\n", arg);
10 pthread_exit(NULL);
11 }
12
13 int main (int argc, char *argv[])
14 {
15 pthread_t threads[NUM_THREADS];
16 int i;
17
18 for (i = 0; i < NUM_THREADS; i++)
19 {
20 pthread_create(&threads[i], NULL, thread_function, (void *)i);
21 printf("Thread %d created.\n", i);
22 }
23 for (i = 0; i < NUM_THREADS; i++)
24 pthread_join(threads[i], NULL);
25
26 printf("finish!\n");
27 return (0);
28 }
******************************************************************************************
I put first break point to line 23. When program stops, 'info threads' shows:
(gdb) info threads
7 Thread 81926 0x40126f56 in nanosleep ()
from /tftpboot/rootfsdir/lib/libc.so.6
6 Thread 65541 0x40126f56 in nanosleep ()
from /tftpboot/rootfsdir/lib/libc.so.6
5 Thread 49156 0x40126f56 in nanosleep ()
from /tftpboot/rootfsdir/lib/libc.so.6
4 Thread 32771 0x40126f56 in nanosleep ()
from /tftpboot/rootfsdir/lib/libc.so.6
3 Thread 16386 0x40126f56 in nanosleep ()
from /tftpboot/rootfsdir/lib/libc.so.6
2 Thread 32769 0x40150a0e in loser_poll ()
from /tftpboot/rootfsdir/lib/libc.so.6
* 1 Thread 16384 main (argc=1, argv=0xbffffe04) at hello.c:23
Looks perfectly for me.
After this if I set "break 9 thread 3" and "continue", program stops on
correct line but I can't 'step' it:
(gdb) c
Continuing.
[Switching to Thread 16386]
Breakpoint 4, thread_function (arg=0x0) at hello.c:9
9 printf("Exited from %d!\n", arg);
(gdb) step
Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 32771]
0x80000540 in thread_function (arg=0x1) at hello.c:9
9 printf("Exited from %d!\n", arg);
(gdb) c
Continuing.
Program received signal SIGILL, Illegal instruction.
0x80000540 in thread_function (arg=0x1) at hello.c:9
9 printf("Exited from %d!\n", arg);
(gdb) x /20i $pc
0x80000540 <thread_function+36>: 010
0x80000542 <thread_function+38>: pea 0x800006d4 <_IO_stdin_used+26>
0x80000548 <thread_function+44>: bsrl 0x80000414 <printf>
0x8000054e <thread_function+50>: addql #8,%sp
0x80000550 <thread_function+52>: clrl %sp@-
0x80000552 <thread_function+54>: bsrl 0x80000444 <pthread_exit>
0x80000558 <thread_function+60>: nop
0x8000055a <main>: linkw %fp,#-24
0x8000055e <main+4>: clrl %fp@(-24)
......
Andreas, do you have this problem on your side?
2) I still need 'set remotetimeout 30' because otherwise I get error "Ignoring
packet error, continuing...". What can gdbserver do for 30 seconds?
Sorry for the long post.
Could you recommend anything?
Regards,
Vladimir.
next prev parent reply other threads:[~2004-11-23 16:58 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-19 14:23 Vladimir Vorobyov
2004-11-19 14:42 ` Daniel Jacobowitz
2004-11-19 15:59 ` Vladimir Vorobyov
2004-11-20 10:01 ` Daniel Jacobowitz
2004-11-20 16:42 ` Vladimir Vorobyov
2004-11-20 16:57 ` Daniel Jacobowitz
2004-11-20 17:13 ` Andreas Schwab
2004-11-20 17:38 ` Vladimir Vorobyov
2004-12-06 18:41 ` NPTL on ppc (was: pthreads debug with gdbserver) Linh Dang
2004-12-06 18:45 ` Daniel Jacobowitz
2004-12-06 19:56 ` NPTL on ppc Linh Dang
2004-12-06 20:18 ` Daniel Jacobowitz
2004-12-06 22:41 ` Andreas Schwab
2004-12-06 23:20 ` Andreas Schwab
2004-12-07 14:33 ` Linh Dang
2004-12-07 14:56 ` Andreas Schwab
2004-12-06 22:04 ` Andreas Schwab
2004-11-22 14:07 ` pthreads debug with gdbserver Vladimir Vorobyov
2004-11-22 18:04 ` Daniel Jacobowitz
2004-11-23 19:33 ` Vladimir Vorobyov [this message]
2004-11-19 16:19 ` Andreas Schwab
2004-11-19 17:30 ` Vladimir Vorobyov
2004-11-20 1:31 ` Andreas Schwab
2004-11-20 1:32 ` Daniel Jacobowitz
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=200411231857.31740.vladimir.vorobyov@iss.org.ua \
--to=vladimir.vorobyov@iss.org.ua \
--cc=drow@false.org \
--cc=gdb@sources.redhat.com \
--cc=schwab@suse.de \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).