message: Remove pevent_print_field + trace_seq_reset for printk functions
diff: @@ -1642,6 +1642,7 @@ static int trace_enum_events( trace_data_t &trace_data, tracecmd_input_t *handle
  trace_seq_printf( &seq, "%s-%u", comm, pid );
  trace_event.comm = strpool.getstr( seq.buffer );
  +
  trace_event.system = strpool.getstr( event->system );
  trace_event.name = strpool.getstr( event->name );
  trace_event.user_comm = trace_event.comm;
  @@ -1676,6 +1677,33 @@ static int trace_enum_events( trace_data_t &trace_data, tracecmd_input_t *handle
  const char *format_name = strpool.getstr( format->name );
  trace_seq_reset( &seq );
  +
  + if ( is_printk_function && ( format_name == trace_data.buf_str ) )
  + {
  + struct print_arg *args = event->print_fmt.args;
  +
  + // We are assuming print_fmt for ftrace/print function is:
  + // print fmt: "%ps: %s", (void *)REC->ip, REC->buf
  + if ( args->type != PRINT_FIELD )
  + args = args->next;
  +
  + print_str_arg( &seq, record->data, record->size,
  + event, "%s", -1, args );
  +
  + // pretty_print prints IP and print string (buf).
  + // pretty_print( &seq, record->data, record->size, event );
  +
  + trace_event.system = "ftrace-print";
  +
  + // Convert all LFs to spaces.
  + for ( unsigned int i = 0; i < seq.len; i++ )
  + {
  + if ( seq.buffer[ i ] == '\n' )
  + seq.buffer[ i ] = ' ';
  + }
  + }
  + else
  + {
  pevent_print_field( &seq, record->data, format );
  if ( format_name == trace_data.seqno_str )
  @@ -1692,8 +1720,7 @@ static int trace_enum_events( trace_data_t &trace_data, tracecmd_input_t *handle
  trace_event.crtc = val;
  }
  -
  - if ( is_ftrace_function )
  + else if ( is_ftrace_function )
  {
  bool is_ip = ( format_name == trace_data.ip_str );
  @@ -1717,30 +1744,6 @@ static int trace_enum_events( trace_data_t &trace_data, tracecmd_input_t *handle
  }
  }
  }
  - else if ( is_printk_function && ( format_name == trace_data.buf_str ) )
  - {
  - struct print_arg *args = event->print_fmt.args;
  -
  - // We are assuming print_fmt for ftrace/print function is:
  - // print fmt: "%ps: %s", (void *)REC->ip, REC->buf
  - if ( args->type != PRINT_FIELD )
  - args = args->next;
  -
  - trace_seq_reset( &seq );
  - print_str_arg( &seq, record->data, record->size,
  - event, "%s", -1, args );
  -
  - // pretty_print prints IP and print string (buf).
  - // pretty_print( &seq, record->data, record->size, event );
  -
  - trace_event.system = "ftrace-print";
  -
  - // Convert all LFs to spaces.
  - for ( unsigned int i = 0; i < seq.len; i++ )
  - {
  - if ( seq.buffer[ i ] == '\n' )
  - seq.buffer[ i ] = ' ';
  - }
  }
  // Trim trailing whitespace
  