[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 3/3] Correct name returned by get_proc_name() f
From: |
Konstantin Belousov |
Subject: |
[Libunwind-devel] [PATCH 3/3] Correct name returned by get_proc_name() for some frames. |
Date: |
Sat, 28 Jun 2014 23:28:10 +0300 |
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 | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/mi/Gget_proc_name.c b/src/mi/Gget_proc_name.c
index 7251c59..bc3d23d 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;
-
- return get_proc_name (tdep_get_as (c), tdep_get_ip (c), buf, buf_len, offp,
- tdep_get_as_arg (c));
+ unw_word_t ip;
+ int error;
+
+ 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;
}