Running a program through gdb without "interfering"
Mel Flynn
mel.flynn+fbsd.hackers at mailing.thruhere.net
Fri Oct 9 17:32:53 UTC 2009
On Friday 09 October 2009 16:50:04 Mel Flynn wrote:
> On Friday 09 October 2009 11:38:29 Dag-Erling Smørgrav wrote:
> > Mel Flynn <mel.flynn+fbsd.hackers at 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".
>
> 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.
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
---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
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
why it segfaults, but not nice enough to keep digging.
--
Mel
More information about the freebsd-hackers
mailing list