-
Notifications
You must be signed in to change notification settings - Fork 304
Open
Description
增加struct2json 结构体与JSON转换代码自动生成的Python脚本,支持从头文件中提取结构体定义,并根据结构体定义自动生成结构体与JSON互转代码,并提供相关示例。
我看这个好像是使用正则表达式完成的信息提取? 我最近也碰到了类似的需求,但是是用 clang 生成 btf 信息之后实现代码生成的;
https://github.com/eunomia-bpf/c-struct-bindgen
有没有想过使用 clang 导出 ast 和 debug 信息,或者 btf 信息,来做这样的事情? (btf 也可以理解成 debug 信息的一种,通过 clang -target bpf -g 即可生成,可以用 libbpf 解析获取结构体定义,类型和字段之类的)
Metadata
Metadata
Assignees
Labels
No labels