From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 914 invoked by alias); 28 Feb 2007 13:05:28 -0000 Received: (qmail 902 invoked by uid 22791); 28 Feb 2007 13:05:26 -0000 X-Spam-Check-By: sourceware.org Received: from mailgw4.ericsson.se (HELO mailgw4.ericsson.se) (193.180.251.62) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 28 Feb 2007 13:05:14 +0000 Received: from mailgw4.ericsson.se (unknown [127.0.0.1]) by mailgw4.ericsson.se (Symantec Mail Security) with ESMTP id 0C40621291 for ; Wed, 28 Feb 2007 14:04:58 +0100 (CET) X-AuditID: c1b4fb3e-a7eeabb000004aff-6e-45e57df94397 Received: from esealmw128.eemea.ericsson.se (unknown [153.88.254.121]) by mailgw4.ericsson.se (Symantec Mail Security) with ESMTP id E4C4E20110 for ; Wed, 28 Feb 2007 14:04:57 +0100 (CET) Received: from esealmw128.eemea.ericsson.se ([153.88.254.176]) by esealmw128.eemea.ericsson.se with Microsoft SMTPSVC(6.0.3790.1830); Wed, 28 Feb 2007 14:04:57 +0100 Received: from axit-desktop ([131.160.255.10]) by esealmw128.eemea.ericsson.se with Microsoft SMTPSVC(6.0.3790.1830); Wed, 28 Feb 2007 14:04:56 +0100 Received: by axit-desktop (Postfix, from userid 1001) id C375C23B424; Wed, 28 Feb 2007 20:04:54 +0700 (ICT) Date: Wed, 28 Feb 2007 13:25:00 -0000 From: Michael Shuldman To: gdb@sources.redhat.com Subject: gdb, target remote, threadbased application in uml Message-ID: <20070228130454.GA31868@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.11 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-02/txt/msg00294.txt.bz2 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 ... (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