Skip to content

Support assignment in struct object constructor #47

Description

@r41k0u

Currently, we only support zero-initialization of a struct object, and filling in the struct fields individually later.

@bpf
@struct
class data_t:
    pid: c_uint64
    ts: c_uint64

@bpf
@section("tracepoint/syscalls/sys_enter_execve")
def hello_world(ctx: c_void_p) -> c_int64:
    dat = data_t()
    dat.pid = 123

A better way of assigning fields would be directly from the constructor:

dat = data_t(123, 0)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestwishlistStuff we want but there are more important things

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions