make non-public context functions static

This commit is contained in:
2020-02-05 22:35:08 +04:00
parent c4376721ad
commit c09c6c1f1b
2 changed files with 9 additions and 8 deletions
+6 -5
View File
@@ -20,12 +20,13 @@ extern int regnum;
pst_log logger; // logger for library pst_log logger; // logger for library
pst_allocator allocator; // custom allocator for PST library pst_allocator allocator; // custom allocator for PST library
void clean_print(pst_context* ctx) { static void clean_print(pst_context* ctx)
{
ctx->buff[0] = 0; ctx->buff[0] = 0;
ctx->offset = 0; ctx->offset = 0;
} }
void print_stack(pst_context* ctx, int max, uint64_t next_cfa) static void print_stack(pst_context* ctx, int max, uint64_t next_cfa)
{ {
pst_log(SEVERITY_DEBUG, "CFA = %#lX, NEXT_CFA = %#lX, SP = %#lX", ctx->cfa, next_cfa, ctx->sp); pst_log(SEVERITY_DEBUG, "CFA = %#lX, NEXT_CFA = %#lX, SP = %#lX", ctx->cfa, next_cfa, ctx->sp);
ctx->clean_print(ctx); ctx->clean_print(ctx);
@@ -44,7 +45,7 @@ void print_stack(pst_context* ctx, int max, uint64_t next_cfa)
} }
} }
void print_registers(pst_context* ctx, int from, int to) static void print_registers(pst_context* ctx, int from, int to)
{ {
ctx->clean_print(ctx); ctx->clean_print(ctx);
for(int i = from; i < regnum && i <= to; ++i) { for(int i = from; i < regnum && i <= to; ++i) {
@@ -57,7 +58,7 @@ void print_registers(pst_context* ctx, int from, int to)
} }
} }
bool print(pst_context* ctx, const char* fmt, ...) static bool print(pst_context* ctx, const char* fmt, ...)
{ {
bool nret = true; bool nret = true;
@@ -74,7 +75,7 @@ bool print(pst_context* ctx, const char* fmt, ...)
return nret; return nret;
} }
bool print_expr_block (pst_context* ctx, Dwarf_Op *exprs, int exprlen, Dwarf_Attribute* attr) static bool print_expr_block (pst_context* ctx, Dwarf_Op *exprs, int exprlen, Dwarf_Attribute* attr)
{ {
ctx->clean_print(ctx); ctx->clean_print(ctx);
for (int i = 0; i < exprlen; i++) { for (int i = 0; i < exprlen; i++) {
+3 -3
View File
@@ -5,8 +5,8 @@
* Author: nnosov * Author: nnosov
*/ */
#ifndef FRAMEWORK_CONTEXT_H_ #ifndef __PST_CONTEXT_H__
#define FRAMEWORK_CONTEXT_H_ #define __PST_CONTEXT_H__
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@@ -58,4 +58,4 @@ typedef struct __pst_context {
void pst_context_init(pst_context* ctx, ucontext_t* hctx); void pst_context_init(pst_context* ctx, ucontext_t* hctx);
void pst_context_fini(pst_context* ctx); void pst_context_fini(pst_context* ctx);
#endif /* FRAMEWORK_CONTEXT_H_ */ #endif /* __PST_CONTEXT_H__ */