diff --git a/framework/context.cpp b/framework/context.cpp index 9793151..45bafc1 100644 --- a/framework/context.cpp +++ b/framework/context.cpp @@ -196,7 +196,7 @@ void pst_context_fini(pst_context* ctx) } -char* pst_dup(const char* str) +char* pst_strdup(const char* str) { pst_assert(str); diff --git a/framework/context.h b/framework/context.h index eb0bc50..f056fcb 100644 --- a/framework/context.h +++ b/framework/context.h @@ -18,22 +18,23 @@ #include "allocator.h" extern pst_log logger; // logger for whole PST library -extern pst_allocator allocator; // custom allocator for PS library +extern pst_allocator allocator; // custom allocator for PST library #define pst_alloc(TYPE) (TYPE*)allocator.alloc(&allocator, sizeof(TYPE)) #define pst_free(NAME) allocator.free(&allocator, NAME) #define pst_log(SEVERITY, FORMAT, ...) logger.log(&logger, SEVERITY, FORMAT, ##__VA_ARGS__) -char* pst_dup(const char* str); -typedef struct __pst_context { +char* pst_strdup(const char* str); + +typedef struct pst_context { // methods - void (*clean_print) (__pst_context* ctx); - bool (*print) (__pst_context* ctx, const char* fmt, ...); - void (*log) (SC_LogSeverity severity, const char*fmt, ...); - bool (*print_expr) (__pst_context* ctx, Dwarf_Op *exprs, int exprlen, Dwarf_Attribute* attr); - void (*print_registers) (__pst_context* ctx, int from, int to); - void (*print_stack) (__pst_context* ctx, int max, uint64_t next_cfa); + void (*clean_print) (pst_context* ctx); + bool (*print) (pst_context* ctx, const char* fmt, ...); + void (*log) (SC_LogSeverity severity, const char*fmt, ...); + bool (*print_expr) (pst_context* ctx, Dwarf_Op *exprs, int exprlen, Dwarf_Attribute* attr); + void (*print_registers) (pst_context* ctx, int from, int to); + void (*print_stack) (pst_context* ctx, int max, uint64_t next_cfa); // fields ucontext_t* hcontext; // context of signal handler diff --git a/framework/dwarf_call_site.h b/framework/dwarf_call_site.h index 616529b..4de6136 100644 --- a/framework/dwarf_call_site.h +++ b/framework/dwarf_call_site.h @@ -62,10 +62,11 @@ typedef struct pst_call_site { pst_context* ctx; // execution context bool allocated; // whether this object was allocated or not } pst_call_site; -void pst_call_site_init(pst_call_site* site, pst_context* c, uint64_t tgt, const char* orn); -pst_call_site* pst_call_site_new(pst_context* c, uint64_t tgt, const char* orn); +void pst_call_site_init(pst_call_site* site, pst_context* context, uint64_t target, const char* origin); +pst_call_site* pst_call_site_new(pst_context* context, uint64_t target, const char* origin); void pst_call_site_fini(pst_call_site* site); + // ----------------------------------------------------------------------------------- // storage for all of function's call sites // ----------------------------------------------------------------------------------- diff --git a/framework/dwarf_parameter.cpp b/framework/dwarf_parameter.cpp index 47adc99..389d748 100644 --- a/framework/dwarf_parameter.cpp +++ b/framework/dwarf_parameter.cpp @@ -18,7 +18,7 @@ void pst_type_init(pst_type* t, const char* name, uint32_t type) { list_node_init(&t->node); - t->name = pst_dup(name); + t->name = pst_strdup(name); t->type = type; t->allocated = false; } @@ -183,7 +183,7 @@ bool param_handle_dwarf(pst_parameter* param, Dwarf_Die* result, pst_function* f Dwarf_Attribute attr_mem; Dwarf_Attribute* attr; - param->name = pst_dup(dwarf_diename(result)); + param->name = pst_strdup(dwarf_diename(result)); param->is_variable = (dwarf_tag(result) == DW_TAG_variable); dwarf_decl_line(result, (int*)¶m->line);