Skip to content

Commit d855e9e

Browse files
correct mistake in null pointer. Also identify error in pointer to char debug info generation
1 parent de19c8f commit d855e9e

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

pythonbpf/vmlinux_parser/ir_gen/debug_info_gen.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def _get_field_debug_type(
7878
"""
7979
# Handle complex types (arrays, pointers)
8080
if field.ctype_complex_type is not None:
81+
print(field)
8182
if issubclass(field.ctype_complex_type, ctypes.Array):
8283
# Handle array types
8384
element_type, base_type_size = _get_basic_debug_type(
@@ -89,6 +90,7 @@ def _get_field_debug_type(
8990
elif issubclass(field.ctype_complex_type, ctypes._Pointer):
9091
# Handle pointer types
9192
pointee_type, _ = _get_basic_debug_type(field.containing_type, generator)
93+
print("DEBUG", pointee_type)
9294
return generator.create_pointer_type(pointee_type), 64
9395

9496
# Handle other vmlinux types (nested structs)
@@ -156,7 +158,6 @@ def _get_basic_debug_type(ctype, generator: DebugInfoGenerator) -> Any:
156158
char_type = generator.get_basic_type("char", 8, dc.DW_ATE_signed_char), 8
157159
return generator.create_pointer_type(char_type)
158160
elif ctype == ctypes.c_void_p:
159-
void_type = generator.module.add_debug_info("DIBasicType", {"name": "void"})
160-
return generator.create_pointer_type(void_type), 64
161+
return generator.create_pointer_type(None), 64
161162
else:
162163
return generator.get_uint64_type(), 64

tests/c-form/ex7.bpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct {
1919
SEC("tp/syscalls/sys_enter_setuid")
2020
int handle_setuid_entry(struct trace_event_raw_sys_enter *ctx) {
2121
struct event data = {};
22-
22+
struct blk_integrity_iter it = {};
2323
// Extract UID from the syscall arguments
2424
data.uid = (unsigned int)ctx->args[0];
2525
data.ts = bpf_ktime_get_ns();

tests/passing_tests/vmlinux/simple_struct_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from pythonbpf import bpf, section, bpfglobal, compile_to_ir, compile
22
from vmlinux import TASK_COMM_LEN # noqa: F401
33
from vmlinux import struct_trace_event_raw_sys_enter # noqa: F401
4+
# from vmlinux import struct_xdp_md
5+
# from vmlinux import struct_request
6+
from vmlinux import struct_blk_integrity_iter
47
from ctypes import c_int64
58

69

@@ -24,4 +27,3 @@ def LICENSE() -> str:
2427

2528

2629
compile_to_ir("simple_struct_test.py", "simple_struct_test.ll")
27-
compile()

0 commit comments

Comments
 (0)