On Mon, 19 Sep 2011 15:00:31 +0000 (UTC), Anton Yuzhaninov wrote: AY> On Mon, 19 Sep 2011 15:58:02 +0300, Mikolaj Golub wrote: AY>>> ktrace -i for truss sleep 5 AY>>> http://dl.dropbox.com/u/8798217/tmp/truss_ktrace2.txt MG>> MG>> Although ptrace(PT_TRACE_ME,0,0,0) returned 0 the process did not stop after MG>> execve() and wait4() in parent (which was actually waiting for this stop) MG>> returned only after the child exit. No I idea why so far :-). MG>> AY> AY> As I understand SIGTRAP used to stop child process after execve(), but AY> this signal ignored: AY> AY> citrin:~> sleep 300 & AY> citrin:~> procstat -i 1991 | fgrep TRAP AY> 1991 sleep TRAP -I- AY> AY> Under FreeBSD 8, where ptrace works for me, this signal is not ignored: AY> x:~> sleep 300 & AY> x:~> procstat -i 78716 | fgrep TRAP AY> 78716 sleep TRAP --- SIGTRAP is ignored by X window manager used by me, and this is inherited across forks/execs up to the truss. IMHO truss should restore default signal handler for SIGTRAP. With this patch truss works for me: --- usr.bin/truss/main.c (revision 225504) +++ usr.bin/truss/main.c (working copy) _at__at_ -255,6 +255,11 _at__at_ main(int ac, char **av) if (trussinfo->pid == 0) { /* Start a command ourselves */ command = av; + /* + * SIGTRUP used to stop traced process after execve + * un-ignore this signal (it can be ignored by parents) + */ + signal(SIGTRAP, SIG_DFL); trussinfo->pid = setup_and_wait(command); signal(SIGINT, SIG_IGN); signal(SIGTERM, SIG_IGN); -- Anton YuzhaninovReceived on Mon Sep 19 2011 - 14:04:07 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:18 UTC