Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||||||
#define DMODE_LIST 4 /* compile program and list probes (-l) */ | #define DMODE_LIST 4 /* compile program and list probes (-l) */ | ||||||||
#define DMODE_HEADER 5 /* compile program for headergen (-h) */ | #define DMODE_HEADER 5 /* compile program for headergen (-h) */ | ||||||||
#define E_SUCCESS 0 | #define E_SUCCESS 0 | ||||||||
#define E_ERROR 1 | #define E_ERROR 1 | ||||||||
#define E_USAGE 2 | #define E_USAGE 2 | ||||||||
static const char DTRACE_OPTSTR[] = | static const char DTRACE_OPTSTR[] = | ||||||||
"3:6:aAb:Bc:CD:ef:FGhHi:I:lL:m:n:o:p:P:qs:SU:vVwx:X:Z"; | "3:6:aAb:Bc:CdD:ef:FGhHi:I:lL:m:n:o:p:P:qs:SU:vVwx:X:Z"; | ||||||||
static char **g_argv; | static char **g_argv; | ||||||||
static int g_argc; | static int g_argc; | ||||||||
static char **g_objv; | static char **g_objv; | ||||||||
static int g_objc; | static int g_objc; | ||||||||
static dtrace_cmd_t *g_cmdv; | static dtrace_cmd_t *g_cmdv; | ||||||||
static int g_cmdc; | static int g_cmdc; | ||||||||
static struct ps_prochandle **g_psv; | static struct ps_prochandle **g_psv; | ||||||||
Show All 36 Lines | |||||||||
NULL }; | NULL }; | ||||||||
#endif | #endif | ||||||||
static int | static int | ||||||||
usage(FILE *fp) | usage(FILE *fp) | ||||||||
{ | { | ||||||||
static const char predact[] = "[[ predicate ] action ]"; | static const char predact[] = "[[ predicate ] action ]"; | ||||||||
(void) fprintf(fp, "Usage: %s [-32|-64] [-aACeFGhHlqSvVwZ] " | (void) fprintf(fp, "Usage: %s [-32|-64] [-aACdeFGhHlqSvVwZ] " | ||||||||
"[-b bufsz] [-c cmd] [-D name[=def]]\n\t[-I path] [-L path] " | "[-b bufsz] [-c cmd] [-D name[=def]]\n\t[-I path] [-L path] " | ||||||||
"[-o output] [-p pid] [-s script] [-U name]\n\t" | "[-o output] [-p pid] [-s script] [-U name]\n\t" | ||||||||
"[-x opt[=val]] [-X a|c|s|t]\n\n" | "[-x opt[=val]] [-X a|c|s|t]\n\n" | ||||||||
"\t[-P provider %s]\n" | "\t[-P provider %s]\n" | ||||||||
"\t[-m [ provider: ] module %s]\n" | "\t[-m [ provider: ] module %s]\n" | ||||||||
"\t[-f [[ provider: ] module: ] func %s]\n" | "\t[-f [[ provider: ] module: ] func %s]\n" | ||||||||
"\t[-n [[[ provider: ] module: ] func: ] name %s]\n" | "\t[-n [[[ provider: ] module: ] func: ] name %s]\n" | ||||||||
"\t[-i probe-id %s] [ args ... ]\n\n", g_pname, | "\t[-i probe-id %s] [ args ... ]\n\n", g_pname, | ||||||||
predact, predact, predact, predact, predact); | predact, predact, predact, predact, predact); | ||||||||
(void) fprintf(fp, "\tpredicate -> '/' D-expression '/'\n"); | (void) fprintf(fp, "\tpredicate -> '/' D-expression '/'\n"); | ||||||||
(void) fprintf(fp, "\t action -> '{' D-statements '}'\n"); | (void) fprintf(fp, "\t action -> '{' D-statements '}'\n"); | ||||||||
(void) fprintf(fp, "\n" | (void) fprintf(fp, "\n" | ||||||||
"\t-32 generate 32-bit D programs and ELF files\n" | "\t-32 generate 32-bit D programs and ELF files\n" | ||||||||
"\t-64 generate 64-bit D programs and ELF files\n\n" | "\t-64 generate 64-bit D programs and ELF files\n\n" | ||||||||
"\t-a claim anonymous tracing state\n" | "\t-a claim anonymous tracing state\n" | ||||||||
"\t-A generate driver.conf(4) directives for anonymous tracing\n" | "\t-A generate driver.conf(4) directives for anonymous tracing\n" | ||||||||
"\t-b set trace buffer size\n" | "\t-b set trace buffer size\n" | ||||||||
"\t-c run specified command and exit upon its completion\n" | "\t-c run specified command and exit upon its completion\n" | ||||||||
"\t-C run cpp(1) preprocessor on script files\n" | "\t-C run cpp(1) preprocessor on script files\n" | ||||||||
"\t-d dump script after syntactic transformations\n" | |||||||||
markjUnsubmitted Done Inline Actions
markj: | |||||||||
"\t-D define symbol when invoking preprocessor\n" | "\t-D define symbol when invoking preprocessor\n" | ||||||||
"\t-e exit after compiling request but prior to enabling probes\n" | "\t-e exit after compiling request but prior to enabling probes\n" | ||||||||
"\t-f enable or list probes matching the specified function name\n" | "\t-f enable or list probes matching the specified function name\n" | ||||||||
"\t-F coalesce trace output by function\n" | "\t-F coalesce trace output by function\n" | ||||||||
"\t-G generate an ELF file containing embedded dtrace program\n" | "\t-G generate an ELF file containing embedded dtrace program\n" | ||||||||
"\t-h generate a header file with definitions for static probes\n" | "\t-h generate a header file with definitions for static probes\n" | ||||||||
"\t-H print included files when invoking preprocessor\n" | "\t-H print included files when invoking preprocessor\n" | ||||||||
"\t-i enable or list probes matching the specified probe id\n" | "\t-i enable or list probes matching the specified probe id\n" | ||||||||
▲ Show 20 Lines • Show All 1,389 Lines • ▼ Show 20 Lines | while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != -1) { | ||||||||
break; | break; | ||||||||
case 'B': | case 'B': | ||||||||
g_ofp = NULL; | g_ofp = NULL; | ||||||||
break; | break; | ||||||||
case 'C': | case 'C': | ||||||||
g_cflags |= DTRACE_C_CPP; | g_cflags |= DTRACE_C_CPP; | ||||||||
break; | |||||||||
case 'd': | |||||||||
g_cflags |= DTRACE_C_SUGAR; | |||||||||
break; | break; | ||||||||
case 'D': | case 'D': | ||||||||
if (dtrace_setopt(g_dtp, "define", optarg) != 0) | if (dtrace_setopt(g_dtp, "define", optarg) != 0) | ||||||||
dfatal("failed to set -D %s", optarg); | dfatal("failed to set -D %s", optarg); | ||||||||
break; | break; | ||||||||
case 'f': | case 'f': | ||||||||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |