<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 16, 2021 at 9:25 AM Alex White <<a href="mailto:alex.white@oarcorp.com">alex.white@oarcorp.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Occasionally the compiler will generate symbols that look similar to<br>
symbols defined in RTEMS code except that they contain some suffix.<br>
These symbol suffixes are only found in the ELF symbol table; the<br>
symbols appear to be normal in the DWARF info. This appears to be<br>
happening on all architectures.<br>
<br>
For example, the function _Message_queue_Create from rtems appears as<br>
"_Message_queue_Create.part.0". Other suffixes include ".isra.0",<br>
".constprop.0", and ".0".<br>
<br>
This looks to be related to compiler optimizations. Symbols with<br>
suffixes were being treated as unique. For our purposes, they should be<br>
mapped to the equivalent symbols in the DWARF info. This has been<br>
fixed.<br></blockquote><div><br></div><div>Everything Alex said is correct. It appears to be related to the compiler</div><div>optimizing and moving a section of a method "out of line". I suspect it could</div><div>be that it is moving an alternate path ahead of the code generated for the</div><div>entry point to improve some straight execution path through the method.</div><div><br></div><div>Perhaps Alex can point to a BSP and test exe for an example.</div><div>But they definitely were there and looked like GCC had split the method </div><div>into different pieces and at least one had an address before the method</div><div>entry point. He never showed me a method split into more than one piece</div><div>but given they ended with a number, that seems likely.</div><div><br></div><div>--joel</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
tester/covoar/ExecutableInfo.cc | 22 +++++++++++++++++++---<br>
tester/covoar/ObjdumpProcessor.cc | 6 ++++++<br>
tester/covoar/SymbolTable.cc | 12 +++++++++---<br>
3 files changed, 34 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc<br>
index c996d75..9384973 100644<br>
--- a/tester/covoar/ExecutableInfo.cc<br>
+++ b/tester/covoar/ExecutableInfo.cc<br>
@@ -118,8 +118,7 @@ namespace Coverage {<br>
// Obtain the coverage map containing the specified address.<br>
itsSymbol = theSymbolTable.getSymbol( address );<br>
if (itsSymbol != "") {<br>
- it = coverageMaps.find( itsSymbol );<br>
- aCoverageMap = (*it).second;<br>
+ aCoverageMap = &findCoverageMap(itsSymbol);<br>
}<br>
<br>
return aCoverageMap;<br>
@@ -150,8 +149,25 @@ namespace Coverage {<br>
)<br>
{<br>
CoverageMaps::iterator cmi = coverageMaps.find( symbolName );<br>
- if ( cmi == coverageMaps.end() )<br>
+ if ( cmi != coverageMaps.end() ) {<br>
+ return *(cmi->second);<br>
+ }<br>
+<br>
+ size_t periodIndex = symbolName.find(".");<br>
+<br>
+ if (periodIndex == std::string::npos) {<br>
+ // Symbol name has no '.', can't do another lookup.<br>
throw CoverageMapNotFoundError(symbolName);<br>
+ }<br>
+<br>
+ cmi = coverageMaps.find(<br>
+ symbolName.substr(0, periodIndex)<br>
+ );<br>
+<br>
+ if ( cmi == coverageMaps.end() ) {<br>
+ throw CoverageMapNotFoundError(symbolName);<br>
+ }<br>
+<br>
return *(cmi->second);<br>
}<br>
<br>
diff --git a/tester/covoar/ObjdumpProcessor.cc b/tester/covoar/ObjdumpProcessor.cc<br>
index fa9894d..544bfa1 100644<br>
--- a/tester/covoar/ObjdumpProcessor.cc<br>
+++ b/tester/covoar/ObjdumpProcessor.cc<br>
@@ -417,6 +417,12 @@ namespace Coverage {<br>
processSymbol = false;<br>
theInstructions.clear();<br>
<br>
+ // Look for a '.' character and strip everything after it.<br>
+ char *periodIndex = strstr(symbol, ".");<br>
+ if (periodIndex != NULL) {<br>
+ *periodIndex = 0;<br>
+ }<br>
+<br>
// See if the new symbol is one that we care about.<br>
if (SymbolsToAnalyze->isDesired( symbol )) {<br>
currentSymbol = symbol;<br>
diff --git a/tester/covoar/SymbolTable.cc b/tester/covoar/SymbolTable.cc<br>
index 53bc8af..00062cc 100644<br>
--- a/tester/covoar/SymbolTable.cc<br>
+++ b/tester/covoar/SymbolTable.cc<br>
@@ -46,12 +46,18 @@ namespace Coverage {<br>
symbolData.startingAddress = start;<br>
symbolData.length = length;<br>
<br>
- if ( info[ symbol ].empty() == false ) {<br>
- if ( info[ symbol ].front().length != length ) {<br>
+ for (auto& symData : info[ symbol ]) {<br>
+ // The starting address could differ since we strip any suffixes beginning<br>
+ // with a '.'<br>
+ if (symData.startingAddress != start) {<br>
+ continue;<br>
+ }<br>
+<br>
+ if (symData.length != length) {<br>
std::ostringstream what;<br>
what << "Different lengths for the symbol "<br>
<< symbol<br>
- << " (" << info[ symbol ].front().length<br>
+ << " (" << symData.length<br>
<< " and " << length<br>
<< ")";<br>
throw rld::error( what, "SymbolTable::addSymbol" );<br>
-- <br>
2.27.0<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>