+2017-09-04 Pedro Alves <palves@redhat.com>
+
+ * cli/cli-cmds.c (print_disassembly, disassemble_current_function)
+ (disassemble_command): Use gdb_disassembly_flags instead of bare
+ int.
+ * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn)
+ (dump_insns, do_mixed_source_and_assembly_deprecated)
+ (do_mixed_source_and_assembly, do_assembly_only, gdb_disassembly):
+ Use gdb_disassembly_flags instead of bare int.
+ * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED, DISASSEMBLY_RAW_INSN)
+ (DISASSEMBLY_OMIT_FNAME, DISASSEMBLY_FILENAME)
+ (DISASSEMBLY_OMIT_PC, DISASSEMBLY_SOURCE)
+ (DISASSEMBLY_SPECULATIVE): No longer macros. Instead they're...
+ (enum gdb_disassembly_flag): ... values of this new enumeration.
+ (gdb_disassembly_flags): Define.
+ (gdb_disassembly)
+ (gdb_pretty_print_disassembler::pretty_print_insn): Use it.
+ * mi/mi-cmd-disas.c (mi_cmd_disassemble): Use
+ gdb_disassembly_flags instead of bare int.
+ * record-btrace.c (btrace_insn_history)
+ (record_btrace_insn_history, record_btrace_insn_history_range)
+ (record_btrace_insn_history_from): Use gdb_disassembly_flags
+ instead of bare int.
+ * record.c (get_insn_history_modifiers, cmd_record_insn_history):
+ Use gdb_disassembly_flags instead of bare int.
+ * target-debug.h (target_debug_print_gdb_disassembly_flags):
+ Define.
+ * target-delegates.c: Regenerate.
+ * target.c (target_insn_history, target_insn_history_from)
+ (target_insn_history_range): Use gdb_disassembly_flags instead of
+ bare int.
+ * target.h: Include "disasm.h".
+ (struct target_ops) <to_insn_history, to_insn_history_from,
+ to_insn_history_range>: Use gdb_disassembly_flags instead of bare
+ int.
+ (target_insn_history, target_insn_history_from)
+ (target_insn_history_range): Use gdb_disassembly_flags instead of
+ bare int.
+
2017-09-04 Simon Marchi <simon.marchi@ericsson.com>
* cli/cli-script.c (build_command_line): For if/while commands,
static void
print_disassembly (struct gdbarch *gdbarch, const char *name,
- CORE_ADDR low, CORE_ADDR high, int flags)
+ CORE_ADDR low, CORE_ADDR high,
+ gdb_disassembly_flags flags)
{
#if defined(TUI)
if (!tui_is_window_visible (DISASSEM_WIN))
Print a disassembly of the current function according to FLAGS. */
static void
-disassemble_current_function (int flags)
+disassemble_current_function (gdb_disassembly_flags flags)
{
struct frame_info *frame;
struct gdbarch *gdbarch;
CORE_ADDR low, high;
const char *name;
CORE_ADDR pc;
- int flags;
+ gdb_disassembly_flags flags;
const char *p;
p = arg;
int
gdb_pretty_print_disassembler::pretty_print_insn (struct ui_out *uiout,
const struct disasm_insn *insn,
- int flags)
+ gdb_disassembly_flags flags)
{
/* parts of the symbolic representation of the address */
int unmapped;
static int
dump_insns (struct gdbarch *gdbarch,
struct ui_out *uiout, CORE_ADDR low, CORE_ADDR high,
- int how_many, int flags, CORE_ADDR *end_pc)
+ int how_many, gdb_disassembly_flags flags, CORE_ADDR *end_pc)
{
struct disasm_insn insn;
int num_displayed = 0;
(struct gdbarch *gdbarch, struct ui_out *uiout,
struct symtab *symtab,
CORE_ADDR low, CORE_ADDR high,
- int how_many, int flags)
+ int how_many, gdb_disassembly_flags flags)
{
int newlines = 0;
int nlines;
struct ui_out *uiout,
struct symtab *main_symtab,
CORE_ADDR low, CORE_ADDR high,
- int how_many, int flags)
+ int how_many, gdb_disassembly_flags flags)
{
const struct linetable_entry *le, *first_le;
int i, nlines;
static void
do_assembly_only (struct gdbarch *gdbarch, struct ui_out *uiout,
CORE_ADDR low, CORE_ADDR high,
- int how_many, int flags)
+ int how_many, gdb_disassembly_flags flags)
{
ui_out_emit_list list_emitter (uiout, "asm_insns");
void
gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout,
- int flags, int how_many,
+ gdb_disassembly_flags flags, int how_many,
CORE_ADDR low, CORE_ADDR high)
{
struct symtab *symtab;
#define DISASM_H
#include "dis-asm.h"
-
-#define DISASSEMBLY_SOURCE_DEPRECATED (0x1 << 0)
-#define DISASSEMBLY_RAW_INSN (0x1 << 1)
-#define DISASSEMBLY_OMIT_FNAME (0x1 << 2)
-#define DISASSEMBLY_FILENAME (0x1 << 3)
-#define DISASSEMBLY_OMIT_PC (0x1 << 4)
-#define DISASSEMBLY_SOURCE (0x1 << 5)
-#define DISASSEMBLY_SPECULATIVE (0x1 << 6)
+#include "common/enum-flags.h"
+
+enum gdb_disassembly_flag
+ {
+ DISASSEMBLY_SOURCE_DEPRECATED = (0x1 << 0),
+ DISASSEMBLY_RAW_INSN = (0x1 << 1),
+ DISASSEMBLY_OMIT_FNAME = (0x1 << 2),
+ DISASSEMBLY_FILENAME = (0x1 << 3),
+ DISASSEMBLY_OMIT_PC = (0x1 << 4),
+ DISASSEMBLY_SOURCE = (0x1 << 5),
+ DISASSEMBLY_SPECULATIVE = (0x1 << 6),
+ };
+DEF_ENUM_FLAGS_TYPE (enum gdb_disassembly_flag, gdb_disassembly_flags);
struct gdbarch;
struct ui_out;
};
extern void gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout,
- int flags, int how_many,
+ gdb_disassembly_flags flags, int how_many,
CORE_ADDR low, CORE_ADDR high);
/* Print the instruction at address MEMADDR in debugged memory,
/* Prints the instruction INSN into UIOUT and returns the length of
the printed instruction in bytes. */
int pretty_print_insn (struct ui_out *uiout, const struct disasm_insn *insn,
- int flags);
+ gdb_disassembly_flags flags);
private:
/* Returns the architecture used for disassembling. */
struct ui_out *uiout = current_uiout;
CORE_ADDR start;
- int mode, disasm_flags;
+ int mode;
+ gdb_disassembly_flags disasm_flags;
struct symtab *s;
/* Which options have we processed ... */
btrace_insn_history (struct ui_out *uiout,
const struct btrace_thread_info *btinfo,
const struct btrace_insn_iterator *begin,
- const struct btrace_insn_iterator *end, int flags)
+ const struct btrace_insn_iterator *end,
+ gdb_disassembly_flags flags)
{
struct cleanup *cleanups, *ui_item_chain;
struct gdbarch *gdbarch;
struct btrace_insn_iterator it;
struct btrace_line_range last_lines;
- DEBUG ("itrace (0x%x): [%u; %u)", flags, btrace_insn_number (begin),
- btrace_insn_number (end));
+ DEBUG ("itrace (0x%x): [%u; %u)", (unsigned) flags,
+ btrace_insn_number (begin), btrace_insn_number (end));
flags |= DISASSEMBLY_SPECULATIVE;
/* The to_insn_history method of target record-btrace. */
static void
-record_btrace_insn_history (struct target_ops *self, int size, int flags)
+record_btrace_insn_history (struct target_ops *self, int size,
+ gdb_disassembly_flags flags)
{
struct btrace_thread_info *btinfo;
struct btrace_insn_history *history;
{
struct btrace_insn_iterator *replay;
- DEBUG ("insn-history (0x%x): %d", flags, size);
+ DEBUG ("insn-history (0x%x): %d", (unsigned) flags, size);
/* If we're replaying, we start at the replay position. Otherwise, we
start at the tail of the trace. */
begin = history->begin;
end = history->end;
- DEBUG ("insn-history (0x%x): %d, prev: [%u; %u)", flags, size,
+ DEBUG ("insn-history (0x%x): %d, prev: [%u; %u)", (unsigned) flags, size,
btrace_insn_number (&begin), btrace_insn_number (&end));
if (size < 0)
static void
record_btrace_insn_history_range (struct target_ops *self,
- ULONGEST from, ULONGEST to, int flags)
+ ULONGEST from, ULONGEST to,
+ gdb_disassembly_flags flags)
{
struct btrace_thread_info *btinfo;
struct btrace_insn_history *history;
low = from;
high = to;
- DEBUG ("insn-history (0x%x): [%u; %u)", flags, low, high);
+ DEBUG ("insn-history (0x%x): [%u; %u)", (unsigned) flags, low, high);
/* Check for wrap-arounds. */
if (low != from || high != to)
static void
record_btrace_insn_history_from (struct target_ops *self,
- ULONGEST from, int size, int flags)
+ ULONGEST from, int size,
+ gdb_disassembly_flags flags)
{
ULONGEST begin, end, context;
/* Read instruction-history modifiers from an argument string. */
-static int
+static gdb_disassembly_flags
get_insn_history_modifiers (char **arg)
{
- int modifiers;
+ gdb_disassembly_flags modifiers;
char *args;
modifiers = 0;
static void
cmd_record_insn_history (char *arg, int from_tty)
{
- int flags, size;
-
require_record_target ();
- flags = get_insn_history_modifiers (&arg);
+ gdb_disassembly_flags flags = get_insn_history_modifiers (&arg);
- size = command_size_to_target_size (record_insn_history_size);
+ int size = command_size_to_target_size (record_insn_history_size);
if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
target_insn_history (size, flags);
target_debug_do_print (host_address_to_string (X))
#define target_debug_print_enum_remove_bp_reason(X) \
target_debug_do_print (plongest (X))
+#define target_debug_print_gdb_disassembly_flags(X) \
+ target_debug_do_print (plongest (X))
static void
target_debug_print_struct_target_waitstatus_p (struct target_waitstatus *status)
}
static void
-delegate_insn_history (struct target_ops *self, int arg1, int arg2)
+delegate_insn_history (struct target_ops *self, int arg1, gdb_disassembly_flags arg2)
{
self = self->beneath;
self->to_insn_history (self, arg1, arg2);
}
static void
-tdefault_insn_history (struct target_ops *self, int arg1, int arg2)
+tdefault_insn_history (struct target_ops *self, int arg1, gdb_disassembly_flags arg2)
{
tcomplain ();
}
static void
-debug_insn_history (struct target_ops *self, int arg1, int arg2)
+debug_insn_history (struct target_ops *self, int arg1, gdb_disassembly_flags arg2)
{
fprintf_unfiltered (gdb_stdlog, "-> %s->to_insn_history (...)\n", debug_target.to_shortname);
debug_target.to_insn_history (&debug_target, arg1, arg2);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_gdb_disassembly_flags (arg2);
fputs_unfiltered (")\n", gdb_stdlog);
}
static void
-delegate_insn_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+delegate_insn_history_from (struct target_ops *self, ULONGEST arg1, int arg2, gdb_disassembly_flags arg3)
{
self = self->beneath;
self->to_insn_history_from (self, arg1, arg2, arg3);
}
static void
-tdefault_insn_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+tdefault_insn_history_from (struct target_ops *self, ULONGEST arg1, int arg2, gdb_disassembly_flags arg3)
{
tcomplain ();
}
static void
-debug_insn_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+debug_insn_history_from (struct target_ops *self, ULONGEST arg1, int arg2, gdb_disassembly_flags arg3)
{
fprintf_unfiltered (gdb_stdlog, "-> %s->to_insn_history_from (...)\n", debug_target.to_shortname);
debug_target.to_insn_history_from (&debug_target, arg1, arg2, arg3);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg2);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg3);
+ target_debug_print_gdb_disassembly_flags (arg3);
fputs_unfiltered (")\n", gdb_stdlog);
}
static void
-delegate_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+delegate_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, gdb_disassembly_flags arg3)
{
self = self->beneath;
self->to_insn_history_range (self, arg1, arg2, arg3);
}
static void
-tdefault_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+tdefault_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, gdb_disassembly_flags arg3)
{
tcomplain ();
}
static void
-debug_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+debug_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, gdb_disassembly_flags arg3)
{
fprintf_unfiltered (gdb_stdlog, "-> %s->to_insn_history_range (...)\n", debug_target.to_shortname);
debug_target.to_insn_history_range (&debug_target, arg1, arg2, arg3);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_ULONGEST (arg2);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg3);
+ target_debug_print_gdb_disassembly_flags (arg3);
fputs_unfiltered (")\n", gdb_stdlog);
}
/* See target.h. */
void
-target_insn_history (int size, int flags)
+target_insn_history (int size, gdb_disassembly_flags flags)
{
current_target.to_insn_history (¤t_target, size, flags);
}
/* See target.h. */
void
-target_insn_history_from (ULONGEST from, int size, int flags)
+target_insn_history_from (ULONGEST from, int size,
+ gdb_disassembly_flags flags)
{
current_target.to_insn_history_from (¤t_target, from, size, flags);
}
/* See target.h. */
void
-target_insn_history_range (ULONGEST begin, ULONGEST end, int flags)
+target_insn_history_range (ULONGEST begin, ULONGEST end,
+ gdb_disassembly_flags flags)
{
current_target.to_insn_history_range (¤t_target, begin, end, flags);
}
#include "btrace.h"
#include "record.h"
#include "command.h"
+#include "disasm.h"
#include "break-common.h" /* For enum target_hw_bp_type. */
the current position.
If SIZE < 0, disassemble abs (SIZE) preceding instructions; otherwise,
disassemble SIZE succeeding instructions. */
- void (*to_insn_history) (struct target_ops *, int size, int flags)
+ void (*to_insn_history) (struct target_ops *, int size,
+ gdb_disassembly_flags flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Disassemble SIZE instructions in the recorded execution trace around
If SIZE < 0, disassemble abs (SIZE) instructions before FROM; otherwise,
disassemble SIZE instructions after FROM. */
void (*to_insn_history_from) (struct target_ops *,
- ULONGEST from, int size, int flags)
+ ULONGEST from, int size,
+ gdb_disassembly_flags flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Disassemble a section of the recorded execution trace from instruction
BEGIN (inclusive) to instruction END (inclusive). */
void (*to_insn_history_range) (struct target_ops *,
- ULONGEST begin, ULONGEST end, int flags)
+ ULONGEST begin, ULONGEST end,
+ gdb_disassembly_flags flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Print a function trace of the recorded execution trace.
extern void target_goto_record (ULONGEST insn);
/* See to_insn_history. */
-extern void target_insn_history (int size, int flags);
+extern void target_insn_history (int size, gdb_disassembly_flags flags);
/* See to_insn_history_from. */
-extern void target_insn_history_from (ULONGEST from, int size, int flags);
+extern void target_insn_history_from (ULONGEST from, int size,
+ gdb_disassembly_flags flags);
/* See to_insn_history_range. */
-extern void target_insn_history_range (ULONGEST begin, ULONGEST end, int flags);
+extern void target_insn_history_range (ULONGEST begin, ULONGEST end,
+ gdb_disassembly_flags flags);
/* See to_call_history. */
extern void target_call_history (int size, int flags);