From 67de8d58ecd51295ce1f84c131640d86e92de051 Mon Sep 17 00:00:00 2001 From: Miika Karanki Date: Wed, 10 Apr 2024 11:57:10 +0300 Subject: [PATCH] scripts: logging: support native_posix dictionary logging - Do not look CONFIG_* symbols from dynamic symbols which might be there before the symbol table where CONFIG_* symbols are found. - Define posix architecture in ARCHS list. - Check if architecture is not found instead of letting the code run into trying to access dictionary with None key. Signed-off-by: Miika Karanki --- scripts/logging/dictionary/database_gen.py | 5 ++++- scripts/logging/dictionary/dictionary_parser/log_database.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/logging/dictionary/database_gen.py b/scripts/logging/dictionary/database_gen.py index 663adb3a365..5060ef3b928 100755 --- a/scripts/logging/dictionary/database_gen.py +++ b/scripts/logging/dictionary/database_gen.py @@ -143,7 +143,7 @@ def find_elf_sections(elf, sh_name): def get_kconfig_symbols(elf): """Get kconfig symbols from the ELF file""" for section in elf.iter_sections(): - if isinstance(section, SymbolTableSection): + if isinstance(section, SymbolTableSection) and section['sh_type'] != 'SHT_DYNSYM': return {sym.name: sym.entry.st_value for sym in section.iter_symbols() if sym.name.startswith("CONFIG_")} @@ -254,6 +254,9 @@ def process_kconfigs(elf, database): if arch['kconfig'] in kconfigs: database.set_arch(name) break + else: + logger.error("Did not found architecture") + sys.exit(1) # Put some kconfigs into the database # diff --git a/scripts/logging/dictionary/dictionary_parser/log_database.py b/scripts/logging/dictionary/dictionary_parser/log_database.py index 1baccfe3b69..3e7b37e396f 100644 --- a/scripts/logging/dictionary/dictionary_parser/log_database.py +++ b/scripts/logging/dictionary/dictionary_parser/log_database.py @@ -46,6 +46,9 @@ ARCHS = { # for explanation. "extra_string_section": ['datas'], }, + "posix" : { + "kconfig": "CONFIG_ARCH_POSIX", + }, "riscv" : { "kconfig": "CONFIG_RISCV", },