Skip to content

Fix record parser when the FLAGS item is omitted - #119

Merged
caikelun merged 1 commit into
bytedance:devfrom
dajiaohuang:fix/118-record-parser-flags
Aug 26, 2026
Merged

Fix record parser when the FLAGS item is omitted#119
caikelun merged 1 commit into
bytedance:devfrom
dajiaohuang:fix/118-record-parser-flags

Conversation

@dajiaohuang

Copy link
Copy Markdown
Contributor

This PR fixes #118

Problem

The record parser accepts item flag combinations that omit the FLAGS field, but parse_line unconditionally parsed that missing field and raised TypeError.

Changes

  • Parse FLAGS only when the field is present.
  • Add a regression test for a valid record containing only the operation type.

Verification

  • python -m unittest test_record_parser.py
  • python -m py_compile record_parser.py test_record_parser.py
  • python record_parser.py -f 000000000100 -l hook_func_addr

@caikelun

Copy link
Copy Markdown
Member

Thanks. Please update your PR: keep only the changes to tools/record_parser.py.
(I don't think it's necessary to keep a Python script in the project specifically for testing this bug.)

@dajiaohuang
dajiaohuang force-pushed the fix/118-record-parser-flags branch from 8842e55 to c78453e Compare August 24, 2026 14:41
@dajiaohuang

Copy link
Copy Markdown
Contributor Author

Updated in c78453e: I removed tools/test_record_parser.py, so the PR now changes only tools/record_parser.py.

Validation:

  • python -m py_compile tools/record_parser.py
  • exercised the missing-FLAGS parse_line() path with a local import stub for the unavailable capstone dependency; it produced the expected operation output
  • git diff --check upstream/dev...HEAD

The full CLI command could not run in this environment because capstone is not installed.

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.

2 participants