Logger

The sof-logger is used to print logs delivered from the FW dma_trace mechanism by searching log entries in the ldc file (logs dictionary) that are generated by the SMEX (Sof Metadata Extractor) tool. Every entry declared in the FW is placed in an elf output file (e.g. sof-apl) in the .static_log_entries section in a struct form that is defined in sof/src/include/sof/trace.h in the sof fw repo.

The ldc file contains snd_sof_logs_header and snd_sof_uids_header (defined in smex/ldc.h). snd_sof_logs_header is followed by a .static_log_entries section incorporated from the FW elf file (e.g. sof-apl). snd_sof_logs_header contains basic information about the .static_log_entries section such as base_address and data_length. The sof-logger works by reading entry parameters values and entries addresses from the FW dma_trace mechanism and searching for suitable entries in the ldc file by its address. The snd_sof_uids_header struct is followed by the .static_uuid_entries section content from the FW elf file. A single uuid entry is defined in sof/src/include/sof/lib/uuid.h in the sof fw repo.

Logger usage

Usage sof-logger <option(s)> <file(s)>

-h

help

-l ldc_file

Specify the ldc file (debugging information and strings)

-i in_file

Get traces from the in_file instead of from the default “/sys/kernel/debug/sof/etrace”

-o out_file

Specify the output file instead of the default stdout

-t

Get traces from “/sys/kernel/debug/sof/trace” instead of from the default “/sys/kernel/debug/sof/etrace”

-p

Get traces from stdin instead of the default “/sys/kernel/debug/sof/etrace”

-c clock

Set the timestamp clock in MHz

-e

Enable checking the firmware version with the default verification file “/sys/kernel/debug/sof/fw_version”

-v ver_file

Enable checking the firmware version with the ver_file file instead of the default: “/sys/kernel/debug/sof/fw_version”

-s

Take a snapshot of state

-r

Less formatted output for chained log processors

-L

Hide log location in source code

-f precision

Set timestamp precision

-g

Hide timestamp

-d

Dump ldc information

Examples:

  • Gets traces from the “/sys/kernel/debug/sof/etrace” file; verifies the fw_version with “/sys/kernel/debug/sof/fw_version” and prints logs to stdout

    sof-logger -l ldc_file -e
    
  • Gets traces from the “/sys/kernel/debug/sof/etrace” file; verifies the fw_version with the ver_file file and prints logs to stdout

    sof-logger -l ldc_file -v ver_file
    
  • Get traces from the “/sys/kernel/debug/sof/etrace” file and prints logs to stdout

    sof-logger -l ldc_file
    
  • Get traces from the “/sys/kernel/debug/sof/etrace” file and prints logs to the out_file file

    sof-logger -l ldc_file -o out_file
    
  • Get traces from the “/sys/kernel/debug/sof/trace” file and prints logs to stdout

    sof-logger -l ldc_file -t
    
  • Get traces from the “/sys/kernel/debug/sof/trace” file and prints logs to the out_file file

    sof-logger -l ldc_file -t -o out_file
    
  • Get traces from stdin and prints logs to stdout

    sof-logger -l ldc_file -p
    
  • Get traces from stdin and prints logs to the out_file file

    sof-logger -l ldc_file -p -o out_file
    
  • Get traces from the trace_dump file and prints logs to stdout

    sof-logger -l ldc_file -i trace_dump
    
  • Get traces from the trace_dump file and prints logs to the out_file file

    sof-logger -l ldc_file -i trace_dump -o out_file
    
  • c flag defines the clock value (in MHz) used to format log timestamps. By default, the clock value is set to 19.2 (MHz). The below example sets the clock value to 19.9 (MHz).

    sof-logger -l ldc_file -i trace_dump -o out_file -c 19.9
    
  • Dump information from the ldc file (such as the ABI version and the uuid dictionary) to stdout

    sof-logger -l ldc_file -d