aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/codesearch/testdata/source0.c.json
diff options
context:
space:
mode:
authorTamas Koczka <poprdi@google.com>2026-01-28 14:34:43 +0000
committerDmitry Vyukov <dvyukov@google.com>2026-01-28 16:30:57 +0000
commit0ce7d86d6a53b38ed75045173da33b277415254d (patch)
tree7adfdaafad8f402b3d1983426d7817c637664424 /pkg/codesearch/testdata/source0.c.json
parentbb732b9882d4a11b56b97fcf41ce9625d82171c9 (diff)
pkg/codesearch: expose struct layout in codesearch
- Extract struct field offsets and sizes in the C++ codesearch indexer. - Add 'fields' to the JSON definition output. - Update pkg/codesearch to parse and expose the new field information. - Add 'struct-layout' command to syz-codesearch for debugging. - Add 'codesearch-struct-layout' tool to pkg/aflow/tool/codesearcher/ to allow LLM agents to query struct memory layout and map byte offsets to fields. - Support pointer marshaling for optional JSON values (e.g. *uint)
Diffstat (limited to 'pkg/codesearch/testdata/source0.c.json')
-rw-r--r--pkg/codesearch/testdata/source0.c.json70
1 files changed, 65 insertions, 5 deletions
diff --git a/pkg/codesearch/testdata/source0.c.json b/pkg/codesearch/testdata/source0.c.json
index 451ab58cc..39e4b6775 100644
--- a/pkg/codesearch/testdata/source0.c.json
+++ b/pkg/codesearch/testdata/source0.c.json
@@ -192,7 +192,14 @@
"start_line": 36,
"end_line": 38
},
- "comment": {}
+ "comment": {},
+ "fields": [
+ {
+ "name": "x",
+ "offset": 0,
+ "size": 32
+ }
+ ]
},
{
"name": "some_struct",
@@ -202,7 +209,19 @@
"start_line": 17,
"end_line": 20
},
- "comment": {}
+ "comment": {},
+ "fields": [
+ {
+ "name": "x",
+ "offset": 0,
+ "size": 32
+ },
+ {
+ "name": "y",
+ "offset": 32,
+ "size": 32
+ }
+ ]
},
{
"name": "some_struct_with_a_comment",
@@ -216,7 +235,19 @@
"file": "source0.h",
"start_line": 24,
"end_line": 26
- }
+ },
+ "fields": [
+ {
+ "name": "x",
+ "offset": 0,
+ "size": 32
+ },
+ {
+ "name": "other_struct",
+ "offset": 64,
+ "size": 64
+ }
+ ]
},
{
"name": "struct_in_c_file",
@@ -226,7 +257,19 @@
"start_line": 6,
"end_line": 9
},
- "comment": {}
+ "comment": {},
+ "fields": [
+ {
+ "name": "X",
+ "offset": 0,
+ "size": 32
+ },
+ {
+ "name": "by_value",
+ "offset": 32,
+ "size": 64
+ }
+ ]
},
{
"name": "some_union",
@@ -236,7 +279,24 @@
"start_line": 40,
"end_line": 44
},
- "comment": {}
+ "comment": {},
+ "fields": [
+ {
+ "name": "x",
+ "offset": 0,
+ "size": 32
+ },
+ {
+ "name": "p",
+ "offset": 0,
+ "size": 64
+ },
+ {
+ "name": "s",
+ "offset": 0,
+ "size": 64
+ }
+ ]
},
{
"name": "some_enum",