Re: truss

From: Anton Yuzhaninov <citrin_at_citrin.ru>
Date: Tue, 20 Sep 2011 13:19:45 +0000 (UTC)
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)
>> _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);
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
Received on Tue Sep 20 2011 - 11:20:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:18 UTC