From 6e6cf6d9350b2e5003dfa921abeef38dcb4be14c Mon Sep 17 00:00:00 2001 From: James <49045138+ghidracadabra@users.noreply.github.com> Date: Fri, 2 Dec 2022 19:30:21 +0000 Subject: [PATCH] GP-2913 minor adjustments --- .../Decompiler/src/decompile/cpp/slgh_compile.cc | 11 +++++++---- .../ghidra/pcodeCPort/slgh_compile/SleighCompile.java | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc index bc0585e754..2de830ffe2 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc @@ -2135,8 +2135,11 @@ void SleighCompile::checkCaseSensitivity(void) SleighSymbol *oldsym = (*check.first).second; ostringstream s; s << "Name collision: " << sym->getName() << " --- "; + s << "Duplicate symbol " << oldsym->getName(); const Location *oldLocation = getLocation(oldsym); - s << "Duplicate symbol " << oldsym->getName() << " defined at " << oldLocation->format(); + if (oldLocation != (Location *) 0x0) { + s << " defined at " << oldLocation->format(); + } const Location *location = getLocation(sym); reportError(location,s.str()); } @@ -2190,13 +2193,13 @@ const Location *SleighCompile::getLocation(Constructor *ctor) const } /// \param sym is the given symbol -/// \return the filename and line number +/// \return the filename and line number or null if location not found const Location *SleighCompile::getLocation(SleighSymbol *sym) const { try { return &symbolLocationMap.at(sym); - } catch (const std::exception &e) { + } catch (const std::out_of_range &e) { return NULL; } } @@ -2678,7 +2681,7 @@ void SleighCompile::attachValues(vector *symlist,vector *n if (patval->maxValue() + 1 != numlist->size()) { ostringstream msg; msg << "Attach value '" + sym->getName(); - msg << "' (range 0.." << patval->maxValue() << ") is wrong size for list (of " << numlist->size() << " entries"; + msg << "' (range 0.." << patval->maxValue() << ") is wrong size for list (of " << numlist->size() << " entries)"; reportError(getCurrentLocation(), msg.str()); } symtab.replaceSymbol(sym, new ValueMapSymbol(sym->getName(),patval,*numlist)); diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slgh_compile/SleighCompile.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slgh_compile/SleighCompile.java index 292e01436b..1e9ea0a332 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slgh_compile/SleighCompile.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slgh_compile/SleighCompile.java @@ -488,6 +488,8 @@ public class SleighCompile extends SleighBase { } for (int i = 0; i < tables.size(); ++i) { if (tables.get(i).isError()) { + reportError(tables.get(i).getLocation(), + "Problem in table: '" + tables.get(i).getName()); errors += 1; } if (tables.get(i).getPattern() == null) {