Skip to content

Support assignment in struct object constructor #47

@r41k0u

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions