STAP copy functions

This commit is contained in:
Nikita Smith
2026-01-22 13:30:03 -08:00
parent 7627ccf84e
commit 1ecd970f31
2 changed files with 24 additions and 2 deletions
+19
View File
@@ -436,3 +436,22 @@ stap_read_arg_f(STAP_Arg arg, Arch arch, void *reg_block, STAP_MemoryRead *memor
return stap_read_arg(arg, arch, reg_block, memory_read, memory_read_ctx, f_out); return stap_read_arg(arg, arch, reg_block, memory_read, memory_read_ctx, f_out);
} }
internal STAP_Arg
stap_arg_copy(STAP_Arg *src)
{
return *src;
}
internal STAP_ArgArray
stap_arg_array_copy(Arena *arena, STAP_ArgArray arr)
{
STAP_ArgArray result = {0};
result.count = arr.count;
result.v = push_array(arena, STAP_Arg, arr.count);
for EachIndex(arg_idx, arr.count)
{
result.v[arg_idx] = stap_arg_copy(&arr.v[arg_idx]);
}
return result;
}
+5 -2
View File
@@ -32,7 +32,7 @@ typedef struct STAP_Arg
B8 is_alias; B8 is_alias;
} reg; } reg;
struct { struct {
S64 disp; S64 disp;
struct { struct {
U32 reg_code; U32 reg_code;
B8 is_alias; B8 is_alias;
@@ -41,7 +41,7 @@ typedef struct STAP_Arg
U32 reg_code; U32 reg_code;
B8 is_alias; B8 is_alias;
} index; } index;
U64 scale; U64 scale;
} memory_ref; } memory_ref;
}; };
} STAP_Arg; } STAP_Arg;
@@ -78,5 +78,8 @@ internal B32 stap_read_arg_u(STAP_Arg arg, Arch arch, void *reg_block, STAP_Memo
internal B32 stap_read_arg_s(STAP_Arg arg, Arch arch, void *reg_block, STAP_MemoryRead *memory_read, void *memory_read_ctx, S64 *s_out); internal B32 stap_read_arg_s(STAP_Arg arg, Arch arch, void *reg_block, STAP_MemoryRead *memory_read, void *memory_read_ctx, S64 *s_out);
internal B32 stap_read_arg_f(STAP_Arg arg, Arch arch, void *reg_block, STAP_MemoryRead *memory_read, void *memory_read_ctx, F64 *f_out); internal B32 stap_read_arg_f(STAP_Arg arg, Arch arch, void *reg_block, STAP_MemoryRead *memory_read, void *memory_read_ctx, F64 *f_out);
internal STAP_Arg stap_arg_copy(STAP_Arg *src);
internal STAP_ArgArray stap_arg_array_copy(Arena *arena, STAP_ArgArray arr);
#endif // STAP_PARSE_H #endif // STAP_PARSE_H