opentelemetry-go-instrumentation icon indicating copy to clipboard operation
opentelemetry-go-instrumentation copied to clipboard

How to get the value of go arguments `interface{}` in bpf?

Open minimAluminiumalism opened this issue 1 year ago • 5 comments

I'm trying to a new instrument probe for a package, the target function attached the probe is:

func (c cmdable) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd

I successfully obtained the arg key with following code:

u64 key_ptr_pos = 4;
u64 key_len_ptr_pos = 5;
void *set_key_ptr = get_argument(ctx, key_ptr_pos);
u64 key_str_len = (u64)get_argument(ctx, key_len_ptr_pos);
u64 query_size = MAX_QUERY_SIZE < key_str_len ? MAX_QUERY_SIZE : key_str_len;
bpf_probe_read(key_str, query_size, set_key_ptr);

But I I encountered difficulties in obtaining another arg value which is interface{} type. I searched through all the code in your project but not found any related functions like the above function. Could you provide some guidance?

minimAluminiumalism avatar Oct 22 '24 18:10 minimAluminiumalism