ARM-software / trappy

This repository has moved to https://gitlab.arm.com/tooling/trappy
Apache License 2.0
60 stars 39 forks source link

base: Improve errors for failures to parse #265

Closed bjackman closed 6 years ago

bjackman commented 7 years ago

Some events from the kernel cannot be parsed by old trace-cmd binaries. This results in data_str starting with "[FAILED TO PARSE]", which we ourselves fail to parse because we expect to find a key=value pair.

This adds a missing 'continue' statement to avoid attempting to avoid a KeyError when attempting to use an unset prev_key as a key into data_dict, and also adds a special error for the "[FAILED TO PARSE]" case.

bjackman commented 6 years ago

Phew.. I really really really don't want to break anything here so trying to be a bit hyper-cautious with testing.. added a unit test, I also added a separate exception class just because there was already one instance of that in the code.

bjackman commented 6 years ago

OK, changed the FAILED TO PARSE case to just print a warning and continue. There might be missing data, but at least we know what went wrong and that the rest of the trace is probably fine.