Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334146 - wrong boundary computation in compute_reverse_lookup_indices
Summary: wrong boundary computation in compute_reverse_lookup_indices
Status: RESOLVED FIXED
Alias: None
Product: TCF
Classification: Tools
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 0.4.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-12 12:46 EST by Christophe Augier CLA
Modified: 2013-06-05 05:54 EDT (History)
1 user (show)

See Also:
eugene: iplog+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!