@@ -535,15 +535,34 @@ static struct track_data *track_data_alloc(unsigned int key_len,
535535 return data ;
536536}
537537
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+
539541static char hist_err_str [MAX_FILTER_STR_VAL ];
540542
541- static void last_cmd_set (char * str )
543+ static void last_cmd_set (struct trace_event_file * file , char * str )
542544{
545+ const char * system = NULL , * name = NULL ;
546+ struct trace_event_call * call ;
547+
543548 if (!str )
544549 return ;
545550
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 );
547566}
548567
549568static void hist_err (char * str , char * var )
@@ -583,6 +602,8 @@ static void hist_err_event(char *str, char *system, char *event, char *var)
583602static void hist_err_clear (void )
584603{
585604 hist_err_str [0 ] = '\0' ;
605+ last_cmd [0 ] = '\0' ;
606+ last_cmd_loc [0 ] = '\0' ;
586607}
587608
588609static bool have_hist_err (void )
@@ -5438,8 +5459,8 @@ static int hist_show(struct seq_file *m, void *v)
54385459 }
54395460
54405461 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 );
54435464 }
54445465
54455466 out_unlock :
@@ -6043,8 +6064,8 @@ static int event_hist_trigger_func(struct event_command *cmd_ops,
60436064 lockdep_assert_held (& event_mutex );
60446065
60456066 if (glob && strlen (glob )) {
6046- last_cmd_set (param );
60476067 hist_err_clear ();
6068+ last_cmd_set (file , param );
60486069 }
60496070
60506071 if (!param )
0 commit comments