Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Oct 2009 19:32:48 +0200
From:      Mel Flynn <mel.flynn+fbsd.hackers@mailing.thruhere.net>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Running a program through gdb without "interfering"
Message-ID:  <200910091932.49028.mel.flynn%2Bfbsd.hackers@mailing.thruhere.net>
In-Reply-To: <200910091650.04231.mel.flynn%2Bfbsd.hackers@mailing.thruhere.net>
References:  <200910090015.24175.mel.flynn%2Bfbsd.hackers@mailing.thruhere.net> <86skds7vqi.fsf@ds4.des.no> <200910091650.04231.mel.flynn%2Bfbsd.hackers@mailing.thruhere.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 09 October 2009 16:50:04 Mel Flynn wrote:
> On Friday 09 October 2009 11:38:29 Dag-Erling Sm=F8rgrav wrote:
> > Mel Flynn <mel.flynn+fbsd.hackers@mailing.thruhere.net> 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".
>=20
> 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
>  something like:
> gdb -batch -x script_with_run_cmd.gdb -exec /usr/local/bin/sudo $argv
>=20
> where somehow I need $argv to be passed as arguments to sudo. I'm thinking
>  i should just wrap it and mktemp(1) a new command script for gdb to use
>  with set args $*, but if anyone has a more clever idea, I'd love to hear
>  it.

Dead end path :/
% bin/gdbsudo echo hi
/tmp/gdbsudo.F3kdwJ:1: Error in sourced command file:
/usr/local/bin/sudo: Permission denied.

% ls -l /usr/local/bin/sudo
=2D--s--x--x  2 root  wheel  116380 Oct  8 18:31 /usr/local/bin/sudo

% sudo chmod g+r /usr/local/bin/sudo

% bin/gdbsudo echo hi

(no debugging symbols found)...(no debugging symbols found)...(no debugging=
=20
symbols found)...(no debugging symbols found)...sudo: must be setuid root

Program exited with code 01.

Perhaps the cause of it not dumping core either. Would've been nice to know=
=20
why it segfaults, but not nice enough to keep digging.
=2D-=20
Mel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910091932.49028.mel.flynn%2Bfbsd.hackers>