Skip to content
Snippets Groups Projects
Commit 37b7496e authored by Clark Coleman's avatar Clark Coleman
Browse files

Fix annotation parsing for memory range annotations.

Former-commit-id: 41fa07d22ca3edef70568823572ee62eda413ef2
parent d2027ddf
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@
#include "MEDS_DeadRegAnnotation.hpp"
#include "MEDS_IBAnnotation.hpp"
#include "MEDS_IBTAnnotation.hpp"
#include "MEDS_MemoryRangeAnnotation.hpp"
// @todo: multiple annotation per instruction
......@@ -104,7 +105,7 @@ void MEDS_AnnotationParser::parseFile(istream &p_inputStream)
if(add_if_valid<MEDS_FuncExitAnnotation>(line)) continue;
if(add_if_valid<MEDS_IBAnnotation>(line)) continue;
if(add_if_valid<MEDS_IBTAnnotation>(line)) continue;
if (add_if_valid<MEDS_MemoryRangeAnnotation>(line)) continue;
}
}
......
......@@ -23,7 +23,7 @@
#include <cstdio>
#include <string>
#include <string.h>
#include <cstdint>
#include <cinttypes>
#include "MEDS_MemoryRangeAnnotation.hpp"
......@@ -87,11 +87,30 @@ void MEDS_MemoryRangeAnnotation::parse()
// 417748 12 INSTR STATICMEMWRITE MIN 3c60320 LIMIT 4e53730 ZZ
// 4992ea 4 INSTR STACKMEMRANGE MIN RSP - 568 LIMIT RSP - 48 INSTRSPDELTA - 592 ZZ
int ItemsFilled = sscanf(m_rawInputLine.c_str(), "%*x %d %*s %*s MIN %lx LIMIT %lx", &instrSize, &MinVal, &LimitVal);
if (3 != ItemsFilled) {
if (this->isStaticGlobalRange()) {
int ItemsFilled = sscanf(m_rawInputLine.c_str(), "%*x %d %*s %*s MIN %" SCNx64 " LIMIT %" SCNx64, &instrSize, &MinVal, &LimitVal);
if (3 != ItemsFilled) {
this->setInvalid();
cerr << "Error on sscanf of annotation: ItemsFilled = " << ItemsFilled << " line: " << m_rawInputLine << endl;
return;
}
else {
cerr << "Parsed STATICMEMWRITE annotation: MIN = " << hex << MinVal << " LIMIT = " << LimitVal << endl;
}
}
else {
#if 0
int ItemsFilled = sscanf(m_rawInputLine.c_str(), "%*x %d %*s %*s MIN %" SCNx64 " LIMIT %" SCNx64, &instrSize, &MinVal, &LimitVal);
if (3 != ItemsFilled) {
this->setInvalid();
cerr << "Error on sscanf of annotation: ItemsFilled = " << ItemsFilled << " line: " << m_rawInputLine << endl;
return;
}
#else
this->setInvalid();
cerr << "Error on sscanf of annotation" << endl;
cerr << "Not yet parsing STACKMEMRANGE annotations " << endl;
return;
#endif
}
this->setInstructionSize(instrSize); // in base class
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment