From owner-freebsd-hackers Sun Nov 5 7:33:27 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from starbug.ugh.net.au (starbug.ugh.net.au [203.31.238.37]) by hub.freebsd.org (Postfix) with ESMTP id 06D0E37B4CF for ; Sun, 5 Nov 2000 07:33:24 -0800 (PST) Received: by starbug.ugh.net.au (Postfix, from userid 1000) id D4DB3A82B; Mon, 6 Nov 2000 02:33:21 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by starbug.ugh.net.au (Postfix) with ESMTP id CE5655464 for ; Mon, 6 Nov 2000 01:33:21 +1000 (EST) Date: Mon, 6 Nov 2000 01:33:21 +1000 (EST) From: andrew@ugh.net.au To: freebsd-hackers@freebsd.org Subject: gdb & threaded application Message-ID: X-WonK: *wibble* MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, I have a program compiled with -pthread and I'm trying to use gdb to debug it. I run the program in one window and then try to attach to it from another. I have put a sleep 10 in the program so I can catch it before it enters the section I want to debug. This is what I get: Attaching to program: /usr/home/andrew/work/msgs2/msgs, process 10063 Reading symbols from /usr/lib/libc_r.so.4...done. Reading symbols from /usr/libexec/ld-elf.so.1...done. 0x280b7368 in _thread_sys_poll () from /usr/lib/libc_r.so.4 (gdb) n Single stepping until exit from function _thread_sys_poll, which has no line number information. 0x280b674f in _thread_kern_sched_state_unlock () from /usr/lib/libc_r.so.4 (gdb) n Single stepping until exit from function _thread_kern_sched_state_unlock, which has no line number information. 0x280b5f99 in _thread_kern_sched () from /usr/lib/libc_r.so.4 (gdb) n Single stepping until exit from function _thread_kern_sched, which has no line number information. 0x28078a70 in _init () from /usr/lib/libc_r.so.4 (gdb) n Single stepping until exit from function _init, which has no line number information. Error accessing memory address 0x158: Bad address. (gdb) n Single stepping until exit from function _thread_kern_sched, which has no line number information. Program received signal SIGSEGV, Segmentation fault. 0x280b591f in _thread_kern_sched () from /usr/lib/libc_r.so.4 (gdb) q The program is running. Quit anyway (and detach it)? (y or n) y Detaching from program: /usr/home/andrew/work/msgs2/msgs, process 10063, thread 1 ptrace: No such process. (gdb) To get out of gdb I need to suspend and kill it. Now this certainly isn't the behaviour I get when running it without the debuger. I haven't spawned any threads at this point. Any ideas what I'm doing wrong? Thanks, Andrew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message