summaryrefslogtreecommitdiff
path: root/gdb/record-btrace.c
diff options
context:
space:
mode:
authorTim Wiederhake <tim.wiederhake@intel.com>2017-05-30 12:47:37 +0200
committerTim Wiederhake <tim.wiederhake@intel.com>2017-05-30 12:49:25 +0200
commit42bfe59e3a3fef26be6809168756f40740fac1d0 (patch)
tree0a4dba01a7aa394ffd8190f12303b97d17e40830 /gdb/record-btrace.c
parentb54b03bd874936ab3c91f23e5dff3a87153c4e36 (diff)
downloadbinutils-gdb-42bfe59e3a3fef26be6809168756f40740fac1d0.tar.gz
btrace: Replace struct btrace_function::up.
This used to hold a function segment pointer. Change it to hold an index into the vector of function segments instead.
Diffstat (limited to 'gdb/record-btrace.c')
-rw-r--r--gdb/record-btrace.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 5c230e7bb2b..41f95b3596a 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1570,7 +1570,7 @@ record_btrace_frame_unwind_stop_reason (struct frame_info *this_frame,
bfun = cache->bfun;
gdb_assert (bfun != NULL);
- if (bfun->up == NULL)
+ if (bfun->up == 0)
return UNWIND_UNAVAILABLE;
return UNWIND_NO_REASON;
@@ -1615,6 +1615,7 @@ record_btrace_frame_prev_register (struct frame_info *this_frame,
const struct btrace_frame_cache *cache;
const struct btrace_function *bfun, *caller;
const struct btrace_insn *insn;
+ struct btrace_call_iterator it;
struct gdbarch *gdbarch;
CORE_ADDR pc;
int pcreg;
@@ -1629,11 +1630,12 @@ record_btrace_frame_prev_register (struct frame_info *this_frame,
bfun = cache->bfun;
gdb_assert (bfun != NULL);
- caller = bfun->up;
- if (caller == NULL)
+ if (btrace_find_call_by_number (&it, &cache->tp->btrace, bfun->up) == 0)
throw_error (NOT_AVAILABLE_ERROR,
_("No caller in btrace record history"));
+ caller = btrace_call_get (&it);
+
if ((bfun->flags & BFUN_UP_LINKS_TO_RET) != 0)
{
insn = VEC_index (btrace_insn_s, caller->insn, 0);
@@ -1683,10 +1685,16 @@ record_btrace_frame_sniffer (const struct frame_unwind *self,
else
{
const struct btrace_function *callee;
+ struct btrace_call_iterator it;
callee = btrace_get_frame_function (next);
- if (callee != NULL && (callee->flags & BFUN_UP_LINKS_TO_TAILCALL) == 0)
- bfun = callee->up;
+ if (callee == NULL || (callee->flags & BFUN_UP_LINKS_TO_TAILCALL) != 0)
+ return 0;
+
+ if (btrace_find_call_by_number (&it, &tp->btrace, callee->up) == 0)
+ return 0;
+
+ bfun = btrace_call_get (&it);
}
if (bfun == NULL)
@@ -1713,7 +1721,9 @@ record_btrace_tailcall_frame_sniffer (const struct frame_unwind *self,
{
const struct btrace_function *bfun, *callee;
struct btrace_frame_cache *cache;
+ struct btrace_call_iterator it;
struct frame_info *next;
+ struct thread_info *tinfo;
next = get_next_frame (this_frame);
if (next == NULL)
@@ -1726,16 +1736,18 @@ record_btrace_tailcall_frame_sniffer (const struct frame_unwind *self,
if ((callee->flags & BFUN_UP_LINKS_TO_TAILCALL) == 0)
return 0;
- bfun = callee->up;
- if (bfun == NULL)
+ tinfo = find_thread_ptid (inferior_ptid);
+ if (btrace_find_call_by_number (&it, &tinfo->btrace, callee->up) == 0)
return 0;
+ bfun = btrace_call_get (&it);
+
DEBUG ("[frame] sniffed tailcall frame for %s on level %d",
btrace_get_bfun_name (bfun), bfun->level);
/* This is our frame. Initialize the frame cache. */
cache = bfcache_new (this_frame);
- cache->tp = find_thread_ptid (inferior_ptid);
+ cache->tp = tinfo;
cache->bfun = bfun;
*this_cache = cache;