truss -f, updated patch

2000-05-21 Thread Arun Sharma

Before I go to sleep, I've shortened the diff by about 50%. The new diff
is at:

http://sharmas.dhs.org/~adsharma/projects/freebsd/truss-diff.gz
http://sharmas.dhs.org/~adsharma/projects/freebsd/truss.tar.gz

To be applied as:

cd truss
gzcat -dc truss-diff.gz | patch -p1

The real 100 lines of changes are:

1. Line 306 in i386-fbsd.c (where all the action starts)
2. Last few lines of main
3. Some changes in syscalls.c:print_syscall

It now prints syscalls one per line, like linux and solaris equivalents.
The Makefile changes can be completely ignored. They are there so that
truss can be compiled in a directory other than /usr/src.

-Arun

$ truss -f -o foo sh -c ls 
$ cat foo
62898: getpid() = 62898 (0xf5b2)
62898: geteuid()= 500 (0x1f4)
62898: readlink("/etc/malloc.conf",0xbfbff79c,63)   = errno 2 'No such file or 
directory'
62898: mmap(0x0,4096,0x3,0x1002,-1,0x0) = 671793152 (0x280ac000)
62898: break(0x80bd000) = 0 (0x0)
62898: break(0x80be000) = 0 (0x0)
62898: getuid() = 500 (0x1f4)
62898: geteuid()= 500 (0x1f4)
62898: getgid() = 100 (0x64)
62898: getegid()= 100 (0x64)
62898: sigaction(SIGINT,0x0,0xbfbff7c4) = 0 (0x0)
62898: sigaction(SIGINT,0xbfbff7c4,0xbfbff7ac)  = 0 (0x0)
62898: sigaction(SIGINT,0x0,0xbfbff7c4) = 0 (0x0)
62898: sigaction(SIGINT,0xbfbff7c4,0x0) = 0 (0x0)
62898: sigaction(SIGQUIT,0x0,0xbfbff7b4)= 0 (0x0)
62898: sigaction(SIGQUIT,0xbfbff7b4,0xbfbff79c) = 0 (0x0)
62898: sigaction(SIGQUIT,0x0,0xbfbff7b4)= 0 (0x0)
62898: sigaction(SIGQUIT,0xbfbff7b4,0x0)= 0 (0x0)
62898: sigaction(SIGTERM,0x0,0xbfbff7c4)= 0 (0x0)
62898: sigaction(SIGTERM,0xbfbff7c4,0xbfbff7ac) = 0 (0x0)
62898: sigaction(SIGSYS,0xbfbff634,0xbfbff61c)  = 0 (0x0)
62898: __getcwd(0xbfbff79c,0x100)   = 0 (0x0)
62898: sigaction(SIGSYS,0xbfbff61c,0x0) = 0 (0x0)
62898: break(0x80bf000) = 0 (0x0)
62898: stat("/home/adsharma/kde/bin/ls",0xbfbff6fc) = errno 2 'No such file or 
directory'
62898: stat("/home/adsharma/bin/ls",0xbfbff6fc) = errno 2 'No such file or directory'
62898: stat("/home/adsharma/kde/bin/ls",0xbfbff6fc) = errno 2 'No such file or 
directory'
62898: stat("/bin/ls",0xbfbff6fc)   = 0 (0x0)
62898: break(0x80c) = 0 (0x0)
62898: fork()   = 62899 (0xf5b3)
62898: getpgrp()= 62897 (0xf5b1)
62899: ... Returning from fork ?()  = 0 (0x0)
62899: open(".",0,00)   = 5 (0x5)
62899: stat(".",0xbfbff798) = 0 (0x0)
62899: open(".",4,00)   = 6 (0x6)
62899: fstat(6,0xbfbff798)  = 0 (0x0)
62899: fcntl(0x6,0x2,0x1)   = 0 (0x0)
62899: __sysctl(0xbfbff650,0x2,0x807ad98,0xbfbff64c,0x0,0x0)= 0 (0x0)
62899: fstatfs(0x6,0xbfbff698)  = 0 (0x0)
62899: break(0x8083000) = 0 (0x0)
62899: getdirentries(0x6,0x8082000,0x1000,0x807e0b4)= 3072 (0xc00)
62899: break(0x8084000) = 0 (0x0)
62899: break(0x8085000) = 0 (0x0)
62899: break(0x8086000) = 0 (0x0)
62899: break(0x8087000) = 0 (0x0)
62899: getdirentries(0x6,0x8082000,0x1000,0x807e0b4)= 0 (0x0)
62899: lseek(6,0x0,0)   = 0 (0x0)
62899: close(6) = 0 (0x0)
62899: fchdir(0x5)  = 0 (0x0)
62899: close(5) = 0 (0x0)
62899: break(0x8088000) = 0 (0x0)
62899: fstat(1,0xbfbff3b8)  = 0 (0x0)
62899: ioctl(1,TIOCGETA,0xbfbff3ec) = 0 (0x0)
62899: write(1,0x8082400,31)= 31 (0x1f)
62899: write(1,0x8082400,23)= 23 (0x17)
62899: write(1,0x8082400,32)= 32 (0x20)
62899: write(1,0x8082400,33)= 33 (0x21)
62899: write(1,0x8082400,19)= 19 (0x13)
62899: write(1,0x8082400,29)= 29 (0x1d)
62899: write(1,0x8082400,20)= 20 (0x14)
62899: write(1,0x8082400,28)= 28 (0x1c)
62899: write(1,0x8082400,20)= 20 (0x14)
62899: write(1,0x8082400,25)= 25 (0x19)
62899: write(1,0x8082400,21)= 21 (0x15)
62899: write(1,0x8082400,22)= 22 (0x16)
62899: write(1,0x8082400,21)= 21 (0x15)
62899: write(1,0x8082400,29)= 29 (0x1d)
62899: write(1,0x8082400,27)= 27 (0x1b)
62899: write(1,0x8082400,26)= 26 (0x1a)
62899: write(1,0x8082400,25)= 25 (0x19)
62899: write(1,0x8082400,24)= 24 (0x18)
62899: write(1,0x8082400,30)= 30 (0x1e)
62899: write(1,0x8082400,24)= 24 (0x18)
62899: exit(0x0) = 0(8048e82)
SIGNAL 20
62898: wait4(0x,0xbfbff728,0x2,0x0) = 62899 (0xf5b3)
62898: exit(0x0) = 0(8048e82)


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: truss -f, updated patch

