Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 May 2006 22:32:21 +0000
From:      John Birrell <jb@what-creek.com>
To:        Alexander Leidinger <Alexander@Leidinger.net>
Cc:        arch@freebsd.org, David Kirchner <dpk@dpk.net>
Subject:   Re: Add some more information in the ktrace(1)/kdump(1) output
Message-ID:  <20060515223221.GA39581@what-creek.com>
In-Reply-To: <20060515195533.70ebea2c@Magellan.Leidinger.net>
References:  <35c231bf0604191339m598d9b7n6681421403d5d4e1@mail.gmail.com> <20060515195533.70ebea2c@Magellan.Leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, May 15, 2006 at 07:55:33PM +0200, Alexander Leidinger wrote:
> > I'd appreciate any feedback you may have. This is just one half of the
> > project; the other half will involve updating the kernel to include
> > more data in the dump output. I'm thinking, specifically, adding
> > KTR_STAT for stat() results and KTR_SOCKADDR for connect(), bind()
> > arguments, and accept() results.
> 
> Because lack of time David isn't able to work further on this.
> 
> Shall we commit the code as is and change the entry on the ideas page
> to read this thread and implement the suggested changes?
> 
> Or shall we just change the ideas page and wait until someone picks
> this up and makes the changes, before we commit this?

I have to say this: "Anything ktrace can do, DTrace can do better!".

My DTrace project already has access to *ALL* syscall parameters with all the
extra DTrace whiz-bang stuff included.

DTrace looks at type information from the kernel and modules in CTF
ELF sections, so you can access fields in structures that are referenced
via syscalls.

Take the stat() syscall as an example.

You can trace the return from that syscall like this:

syscall::stat:return
/execname == "make" && errno == 0/
{
        ptr = (struct stat *) arg1;
        printf("File '%s' size = %ld", copyinstr(arg0), (long) ptr->st_size);
}

And the output will look like this (from a buildworld):

CPU     ID                    FUNCTION:NAME
  0    381                      stat:return File '/freebsd2/u2/p4/dtrace/src' size = 512
  0    381                      stat:return File '/usr/obj/freebsd2/u2/p4/dtrace/src' size = 512
  0    381                      stat:return File '.' size = 512
  0    381                      stat:return File '/freebsd2/u2/p4/dtrace/src' size = 512
  0    381                      stat:return File '/usr/share/mk' size = 1024
  0    381                      stat:return File '/etc/make.conf' size = 220
  0    381                      stat:return File '/u2/freebsd/obj/freebsd2/u2/p4/dtrace/src' size = 512
  0    381                      stat:return File '.' size = 512
  0    381                      stat:return File '/usr/share/mk' size = 1024
  0    381                      stat:return File '/etc/make.conf' size = 220
  0    381                      stat:return File '/freebsd2/u2/p4/dtrace/src/share/mk' size = 1024
  0    381                      stat:return File '/freebsd2/u2/p4/dtrace/src/tools/build/make_check' size = 512
  0    381                      stat:return File '/usr/obj/freebsd2/u2/p4/dtrace/src/tools/build/make_check' size = 512
  0    381                      stat:return File '.' size = 512
  0    381                      stat:return File '/freebsd2/u2/p4/dtrace/src/tools/build/make_check' size = 512
  0    381                      stat:return File '/etc/make.conf' size = 220
  0    381                      stat:return File '/usr/obj/freebsd2/u2/p4/dtrace/src/tools/build/make_check/' size = 512
  0    381                      stat:return File '/freebsd2/u2/p4/dtrace/src/share/mk' size = 1024
  0    381                      stat:return File '/freebsd2/u2/p4/dtrace/src/tools/build/make_check' size = 512


Can you do that with ktrace?

The project is in P4 under: //depot/projects/dtrace

And it works!

For what it's worth, the example I've given above is something you can't
do on Solaris! I'm haggling with their main DTrace developer about the
semantics of their implementation. Sigh.

--
John Birrell



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060515223221.GA39581>