From dbce594d336dd1766e2e5727958b6b341492a7c9 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 28 Jun 2014 23:28:10 +0300 Subject: [PATCH] Correct name returned by get_proc_name() for some frames. Fix returning the name of the function containing the frame PC, for the non-interrupted frames. The symbol lookup code should take use_prev_instr value into account, otherwise it could return the name of the function adjacent to the caller. --- src/mi/Gget_proc_name.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mi/Gget_proc_name.c b/src/mi/Gget_proc_name.c index 7251c591..bc3d23d2 100644 --- a/src/mi/Gget_proc_name.c +++ b/src/mi/Gget_proc_name.c @@ -100,7 +100,15 @@ unw_get_proc_name (unw_cursor_t *cursor, char *buf, size_t buf_len, unw_word_t *offp) { struct cursor *c = (struct cursor *) cursor; + unw_word_t ip; + int error; - return get_proc_name (tdep_get_as (c), tdep_get_ip (c), buf, buf_len, offp, - tdep_get_as_arg (c)); + ip = tdep_get_ip (c); + if (c->dwarf.use_prev_instr) + --ip; + error = get_proc_name (tdep_get_as (c), ip, buf, buf_len, offp, + tdep_get_as_arg (c)); + if (c->dwarf.use_prev_instr && offp != NULL && error == 0) + *offp += 1; + return error; }