From ba90c20b27d6def6f86bf0aace8a03d2aff9e4fe Mon Sep 17 00:00:00 2001 From: robojumper Date: Sun, 6 Oct 2024 19:13:17 +0200 Subject: [PATCH] Namespace fix --- tools/ghidra_scripts/DecompMapToGhidra.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tools/ghidra_scripts/DecompMapToGhidra.py b/tools/ghidra_scripts/DecompMapToGhidra.py index 77f722ca..c31d2c5c 100644 --- a/tools/ghidra_scripts/DecompMapToGhidra.py +++ b/tools/ghidra_scripts/DecompMapToGhidra.py @@ -139,17 +139,12 @@ def update_addr(addr, mangled_name): namespace = NamespaceUtils.createNamespaceHierarchy(namespace_str, None, currentProgram, IMPORTED) sym = getSymbolAt(addr) + if namespace is None: + namespace = currentProgram.getGlobalNamespace() if sym: - if namespace: - sym.setNameAndNamespace(symbol_str, namespace, IMPORTED) - else: - sym.setName(symbol_str, IMPORTED) + sym.setNameAndNamespace(symbol_str, namespace, IMPORTED) else: - if namespace: - createLabel(addr, symbol_str, namespace, True, IMPORTED) - else: - createLabel(addr, symbol_str, True, IMPORTED) - + createLabel(addr, symbol_str, namespace, True, IMPORTED) unit.setComment(PLATE_COMMENT, new_comment) def apply_symbols_map(symbols_map, file_name):