From 99321c7669a120dd614bce4003cdc5c5c25c168a Mon Sep 17 00:00:00 2001 From: varun-r-mallya Date: Fri, 21 Nov 2025 23:01:08 +0530 Subject: [PATCH] add a failing C test --- pythonbpf/type_deducer.py | 1 + tests/c-form/requests2.bpf.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/c-form/requests2.bpf.c diff --git a/pythonbpf/type_deducer.py b/pythonbpf/type_deducer.py index a6834a9..74abc0d 100644 --- a/pythonbpf/type_deducer.py +++ b/pythonbpf/type_deducer.py @@ -16,6 +16,7 @@ mapping = { "c_long": ir.IntType(64), "c_ulong": ir.IntType(64), "c_longlong": ir.IntType(64), + "c_uint": ir.IntType(32), # Not so sure about this one "str": ir.PointerType(ir.IntType(8)), } diff --git a/tests/c-form/requests2.bpf.c b/tests/c-form/requests2.bpf.c new file mode 100644 index 0000000..c0cbf9f --- /dev/null +++ b/tests/c-form/requests2.bpf.c @@ -0,0 +1,18 @@ +#include "vmlinux.h" +#include +#include +#include + +char LICENSE[] SEC("license") = "GPL"; + +SEC("kprobe/blk_mq_start_request") +int example(struct pt_regs *ctx) +{ + u64 a = ctx->r15; + struct request *req = (struct request *)(ctx->di); + unsigned int something_ns = req->timeout; + unsigned int data_len = req->__data_len; + bpf_printk("data length %lld %ld %ld\n", data_len, something_ns, a); + + return 0; +}