btrace: extend struct btrace_insn

Add the instruction's size as well as a coarse classification to struct
btrace_insn.  Use the information in ftrace_update_function and
ftrace_find_call.

2015-02-09  Markus Metzger  <markus.t.metzger@intel.com>

	* btrace.h (btrace_insn_class): New.
	(btrace_insn) <size, iclass>: New.
	* btrace.c (ftrace_find_call): Update parameters.  Update users.
	Use instruction classification.
	(ftrace_new_return): Update parameters.  Update users.
	(ftrace_update_function): Update parameters.  Update users.  Use
	instruction classification.
	(ftrace_update_insns): Update parameters.  Update users.
	(ftrace_classify_insn): New.
	(btrace_compute_ftrace_bts): Fill in new btrace_insn fields.  Add
	TRY_CATCH around call to gdb_insn_length.
This commit is contained in:
Markus Metzger
2014-01-29 12:56:09 +01:00
parent 76235df10b
commit 7d5c24b3ae
3 changed files with 99 additions and 52 deletions

View File

@ -31,6 +31,22 @@
struct thread_info;
struct btrace_function;
/* A coarse instruction classification. */
enum btrace_insn_class
{
/* The instruction is something not listed below. */
BTRACE_INSN_OTHER,
/* The instruction is a function call. */
BTRACE_INSN_CALL,
/* The instruction is a function return. */
BTRACE_INSN_RETURN,
/* The instruction is an unconditional jump. */
BTRACE_INSN_JUMP
};
/* A branch trace instruction.
This represents a single instruction in a branch trace. */
@ -38,6 +54,12 @@ struct btrace_insn
{
/* The address of this instruction. */
CORE_ADDR pc;
/* The size of this instruction in bytes. */
gdb_byte size;
/* The instruction class of this instruction. */
enum btrace_insn_class iclass;
};
/* A vector of branch trace instructions. */