From owner-cvs-all@FreeBSD.ORG Thu Jul 15 04:03:58 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4F48116A4CE; Thu, 15 Jul 2004 04:03:58 +0000 (GMT) Received: from exchhz01.viatech.com.cn (ip-40-162-97-218.anlai.com [218.97.162.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6306743D1F; Thu, 15 Jul 2004 04:03:54 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from freebsd.org (DAVIDWNT [10.4.1.99]) by exchhz01.viatech.com.cn with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id NVXA926V; Thu, 15 Jul 2004 12:03:15 +0800 Message-ID: <40F602EE.4060103@freebsd.org> Date: Thu, 15 Jul 2004 12:07:10 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030723 Thunderbird/0.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Scott Long References: <40F5FED0.8050908@freebsd.org> In-Reply-To: <40F5FED0.8050908@freebsd.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/lib/libthread_db Makefile src/lib/libthread_d b/include thread_db.h thread_db_int.h src/lib/libthread_db/pthrea d Makefile pthread_db.c pthread_db.h pthread_db_i386.c sr c/lib/libthread_db/src Makefile thread_db.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2004 04:03:58 -0000 Scott Long wrote: > David Xu wrote: > >>davidxu 2004-07-15 03:36:35 UTC >> >> FreeBSD src repository >> >> Added files: >> lib/libthread_db Makefile >> lib/libthread_db/include thread_db.h thread_db_int.h >> lib/libthread_db/pthread Makefile pthread_db.c pthread_db.h >> pthread_db_i386.c >> lib/libthread_db/src Makefile thread_db.c >> Log: >> Add my initial work of libthread_db. The library is used by gdb to > > debug > >> threaded process. Current, only libpthread is supported, but macrel > > will > >> work on it to support libthr and libc_r. >> > > > This is excellent! Can you give a quick summary of what one should > expect from this when using GDB? > When you are debugging a program linked with libpthread, you can see a list of threads when you type 'info threads', you can get info about how to debug threaded process by typing 'info gdb' on command line. Here is an example: avidxu@davidbsd:/home/davidxu/ptest> gdb ./crew GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-marcel-freebsd"... (gdb) break worker_routine Breakpoint 1 at 0x8048dae: file crew.c, line 73. (gdb) run node /usr/src/sys Starting program: /usr/home/davidxu/ptest/crew node /usr/src/sys setenv SSH_AUTH_SOCK /tmp/ssh-jKcG3qxNRo/agent.1292; setenv SSH_AGENT_PID 1293; echo Agent pid 1293; [Switching to Thread 1 (LWP 100082)] Breakpoint 1, worker_routine (arg=0xbfbfeab4) at crew.c:73 73 worker_p mine = (worker_t*)arg; (gdb) info threads 11 Thread 10 (sleeping) 0x280964d6 in pthread_mutexattr_init () from /usr/lib/libpthread.so.1 10 Thread 9 (LWP 100116) 0x2809e94b in pthread_testcancel () from /usr/lib/libpthread.so.1 9 Thread 8 (runnable) 0x2814b3b0 in _ctx_start () from /lib/libc.so.5 8 Thread 7 (runnable) 0x2814b3b0 in _ctx_start () from /lib/libc.so.5 7 Thread 6 (runnable) 0x2814b3b0 in _ctx_start () from /lib/libc.so.5 6 Thread 5 (runnable) 0x2814b3b0 in _ctx_start () from /lib/libc.so.5 5 Thread 4 (runnable) 0x2814b3b0 in _ctx_start () from /lib/libc.so.5 4 Thread 3 (runnable) 0x2814b3b0 in _ctx_start () from /lib/libc.so.5 3 Thread 2 (runnable) 0x2814b3b0 in _ctx_start () from /lib/libc.so.5 * 2 Thread 1 (LWP 100082) worker_routine (arg=0xbfbfeab4) at crew.c:73 (gdb) After I commit source code for gdb, you can do it same as me. > Scott > David Xu