[PATCH v2] covoar: Fix off-by-one in Coverage::finalizeSymbol()
Alex White
alex.white at oarcorp.com
Wed Mar 31 17:19:05 UTC 2021
The `rangeIndex` variable is 1 higher than the index at which the first
instruction address was found. This fixes the loop to set `rangeIndex`
correctly.
---
tester/covoar/ObjdumpProcessor.cc | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/tester/covoar/ObjdumpProcessor.cc b/tester/covoar/ObjdumpProcessor.cc
index 62a06c5..c2ed3d5 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -52,13 +52,12 @@ namespace Coverage {
throw rld::error( what, "Coverage::finalizeSymbol" );
}
- int rangeIndex;
+ int rangeIndex = -1;
uint32_t lowAddress = UINT32_MAX;
- for (rangeIndex = 0;
- firstInstructionAddress != lowAddress;
- rangeIndex++) {
+ do {
+ rangeIndex++;
lowAddress = coverageMap.getLowAddressOfRange(rangeIndex);
- }
+ } while (firstInstructionAddress != lowAddress);
uint32_t sizeWithoutNops = coverageMap.getSizeOfRange(rangeIndex);
uint32_t size = sizeWithoutNops;
--
2.27.0
More information about the devel
mailing list