Skip to content

ctf: fix bits interpreted as bytes in index creation - #427

Open
arfio wants to merge 1 commit into
eclipse-tracecompass:masterfrom
arfio:fix-index-creation
Open

ctf: fix bits interpreted as bytes in index creation#427
arfio wants to merge 1 commit into
eclipse-tracecompass:masterfrom
arfio:fix-index-creation

Conversation

@arfio

@arfio arfio commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What it does

Fix how packet contexts are mapped into memory. The packet context size was in bits not bytes, a division was added to fix that issue.

How to test

Use the following trace: the-trace.zip

Follow-ups

N/A

Review checklist

  • As an author, I have thoroughly tested my changes and carefully followed the instructions in this template

Summary by CodeRabbit

  • Bug Fixes
    • Fixed packet context indexing to ensure trace data is mapped using the correct byte-based size.
    • Improved reliability when reading and navigating CTF traces.

Signed-off-by: Arnaud Fiorini <fiorini.arnaud@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

CTFTrace.createIndex now converts the packet-context size from bits to bytes before memory mapping.

Changes

Packet Context Index Mapping

Layer / File(s) Summary
Convert packet-context size before mapping
ctf/.../CTFTrace.java
createIndex uses the packet-context maximum size converted from bits to bytes when it creates the mapping.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the fix for interpreting packet-context bits as bytes during index creation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@arfio
arfio marked this pull request as ready for review August 5, 2026 13:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java`:
- Line 619: Update the packet mapping logic in CTFTrace so the bit-sized packet
context length is converted to bytes with ceiling alignment instead of
truncation. Adjust both the bounds check that compares against
packetPosition/getPacketHeader().getMaximumSize() and the
SafeMappedByteBuffer.map() byte-length argument using the same rounded-up byte
calculation. Keep the existing mapping flow intact, and make sure
packetContextDecl.getMaximumSize() remains the source of the size used in both
places.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f5ef40d8-44de-4834-b740-8a827737109a

📥 Commits

Reviewing files that changed from the base of the PR and between 9708bb9 and ecce0ff.

📒 Files selected for processing (1)
  • ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant