logging: dictionary: workaround non-existing strings

When strings are not in the dictionary, the parser would crash.
This works around the issue by indcating an unknown string
as "string@<addr>".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2022-01-13 12:28:02 -08:00 committed by Anas Nashif
parent b89a0f5d24
commit 9b9001956f

View File

@ -195,7 +195,10 @@ class LogParserV1(LogParser):
str_idx = arg_offset + self.data_types.get_sizeof(DataTypes.PTR) * 2
str_idx /= self.data_types.get_sizeof(DataTypes.INT)
ret = string_tbl[int(str_idx)]
if int(str_idx) not in string_tbl:
ret = "<string@0x{0:x}>".format(arg)
else:
ret = string_tbl[int(str_idx)]
return ret