From owner-freebsd-current@FreeBSD.ORG Tue Sep 20 13:20:02 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52B5F106564A for ; Tue, 20 Sep 2011 13:20:02 +0000 (UTC) (envelope-from freebsd-current@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id D13FA8FC0A for ; Tue, 20 Sep 2011 13:20:01 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R60Ex-00058e-1K for freebsd-current@freebsd.org; Tue, 20 Sep 2011 15:19:59 +0200 Received: from 178.214.36.169 ([178.214.36.169]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 20 Sep 2011 15:19:59 +0200 Received: from citrin by 178.214.36.169 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 20 Sep 2011 15:19:59 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-current@freebsd.org From: Anton Yuzhaninov Date: Tue, 20 Sep 2011 13:19:45 +0000 (UTC) Organization: Vega Lines: 46 Sender: Anton Yuzhaninov Message-ID: References: <4E5E46A4.3060705@citrin.ru> <4E6A99A9.1000204@delphij.net> <864o0adkva.fsf@kopusha.home.net> <86mxe0r8o5.fsf@in138.ua3> <20110919212722.GQ1511@deviant.kiev.zoral.com.ua> X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 178.214.36.169 X-Comment-To: Kostik Belousov User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/9.0-BETA2 (i386)) Subject: Re: truss X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 13:20:02 -0000 On Tue, 20 Sep 2011 00:27:22 +0300, Kostik Belousov wrote: >> With this patch truss works for me: >> >> --- usr.bin/truss/main.c (revision 225504) >> +++ usr.bin/truss/main.c (working copy) >> @@ -255,6 +255,11 @@ main(int ac, char **av) >> >> if (trussinfo->pid == 0) { /* Start a command ourselves */ >> command = av; >> + /* >> + * SIGTRUP used to stop traced process after execve >> + * un-ignore this signal (it can be ignored by parents) >> + */ >> + signal(SIGTRAP, SIG_DFL); >> trussinfo->pid = setup_and_wait(command); >> signal(SIGINT, SIG_IGN); >> signal(SIGTERM, SIG_IGN); KB> This is quite a hack. The proper fix should go in kernel, otherwise KB> we cannot debug programs that decided to ignore SIGTRAP. The reason It seems to be, that in gdb used similar hack: citrin:~> procstat -i 2433 | fgrep TRAP 2433 dd TRAP -I- :~> gdb /bin/dd 2433 ... (gdb) next Single stepping until exit from function write, which has no line number information. dd_out (force=1) at dd.c:458 458 if (nw <= 0) { (gdb) ... :~> procstat -i 2433 | fgrep TRAP 2433 dd TRAP --- KB> Could you, please, test the change below ? For me, I still can truss(1) KB> or debug with gdb after the change applied. Does truss work for you KB> with only this change, without resetting SIGTRAP handler in truss process ? I'll test this patch. -- Anton Yuzhaninov