summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLéo Lam <leolino.lam@gmail.com>2018-04-13 20:48:28 +0200
committerGitHub <noreply@github.com>2018-04-13 20:48:28 +0200
commit52905a5faecb7f387e4b519be3ae1086fbebb1b6 (patch)
tree2eb56b7713f0d27cd8cf5df51a69a4d2255476b5 /Source/Core
parentfa982fdb39e5cb40e5e25968e0f69c25bf717f95 (diff)
parent7d3616548953d403eb9a6b87cdb2332241f89220 (diff)
Merge pull request #6627 from sepalani/map-strip
PPCSymbolDB: Do not truncate fixed size symbols
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/SymbolDB.h2
-rw-r--r--Source/Core/Core/PowerPC/PPCAnalyst.cpp4
-rw-r--r--Source/Core/Core/PowerPC/PPCAnalyst.h4
-rw-r--r--Source/Core/Core/PowerPC/PPCSymbolDB.cpp10
4 files changed, 13 insertions, 7 deletions
diff --git a/Source/Core/Common/SymbolDB.h b/Source/Core/Common/SymbolDB.h
index 147305f8f4..7b6a088124 100644
--- a/Source/Core/Common/SymbolDB.h
+++ b/Source/Core/Common/SymbolDB.h
@@ -39,7 +39,7 @@ struct Symbol
u32 hash = 0; // use for HLE function finding
u32 address = 0;
u32 flags = 0;
- int size = 0;
+ u32 size = 0;
int numCalls = 0;
Type type = Type::Function;
int index = 0; // only used for coloring the disasm view
diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
index 1aedec38c5..17b64462b5 100644
--- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp
+++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
@@ -83,7 +83,7 @@ static u32 EvaluateBranchTarget(UGeckoInstruction instr, u32 pc)
// Also collect which internal branch goes the farthest.
// If any one goes farther than the blr or rfi, assume that there is more than
// one blr or rfi, and keep scanning.
-bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size)
+bool AnalyzeFunction(u32 startAddr, Symbol& func, u32 max_size)
{
if (func.name.empty())
func.Rename(StringFromFormat("zz_%08x_", startAddr));
@@ -176,7 +176,7 @@ bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size)
}
}
-bool ReanalyzeFunction(u32 start_addr, Symbol& func, int max_size)
+bool ReanalyzeFunction(u32 start_addr, Symbol& func, u32 max_size)
{
ASSERT_MSG(SYMBOLS, func.analyzed, "The function wasn't previously analyzed!");
diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.h b/Source/Core/Core/PowerPC/PPCAnalyst.h
index e5e84a69f6..b9785eb27a 100644
--- a/Source/Core/Core/PowerPC/PPCAnalyst.h
+++ b/Source/Core/Core/PowerPC/PPCAnalyst.h
@@ -225,7 +225,7 @@ private:
void LogFunctionCall(u32 addr);
void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB* func_db);
-bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size = 0);
-bool ReanalyzeFunction(u32 start_addr, Symbol& func, int max_size = 0);
+bool AnalyzeFunction(u32 startAddr, Symbol& func, u32 max_size = 0);
+bool ReanalyzeFunction(u32 start_addr, Symbol& func, u32 max_size = 0);
} // namespace
diff --git a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp
index ff0f8b496a..28dfa121bd 100644
--- a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp
+++ b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp
@@ -68,6 +68,13 @@ void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const std::string& nam
if (tf.type == Symbol::Type::Function)
{
PPCAnalyst::AnalyzeFunction(startAddr, tf, size);
+ // Do not truncate symbol when a size is expected
+ if (size != 0 && tf.size != size)
+ {
+ WARN_LOG(SYMBOLS, "Analysed symbol (%s) size mismatch, %u expected but %u computed",
+ name.c_str(), size, tf.size);
+ tf.size = size;
+ }
checksumToFunction[tf.hash].insert(&functions[startAddr]);
}
else
@@ -405,8 +412,7 @@ bool PPCSymbolDB::LoadMap(const std::string& filename, bool bad)
}
Index();
- if (bad)
- SuccessAlertT("Loaded %d good functions, ignored %d bad functions.", good_count, bad_count);
+ NOTICE_LOG(SYMBOLS, "%d symbols loaded, %d symbols ignored.", good_count, bad_count);
return true;
}