@@ -294,10 +294,11 @@ static int write_new_event(int fd, const char *buf)
294294{
295295 int ret ;
296296
297- printf ("Adding new event: %s\n" , buf );
298297 ret = write (fd , buf , strlen (buf ));
299298 if (ret <= 0 )
300- die ("failed to create event." );
299+ die ("Failed to create event." );
300+ else
301+ printf ("Added new event: %s\n" , buf );
301302
302303 return ret ;
303304}
@@ -310,7 +311,7 @@ static int synthesize_probe_event(struct probe_point *pp)
310311 int i , len , ret ;
311312 pp -> probes [0 ] = buf = (char * )calloc (MAX_CMDLEN , sizeof (char ));
312313 if (!buf )
313- die ("calloc" );
314+ die ("Failed to allocate memory by calloc. " );
314315 ret = snprintf (buf , MAX_CMDLEN , "%s+%d" , pp -> function , pp -> offset );
315316 if (ret <= 0 || ret >= MAX_CMDLEN )
316317 goto error ;
@@ -363,7 +364,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
363364 if (ret == - E2BIG )
364365 semantic_error ("probe point is too long." );
365366 else if (ret < 0 )
366- die ("snprintf " );
367+ die ("Failed to synthesize a probe point. " );
367368 }
368369
369370#ifndef NO_LIBDWARF
@@ -375,7 +376,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
375376 else
376377 fd = open_default_vmlinux ();
377378 if (fd < 0 )
378- die ("vmlinux/module file open " );
379+ die ("Could not open vmlinux/module file. " );
379380
380381 /* Searching probe points */
381382 for (j = 0 ; j < session .nr_probe ; j ++ ) {
@@ -396,8 +397,13 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
396397 /* Settng up probe points */
397398 snprintf (buf , MAX_CMDLEN , "%s/../kprobe_events" , debugfs_path );
398399 fd = open (buf , O_WRONLY , O_APPEND );
399- if (fd < 0 )
400- die ("kprobe_events open" );
400+ if (fd < 0 ) {
401+ if (errno == ENOENT )
402+ die ("kprobe_events file does not exist - please rebuild with CONFIG_KPROBE_TRACER." );
403+ else
404+ die ("Could not open kprobe_events file: %s" ,
405+ strerror (errno ));
406+ }
401407 for (j = 0 ; j < session .nr_probe ; j ++ ) {
402408 pp = & session .probes [j ];
403409 if (pp -> found == 1 ) {
0 commit comments