« July 2009
SunMonTueWedThuFriSat
   
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today
XML

Neat blogs

Navigation

Editing

Powered by Roller Weblogger.

statcounter.com

clustrmaps.com

Locations of visitors to this page

technorati.com

20080716 Wednesday July 16, 2008
Simple dtrace script to check for errors in functions

I'm trying to prove that I've fixed a bug and I happen to know that if a certain function returns an error code, then I might have hit the code in question. How do I quickly determine whether or not I have hit such a case?

[root@pnfs-3-11 ~/dtrace]> more mms.d 
#! /usr/sbin/dtrace -Fs

:nfs:nfs4_trigger_mount:return
/args[1] != 0/
{
        printf("rc1 = %d\n", args[1]);
}

:nfs:nfs4_ephemeral_umount:return
/args[1] != 0/
{
        printf("rc1 = %d\n", args[1]);
}

[root@pnfs-3-11 ~/dtrace]> ./mms.d
dtrace: script './mms.d' matched 2 probes
CPU FUNCTION                                 
  0  <- nfs4_ephemeral_umount                 rc1 = 16

  0  <- nfs4_ephemeral_umount                 rc1 = 16

So if the function name is nfs4_trigger_mount or nfs4_ephemeral_umount, then print the return code if it is not 0. Hmm, I should probably remove the '\n's.

[root@pnfs-3-11 ~/dtrace]> ./mms.d
dtrace: script './mms.d' matched 2 probes
CPU FUNCTION                                 
  1  <- nfs4_ephemeral_umount                 rc1 = 16
  1  <- nfs4_ephemeral_umount                 rc1 = 16

I'm actually looking for an 11 (EAGAIN) coming back from nfs4_trigger_mount, but the abundance of 16 (EBUSY) from nfs4_ephemeral_umount tells me I've probably fixed another bug I was hitting.


Originally posted on Kool Aid Served Daily
Copyright (C) 2008, Kool Aid Served Daily

Trackback URL: http://blogs.sun.com/tdh/entry/simple_dtrace_script_to_check
Comments:

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed