Bug 525629 - Incorrect byte order for structures
Summary: Incorrect byte order for structures
Status: NEW
Alias: None
Product: Tracecompass
Classification: Tools
Component: CTF (show other bugs)
Version: 3.0.0   Edit
Hardware: Power PC Windows 7
: P3 normal
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Project Inbox CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-05 10:37 EDT by Luana Mincu CLA
Modified: 2017-10-11 07:30 EDT (History)
2 users (show)

See Also:


Attachments
CTF trace that reproduces the problem (40.22 KB, application/x-zip-compressed)
2017-10-05 10:51 EDT, Luana Mincu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luana Mincu CLA 2017-10-05 10:37:54 EDT
The bug reproduces in the following scenario:
1. Byte order is specified in trace description and is different from native order.
2. At least one structure is defined, and its definition is placed before trace definition in metadata file.

Actual behavior:
Byte order defined in trace description does not propagate to structures, but only to basic types. The structure will have an incorrect byte_order.

Cause:
When reading byte_order in trace description, all previously defined types should be updated with the new byte order.
In TraceDeclarationParser.java:setAlign(DeclarationScope, StructDeclaration, ByteOrder), if the field is of type IntegerDeclaration, a new field with the correct byte order is added. Because the field name already exists, this operation fails with a warning:
!ENTRY org.eclipse.tracecompass.ctf.core 2 0 2017-10-05 16:48:10.766
!MESSAGE Struct already contains a field named <field_name>

Fix:
In this case, just update the existing field with the correct declaration.

Workaround:
In metadata, place trace description before structure definition.
Comment 1 Luana Mincu CLA 2017-10-05 10:51:03 EDT
Created attachment 270844 [details]
CTF trace that reproduces the problem
Comment 2 Matthew Khouzam CLA 2017-10-05 15:05:01 EDT
This is interesting, I will try to put up a patch soon, could I use your trace in our regression tests?
Comment 3 Matthew Khouzam CLA 2017-10-06 08:54:48 EDT
Hi Luana, I'm a little backlogged at the moment, is the workaround sufficient for the short term?
Comment 4 Luana Mincu CLA 2017-10-11 07:30:43 EDT
Hi Matthew,

Yes, feel free to use our trace for any needed tests. Also, the workaround is sufficient short term.

Thank you,
Luana