Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2014-02-11 22:06:44 -0500
committerEugene Tarassov2014-02-11 22:06:44 -0500
commit01e02e9f5bc5b8621e71e39f2e18f81b5ccbe2dd (patch)
treeff98c089c9c9e30ff36d251cd1f21f5cd407e331
parent429d37631a89e6575ff162ea11dcfc943b61cd6f (diff)
downloadorg.eclipse.tcf.agent-01e02e9f5bc5b8621e71e39f2e18f81b5ccbe2dd.tar.gz
org.eclipse.tcf.agent-01e02e9f5bc5b8621e71e39f2e18f81b5ccbe2dd.tar.xz
org.eclipse.tcf.agent-01e02e9f5bc5b8621e71e39f2e18f81b5ccbe2dd.zip
TCF Agent: added code to remove duplicate elements in mAddrRanges array
-rw-r--r--agent/tcf/services/dwarfcache.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/agent/tcf/services/dwarfcache.c b/agent/tcf/services/dwarfcache.c
index e02147fe..8e1cb412 100644
--- a/agent/tcf/services/dwarfcache.c
+++ b/agent/tcf/services/dwarfcache.c
@@ -969,7 +969,20 @@ static void load_addr_ranges(void) {
}
}
if (sCache->mAddrRangesCnt > 1) {
+ unsigned i, j = 0;
qsort(sCache->mAddrRanges, sCache->mAddrRangesCnt, sizeof(UnitAddressRange), addr_ranges_comparator);
+ for (i = 0; i < sCache->mAddrRangesCnt - 1; i++) {
+ UnitAddressRange * x = sCache->mAddrRanges + i;
+ UnitAddressRange * y = x + 1;
+ if (x->mSection == y->mSection && x->mUnit == y->mUnit &&
+ x->mAddr == y->mAddr && x->mSize == y->mSize) {
+ /* Skip duplicate entry */
+ continue;
+ }
+ if (j < i) memcpy(sCache->mAddrRanges + j, x, sizeof(UnitAddressRange));
+ j++;
+ }
+ sCache->mAddrRangesCnt = j;
}
}

Back to the top