Running a program through gdb without "interfering"
mel.flynn+fbsd.hackers at mailing.thruhere.net
Sat Oct 10 01:52:09 UTC 2009
On Friday 09 October 2009 21:27:21 Dag-Erling Smørgrav wrote:
> Mel Flynn <mel.flynn+fbsd.hackers at mailing.thruhere.net> writes:
> > Dag-Erling Smørgrav <des at 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
> > 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
> > 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.
> Why look for a clever option, when the simple one will do just fine?
Cause I don't know how much of the cause of this bug I'm influencing. Even
though this is now the simple solution, it would be simpler if gdb (or another
debugger) could work similar as sudo, where it would take the first argument
as binary and the rest as arguments to the binary. This would do away with
some extra IO I'm now creating. Though, it's unlikely it is related to IO,
there is no pattern that I've found yet for the segfault, so I'm trying to
limit any "extra stuff".
I'll patch the kernel tomorrow with the new sysctl and see how far that gets
> Add 'ulimit -c unlimited' somewhere in the script before it invokes sudo.
I'll add it.
More information about the freebsd-hackers