mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
fix errors. Does not support union name resolution yet.
This commit is contained in:
@ -49,19 +49,22 @@ class IRGenerator:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Process all dependencies first
|
# Process all dependencies first
|
||||||
for dependency in struct.depends_on:
|
if struct.depends_on is None:
|
||||||
if dependency not in self.generated:
|
pass
|
||||||
# Check if dependency exists in handler
|
else:
|
||||||
if dependency in self.handler.nodes:
|
for dependency in struct.depends_on:
|
||||||
dep_node_from_dependency = self.handler[dependency]
|
if dependency not in self.generated:
|
||||||
# Pass the processing_stack down to track circular refs
|
# Check if dependency exists in handler
|
||||||
self.struct_processor(
|
if dependency in self.handler.nodes:
|
||||||
dep_node_from_dependency, processing_stack
|
dep_node_from_dependency = self.handler[dependency]
|
||||||
)
|
# Pass the processing_stack down to track circular refs
|
||||||
else:
|
self.struct_processor(
|
||||||
raise RuntimeError(
|
dep_node_from_dependency, processing_stack
|
||||||
f"Warning: Dependency {dependency} not found in handler"
|
)
|
||||||
)
|
else:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"Warning: Dependency {dependency} not found in handler"
|
||||||
|
)
|
||||||
|
|
||||||
# Actual processor logic here after dependencies are resolved
|
# Actual processor logic here after dependencies are resolved
|
||||||
self.gen_ir(struct)
|
self.gen_ir(struct)
|
||||||
@ -152,6 +155,7 @@ class IRGenerator:
|
|||||||
)
|
)
|
||||||
return name
|
return name
|
||||||
else:
|
else:
|
||||||
|
print(self.handler[struct.name])
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
"Name generation cannot occur due to type name not starting with struct"
|
"Name generation cannot occur due to type name not starting with struct"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -2,12 +2,13 @@ from pythonbpf import bpf, map, section, bpfglobal, compile_to_ir
|
|||||||
from pythonbpf.maps import HashMap
|
from pythonbpf.maps import HashMap
|
||||||
from pythonbpf.helper import XDP_PASS
|
from pythonbpf.helper import XDP_PASS
|
||||||
from vmlinux import TASK_COMM_LEN # noqa: F401
|
from vmlinux import TASK_COMM_LEN # noqa: F401
|
||||||
from vmlinux import struct_trace_event_raw_sys_enter # noqa: F401
|
# from vmlinux import struct_qspinlock_0_1
|
||||||
from vmlinux import struct_posix_cputimers # noqa: F401
|
# from vmlinux import struct_trace_event_raw_sys_enter # noqa: F401
|
||||||
|
# from vmlinux import struct_posix_cputimers # noqa: F401
|
||||||
from vmlinux import struct_xdp_md
|
from vmlinux import struct_xdp_md
|
||||||
# from vmlinux import struct_trace_event_raw_sys_enter # noqa: F401
|
# from vmlinux import struct_trace_event_raw_sys_enter # noqa: F401
|
||||||
from vmlinux import struct_ring_buffer_per_cpu # noqa: F401
|
# from vmlinux import struct_ring_buffer_per_cpu # noqa: F401
|
||||||
|
from vmlinux import struct_request
|
||||||
from ctypes import c_int64
|
from ctypes import c_int64
|
||||||
|
|
||||||
# Instructions to how to run this program
|
# Instructions to how to run this program
|
||||||
|
|||||||
Reference in New Issue
Block a user