static void record_btrace_call_history_range (struct target_ops *self, ULONGEST from, ULONGEST to, int flags) { struct btrace_thread_info *btinfo; struct btrace_call_history *history; struct btrace_call_iterator begin, end; struct cleanup *uiout_cleanup; struct ui_out *uiout; unsigned int low, high; int found; uiout = current_uiout; uiout_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "func history"); low = from; high = to; DEBUG ("call-history (0x%x): [%u; %u)", flags, low, high); /* Check for wrap-arounds. */ if (low != from || high != to) error (_("Bad range.")); if (high < low) error (_("Bad range.")); btinfo = require_btrace (); found = btrace_find_call_by_number (&begin, btinfo, low); if (found == 0) error (_("Range out of bounds.")); found = btrace_find_call_by_number (&end, btinfo, high); if (found == 0) { /* Silently truncate the range. */ btrace_call_end (&end, btinfo); } else { /* We want both begin and end to be inclusive. */ btrace_call_next (&end, 1); } btrace_call_history (uiout, btinfo, &begin, &end, flags); btrace_set_call_history (btinfo, &begin, &end); do_cleanups (uiout_cleanup); }
static const btrace_function * btrace_func_from_recpy_func (const PyObject * const pyobject) { const btrace_function *func; const recpy_element_object *obj; thread_info *tinfo; btrace_call_iterator iter; if (Py_TYPE (pyobject) != &recpy_func_type) { PyErr_Format (gdbpy_gdb_error, _("Must be gdb.RecordFunctionSegment")); return NULL; } obj = (const recpy_element_object *) pyobject; tinfo = obj->thread; if (tinfo == NULL || btrace_is_empty (tinfo)) { PyErr_Format (gdbpy_gdb_error, _("No such function segment.")); return NULL; } if (btrace_find_call_by_number (&iter, &tinfo->btrace, obj->number) == 0) { PyErr_Format (gdbpy_gdb_error, _("No such function segment.")); return NULL; } func = btrace_call_get (&iter); if (func == NULL) { PyErr_Format (gdbpy_gdb_error, _("Not a valid function segment.")); return NULL; } return func; }