iovisor / iovisor/bcc

Lua Parsing of Tracepoint Fields doesn't handle `__data_loc` correctly

Open
#5,419 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
5d 13h
Merged PRs (30d)
3

Description

Some arguments of tracepoint fields are of the format `__data_loc char[] var,` which is not being parsed correctly by the Lua tooling.

This problem is very similar to the one mentioned here: https://github.com/bpftrace/bpftrace/issues/385

To fix this, I have taken the same approach proposed by @brendangregg in that issue of transforming them to `char*` instead.

`src/lua/bpf/cdef.lua`:
```
275,276c275
< local g = string.gsub(f, "__data_loc char%[%]", "char*")
< table.insert(fields, g)
---
> table.insert(fields, f)
```

My approach right now is rather a hack, so please advise on what should be done.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read src/lua/bpf/cdef.lua around lines 275-276 and trace how tracepoint field strings reach the fields list. Reproduce a __data_loc char[] var field through the Lua tooling, then verify that parsing produces the intended char* representation without breaking other field forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.