aboutsummaryrefslogtreecommitdiff
path: root/gdb/target-delegates.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-09-04 18:23:22 +0100
committerPedro Alves <palves@redhat.com>2017-09-04 18:23:22 +0100
commit9a24775b97646827396073d0d7e510b9694331ab (patch)
treed360279777f8163d750f17c01507fc671e24b4b6 /gdb/target-delegates.c
parent9521ecda6835b338d61b1b06e1a91706711b1d0b (diff)
downloadfsf-binutils-gdb-9a24775b97646827396073d0d7e510b9694331ab.zip
fsf-binutils-gdb-9a24775b97646827396073d0d7e510b9694331ab.tar.gz
fsf-binutils-gdb-9a24775b97646827396073d0d7e510b9694331ab.tar.bz2
Introduce gdb_disassembly_flags
For some reason I ended up staring at some of the "int flags" in btrace-related code, and I got confused because I had no clue what the flags where supposed to indicate. Fix that by using enum_flags, so that: #1 - it's clear from the type what the flags are about, and #2 - the compiler can catch mismatching mistakes gdb/ChangeLog: 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.
Diffstat (limited to 'gdb/target-delegates.c')
-rw-r--r--gdb/target-delegates.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 88e3e0b..4fc06ea 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -3854,20 +3854,20 @@ debug_goto_record (struct target_ops *self, ULONGEST arg1)
}
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);
@@ -3876,25 +3876,25 @@ debug_insn_history (struct target_ops *self, int arg1, int 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);
@@ -3905,25 +3905,25 @@ debug_insn_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int a
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);
@@ -3934,7 +3934,7 @@ debug_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2,
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);
}