From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 9 17:30:48 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 CCCFC106568B for ; Fri, 9 Oct 2009 17:30:48 +0000 (UTC) (envelope-from nate@thatsmathematics.com) Received: from euclid.ucsd.edu (euclid.ucsd.edu [132.239.145.52]) by mx1.freebsd.org (Postfix) with ESMTP id AA9F38FC15 for ; Fri, 9 Oct 2009 17:30:48 +0000 (UTC) Received: from zeno.ucsd.edu (zeno.ucsd.edu [132.239.145.22]) by euclid.ucsd.edu (8.11.7p3+Sun/8.11.7) with ESMTP id n99HUko13648; Fri, 9 Oct 2009 10:30:46 -0700 (PDT) Received: from localhost (neldredg@localhost) by zeno.ucsd.edu (8.11.7p3+Sun/8.11.7) with ESMTP id n99HUjQ01209; Fri, 9 Oct 2009 10:30:45 -0700 (PDT) X-Authentication-Warning: zeno.ucsd.edu: neldredg owned process doing -bs Date: Fri, 9 Oct 2009 10:30:44 -0700 (PDT) From: Nate Eldredge X-X-Sender: neldredg@zeno.ucsd.edu To: Mel Flynn In-Reply-To: <200910091650.04231.mel.flynn+fbsd.hackers@mailing.thruhere.net> Message-ID: References: <200910090015.24175.mel.flynn+fbsd.hackers@mailing.thruhere.net> <86skds7vqi.fsf@ds4.des.no> <200910091650.04231.mel.flynn+fbsd.hackers@mailing.thruhere.net> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-1506727461-1255109444=:5432" Cc: freebsd-hackers@freebsd.org, Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?= 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 17:30:48 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---559023410-1506727461-1255109444=:5432 Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 9 Oct 2009, Mel Flynn wrote: > On Friday 09 October 2009 11:38:29 Dag-Erling Sm=F8rgrav wrote: >> Mel Flynn writes: >>> is there a way to have a program run through gdb and gdb only record a >>> segfault, but otherwise let the program run? >> >> 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 > somewhat reliably reproduce it is to have portmaster invoke it as it's > PM_SU_CMD. And no, running that same command again doesn't trigger the > segfault, so it's "something environmental". Hence I'm looking for someth= ing > 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 > should just wrap it and mktemp(1) a new command script for gdb to use wit= h set > args $*, but if anyone has a more clever idea, I'd love to hear it. This won't work. You can't debug setuid programs (for reasons which=20 should be obvious). You could do it if you ran everything as root, but it= =20 sounds like the bug doesn't occur in that case. --=20 Nate Eldredge nate@thatsmathematics.com ---559023410-1506727461-1255109444=:5432--