From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
To: gdb@sources.redhat.com
Subject: huge remote debug traffic with multi-thread program
Date: Wed, 16 Feb 2005 16:24:00 -0000 [thread overview]
Message-ID: <20050216.210432.15259170.nemoto@toshiba-tops.co.jp> (raw)
[-- Attachment #1: Type: Text/Plain, Size: 3379 bytes --]
When remote-debugging a multi-thread program on mips-linux, I see huge
remote traffic after interrupting the remote program.
My target environment is mips(el)-linux (Debian sarge) and current gdb
snapshot (20050216).
Here is my test program.
#include <pthread.h>
pthread_mutex_t pm;
static void *func(void *arg)
{
while (1) {
pthread_mutex_lock(&pm);
pthread_mutex_unlock(&pm);
}
}
int main(int argc, char *argv[])
{
int i;
pthread_t tid[2];
pthread_mutex_init(&pm, NULL);
for (i = 0; i < 2; i++)
pthread_create(&tid[i], NULL, func, NULL);
for (i = 0; i < 2; i++)
pthread_join(tid[i], NULL);
}
When I typed Ctrl-C and 'c' (continue) on gdb, traffic between gdb and
gdbserver start eating network bandwidth and gdbserver eats whole CPU
power on the target. Is this a normal behavior?
If I replace last 2 line in main() with following code (i.e. not
use pthread_join), the traffic disappear soon.
while (1)
sleep(100);
With gdb 6.3, the traffic disappear soon without this change.
With "set debug remote 1", I got following logs after the 'c' command.
(please refer hostlog-join.txt for complete log)
(gdb) c
Continuing.
Sending packet: $m404e18,4#33...Ack
Packet received: 03e00008
Sending packet: $m404e18,4#33...Ack
Packet received: 03e00008
Sending packet: $m404a78,4#35...Ack
Packet received: 8fbc0010
Sending packet: $M404a78,4:0005000d#08...Ack
Packet received: OK
Sending packet: $vCont;c#a8...Ack
Packet received: T0525:00404a78;1d:7f7ff998;thread:4002;
...
Sending packet: $vCont;c:4002#a8...Ack
Packet received: T0525:00404a7c;1d:7f7ff998;thread:4002;
...
Sending packet: $vCont;c#a8...Ack
Packet received: T0525:00404a78;1d:7f5ff998;thread:8003;
...
Sending packet: $vCont;c:8003#ad...Ack
Packet received: T0525:00404a7c;1d:7f5ff998;thread:8003;
...
Sending packet: $vCont;c#a8...Ack
Packet received: T0525:00404a78;1d:7f7ff998;thread:4002;
...
Sending packet: $vCont;c:4002#a8...Ack
Packet received: T0525:00404a7c;1d:7f7ff998;thread:4002;
...
0x00404a78 and 0x00404a7c are within __pthread_wait_for_restart_signal().
0x00404a70 <__pthread_wait_for_restart_signal+124>: jalr t9 # __pthread_sigsuspend()
0x00404a74 <__pthread_wait_for_restart_signal+128>: nop
0x00404a78 <__pthread_wait_for_restart_signal+132>: lw gp,16(sp)
0x00404a7c <__pthread_wait_for_restart_signal+136>: lw v1,96(s0)
0x00404a80 <__pthread_wait_for_restart_signal+140>: lw v0,-32364(gp)
0x00404a84 <__pthread_wait_for_restart_signal+144>: nop
0x00404a88 <__pthread_wait_for_restart_signal+148>: lw v0,0(v0)
0x00404a8c <__pthread_wait_for_restart_signal+152>: nop
0x00404a90 <__pthread_wait_for_restart_signal+156>: bne v1,v0,0x404a68 <__pthread_wait_for_restart_signal+116>
Using sleep() instead of pthread_join(), I got any packets after
'$vCont' until I type Ctrl-C again.
(please refer hostlog-sleep.txt for complete log)
Attached is a complete logs for both side. The test program is
statically linked. This problem is same with dynamically linked
program.
hostlog-join.txt -- gdb log with 'set debug remote 1' (pthread_join)
serverlog-join.txt -- gdbserver log with debug_threads = 1 (pthread_join)
hostlog-sleep.txt -- gdb log with 'set debug remote 1' (sleep)
serverlog-sleep.txt -- gdbserver log with debug_threads = 1 (sleep)
Could someone look into this?
Thank you.
---
Atsushi Nemoto
[-- Attachment #2: log.tar.gz --]
[-- Type: Application/Octet-Stream, Size: 4483 bytes --]
next reply other threads:[~2005-02-16 12:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-16 16:24 Atsushi Nemoto [this message]
2005-02-17 1:42 ` Daniel Jacobowitz
2005-02-17 9:01 ` Atsushi Nemoto
2005-02-18 22:54 ` Atsushi Nemoto
2005-02-22 18:59 ` Atsushi Nemoto
2005-03-17 5:43 ` Atsushi Nemoto
2005-03-17 11:38 ` Bob Rossi
2005-03-17 18:21 ` Mark Kettenis
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=20050216.210432.15259170.nemoto@toshiba-tops.co.jp \
--to=anemo@mba.ocn.ne.jp \
--cc=gdb@sources.redhat.com \
/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