Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Oct 2009 21:27:21 +0200
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        Mel Flynn <mel.flynn+fbsd.hackers@mailing.thruhere.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Running a program through gdb without "interfering"
Message-ID:  <86skdss6zq.fsf@ds4.des.no>
In-Reply-To: <200910091650.04231.mel.flynn%2Bfbsd.hackers@mailing.thruhere.net> (Mel Flynn's message of "Fri, 9 Oct 2009 16:50:04 %2B0200")
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
Mel Flynn <mel.flynn+fbsd.hackers@mailing.thruhere.net> writes:
> Dag-Erling Sm=C3=B8rgrav <des@des.no> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86skdss6zq.fsf>