From db2e5170b93bd2481eeb2c9c8eeda89f66e212fb Mon Sep 17 00:00:00 2001 From: Krystof Vasa Date: Tue, 13 Aug 2013 09:23:00 +0100 Subject: [PATCH] Can be much easier --- Gget_proc_name.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/Gget_proc_name.c b/Gget_proc_name.c index 8c9c2d5..b5f1ee5 100644 --- a/Gget_proc_name.c +++ b/Gget_proc_name.c @@ -26,33 +26,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "include/libunwind_i.h" #include -struct proc_name_search_result { - caddr_t ip; - char *buf; - size_t buf_len; - long *offset; -}; - -static int linker_foreach(linker_file_t file, void *ctx) { - struct proc_name_search_result *result = (struct proc_name_search_result*)ctx; - if (linker_search_symbol_name(result->ip, result->buf, result->buf_len, result->offset) == 0){ - // Found it -> return 1 so that the foreach stops - return 1; - } - return 0; -} - static inline int get_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - struct proc_name_search_result result; - result.ip = (caddr_t)ip; - result.buf = buf; - result.buf_len = buf_len; - result.offset = offp; - - return linker_file_foreach(linker_foreach, &result); + return linker_search_symbol_name((caddr_t)ip, buf, buf_len, offp); } PROTECTED int