@@ -535,15 +535,34 @@ static struct track_data *track_data_alloc(unsigned int key_len,
535
535
return data ;
536
536
}
537
537
538
- static char last_hist_cmd [MAX_FILTER_STR_VAL ];
538
+ static char last_cmd [MAX_FILTER_STR_VAL ];
539
+ static char last_cmd_loc [MAX_FILTER_STR_VAL ];
540
+
539
541
static char hist_err_str [MAX_FILTER_STR_VAL ];
540
542
541
- static void last_cmd_set (char * str )
543
+ static void last_cmd_set (struct trace_event_file * file , char * str )
542
544
{
545
+ const char * system = NULL , * name = NULL ;
546
+ struct trace_event_call * call ;
547
+
543
548
if (!str )
544
549
return ;
545
550
546
- strncpy (last_hist_cmd , str , MAX_FILTER_STR_VAL - 1 );
551
+ strncpy (last_cmd , str , MAX_FILTER_STR_VAL - 1 );
552
+
553
+ if (file ) {
554
+ call = file -> event_call ;
555
+
556
+ system = call -> class -> system ;
557
+ if (system ) {
558
+ name = trace_event_name (call );
559
+ if (!name )
560
+ system = NULL ;
561
+ }
562
+ }
563
+
564
+ if (system )
565
+ snprintf (last_cmd_loc , MAX_FILTER_STR_VAL , "hist:%s:%s" , system , name );
547
566
}
548
567
549
568
static void hist_err (char * str , char * var )
@@ -583,6 +602,8 @@ static void hist_err_event(char *str, char *system, char *event, char *var)
583
602
static void hist_err_clear (void )
584
603
{
585
604
hist_err_str [0 ] = '\0' ;
605
+ last_cmd [0 ] = '\0' ;
606
+ last_cmd_loc [0 ] = '\0' ;
586
607
}
587
608
588
609
static bool have_hist_err (void )
@@ -5438,8 +5459,8 @@ static int hist_show(struct seq_file *m, void *v)
5438
5459
}
5439
5460
5440
5461
if (have_hist_err ()) {
5441
- seq_printf (m , "\nERROR: %s \n" , hist_err_str );
5442
- seq_printf (m , " Last command: %s\n" , last_hist_cmd );
5462
+ seq_printf (m , "\n%s: error: \n" , hist_err_str );
5463
+ seq_printf (m , " Last command: %s\n" , last_cmd );
5443
5464
}
5444
5465
5445
5466
out_unlock :
@@ -6043,8 +6064,8 @@ static int event_hist_trigger_func(struct event_command *cmd_ops,
6043
6064
lockdep_assert_held (& event_mutex );
6044
6065
6045
6066
if (glob && strlen (glob )) {
6046
- last_cmd_set (param );
6047
6067
hist_err_clear ();
6068
+ last_cmd_set (file , param );
6048
6069
}
6049
6070
6050
6071
if (!param )
0 commit comments