From owner-freebsd-threads@FreeBSD.ORG Wed Sep 24 21:34:14 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F7B41065689 for ; Wed, 24 Sep 2008 21:34:14 +0000 (UTC) (envelope-from dixit@netapp.com) Received: from mx2.netapp.com (mx2.netapp.com [216.240.18.37]) by mx1.freebsd.org (Postfix) with ESMTP id EA4C08FC16 for ; Wed, 24 Sep 2008 21:34:13 +0000 (UTC) (envelope-from dixit@netapp.com) X-IronPort-AV: E=Sophos;i="4.33,303,1220252400"; d="scan'208";a="60394433" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 24 Sep 2008 14:05:52 -0700 Received: from dixit-lxp.nane.netapp.com ([10.97.16.124]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id m8OL5p0u002532; Wed, 24 Sep 2008 14:05:52 -0700 (PDT) Message-ID: <48DAABAF.9030709@netapp.com> Date: Wed, 24 Sep 2008 17:05:51 -0400 From: Amol Dixit User-Agent: Thunderbird 2.0.0.16 (X11/20080707) MIME-Version: 1.0 To: freebsd-threads@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: davidxu@freebsd.org Subject: SIGTRAP during thr_new syscall X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Sep 2008 21:34:14 -0000 Hi, I am seeing an unexpected SIGTRAP being reported to gdbserver when the debugged process creates a new thread via the _pthread_create() call of libthr library. [libthr/thread/thr_create.c,v 1.22.4.1, Freebsd 6.0] Gdbserver has internally set a breakpoint on address of _thread_bp_create() so that it gets notified on thread creation and is expecting a SIGTRAP at address (stop pc) of _thread_bp_create(). But instead SIGTRAP happens as a side-effect of thr_new() system call and the stop pc at that point is that of routine thread_start() which is the starting function of new thread. So gdbserver cannot match expected breakpoint (ie. _thread_bp_create) and is confused. For testing purpose, if I call _thread_bp_create() before thr_new() in _pthread_create(), I get the _expected_ SIGTRAP with address of _thread_bp_create. But that is not the fix. Does anyone have any idea about this SIGTRAP being reported to tracing process gdbserver as part of thr_new? Where is it originating from and why? Thanks, Amol