Skip to content

logger: add error message when reading sof/etrace instead of sof/trace - #3402

Merged
lgirdwood merged 2 commits into
thesofproject:masterfrom
marc-hb:log-etrace-err
Sep 14, 2020
Merged

lgirdwood merged 2 commits into
thesofproject:masterfrom
marc-hb:log-etrace-err

Conversation

@marc-hb

@marc-hb marc-hb commented Sep 11, 2020

Copy link
Copy Markdown
Collaborator

2 commits. Main one:

Failing silently is not nice. Now prints instead:

  TIMESTAMP   DELTA C# COMPONENT   LOCATION   CONTENT
  error: in logger_read(), fread(..., /sys/kernel/debug/sof/etrace) \
    failed: Invalid argument(22)

Also make logger_read() and the process return [-]errno which can have
different values and some information instead of -ferror() which has
only one value (non-zero in theory, 1 in practice) hence no information.

Signed-off-by: Marc Herbert marc.herbert@intel.com

Also works with clang.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Failing silently is not nice. Now prints instead:

  TIMESTAMP   DELTA C# COMPONENT   LOCATION   CONTENT
  error: in logger_read(), fread(..., /sys/kernel/debug/sof/etrace) \
    failed: Invalid argument(22)

Also make logger_read() and the process return [-]errno which can have
different values and some information instead of -ferror() which has
only one value (non-zero in theory, 1 in practice) hence no information.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb

marc-hb commented Sep 11, 2020

Copy link
Copy Markdown
Collaborator Author

The first checkpatch warning recommends __printf. I think it's wrong because __printf is a kernel shortcut. It should probably be turned off in this repo.

The second and last checkpatch warnings is because of ONE spurious space character. It's a --strict warning that's why I missed it. I'll remove this space if another revision is required.

@marc-hb
marc-hb marked this pull request as ready for review September 11, 2020 05:47
@marc-hb marc-hb changed the title Log etrace err logger: add error message when reading sof/etrace instead of sof/trace Sep 11, 2020
@marc-hb

marc-hb commented Sep 11, 2020 •

Copy link
Copy Markdown
Collaborator Author

Sorry I forgot to fix the PR Subject before adding reviewers

@marc-hb
marc-hb requested a review from mmaka1 September 11, 2020 05:54
Comment thread tools/logger/logger.c
@@ -150,7 +150,7 @@ static int append_filter_config(struct convert_config *config, const char *input

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marc-hb can you explain why do we need this commit?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this commit turn on printf like formatting string vs argument list check in compilation time for asprintf and log_err functions

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The printf attribute finds run-time memory corruption at compile time, always seemed very useful to me. It works with clang too BTW (tested).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants