From: Michael Shuldman <michael.shuldman@ericsson.com>
To: gdb@sources.redhat.com
Subject: gdb, target remote, threadbased application in uml
Date: Wed, 28 Feb 2007 13:25:00 -0000 [thread overview]
Message-ID: <20070228130454.GA31868@localhost> (raw)
Hello, I'm having a problem running gdb on a threadbased application.
The application is running inside uml, with pid 765. UML is running on
the same physical machine as I'm debugging from.
Status is this:
On the target (uml) side I do the following, to start gdbserver:
$ gdbserver 172.16.254.1:2024 --attach 765
Attached; pid = 765
Listening on port 2024
Remote debugging from host 172.16.254.1
On the host side, I then start gdb and do the following:
set solib-search-path usr/local/...
target remote 172.16.254.2:2024
Remote debugging using 172.16.254.2:2024
0xffffe410 in ?? ()
[Thread debugging using libthread_db enabled]
[New Thread 1076389568 (LWP 765)]
Can't attach LWP 765: No such process
(gdb)
(gdb) bt
#0 0xffffe410 in ?? ()
#1 0xbf502568 in ?? ()
2 0x0000081c in ?? ()
#3 0xbf501d34 in ?? ()
#4 0x4004556b in __read_nocancel () from
/lib/tls/i686/cmov/libpthread.so.0
#5 0x40026a24 in Msg__Wait (pMsgQue=0x8502d00,
ePreemptive=NON_PREEMPTIVE)
at /home/a8648/src/oms.svn/main/basic/ipc/msg.c:235
#6 0x0804ad51 in main (argc=1, argv=0xbf502644)
at /home/a8648/src/oms.svn/main/mpls/rcim/rcim.c:259
(gdb) bt
#0 0xffffe410 in ?? ()
#1 0xbf502568 in ?? ()
#2 0x0000081c in ?? ()
#3 0xbf501d34 in ?? ()
#4 0x4004556b in __read_nocancel () from /lib/tls/i686/cmov/libpthread.so.0
#5 ... <properly resolved functions>
(gdb) n
Cannot find bounds of current function
(gdb) c
Continuing.
0xffffe410 in ?? ()
ptrace: No such process.
I thought the "Can't attach LWP 765: No such process" errormessage was
something read from the target host, but I strace(1)-ed gdbserver on
the target without seeing any errormessages.
I then straced gdb on the host, and see that gdb on the host connects
to target, and then seems to write a bunch of instructions to gdbserver
on target:
connect(6, {sa_family=AF_INET, sin_port=htons(2024), sin_addr=inet_addr("172.16.254.2")}, 16) = -1 EINPROGRESS (Operation now in progress)
...
send(6, "+", 1, 0) = 1
send(6, "$Hc-1#09", 8, 0) = 8
...
This is as I would expect.
Then the same gdb on host starts doing ptrace(2) calls, which I did
not expect:
ptrace(PTRACE_PEEKUSER, 1076389568, offsetof(struct user, u_debugreg) +
24, [0xb
7eee320]) = -1 ESRCH (No such process)
write(1, "[Switching to thread 1076389568]"..., 33) = 33
igprocmask(SIG_BLOCK, NULL, [], 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
send(6, "$mffffe410,8#63", 15, 0) = 15
select(7, [6], NULL, [6], {1, 0}) = 1 (in [6], left {1, 0})
...
write(1, "[Thread debugging using libthrea"..., 46) = 46
ptrace(PTRACE_PEEKTEXT, 1076389568, 0x40047cb0, [0xb7e253b4]) = -1 ESRCH
(No such process)
send(6, "$m40047cb0,4#c1", 15, 0) = 15
select(7, [6], NULL, [6], {1, 0}) = 1 (in [6], left {1, 0})
recv(6, "+$08000000#88", 8192, 0) = 13
send(6, "+", 1, 0) = 1
ptrace(PTRACE_PEEKTEXT, 1076389568, 0x4004c52c, [0xbfaacd30]) = -1 ESRCH
(No such process)
send(6, "$m4004c52c,8#c6", 15, 0) = 15
select(7, [6], NULL, [6], {1, 0}) = 1 (in [6], left {1, 0})
recv(6, "+$8001000000000000#09", 8192, 0) = 21
send(6, "+", 1, 0) = 1
open("/proc/1076389568/mem", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such
file or
directory)
ptrace(PTRACE_PEEKTEXT, 1076389568, 0x40047ca4, [0]) = -1 ESRCH (No such process
)
ptrace(PTRACE_ATTACH, 765, 0, 0) = -1 ESRCH (No such process)
I don't know why gdb on host is calling ptrace(2) at all.
Thanks for any help,
--
_ //
\X/ -- Michael Shuldman <michael.shuldman@ericsson.com>
next reply other threads:[~2007-02-28 13:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-28 13:25 Michael Shuldman [this message]
2007-02-28 13:35 ` Daniel Jacobowitz
2007-02-28 13:47 ` Michael Shuldman
2007-02-28 14:11 ` Daniel Jacobowitz
2007-02-28 21:16 ` Michael Shuldman
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=20070228130454.GA31868@localhost \
--to=michael.shuldman@ericsson.com \
--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