Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 334146

Summary: wrong boundary computation in compute_reverse_lookup_indices
Product: [Tools] TCF Reporter: Christophe Augier <christophe.augier>
Component: CoreAssignee: Project Inbox <tcf.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eugene
Version: unspecifiedFlags: eugene: iplog+
Target Milestone: 0.4.0   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Christophe Augier CLA 2011-01-12 12:46:32 EST
in compute_reverse_lookup_indices, following patch fixes the problem.

--- services/dwarfcache.c	(revision 1361)
+++ services/dwarfcache.c	(working copy)
@@ -816,9 +816,9 @@
     Unit->mStatesIndex = (LineNumbersState **)loc_alloc(sizeof(LineNumbersState *) * Unit->mStatesCnt);
     for (i = 0; i < Unit->mStatesCnt; i++) Unit->mStatesIndex[i] = Unit->mStates + i;
     qsort(Unit->mStatesIndex, Unit->mStatesCnt, sizeof(LineNumbersState *), state_text_pos_comparator);
-    for (i = 0; i < Unit->mStatesCnt - 1; i++) {
-        LineNumbersState * s = Unit->mStatesIndex[i];
-        LineNumbersState * n = Unit->mStatesIndex[i + 1];
+    for (i = 1; i < Unit->mStatesCnt; i++) {
+        LineNumbersState * s = Unit->mStatesIndex[i - 1];
+        LineNumbersState * n = Unit->mStatesIndex[i];
         s->mNext = n - Unit->mStates;
     }
 }
Comment 1 Eugene Tarassov CLA 2011-01-12 14:30:33 EST
I have committed the patch.
Thanks!