Example #1
0
static void
btrace_func_history_insn_range (struct ui_out *uiout, struct btrace_func *bfun)
{
  ui_out_field_uint (uiout, "insn begin", bfun->ibegin);

  if (bfun->ibegin == bfun->iend)
    return;

  ui_out_text (uiout, "-");
  ui_out_field_uint (uiout, "insn end", bfun->iend);
}
Example #2
0
static void
btrace_call_history_insn_range (struct ui_out *uiout,
				const struct btrace_function *bfun)
{
  unsigned int begin, end, size;

  size = VEC_length (btrace_insn_s, bfun->insn);
  gdb_assert (size > 0);

  begin = bfun->insn_offset;
  end = begin + size - 1;

  ui_out_field_uint (uiout, "insn begin", begin);
  ui_out_text (uiout, ",");
  ui_out_field_uint (uiout, "insn end", end);
}
Example #3
0
static void
btrace_insn_history (struct ui_out *uiout,
		     const struct btrace_insn_iterator *begin,
		     const struct btrace_insn_iterator *end, int flags)
{
  struct gdbarch *gdbarch;
  struct btrace_insn_iterator it;

  DEBUG ("itrace (0x%x): [%u; %u)", flags, btrace_insn_number (begin),
	 btrace_insn_number (end));

  gdbarch = target_gdbarch ();

  for (it = *begin; btrace_insn_cmp (&it, end) != 0; btrace_insn_next (&it, 1))
    {
      const struct btrace_insn *insn;

      insn = btrace_insn_get (&it);

      /* Print the instruction index.  */
      ui_out_field_uint (uiout, "index", btrace_insn_number (&it));
      ui_out_text (uiout, "\t");

      /* Disassembly with '/m' flag may not produce the expected result.
	 See PR gdb/11833.  */
      gdb_disassembly (gdbarch, uiout, NULL, flags, 1, insn->pc, insn->pc + 1);
    }
}
Example #4
0
static void
btrace_call_history (struct ui_out *uiout,
		     const struct btrace_thread_info *btinfo,
		     const struct btrace_call_iterator *begin,
		     const struct btrace_call_iterator *end,
		     enum record_print_flag flags)
{
  struct btrace_call_iterator it;

  DEBUG ("ftrace (0x%x): [%u; %u)", flags, btrace_call_number (begin),
	 btrace_call_number (end));

  for (it = *begin; btrace_call_cmp (&it, end) < 0; btrace_call_next (&it, 1))
    {
      const struct btrace_function *bfun;
      struct minimal_symbol *msym;
      struct symbol *sym;

      bfun = btrace_call_get (&it);
      sym = bfun->sym;
      msym = bfun->msym;

      /* Print the function index.  */
      ui_out_field_uint (uiout, "index", bfun->number);
      ui_out_text (uiout, "\t");

      if ((flags & RECORD_PRINT_INDENT_CALLS) != 0)
	{
	  int level = bfun->level + btinfo->level, i;

	  for (i = 0; i < level; ++i)
	    ui_out_text (uiout, "  ");
	}

      if (sym != NULL)
	ui_out_field_string (uiout, "function", SYMBOL_PRINT_NAME (sym));
      else if (msym != NULL)
	ui_out_field_string (uiout, "function", MSYMBOL_PRINT_NAME (msym));
      else if (!ui_out_is_mi_like_p (uiout))
	ui_out_field_string (uiout, "function", "??");

      if ((flags & RECORD_PRINT_INSN_RANGE) != 0)
	{
	  ui_out_text (uiout, _("\tinst "));
	  btrace_call_history_insn_range (uiout, bfun);
	}

      if ((flags & RECORD_PRINT_SRC_LINE) != 0)
	{
	  ui_out_text (uiout, _("\tat "));
	  btrace_call_history_src_line (uiout, bfun);
	}

      ui_out_text (uiout, "\n");
    }
}
Example #5
0
static void
btrace_func_history (struct btrace_thread_info *btinfo, struct ui_out *uiout,
		     unsigned int begin, unsigned int end,
		     enum record_print_flag flags)
{
  struct btrace_func *bfun;
  unsigned int idx;

  DEBUG ("ftrace (0x%x): [%u; %u[", flags, begin, end);

  for (idx = begin; VEC_iterate (btrace_func_s, btinfo->ftrace, idx, bfun)
	 && idx < end; ++idx)
    {
      /* Print the function index.  */
      ui_out_field_uint (uiout, "index", idx);
      ui_out_text (uiout, "\t");

      if ((flags & record_print_insn_range) != 0)
	{
	  btrace_func_history_insn_range (uiout, bfun);
	  ui_out_text (uiout, "\t");
	}

      if ((flags & record_print_src_line) != 0)
	{
	  btrace_func_history_src_line (uiout, bfun);
	  ui_out_text (uiout, "\t");
	}

      if (bfun->sym != NULL)
	ui_out_field_string (uiout, "function", SYMBOL_PRINT_NAME (bfun->sym));
      else if (bfun->msym != NULL)
	ui_out_field_string (uiout, "function", SYMBOL_PRINT_NAME (bfun->msym));
      ui_out_text (uiout, "\n");
    }
}
Example #6
0
static void
btrace_insn_history (struct btrace_thread_info *btinfo, struct ui_out *uiout,
		     unsigned int begin, unsigned int end, int flags)
{
  struct gdbarch *gdbarch;
  struct btrace_inst *inst;
  unsigned int idx;

  DEBUG ("itrace (0x%x): [%u; %u[", flags, begin, end);

  gdbarch = target_gdbarch ();

  for (idx = begin; VEC_iterate (btrace_inst_s, btinfo->itrace, idx, inst)
	 && idx < end; ++idx)
    {
      /* Print the instruction index.  */
      ui_out_field_uint (uiout, "index", idx);
      ui_out_text (uiout, "\t");

      /* Disassembly with '/m' flag may not produce the expected result.
	 See PR gdb/11833.  */
      gdb_disassembly (gdbarch, uiout, NULL, flags, 1, inst->pc, inst->pc + 1);
    }
}