start cleaning up function call instrumentation

It's a mess. I calculate call-graph depth one way and calculate caller
names another way. At least one of the ways fails to work with indirect
calls. Hopefully the other way works?
This commit is contained in:
Kartik K. Agaram 2022-03-16 20:29:50 -07:00
parent b9c187d259
commit 709cc25130
1 changed files with 2 additions and 2 deletions

View File

@ -320,7 +320,7 @@ void append_string_to_array(lua_State* L, int array_index, const char* s) {
lua_rawseti(L, array_index, new_index);
}
extern void save_caller_as(lua_State* L, const char* name, const char* caller_name);
static void save_caller_as(lua_State* L, const char* name, const char* caller_name);
void save_caller(lua_State* L, const char* name, int call_graph_depth) {
lua_Debug ar;
lua_getstack(L, 1, &ar);
@ -328,7 +328,7 @@ void save_caller(lua_State* L, const char* name, int call_graph_depth) {
if (ar.name) save_caller_as(L, name, ar.name);
}
void save_caller_as(lua_State* L, const char* name, const char* caller_name) {
static void save_caller_as(lua_State* L, const char* name, const char* caller_name) {
// push table of caller tables
luaL_newmetatable(L, "__teliva_caller");
int ct = lua_gettop(L);