Bug 160540 - Incorrect offsets in PDOMPointerType and PDOMQualifierType
Summary: Incorrect offsets in PDOMPointerType and PDOMQualifierType
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 4.0 M5   Edit
Assignee: Doug Schaefer CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-10-11 15:21 EDT by Jason Montojo CLA
Modified: 2008-06-20 10:45 EDT (History)
1 user (show)

See Also:


Attachments
Proposed patch (3.62 KB, patch)
2006-10-30 10:26 EST, Jason Montojo CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Montojo CLA 2006-10-11 15:21:36 EDT
In PDOMPointerType and PDOMQualifierType, there are 2 fields being stored in the database:

FLAGS (1 byte), and
TYPE (4 bytes)

... for a total of 5 bytes.

Right now, the offsets for FLAGS and TYPE are 1, and 4, respectively.  It gets packed this way in the database:

+---+---+---+---+---+---+---+---+
| / | F | / | / | T | T | T | T |
+---+---+---+---+---+---+---+---+
  0   1   2   3   4   5   6   7

F - FLAGS
T - TYPE
/ - unused

However, the declared record size for these records is 5 bytes, so the intended packing is probably:

+---+---+---+---+---+---+---+---+
| F | T | T | T | T | / | / | / |
+---+---+---+---+---+---+---+---+
  0   1   2   3   4   5   6   7

So the offsets for FLAGS and TYPE should be 0 and 1, respectively.  We're not seeing any side-effects right now because both fields in the current configuration fit within the 16-byte allocation unit in the PDOM.
Comment 1 Doug Schaefer CLA 2006-10-12 15:28:00 EDT
Yikes. Luckily the minimum size for a record is 16 bytes so it still fits in the record. But this should be cleaned up so that it doesn't break in the future.
Comment 2 Jason Montojo CLA 2006-10-30 10:26:01 EST
Created attachment 52933 [details]
Proposed patch

This should fix the offsets.  This patch also contains documentation for Markus' PDOM changes which adds timestamps to PDOMFiles (bug 149571).
Comment 3 Markus Schorn CLA 2006-11-09 09:33:12 EST
I ran into a similar problem in PDOMCPPVariable and fixed it together with the two offsets mentioned above. 
Comment 4 Jason Montojo CLA 2006-11-13 09:46:21 EST
Fixed by Markus (see comment #3)