From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 9 19:27:23 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 027C21065670 for ; Fri, 9 Oct 2009 19:27:23 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id B7EC48FC15 for ; Fri, 9 Oct 2009 19:27:22 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id EA6DA6D41B; Fri, 9 Oct 2009 19:27:21 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id A90CF84562; Fri, 9 Oct 2009 21:27:21 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Mel Flynn References: <200910090015.24175.mel.flynn+fbsd.hackers@mailing.thruhere.net> <86skds7vqi.fsf@ds4.des.no> <200910091650.04231.mel.flynn+fbsd.hackers@mailing.thruhere.net> Date: Fri, 09 Oct 2009 21:27:21 +0200 In-Reply-To: <200910091650.04231.mel.flynn+fbsd.hackers@mailing.thruhere.net> (Mel Flynn's message of "Fri, 9 Oct 2009 16:50:04 +0200") Message-ID: <86skdss6zq.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.95 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: Running a program through gdb without "interfering" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2009 19:27:23 -0000 Mel Flynn writes: > Dag-Erling Sm=C3=B8rgrav writes: > > Yes, just run "gdb /path/to/program" and type "run". > Not what I was looking for. The segfaults are random and the only way to= =20 > somewhat reliably reproduce it is to have portmaster invoke it as it's=20 > PM_SU_CMD. And no, running that same command again doesn't trigger the=20 > segfault, so it's "something environmental". Hence I'm looking for someth= ing=20 > like: > gdb -batch -x script_with_run_cmd.gdb -exec /usr/local/bin/sudo $argv > > where somehow I need $argv to be passed as arguments to sudo. I'm thinkin= g i=20 > should just wrap it and mktemp(1) a new command script for gdb to use wit= h set=20 > args $*, but if anyone has a more clever idea, I'd love to hear it. Why look for a clever option, when the simple one will do just fine? :>gdb-script-$$ echo "set args $@" >>gdb-script-$$ echo "run" >>gdb-script-$$ gdb -batch -x gdb-script-$$ /usr/local/bin/sudo > It still segfaults and doesn't dump: > Oct 9 04:34:18 smell kernel: pid 39476 (sudo), uid 0: exited on signal 11 > Oct 9 04:36:32 smell kernel: pid 79657 (sudo), uid 0: exited on signal 11 > Oct 9 04:36:43 smell kernel: pid 82390 (sudo), uid 0: exited on signal 11 > Oct 9 04:51:46 smell kernel: pid 3601 (sudo), uid 0: exited on signal 11 > > find / -name '*.core' in the jail does not yield anything.=20 Add 'ulimit -c unlimited' somewhere in the script before it invokes sudo. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no