2000-05-21 Thread Christian Weisgerber

Arun Sharma [EMAIL PROTECTED] wrote:

 http://sharmas.dhs.org/~adsharma/projects/freebsd/truss-diff.gz

Those gratuitous whitespace and formatting changes are a pain...

Related question:
Currently, truss does very little parsing of syscall arguments.
That table in syscalls.c looks anemic. Is there any interest in
expanding this? I guess that's something I could take on, as it
appears to be mostly grunt work.

-- 
Christian "naddy" Weisgerber  [EMAIL PROTECTED]



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: truss -f, updated patch

2000-05-21 Thread Dan Nelson

In the last episode (May 21), Christian Weisgerber said:
 Arun Sharma [EMAIL PROTECTED] wrote:
 
  http://sharmas.dhs.org/~adsharma/projects/freebsd/truss-diff.gz
 
 Those gratuitous whitespace and formatting changes are a pain...
 
 Related question:
 Currently, truss does very little parsing of syscall arguments.
 That table in syscalls.c looks anemic. Is there any interest in
 expanding this? I guess that's something I could take on, as it
 appears to be mostly grunt work.

I had worked on this a little, but had too much trouble keeping the
binary compatible with our emulation code.  Also printing syscall args
can get pretty hairy if you want to do it *right*.  Here's a snippet of
an email I sent to another guy that was interested in rewriting truss,
about 6 months ago:

Specifiers are nice for the simple types, like int, float, and
string, but how do you specify that a sycall takes a pointer to a
struct timeval, without actually writing "struct timeval *"?  You
end up rewriting the contents of syscalls.master :)

Although you *do* need to specify somewhere which arguments are
IN/OUT/BOTH.  Like stat().  You only want to print the "struct
stat" contents after the syscall has returned.  The opposite is the
case for utimes().  You want to print the "struct timeval" before
the call. Then you have functions like poll() or select(), that
modify a structure, so you need to print it before and after.

I had patterened my code after a free version of truss for Digital
Unix.

-- 
Dan Nelson
[EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message