diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2015-07-31 13:19:53 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2015-07-31 13:19:53 -0400 |
commit | f486487f558686c05d4f4d91a75638b9da399044 (patch) | |
tree | fef0470290c0abbc6d79d451a651aae987e47699 | |
parent | 22d31b1192bb38c766e349e5eed1a82298cc2c1f (diff) | |
download | gdb-f486487f558686c05d4f4d91a75638b9da399044.zip gdb-f486487f558686c05d4f4d91a75638b9da399044.tar.gz gdb-f486487f558686c05d4f4d91a75638b9da399044.tar.bz2 |
Mostly trivial enum fixes
This is a patch I extracted from Pedro's C++ branch. It contains the
most trivial enum fixes, where an integer type/value was used instead
of the appropriate enum type/value. It fixes many C++ errors, since
in C++ you can't mix integers and enums implicitely.
Regardless of the C++ conversion, I think this is a good cleanup to make
use of the appropriate enum types.
Regression-tested on native x86_64.
gdb/ChangeLog:
* aarch64-linux-nat.c (aarch64_linux_can_use_hw_breakpoint): Use enum
type or value instead of integer.
(aarch64_linux_insert_watchpoint): Likewise.
(aarch64_linux_remove_watchpoint): Likewise.
* ada-lang.c (ada_op_print_tab): Likewise.
* amd64-linux-tdep.c (amd64_canonicalize_syscall): Likewise.
(amd64_linux_syscall_record_common): Likewise.
* arch-utils.c (target_byte_order_user): Likewise.
(default_byte_order): Likewise.
* arm-linux-nat.c (arm_linux_can_use_hw_breakpoint): Likewise.
(arm_linux_get_hwbp_type): Likewise.
(arm_linux_hw_watchpoint_initialize): Likewise.
(arm_linux_insert_watchpoint): Likewise.
* arm-linux-tdep.c (arm_canonicalize_syscall): Likewise.
(arm_linux_syscall_record): Likewise.
* breakpoint.c (update_watchpoint): Likewise.
(breakpoint_here_p): Likewise.
(bpstat_print): Likewise.
(enable_breakpoint_disp): Likewise.
* c-lang.c (c_op_print_tab): Likewise.
* cli/cli-decode.c (add_info_alias): Likewise.
* d-lang.c (d_op_print_tab): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* f-exp.y (dot_ops): Likewise.
(f77_keywords): Likewise.
* f-lang.c (f_op_print_tab): Likewise.
* go-lang.c (go_op_print_tab): Likewise.
* guile/scm-breakpoint.c (gdbscm_make_breakpoint): Likewise.
* guile/scm-cmd.c (gdbscm_make_command): Likewise.
* guile/scm-param.c (gdbscm_make_parameter): Likewise.
* guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer): Likewise.
* guile/scm-string.c (struct scm_to_stringn_data): Likewise.
(struct scm_from_stringn_data): Likewise.
* i386-linux-tdep.c (i386_canonicalize_syscall): Likewise.
* ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise.
(ia64_linux_remove_watchpoint): Likewise.
(ia64_linux_can_use_hw_breakpoint): Likewise.
* infrun.c (print_stop_event): Likewise.
* jv-lang.c (java_op_print_tab): Likewise.
* linux-nat.c (linux_proc_xfer_partial): Likewise.
* linux-nat.h (struct lwp_info): Likewise.
* linux-thread-db.c (enable_thread_event): Likewise.
* m2-lang.c (m2_op_print_tab): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Likewise.
(mi_cmd_stack_list_variables): Likewise.
* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
* mi/mi-out.c (mi_table_begin): Likewise.
(mi_table_header): Likewise.
* mips-linux-nat.c (mips_linux_can_use_hw_breakpoint): Likewise.
(mips_linux_insert_watchpoint): Likewise.
(mips_linux_remove_watchpoint): Likewise.
* nat/mips-linux-watch.c (mips_linux_watch_type_to_irw): Likewise.
* nat/mips-linux-watch.h (struct mips_watchpoint): Likewise.
(mips_linux_watch_type_to_irw): Likewise.
* nto-procfs.c (procfs_can_use_hw_breakpoint): Likewise.
(procfs_insert_hw_watchpoint): Likewise.
(procfs_remove_hw_watchpoint): Likewise.
(procfs_hw_watchpoint): Likewise.
(procfs_can_use_hw_breakpoint): Likewise.
(procfs_remove_hw_watchpoint): Likewise.
(procfs_insert_hw_watchpoint): Likewise.
* p-lang.c (pascal_op_print_tab): Likewise.
* ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Likewise.
* ppc-linux-tdep.c (ppu2spu_unwind_register): Likewise.
* ppc-sysv-tdep.c (get_decimal_float_return_value): Likewise.
* procfs.c (procfs_can_use_hw_breakpoint): Likewise.
(procfs_insert_watchpoint): Likewise.
(procfs_remove_watchpoint): Likewise.
* psymtab.c (recursively_search_psymtabs): Likewise.
* remote-m32r-sdi.c (m32r_can_use_hw_watchpoint): Likewise.
(m32r_insert_watchpoint): Likewise.
* remote-mips.c (mips_can_use_watchpoint): Likewise.
(mips_insert_watchpoint): Likewise.
(mips_remove_watchpoint): Likewise.
* remote.c (watchpoint_to_Z_packet): Likewise.
(remote_insert_watchpoint): Likewise.
(remote_remove_watchpoint): Likewise.
(remote_check_watch_resources): Likewise.
* s390-linux-nat.c (s390_insert_watchpoint): Likewise.
(s390_remove_watchpoint): Likewise.
(s390_can_use_hw_breakpoint): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* spu-linux-nat.c (spu_can_use_hw_breakpoint): Likewise.
* target.h (struct target_ops): Likewise.
* tilegx-tdep.c (tilegx_analyze_prologue): Likewise.
* ui-out.c (struct ui_out_hdr): Likewise.
(append_header_to_list): Likewise.
(get_next_header): Likewise.
(verify_field): Likewise.
(ui_out_begin): Likewise.
(ui_out_field_int): Likewise.
(ui_out_field_fmt_int): Likewise.
(ui_out_field_skip): Likewise.
(ui_out_field_string): Likewise.
(ui_out_field_fmt): Likewise.
* varobj.c (new_variable): Likewise.
* x86-nat.c (x86_insert_watchpoint): Likewise.
(x86_remove_watchpoint): Likewise.
(x86_can_use_hw_breakpoint): Likewise.
* xtensa-tdep.h (struct gdbarch_tdep): Likewise.
* inflow.c (enum gdb_has_a_terminal_flag_enum): Add name to
previously anonymous enumeration type..
* linux-record.h (enum gdb_syscall): Add gdb_sys_no_syscall
value.
* target-debug.h (target_debug_print_enum_target_hw_bp_type): New.
(target_debug_print_enum_bptype): New.
* target-delegates.c: Regenerate.
57 files changed, 290 insertions, 144 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b52367e..a407456 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,113 @@ +2015-07-31 Simon Marchi <simon.marchi@ericsson.com> + + * aarch64-linux-nat.c (aarch64_linux_can_use_hw_breakpoint): Use enum + type or value instead of integer. + (aarch64_linux_insert_watchpoint): Likewise. + (aarch64_linux_remove_watchpoint): Likewise. + * ada-lang.c (ada_op_print_tab): Likewise. + * amd64-linux-tdep.c (amd64_canonicalize_syscall): Likewise. + (amd64_linux_syscall_record_common): Likewise. + * arch-utils.c (target_byte_order_user): Likewise. + (default_byte_order): Likewise. + * arm-linux-nat.c (arm_linux_can_use_hw_breakpoint): Likewise. + (arm_linux_get_hwbp_type): Likewise. + (arm_linux_hw_watchpoint_initialize): Likewise. + (arm_linux_insert_watchpoint): Likewise. + * arm-linux-tdep.c (arm_canonicalize_syscall): Likewise. + (arm_linux_syscall_record): Likewise. + * breakpoint.c (update_watchpoint): Likewise. + (breakpoint_here_p): Likewise. + (bpstat_print): Likewise. + (enable_breakpoint_disp): Likewise. + * c-lang.c (c_op_print_tab): Likewise. + * cli/cli-decode.c (add_info_alias): Likewise. + * d-lang.c (d_op_print_tab): Likewise. + * eval.c (evaluate_subexp_standard): Likewise. + * f-exp.y (dot_ops): Likewise. + (f77_keywords): Likewise. + * f-lang.c (f_op_print_tab): Likewise. + * go-lang.c (go_op_print_tab): Likewise. + * guile/scm-breakpoint.c (gdbscm_make_breakpoint): Likewise. + * guile/scm-cmd.c (gdbscm_make_command): Likewise. + * guile/scm-param.c (gdbscm_make_parameter): Likewise. + * guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer): Likewise. + * guile/scm-string.c (struct scm_to_stringn_data): Likewise. + (struct scm_from_stringn_data): Likewise. + * i386-linux-tdep.c (i386_canonicalize_syscall): Likewise. + * ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise. + (ia64_linux_remove_watchpoint): Likewise. + (ia64_linux_can_use_hw_breakpoint): Likewise. + * infrun.c (print_stop_event): Likewise. + * jv-lang.c (java_op_print_tab): Likewise. + * linux-nat.c (linux_proc_xfer_partial): Likewise. + * linux-nat.h (struct lwp_info): Likewise. + * linux-thread-db.c (enable_thread_event): Likewise. + * m2-lang.c (m2_op_print_tab): Likewise. + * mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Likewise. + (mi_cmd_stack_list_variables): Likewise. + * mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise. + * mi/mi-out.c (mi_table_begin): Likewise. + (mi_table_header): Likewise. + * mips-linux-nat.c (mips_linux_can_use_hw_breakpoint): Likewise. + (mips_linux_insert_watchpoint): Likewise. + (mips_linux_remove_watchpoint): Likewise. + * nat/mips-linux-watch.c (mips_linux_watch_type_to_irw): Likewise. + * nat/mips-linux-watch.h (struct mips_watchpoint): Likewise. + (mips_linux_watch_type_to_irw): Likewise. + * nto-procfs.c (procfs_can_use_hw_breakpoint): Likewise. + (procfs_insert_hw_watchpoint): Likewise. + (procfs_remove_hw_watchpoint): Likewise. + (procfs_hw_watchpoint): Likewise. + (procfs_can_use_hw_breakpoint): Likewise. + (procfs_remove_hw_watchpoint): Likewise. + (procfs_insert_hw_watchpoint): Likewise. + * p-lang.c (pascal_op_print_tab): Likewise. + * ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Likewise. + * ppc-linux-tdep.c (ppu2spu_unwind_register): Likewise. + * ppc-sysv-tdep.c (get_decimal_float_return_value): Likewise. + * procfs.c (procfs_can_use_hw_breakpoint): Likewise. + (procfs_insert_watchpoint): Likewise. + (procfs_remove_watchpoint): Likewise. + * psymtab.c (recursively_search_psymtabs): Likewise. + * remote-m32r-sdi.c (m32r_can_use_hw_watchpoint): Likewise. + (m32r_insert_watchpoint): Likewise. + * remote-mips.c (mips_can_use_watchpoint): Likewise. + (mips_insert_watchpoint): Likewise. + (mips_remove_watchpoint): Likewise. + * remote.c (watchpoint_to_Z_packet): Likewise. + (remote_insert_watchpoint): Likewise. + (remote_remove_watchpoint): Likewise. + (remote_check_watch_resources): Likewise. + * s390-linux-nat.c (s390_insert_watchpoint): Likewise. + (s390_remove_watchpoint): Likewise. + (s390_can_use_hw_breakpoint): Likewise. + * s390-linux-tdep.c (s390_gdbarch_init): Likewise. + * spu-linux-nat.c (spu_can_use_hw_breakpoint): Likewise. + * target.h (struct target_ops): Likewise. + * tilegx-tdep.c (tilegx_analyze_prologue): Likewise. + * ui-out.c (struct ui_out_hdr): Likewise. + (append_header_to_list): Likewise. + (get_next_header): Likewise. + (verify_field): Likewise. + (ui_out_begin): Likewise. + (ui_out_field_int): Likewise. + (ui_out_field_fmt_int): Likewise. + (ui_out_field_skip): Likewise. + (ui_out_field_string): Likewise. + (ui_out_field_fmt): Likewise. + * varobj.c (new_variable): Likewise. + * x86-nat.c (x86_insert_watchpoint): Likewise. + (x86_remove_watchpoint): Likewise. + (x86_can_use_hw_breakpoint): Likewise. + * xtensa-tdep.h (struct gdbarch_tdep): Likewise. + * inflow.c (enum gdb_has_a_terminal_flag_enum): Add name to + previously anonymous enumeration type.. + * linux-record.h (enum gdb_syscall): Add gdb_sys_no_syscall + value. + * target-debug.h (target_debug_print_enum_target_hw_bp_type): New. + (target_debug_print_enum_bptype): New. + * target-delegates.c: Regenerate. + 2015-07-30 Sandra Loosemore <sandra@codesourcery.com> * nios2-tdep.c (nios2_analyze_prologue): Do what the comment diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 758b30f..b6ee502 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -711,7 +711,8 @@ aarch64_linux_read_description (struct target_ops *ops) static int aarch64_linux_can_use_hw_breakpoint (struct target_ops *self, - int type, int cnt, int othertype) + enum bptype type, + int cnt, int othertype) { if (type == bp_hardware_watchpoint || type == bp_read_watchpoint || type == bp_access_watchpoint || type == bp_watchpoint) @@ -807,7 +808,8 @@ aarch64_linux_remove_hw_breakpoint (struct target_ops *self, static int aarch64_linux_insert_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { int ret; @@ -839,7 +841,8 @@ aarch64_linux_insert_watchpoint (struct target_ops *self, static int aarch64_linux_remove_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { int ret; diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 06c72ee..409ecb1 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13636,7 +13636,7 @@ static const struct op_print ada_op_print_tab[] = { {".all", UNOP_IND, PREC_SUFFIX, 1}, {"'access", UNOP_ADDR, PREC_SUFFIX, 1}, {"'size", OP_ATR_SIZE, PREC_SUFFIX, 1}, - {NULL, 0, 0, 0} + {NULL, OP_NULL, PREC_SUFFIX, 0} }; enum ada_primitive_types { diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index e9be9cf..14c1065 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -995,7 +995,7 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number) case amd64_sys_arch_prctl: case amd64_x32_sys_arch_prctl: - return -1; /* Note */ + return gdb_sys_no_syscall; /* Note */ case amd64_sys_adjtimex: case amd64_x32_sys_adjtimex: @@ -1429,7 +1429,7 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number) return gdb_sys_move_pages; default: - return -1; + return gdb_sys_no_syscall; } } @@ -1451,7 +1451,7 @@ amd64_linux_syscall_record_common (struct regcache *regcache, { int ret; ULONGEST syscall_native; - enum gdb_syscall syscall_gdb = -1; + enum gdb_syscall syscall_gdb = gdb_sys_no_syscall; regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &syscall_native); @@ -1486,9 +1486,10 @@ amd64_linux_syscall_record_common (struct regcache *regcache, break; } - syscall_gdb = amd64_canonicalize_syscall (syscall_native); + syscall_gdb + = amd64_canonicalize_syscall ((enum amd64_syscall) syscall_native); - if (syscall_gdb < 0) + if (syscall_gdb == gdb_sys_no_syscall) { printf_unfiltered (_("Process record and replay target doesn't " "support syscall number %s\n"), diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 46a6db0..7df5570 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -273,7 +273,7 @@ default_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range) /* Functions to manipulate the endianness of the target. */ -static int target_byte_order_user = BFD_ENDIAN_UNKNOWN; +static enum bfd_endian target_byte_order_user = BFD_ENDIAN_UNKNOWN; static const char endian_big[] = "big"; static const char endian_little[] = "little"; @@ -603,7 +603,7 @@ static const bfd_target *default_bfd_vec = &DEFAULT_BFD_VEC; static const bfd_target *default_bfd_vec; #endif -static int default_byte_order = BFD_ENDIAN_UNKNOWN; +static enum bfd_endian default_byte_order = BFD_ENDIAN_UNKNOWN; void initialize_current_architecture (void) diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index ff156d0..e2e43ac 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -686,7 +686,8 @@ arm_linux_get_hw_watchpoint_count (void) there is not an appropriate resource available, otherwise returns 1. */ static int arm_linux_can_use_hw_breakpoint (struct target_ops *self, - int type, int cnt, int ot) + enum bptype type, + int cnt, int ot) { if (type == bp_hardware_watchpoint || type == bp_read_watchpoint || type == bp_access_watchpoint || type == bp_watchpoint) @@ -922,10 +923,10 @@ arm_linux_hw_breakpoint_initialize (struct gdbarch *gdbarch, p->control = arm_hwbp_control_initialize (mask, arm_hwbp_break, 1); } -/* Get the ARM hardware breakpoint type from the RW value we're given when - asked to set a watchpoint. */ +/* Get the ARM hardware breakpoint type from the type value we're + given when asked to set a watchpoint. */ static arm_hwbp_type -arm_linux_get_hwbp_type (int rw) +arm_linux_get_hwbp_type (enum target_hw_bp_type type) { if (rw == hw_read) return arm_hwbp_load; @@ -938,7 +939,8 @@ arm_linux_get_hwbp_type (int rw) /* Initialize the hardware breakpoint structure P for a watchpoint at ADDR to LEN. The type of watchpoint is given in RW. */ static void -arm_linux_hw_watchpoint_initialize (CORE_ADDR addr, int len, int rw, +arm_linux_hw_watchpoint_initialize (CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct arm_linux_hw_breakpoint *p) { const struct arm_linux_hwbp_cap *cap = arm_linux_get_hwbp_cap (); @@ -951,7 +953,7 @@ arm_linux_hw_watchpoint_initialize (CORE_ADDR addr, int len, int rw, p->address = (unsigned int) addr; p->control = arm_hwbp_control_initialize (mask, - arm_linux_get_hwbp_type (rw), 1); + arm_linux_get_hwbp_type (type), 1); } /* Are two break-/watch-points equal? */ @@ -1147,7 +1149,8 @@ arm_linux_region_ok_for_hw_watchpoint (struct target_ops *self, /* Insert a Hardware breakpoint. */ static int arm_linux_insert_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int rw, + CORE_ADDR addr, int len, + enum target_hw_bp_type rw, struct expression *cond) { struct lwp_info *lp; diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 6273027..4772d82 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -1267,7 +1267,7 @@ arm_canonicalize_syscall (int syscall) else if (syscall >= 248 && syscall <= 253) return syscall + 4; - return -1; + return gdb_sys_no_syscall; } /* Record all registers but PC register for process-record. */ @@ -1299,7 +1299,7 @@ arm_linux_syscall_record (struct regcache *regcache, unsigned long svc_number) syscall_gdb = arm_canonicalize_syscall (svc_number); - if (syscall_gdb < 0) + if (syscall_gdb == gdb_sys_no_syscall) { printf_unfiltered (_("Process record and replay target doesn't " "support syscall number %s\n"), diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 2a55a6f..78a694e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1966,7 +1966,7 @@ update_watchpoint (struct watchpoint *b, int reparse) && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) { CORE_ADDR addr; - int type; + enum target_hw_bp_type type; struct bp_location *loc, **tmp; int bitpos = 0, bitsize = 0; @@ -4211,7 +4211,7 @@ breakpoint_here_p (struct address_space *aspace, CORE_ADDR pc) } } - return any_breakpoint_here ? ordinary_breakpoint_here : 0; + return any_breakpoint_here ? ordinary_breakpoint_here : no_breakpoint_here; } /* Return true if there's a moribund breakpoint at PC. */ @@ -4838,7 +4838,7 @@ print_solib_event (int is_catchpoint) enum print_stop_action bpstat_print (bpstat bs, int kind) { - int val; + enum print_stop_action val; /* Maybe another breakpoint in the chain caused us to stop. (Currently all watchpoints go on the bpstat whether hit or not. @@ -14573,7 +14573,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition, if (is_watchpoint (bpt)) { /* Initialize it just to avoid a GCC false warning. */ - enum enable_state orig_enable_state = 0; + enum enable_state orig_enable_state = bp_disabled; TRY { diff --git a/gdb/c-lang.c b/gdb/c-lang.c index cbc7a9e..f38af47 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -754,7 +754,7 @@ const struct op_print c_op_print_tab[] = {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0}, {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0}, {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0}, - {NULL, 0, 0, 0} + {NULL, OP_NULL, PREC_PREFIX, 0} }; enum c_primitive_types { diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 4d0d5a9..e406157 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -864,7 +864,7 @@ add_info (const char *name, cmd_cfunc_ftype *fun, const char *doc) struct cmd_list_element * add_info_alias (const char *name, const char *oldname, int abbrev_flag) { - return add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist); + return add_alias_cmd (name, oldname, class_run, abbrev_flag, &infolist); } /* Add an element to the list of commands. */ diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 68b9bea..bfb8e57 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -90,7 +90,7 @@ static const struct op_print d_op_print_tab[] = {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0}, {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0}, {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0}, - {NULL, 0, 0, 0} + {NULL, OP_NULL, PREC_PREFIX, 0} }; /* Mapping of all D basic data types into the language vector. */ @@ -1063,7 +1063,7 @@ evaluate_subexp_standard (struct type *expect_type, CORE_ADDR selector = 0; int struct_return = 0; - int sub_no_side = 0; + enum noside sub_no_side = EVAL_NORMAL; struct value *msg_send = NULL; struct value *msg_send_stret = NULL; diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 94494f0..7e4b1e1 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -859,7 +859,7 @@ static const struct token dot_ops[] = { ".GT.", GREATERTHAN, BINOP_END }, { ".lt.", LESSTHAN, BINOP_END }, { ".LT.", LESSTHAN, BINOP_END }, - { NULL, 0, 0 } + { NULL, 0, BINOP_END } }; struct f77_boolean_val @@ -894,7 +894,7 @@ static const struct token f77_keywords[] = { "sizeof", SIZEOF, BINOP_END }, { "real_8", REAL_S8_KEYWORD, BINOP_END }, { "real", REAL_KEYWORD, BINOP_END }, - { NULL, 0, 0 } + { NULL, 0, BINOP_END } }; /* Implementation of a dynamically expandable buffer for processing input diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 8b61028..e4deeb9 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -143,7 +143,7 @@ static const struct op_print f_op_print_tab[] = {".LT.", BINOP_LESS, PREC_ORDER, 0}, {"**", UNOP_IND, PREC_PREFIX, 0}, {"@", BINOP_REPEAT, PREC_REPEAT, 0}, - {NULL, 0, 0, 0} + {NULL, OP_NULL, PREC_REPEAT, 0} }; enum f_primitive_types { diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 2835dd9..b72c857 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -478,7 +478,7 @@ static const struct op_print go_op_print_tab[] = {"unsafe.Sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0}, {"++", UNOP_POSTINCREMENT, PREC_SUFFIX, 0}, {"--", UNOP_POSTDECREMENT, PREC_SUFFIX, 0}, - {NULL, 0, 0, 0} + {NULL, OP_NULL, PREC_SUFFIX, 0} }; enum go_primitive_types { diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c index ad853ed..eef8a4b 100644 --- a/gdb/guile/scm-breakpoint.c +++ b/gdb/guile/scm-breakpoint.c @@ -340,8 +340,8 @@ gdbscm_make_breakpoint (SCM location_scm, SCM rest) char *s; char *location; int type_arg_pos = -1, access_type_arg_pos = -1, internal_arg_pos = -1; - int type = bp_breakpoint; - int access_type = hw_write; + enum bptype type = bp_breakpoint; + enum target_hw_bp_type access_type = hw_write; int internal = 0; SCM result; breakpoint_smob *bp_smob; diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c index a693df2..4477b98 100644 --- a/gdb/guile/scm-cmd.c +++ b/gdb/guile/scm-cmd.c @@ -673,7 +673,7 @@ gdbscm_make_command (SCM name_scm, SCM rest) int doc_arg_pos = -1; char *s; char *name; - int command_class = no_class; + enum command_class command_class = no_class; SCM completer_class = SCM_BOOL_F; int is_prefix = 0; char *doc = NULL; diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c index 508bcb9..da9c31a 100644 --- a/gdb/guile/scm-param.c +++ b/gdb/guile/scm-param.c @@ -957,7 +957,7 @@ gdbscm_make_parameter (SCM name_scm, SCM rest) if (gdbscm_is_exception (initial_value_scm)) gdbscm_throw (initial_value_scm); } - pascm_set_param_value_x (param_type, &p_smob->value, enum_list, + pascm_set_param_value_x (p_smob->type, &p_smob->value, enum_list, initial_value_scm, initial_value_arg_pos, FUNC_NAME); } diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c index 860cf8e..879c4ea 100644 --- a/gdb/guile/scm-pretty-print.c +++ b/gdb/guile/scm-pretty-print.c @@ -971,7 +971,7 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang, struct value *value; enum display_hint hint; struct cleanup *cleanups; - int result = EXT_LANG_RC_NOP; + enum ext_lang_rc result = EXT_LANG_RC_NOP; enum string_repr_result print_result; /* No pretty-printer support for unavailable values. */ diff --git a/gdb/guile/scm-string.c b/gdb/guile/scm-string.c index dc84b83..587ad75 100644 --- a/gdb/guile/scm-string.c +++ b/gdb/guile/scm-string.c @@ -83,7 +83,7 @@ struct scm_to_stringn_data SCM string; size_t *lenp; const char *charset; - int conversion_kind; + scm_t_string_failed_conversion_handler conversion_kind; char *result; }; @@ -151,7 +151,7 @@ struct scm_from_stringn_data const char *string; size_t len; const char *charset; - int conversion_kind; + scm_t_string_failed_conversion_handler conversion_kind; SCM result; }; diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 2022927..04ce2df 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -381,7 +381,7 @@ i386_canonicalize_syscall (int syscall) if (syscall <= i386_syscall_max) return syscall; else - return -1; + return gdb_sys_no_syscall; } /* Parse the arguments of current system call instruction and record diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index fc17d81..03bd140 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -542,7 +542,8 @@ is_power_of_2 (int val) static int ia64_linux_insert_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int rw, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { struct lwp_info *lp; @@ -569,7 +570,7 @@ ia64_linux_insert_watchpoint (struct target_ops *self, dbr_addr = (long) addr; dbr_mask = (~(len - 1) & 0x00ffffffffffffffL); /* construct mask to match */ dbr_mask |= 0x0800000000000000L; /* Only match privilege level 3 */ - switch (rw) + switch (type) { case hw_write: dbr_mask |= (1L << 62); /* Set w bit */ @@ -597,7 +598,8 @@ ia64_linux_insert_watchpoint (struct target_ops *self, static int ia64_linux_remove_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { int idx; @@ -678,7 +680,8 @@ ia64_linux_stopped_by_watchpoint (struct target_ops *ops) static int ia64_linux_can_use_hw_breakpoint (struct target_ops *self, - int type, int cnt, int othertype) + enum bptype type, + int cnt, int othertype) { return 1; } diff --git a/gdb/inflow.c b/gdb/inflow.c index 1456fd8..a9db650 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -136,7 +136,7 @@ gdb_getpgrp (void) } #endif -enum +enum gdb_has_a_terminal_flag_enum { yes, no, have_not_checked } diff --git a/gdb/infrun.c b/gdb/infrun.c index 445a612..8430628 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -6486,7 +6486,7 @@ void print_stop_event (struct target_waitstatus *ws) { int bpstat_ret; - int source_flag; + enum print_what source_flag; int do_frame_printing = 1; struct thread_info *tp = inferior_thread (); diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index fee816c..c842a01 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -1098,7 +1098,7 @@ const struct op_print java_op_print_tab[] = {"*", UNOP_IND, PREC_PREFIX, 0}, {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0}, {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0}, - {NULL, 0, 0, 0} + {NULL, OP_NULL, PREC_PREFIX, 0} }; enum java_primitive_types diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 69cfefc..0aecfc8 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -4154,7 +4154,7 @@ linux_proc_xfer_partial (struct target_ops *ops, enum target_object object, char filename[64]; if (object != TARGET_OBJECT_MEMORY || !readbuf) - return 0; + return TARGET_XFER_EOF; /* Don't bother for one word. */ if (len < 3 * sizeof (long)) diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h index cae263a..81b3ded 100644 --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -98,7 +98,7 @@ struct lwp_info Values: - TARGET_WAITKIND_SYSCALL_ENTRY - TARGET_WAITKIND_SYSCALL_RETURN */ - int syscall_state; + enum target_waitkind syscall_state; /* The processor core this LWP was last seen on. */ int core; diff --git a/gdb/linux-record.h b/gdb/linux-record.h index 27bb700..6d29985 100644 --- a/gdb/linux-record.h +++ b/gdb/linux-record.h @@ -182,6 +182,9 @@ struct linux_record_tdep each must provide a mapping from their set to this one. */ enum gdb_syscall { + /* An unknown GDB syscall, not a real syscall. */ + gdb_sys_no_syscall = -1, + gdb_sys_restart_syscall = 0, gdb_sys_exit = 1, gdb_sys_fork = 2, diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 6177f39..26350bb 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -476,7 +476,7 @@ verbose_dlsym (void *handle, const char *name) } static td_err_e -enable_thread_event (int event, CORE_ADDR *bp) +enable_thread_event (td_event_e event, CORE_ADDR *bp) { td_notify_t notify; td_err_e err; diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 6ddfb5a..fb93c64 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -304,7 +304,7 @@ static const struct op_print m2_op_print_tab[] = {"MIN", UNOP_MIN, PREC_BUILTIN_FUNCTION, 0}, {"ODD", UNOP_ODD, PREC_BUILTIN_FUNCTION, 0}, {"TRUNC", UNOP_TRUNC, PREC_BUILTIN_FUNCTION, 0}, - {NULL, 0, 0, 0} + {NULL, OP_NULL, PREC_BUILTIN_FUNCTION, 0} }; /* The built-in types of Modula-2. */ diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 1b863eb..9a13ac8 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -215,7 +215,7 @@ mi_cmd_stack_list_locals (char *command, char **argv, int argc) struct frame_info *frame; int raw_arg = 0; enum ext_lang_bt_status result = EXT_LANG_BT_ERROR; - int print_value; + enum print_values print_value; int oind = 0; int skip_unavailable = 0; int i; @@ -412,7 +412,7 @@ mi_cmd_stack_list_variables (char *command, char **argv, int argc) struct frame_info *frame; int raw_arg = 0; enum ext_lang_bt_status result = EXT_LANG_BT_ERROR; - int print_value; + enum print_values print_value; int oind = 0; int skip_unavailable = 0; diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 66bcd88..b2513a1 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -2755,8 +2755,8 @@ mi_cmd_trace_frame_collected (char *command, char **argv, int argc) struct collection_list tracepoint_list, stepping_list; struct traceframe_info *tinfo; int oind = 0; - int var_print_values = PRINT_ALL_VALUES; - int comp_print_values = PRINT_ALL_VALUES; + enum print_values var_print_values = PRINT_ALL_VALUES; + enum print_values comp_print_values = PRINT_ALL_VALUES; int registers_format = 'x'; int memory_contents = 0; struct ui_out *uiout = current_uiout; diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 20f59c3..fa8282f 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -106,8 +106,8 @@ mi_table_begin (struct ui_out *uiout, const char *tblid) { mi_open (uiout, tblid, ui_out_type_tuple); - mi_field_int (uiout, -1, -1, -1, "nr_rows", nr_rows); - mi_field_int (uiout, -1, -1, -1, "nr_cols", nr_cols); + mi_field_int (uiout, -1, -1, ui_left, "nr_rows", nr_rows); + mi_field_int (uiout, -1, -1, ui_left, "nr_cols", nr_cols); mi_open (uiout, "hdr", ui_out_type_list); } @@ -149,9 +149,9 @@ mi_table_header (struct ui_out *uiout, int width, enum ui_align alignment, return; mi_open (uiout, NULL, ui_out_type_tuple); - mi_field_int (uiout, 0, 0, 0, "width", width); - mi_field_int (uiout, 0, 0, 0, "alignment", alignment); - mi_field_string (uiout, 0, 0, 0, "col_name", col_name); + mi_field_int (uiout, 0, 0, ui_center, "width", width); + mi_field_int (uiout, 0, 0, ui_center, "alignment", alignment); + mi_field_string (uiout, 0, 0, ui_center, "col_name", col_name); mi_field_string (uiout, 0, width, alignment, "colhdr", colhdr); mi_close (uiout, ui_out_type_tuple); } diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 6df618d..aba4b4b 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -509,7 +509,8 @@ mips_show_dr (const char *func, CORE_ADDR addr, static int mips_linux_can_use_hw_breakpoint (struct target_ops *self, - int type, int cnt, int ot) + enum bptype type, + int cnt, int ot) { int i; uint32_t wanted_mask, irw_mask; @@ -643,7 +644,8 @@ mips_linux_new_thread (struct lwp_info *lp) static int mips_linux_insert_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { struct pt_watch_regs regs; @@ -697,7 +699,8 @@ mips_linux_insert_watchpoint (struct target_ops *self, static int mips_linux_remove_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { int retval; diff --git a/gdb/nat/mips-linux-watch.c b/gdb/nat/mips-linux-watch.c index 231dbe0..613c291 100644 --- a/gdb/nat/mips-linux-watch.c +++ b/gdb/nat/mips-linux-watch.c @@ -198,7 +198,7 @@ mips_linux_read_watch_registers (long lwpid, /* Convert GDB's TYPE to an IRW mask. */ uint32_t -mips_linux_watch_type_to_irw (int type) +mips_linux_watch_type_to_irw (enum target_hw_bp_type type) { switch (type) { diff --git a/gdb/nat/mips-linux-watch.h b/gdb/nat/mips-linux-watch.h index 10ed6ba..6983f25 100644 --- a/gdb/nat/mips-linux-watch.h +++ b/gdb/nat/mips-linux-watch.h @@ -94,7 +94,7 @@ struct mips_watchpoint { CORE_ADDR addr; int len; - int type; + enum target_hw_bp_type type; struct mips_watchpoint *next; }; @@ -110,7 +110,7 @@ int mips_linux_watch_try_one_watch (struct pt_watch_regs *regs, CORE_ADDR addr, int len, uint32_t irw); void mips_linux_watch_populate_regs (struct mips_watchpoint *current_watches, struct pt_watch_regs *regs); -uint32_t mips_linux_watch_type_to_irw (int type); +uint32_t mips_linux_watch_type_to_irw (enum target_hw_bp_type type); int mips_linux_read_watch_registers (long lwpid, struct pt_watch_regs *watch_readback, diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 7312060..262c41f 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -54,14 +54,16 @@ static procfs_run run; static ptid_t do_attach (ptid_t ptid); static int procfs_can_use_hw_breakpoint (struct target_ops *self, - int, int, int); + enum target_hw_bp_type, int, int); static int procfs_insert_hw_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond); static int procfs_remove_hw_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond); static int procfs_stopped_by_watchpoint (struct target_ops *ops); @@ -1494,16 +1496,16 @@ _initialize_procfs (void) static int -procfs_hw_watchpoint (int addr, int len, int type) +procfs_hw_watchpoint (int addr, int len, enum target_hw_bp_type type) { procfs_break brk; switch (type) { - case 1: /* Read. */ + case hw_read: brk.type = _DEBUG_BREAK_RD; break; - case 2: /* Read/Write. */ + case hw_access: brk.type = _DEBUG_BREAK_RW; break; default: /* Modify. */ @@ -1525,14 +1527,16 @@ procfs_hw_watchpoint (int addr, int len, int type) static int procfs_can_use_hw_breakpoint (struct target_ops *self, - int type, int cnt, int othertype) + enum bptype type, + int cnt, int othertype) { return 1; } static int procfs_remove_hw_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { return procfs_hw_watchpoint (addr, -1, type); @@ -1540,7 +1544,8 @@ procfs_remove_hw_watchpoint (struct target_ops *self, static int procfs_insert_hw_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { return procfs_hw_watchpoint (addr, len, type); diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 516dd93..df6df22 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -339,7 +339,7 @@ const struct op_print pascal_op_print_tab[] = {"^", UNOP_IND, PREC_SUFFIX, 1}, {"@", UNOP_ADDR, PREC_PREFIX, 0}, {"sizeof", UNOP_SIZEOF, PREC_PREFIX, 0}, - {NULL, 0, 0, 0} + {NULL, OP_NULL, PREC_PREFIX, 0} }; enum pascal_primitive_types { diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 7514685..df69b06 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -1391,7 +1391,7 @@ have_ptrace_hwdebug_interface (void) static int ppc_linux_can_use_hw_breakpoint (struct target_ops *self, - int type, int cnt, int ot) + enum bptype type, int cnt, int ot) { int total_hw_wp, total_hw_bp; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 4bdd13e..cf46c2d 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1292,7 +1292,7 @@ struct ppu2spu_data gdb_byte gprs[128*16]; }; -static int +static enum register_status ppu2spu_unwind_register (void *src, int regnum, gdb_byte *buf) { struct ppu2spu_data *data = src; diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index ea98c6e..1c2644d 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -608,7 +608,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } /* Handle the return-value conventions for Decimal Floating Point values. */ -static int +static enum return_value_convention get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) diff --git a/gdb/procfs.c b/gdb/procfs.c index b62539f..b37e22e 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -143,7 +143,7 @@ static char * procfs_make_note_section (struct target_ops *self, bfd *, int *); static int procfs_can_use_hw_breakpoint (struct target_ops *self, - int, int, int); + enum bptype, int, int); static void procfs_info_proc (struct target_ops *, const char *, enum info_proc_what); @@ -4764,7 +4764,8 @@ procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag, static int procfs_can_use_hw_breakpoint (struct target_ops *self, - int type, int cnt, int othertype) + enum bptype type, + int cnt, int othertype) { /* Due to the way that proc_set_watchpoint() is implemented, host and target pointers must be of the same size. If they are not, @@ -4828,7 +4829,8 @@ procfs_stopped_data_address (struct target_ops *targ, CORE_ADDR *addr) static int procfs_insert_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { if (!target_have_steppable_watchpoint @@ -4851,7 +4853,8 @@ procfs_insert_watchpoint (struct target_ops *self, static int procfs_remove_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { return procfs_set_watchpoint (inferior_ptid, addr, 0, 0, 0); diff --git a/gdb/psymtab.c b/gdb/psymtab.c index ba677bc..7b1bbc8 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1318,7 +1318,7 @@ recursively_search_psymtabs (struct partial_symtab *ps, struct partial_symbol **psym; struct partial_symbol **bound, **gbound, **sbound; int keep_going = 1; - int result = PST_SEARCHED_AND_NOT_FOUND; + enum psymtab_search_status result = PST_SEARCHED_AND_NOT_FOUND; int i; if (ps->searched_flag != PST_NOT_SEARCHED) diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 01cb5b6..9c63fd5 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1424,7 +1424,8 @@ m32r_stop (struct target_ops *self, ptid_t ptid) static int m32r_can_use_hw_watchpoint (struct target_ops *self, - int type, int cnt, int othertype) + enum bptype type, + int cnt, int othertype) { return sdi_desc != NULL && cnt < max_access_breaks; } @@ -1435,7 +1436,7 @@ m32r_can_use_hw_watchpoint (struct target_ops *self, static int m32r_insert_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond) { int i; diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 143e5fd..0846d84 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -2402,7 +2402,7 @@ mips_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, static int mips_can_use_watchpoint (struct target_ops *self, - int type, int cnt, int othertype) + enum bptype type, int cnt, int othertype) { return cnt < MAX_LSI_BREAKPOINTS && strcmp (target_shortname, "lsi") == 0; } @@ -2437,10 +2437,13 @@ calculate_mask (CORE_ADDR addr, int len) static int mips_insert_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond) { - if (mips_set_breakpoint (addr, len, type)) + /* These enum types are compatible by design. */ + enum break_type btype = (enum break_type) type; + + if (mips_set_breakpoint (addr, len, btype)) return -1; return 0; @@ -2450,10 +2453,13 @@ mips_insert_watchpoint (struct target_ops *self, static int mips_remove_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond) { - if (mips_clear_breakpoint (addr, len, type)) + /* These enum types are compatible by design. */ + enum break_type btype = (enum break_type) type; + + if (mips_clear_breakpoint (addr, len, btype)) return -1; return 0; diff --git a/gdb/remote.c b/gdb/remote.c index 4ac393b..c047f35 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8706,7 +8706,7 @@ remote_remove_breakpoint (struct target_ops *ops, return memory_remove_breakpoint (ops, gdbarch, bp_tgt); } -static int +static enum Z_packet_type watchpoint_to_Z_packet (int type) { switch (type) @@ -8727,9 +8727,8 @@ watchpoint_to_Z_packet (int type) } static int -remote_insert_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, - struct expression *cond) +remote_insert_watchpoint (struct target_ops *self, CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { struct remote_state *rs = get_remote_state (); char *endbuf = rs->buf + get_remote_packet_size (); @@ -8777,9 +8776,8 @@ remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, static int -remote_remove_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, - struct expression *cond) +remote_remove_watchpoint (struct target_ops *self, CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { struct remote_state *rs = get_remote_state (); char *endbuf = rs->buf + get_remote_packet_size (); @@ -8835,7 +8833,7 @@ remote_region_ok_for_hw_watchpoint (struct target_ops *self, static int remote_check_watch_resources (struct target_ops *self, - int type, int cnt, int ot) + enum bptype type, int cnt, int ot) { if (type == bp_hardware_breakpoint) { diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index 360d761..9220589 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -554,7 +554,7 @@ s390_new_thread (struct lwp_info *lp) static int s390_insert_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond) { struct lwp_info *lp; @@ -576,7 +576,7 @@ s390_insert_watchpoint (struct target_ops *self, static int s390_remove_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, + CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond) { struct lwp_info *lp; @@ -605,7 +605,7 @@ s390_remove_watchpoint (struct target_ops *self, static int s390_can_use_hw_breakpoint (struct target_ops *self, - int type, int cnt, int othertype) + enum bptype type, int cnt, int othertype) { return type == bp_hardware_watchpoint; } diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index ec28448..32a5ed6 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -2979,7 +2979,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) struct tdesc_arch_data *tdesc_data = NULL; struct gdbarch *gdbarch; struct gdbarch_tdep *tdep; - int tdep_abi; + enum s390_abi_kind tdep_abi; enum s390_vector_abi_kind vector_abi; int have_upper = 0; int have_linux_v1 = 0; diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c index cb182be..fd1f996 100644 --- a/gdb/spu-linux-nat.c +++ b/gdb/spu-linux-nat.c @@ -625,7 +625,7 @@ spu_xfer_partial (struct target_ops *ops, /* Override the to_can_use_hw_breakpoint routine. */ static int spu_can_use_hw_breakpoint (struct target_ops *self, - int type, int cnt, int othertype) + enum bptype type, int cnt, int othertype) { return 0; } diff --git a/gdb/target-debug.h b/gdb/target-debug.h index 63ce12c..e1ffc5b 100644 --- a/gdb/target-debug.h +++ b/gdb/target-debug.h @@ -152,6 +152,10 @@ target_debug_do_print (host_address_to_string (X)) #define target_debug_print_const_struct_btrace_target_info_p(X) \ target_debug_do_print (host_address_to_string (X)) +#define target_debug_print_enum_target_hw_bp_type(X) \ + target_debug_do_print (plongest (X)) +#define target_debug_print_enum_bptype(X) \ + target_debug_do_print (plongest (X)) static void target_debug_print_struct_target_waitstatus_p (struct target_waitstatus *status) diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 36eacbf..d2d794f 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -401,20 +401,20 @@ debug_supports_stopped_by_hw_breakpoint (struct target_ops *self) } static int -delegate_can_use_hw_breakpoint (struct target_ops *self, int arg1, int arg2, int arg3) +delegate_can_use_hw_breakpoint (struct target_ops *self, enum bptype arg1, int arg2, int arg3) { self = self->beneath; return self->to_can_use_hw_breakpoint (self, arg1, arg2, arg3); } static int -tdefault_can_use_hw_breakpoint (struct target_ops *self, int arg1, int arg2, int arg3) +tdefault_can_use_hw_breakpoint (struct target_ops *self, enum bptype arg1, int arg2, int arg3) { return 0; } static int -debug_can_use_hw_breakpoint (struct target_ops *self, int arg1, int arg2, int arg3) +debug_can_use_hw_breakpoint (struct target_ops *self, enum bptype arg1, int arg2, int arg3) { int result; fprintf_unfiltered (gdb_stdlog, "-> %s->to_can_use_hw_breakpoint (...)\n", debug_target.to_shortname); @@ -422,7 +422,7 @@ debug_can_use_hw_breakpoint (struct target_ops *self, int arg1, int arg2, int ar fprintf_unfiltered (gdb_stdlog, "<- %s->to_can_use_hw_breakpoint (", debug_target.to_shortname); target_debug_print_struct_target_ops_p (&debug_target); fputs_unfiltered (", ", gdb_stdlog); - target_debug_print_int (arg1); + target_debug_print_enum_bptype (arg1); fputs_unfiltered (", ", gdb_stdlog); target_debug_print_int (arg2); fputs_unfiltered (", ", gdb_stdlog); @@ -523,20 +523,20 @@ debug_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *arg1, struc } static int -delegate_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4) +delegate_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4) { self = self->beneath; return self->to_remove_watchpoint (self, arg1, arg2, arg3, arg4); } static int -tdefault_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4) +tdefault_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4) { return -1; } static int -debug_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4) +debug_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4) { int result; fprintf_unfiltered (gdb_stdlog, "-> %s->to_remove_watchpoint (...)\n", debug_target.to_shortname); @@ -548,7 +548,7 @@ debug_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int fputs_unfiltered (", ", gdb_stdlog); target_debug_print_int (arg2); fputs_unfiltered (", ", gdb_stdlog); - target_debug_print_int (arg3); + target_debug_print_enum_target_hw_bp_type (arg3); fputs_unfiltered (", ", gdb_stdlog); target_debug_print_struct_expression_p (arg4); fputs_unfiltered (") = ", gdb_stdlog); @@ -558,20 +558,20 @@ debug_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int } static int -delegate_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4) +delegate_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4) { self = self->beneath; return self->to_insert_watchpoint (self, arg1, arg2, arg3, arg4); } static int -tdefault_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4) +tdefault_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4) { return -1; } static int -debug_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4) +debug_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4) { int result; fprintf_unfiltered (gdb_stdlog, "-> %s->to_insert_watchpoint (...)\n", debug_target.to_shortname); @@ -583,7 +583,7 @@ debug_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int fputs_unfiltered (", ", gdb_stdlog); target_debug_print_int (arg2); fputs_unfiltered (", ", gdb_stdlog); - target_debug_print_int (arg3); + target_debug_print_enum_target_hw_bp_type (arg3); fputs_unfiltered (", ", gdb_stdlog); target_debug_print_struct_expression_p (arg4); fputs_unfiltered (") = ", gdb_stdlog); diff --git a/gdb/target.h b/gdb/target.h index cad5c52..462c0de 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -41,6 +41,7 @@ struct dcache_struct; struct inferior; #include "infrun.h" /* For enum exec_direction_kind. */ +#include "breakpoint.h" /* For enum bptype. */ /* This include file defines the interface between the main part of the debugger, and the part which is target-specific, or @@ -73,6 +74,8 @@ struct inferior; #include "btrace.h" #include "command.h" +#include "break-common.h" /* For enum target_hw_bp_type. */ + enum strata { dummy_stratum, /* The lowest of the low */ @@ -513,7 +516,8 @@ struct target_ops int (*to_supports_stopped_by_hw_breakpoint) (struct target_ops *) TARGET_DEFAULT_RETURN (0); - int (*to_can_use_hw_breakpoint) (struct target_ops *, int, int, int) + int (*to_can_use_hw_breakpoint) (struct target_ops *, + enum bptype, int, int) TARGET_DEFAULT_RETURN (0); int (*to_ranged_break_num_registers) (struct target_ops *) TARGET_DEFAULT_RETURN (-1); @@ -526,11 +530,11 @@ struct target_ops /* Documentation of what the two routines below are expected to do is provided with the corresponding target_* macros. */ - int (*to_remove_watchpoint) (struct target_ops *, - CORE_ADDR, int, int, struct expression *) + int (*to_remove_watchpoint) (struct target_ops *, CORE_ADDR, int, + enum target_hw_bp_type, struct expression *) TARGET_DEFAULT_RETURN (-1); - int (*to_insert_watchpoint) (struct target_ops *, - CORE_ADDR, int, int, struct expression *) + int (*to_insert_watchpoint) (struct target_ops *, CORE_ADDR, int, + enum target_hw_bp_type, struct expression *) TARGET_DEFAULT_RETURN (-1); int (*to_insert_mask_watchpoint) (struct target_ops *, diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c index 18b1832..d136401 100644 --- a/gdb/tilegx-tdep.c +++ b/gdb/tilegx-tdep.c @@ -437,7 +437,7 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch, status = safe_frame_unwind_memory (next_frame, instbuf_start, instbuf, instbuf_size); if (status == 0) - memory_error (status, next_addr); + memory_error (TARGET_XFER_E_IO, next_addr); } reverse_frame_valid = 0; diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 8872600..a18fe2e 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -31,7 +31,7 @@ struct ui_out_hdr { int colno; int width; - int alignment; + enum ui_align alignment; char *col_name; char *colhdr; struct ui_out_hdr *next; @@ -269,14 +269,14 @@ static void uo_data_destroy (struct ui_out *uiout); extern void _initialize_ui_out (void); static void append_header_to_list (struct ui_out *uiout, int width, - int alignment, const char *col_name, + enum ui_align alignment, const char *col_name, const char *colhdr); static int get_next_header (struct ui_out *uiout, int *colno, int *width, - int *alignment, char **colhdr); + enum ui_align *alignment, char **colhdr); static void clear_header_list (struct ui_out *uiout); static void clear_table (struct ui_out *uiout); static void verify_field (struct ui_out *uiout, int *fldno, int *width, - int *align); + enum ui_align *align); /* exported functions (ui_out API) */ @@ -395,7 +395,7 @@ specified after table_body.")); { int fldno; int width; - int align; + enum ui_align align; verify_field (uiout, &fldno, &width, &align); } @@ -470,7 +470,7 @@ ui_out_field_int (struct ui_out *uiout, { int fldno; int width; - int align; + enum ui_align align; verify_field (uiout, &fldno, &width, &align); @@ -486,7 +486,7 @@ ui_out_field_fmt_int (struct ui_out *uiout, { int fldno; int width; - int align; + enum ui_align align; verify_field (uiout, &fldno, &width, &align); @@ -530,7 +530,7 @@ ui_out_field_skip (struct ui_out *uiout, { int fldno; int width; - int align; + enum ui_align align; verify_field (uiout, &fldno, &width, &align); @@ -544,7 +544,7 @@ ui_out_field_string (struct ui_out *uiout, { int fldno; int width; - int align; + enum ui_align align; verify_field (uiout, &fldno, &width, &align); @@ -560,7 +560,7 @@ ui_out_field_fmt (struct ui_out *uiout, va_list args; int fldno; int width; - int align; + enum ui_align align; /* Will not align, but has to call anyway. */ verify_field (uiout, &fldno, &width, &align); @@ -956,7 +956,7 @@ clear_header_list (struct ui_out *uiout) static void append_header_to_list (struct ui_out *uiout, int width, - int alignment, + enum ui_align alignment, const char *col_name, const char *colhdr) { @@ -1002,7 +1002,7 @@ static int get_next_header (struct ui_out *uiout, int *colno, int *width, - int *alignment, + enum ui_align *alignment, char **colhdr) { /* There may be no headers at all or we may have used all columns. */ @@ -1023,7 +1023,8 @@ get_next_header (struct ui_out *uiout, available/applicable). */ static void -verify_field (struct ui_out *uiout, int *fldno, int *width, int *align) +verify_field (struct ui_out *uiout, int *fldno, int *width, + enum ui_align *align) { struct ui_out_level *current = current_level (uiout); char *text; diff --git a/gdb/varobj.c b/gdb/varobj.c index b220fd8..15eb90f 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -2123,7 +2123,7 @@ new_variable (void) var->num_children = -1; var->parent = NULL; var->children = NULL; - var->format = 0; + var->format = FORMAT_NATURAL; var->root = NULL; var->updated = 0; var->print_value = NULL; diff --git a/gdb/x86-nat.c b/gdb/x86-nat.c index 1cff1aa..13a5d95 100644 --- a/gdb/x86-nat.c +++ b/gdb/x86-nat.c @@ -149,9 +149,8 @@ x86_cleanup_dregs (void) of the type TYPE. Return 0 on success, -1 on failure. */ static int -x86_insert_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, - struct expression *cond) +x86_insert_watchpoint (struct target_ops *self, CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { struct x86_debug_reg_state *state = x86_debug_reg_state (ptid_get_pid (inferior_ptid)); @@ -163,9 +162,8 @@ x86_insert_watchpoint (struct target_ops *self, address ADDR, whose length is LEN bytes, and for accesses of the type TYPE. Return 0 on success, -1 on failure. */ static int -x86_remove_watchpoint (struct target_ops *self, - CORE_ADDR addr, int len, int type, - struct expression *cond) +x86_remove_watchpoint (struct target_ops *self, CORE_ADDR addr, int len, + enum target_hw_bp_type type, struct expression *cond) { struct x86_debug_reg_state *state = x86_debug_reg_state (ptid_get_pid (inferior_ptid)); @@ -259,7 +257,7 @@ x86_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, static int x86_can_use_hw_breakpoint (struct target_ops *self, - int type, int cnt, int othertype) + enum bptype type, int cnt, int othertype) { return 1; } diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h index adacaf8..caa2988 100644 --- a/gdb/xtensa-tdep.h +++ b/gdb/xtensa-tdep.h @@ -246,7 +246,7 @@ struct gdbarch_tdep .spill_location = -1, \ .spill_size = (spillsz), \ .unused = 0, \ - .call_abi = 0, \ + .call_abi = CallAbiDefault, \ .debug_interrupt_level = XCHAL_DEBUGLEVEL, \ .icache_line_bytes = XCHAL_ICACHE_LINESIZE, \ .dcache_line_bytes = XCHAL_DCACHE_LINESIZE, \ |