Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Sep 2011 13:19:45 +0000 (UTC)
From:      Anton Yuzhaninov <citrin@citrin.ru>
To:        freebsd-current@freebsd.org
Subject:   Re: truss
Message-ID:  <j5a3th$vds$1@dough.gmane.org>
References:  <4E5E46A4.3060705@citrin.ru> <4E6A99A9.1000204@delphij.net> <j4pgu9$m94$1@dough.gmane.org> <864o0adkva.fsf@kopusha.home.net> <j57bm4$3lk$1@dough.gmane.org> <86mxe0r8o5.fsf@in138.ua3> <j57lef$a3d$1@dough.gmane.org> <j57p4t$8u8$1@dough.gmane.org> <20110919212722.GQ1511@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 20 Sep 2011 00:27:22 +0300, Kostik Belousov wrote:
>> With this patch truss works for me:
>> 
>> --- usr.bin/truss/main.c        (revision 225504)
>> +++ usr.bin/truss/main.c        (working copy)
>> @@ -255,6 +255,11 @@ 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);
KB> This is quite a hack. The proper fix should go in kernel, otherwise
KB> we cannot debug programs that decided to ignore SIGTRAP. The reason

It seems to be, that in gdb used similar hack:

citrin:~> procstat -i 2433 | fgrep TRAP
 2433 dd               TRAP     -I-

:~> gdb /bin/dd 2433
...
(gdb) next
Single stepping until exit from function write,
which has no line number information.
dd_out (force=1) at dd.c:458
458                             if (nw <= 0) {
(gdb)
...

:~> procstat -i 2433 | fgrep TRAP
 2433 dd               TRAP     ---

KB> Could you, please, test the change below ? For me, I still can truss(1)
KB> or debug with gdb after the change applied. Does truss work for you
KB> with only this change, without resetting SIGTRAP handler in truss process ?

I'll test this patch.

-- 
 Anton Yuzhaninov




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?j5a3th$vds$1>