From 57810aa7e8032c598897454daea14ed17df0f89d Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 3 May 2018 00:37:26 +0100 Subject: target_ops: Use bool throughout After the previous target_ops/C++ patches are all squashed and merged, this one can go in separately. This patch adjusts all the target methods to return bool instead of int when they're returning a boolean. gdb/ChangeLog: 2018-05-02 Pedro Alves * target.h (target_ops) : Adjust to return bool. * aarch64-linux-nat.c: All implementations adjusted. * aix-thread.c: All implementations adjusted. * arm-linux-nat.c: All implementations adjusted. * breakpoint.c: All implementations adjusted. * bsd-kvm.c: All implementations adjusted. * bsd-uthread.c: All implementations adjusted. * corelow.c: All implementations adjusted. * ctf.c: All implementations adjusted. * darwin-nat.c: All implementations adjusted. * darwin-nat.h: All implementations adjusted. * exec.c: All implementations adjusted. * fbsd-nat.c: All implementations adjusted. * fbsd-nat.h: All implementations adjusted. * gnu-nat.c: All implementations adjusted. * gnu-nat.h: All implementations adjusted. * go32-nat.c: All implementations adjusted. * ia64-linux-nat.c: All implementations adjusted. * inf-child.c: All implementations adjusted. * inf-child.h: All implementations adjusted. * inf-ptrace.c: All implementations adjusted. * inf-ptrace.h: All implementations adjusted. * linux-nat.c: All implementations adjusted. * linux-nat.h: All implementations adjusted. * mips-linux-nat.c: All implementations adjusted. * nto-procfs.c: All implementations adjusted. * ppc-linux-nat.c: All implementations adjusted. * procfs.c: All implementations adjusted. * ravenscar-thread.c: All implementations adjusted. * record-btrace.c: All implementations adjusted. * record-full.c: All implementations adjusted. * remote-sim.c: All implementations adjusted. * remote.c: All implementations adjusted. * s390-linux-nat.c: All implementations adjusted. * sol-thread.c: All implementations adjusted. * spu-multiarch.c: All implementations adjusted. * target-delegates.c: All implementations adjusted. * target.c: All implementations adjusted. * target.h: All implementations adjusted. * tracefile-tfile.c: All implementations adjusted. * tracefile.c: All implementations adjusted. * tracefile.h: All implementations adjusted. * windows-nat.c: All implementations adjusted. * x86-linux-nat.h: All implementations adjusted. * x86-nat.h: All implementations adjusted. --- gdb/ChangeLog | 64 +++++++ gdb/aarch64-linux-nat.c | 20 +- gdb/aix-thread.c | 4 +- gdb/amd64-fbsd-nat.c | 6 +- gdb/arm-linux-nat.c | 20 +- gdb/breakpoint.c | 2 +- gdb/bsd-kvm.c | 12 +- gdb/bsd-uthread.c | 6 +- gdb/corelow.c | 18 +- gdb/ctf.c | 8 +- gdb/darwin-nat.c | 8 +- gdb/darwin-nat.h | 4 +- gdb/exec.c | 4 +- gdb/fbsd-nat.c | 16 +- gdb/fbsd-nat.h | 6 +- gdb/gnu-nat.c | 2 +- gdb/gnu-nat.h | 2 +- gdb/go32-nat.c | 4 +- gdb/i386-fbsd-nat.c | 6 +- gdb/ia64-linux-nat.c | 16 +- gdb/inf-child.c | 24 +-- gdb/inf-child.h | 22 +-- gdb/inf-ptrace.c | 2 +- gdb/inf-ptrace.h | 2 +- gdb/linux-nat.c | 30 +-- gdb/linux-nat.h | 36 ++-- gdb/mips-linux-nat.c | 16 +- gdb/nto-procfs.c | 17 +- gdb/ppc-linux-nat.c | 24 +-- gdb/procfs.c | 22 +-- gdb/ravenscar-thread.c | 40 ++-- gdb/record-btrace.c | 42 ++--- gdb/record-full.c | 50 ++--- gdb/remote-sim.c | 32 ++-- gdb/remote.c | 166 ++++++++--------- gdb/s390-linux-nat.c | 15 +- gdb/sol-thread.c | 10 +- gdb/spu-multiarch.c | 3 +- gdb/target-delegates.c | 486 ++++++++++++++++++++++++------------------------ gdb/target.c | 4 +- gdb/target.h | 152 +++++++-------- gdb/tracefile-tfile.c | 8 +- gdb/tracefile.c | 10 +- gdb/tracefile.h | 10 +- gdb/windows-nat.c | 15 +- gdb/x86-linux-nat.h | 8 +- gdb/x86-nat.h | 6 +- 47 files changed, 772 insertions(+), 708 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d17e2f6..5a83da0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,69 @@ 2018-05-02 Pedro Alves + * target.h (target_ops) + : Adjust to return bool. + * aarch64-linux-nat.c: All implementations adjusted. + * aix-thread.c: All implementations adjusted. + * arm-linux-nat.c: All implementations adjusted. + * breakpoint.c: All implementations adjusted. + * bsd-kvm.c: All implementations adjusted. + * bsd-uthread.c: All implementations adjusted. + * corelow.c: All implementations adjusted. + * ctf.c: All implementations adjusted. + * darwin-nat.c: All implementations adjusted. + * darwin-nat.h: All implementations adjusted. + * exec.c: All implementations adjusted. + * fbsd-nat.c: All implementations adjusted. + * fbsd-nat.h: All implementations adjusted. + * gnu-nat.c: All implementations adjusted. + * gnu-nat.h: All implementations adjusted. + * go32-nat.c: All implementations adjusted. + * ia64-linux-nat.c: All implementations adjusted. + * inf-child.c: All implementations adjusted. + * inf-child.h: All implementations adjusted. + * inf-ptrace.c: All implementations adjusted. + * inf-ptrace.h: All implementations adjusted. + * linux-nat.c: All implementations adjusted. + * linux-nat.h: All implementations adjusted. + * mips-linux-nat.c: All implementations adjusted. + * nto-procfs.c: All implementations adjusted. + * ppc-linux-nat.c: All implementations adjusted. + * procfs.c: All implementations adjusted. + * ravenscar-thread.c: All implementations adjusted. + * record-btrace.c: All implementations adjusted. + * record-full.c: All implementations adjusted. + * remote-sim.c: All implementations adjusted. + * remote.c: All implementations adjusted. + * s390-linux-nat.c: All implementations adjusted. + * sol-thread.c: All implementations adjusted. + * spu-multiarch.c: All implementations adjusted. + * target-delegates.c: All implementations adjusted. + * target.c: All implementations adjusted. + * target.h: All implementations adjusted. + * tracefile-tfile.c: All implementations adjusted. + * tracefile.c: All implementations adjusted. + * tracefile.h: All implementations adjusted. + * windows-nat.c: All implementations adjusted. + * x86-linux-nat.h: All implementations adjusted. + * x86-nat.h: All implementations adjusted. + +2018-05-02 Pedro Alves + * make-target-delegates (scan_target_h): Don't trim lines here. Replace sequences of tabs and/or whitespace with a single whitespace. diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 63276ec..86b4cf1 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -67,9 +67,9 @@ public: struct expression *) override; int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; - int stopped_by_watchpoint () override; - int stopped_data_address (CORE_ADDR *) override; - int watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; + bool stopped_by_watchpoint () override; + bool stopped_data_address (CORE_ADDR *) override; + bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; int can_do_single_step () override; @@ -733,7 +733,7 @@ aarch64_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) /* Implement the "stopped_data_address" target_ops method. */ -int +bool aarch64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) { siginfo_t siginfo; @@ -741,12 +741,12 @@ aarch64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) struct aarch64_debug_reg_state *state; if (!linux_nat_get_siginfo (inferior_ptid, &siginfo)) - return 0; + return false; /* This must be a hardware breakpoint. */ if (siginfo.si_signo != SIGTRAP || (siginfo.si_code & 0xffff) != TRAP_HWBKPT) - return 0; + return false; /* Check if the address matches any watched address. */ state = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid)); @@ -762,16 +762,16 @@ aarch64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) && addr_trap < addr_watch + len) { *addr_p = addr_trap; - return 1; + return true; } } - return 0; + return false; } /* Implement the "stopped_by_watchpoint" target_ops method. */ -int +bool aarch64_linux_nat_target::stopped_by_watchpoint () { CORE_ADDR addr; @@ -781,7 +781,7 @@ aarch64_linux_nat_target::stopped_by_watchpoint () /* Implement the "watchpoint_addr_within_range" target_ops method. */ -int +bool aarch64_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start, int length) { diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 3727336f..410fb55 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -137,7 +137,7 @@ public: void mourn_inferior () override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const char *pid_to_str (ptid_t) override; @@ -1762,7 +1762,7 @@ aix_thread_target::mourn_inferior () /* Return whether thread PID is still valid. */ -int +bool aix_thread_target::thread_alive (ptid_t ptid) { struct target_ops *beneath = find_target_beneath (this); diff --git a/gdb/amd64-fbsd-nat.c b/gdb/amd64-fbsd-nat.c index 57e6ff2..fbec9b1 100644 --- a/gdb/amd64-fbsd-nat.c +++ b/gdb/amd64-fbsd-nat.c @@ -45,7 +45,7 @@ public: const struct target_desc *read_description () override; #if defined(HAVE_PT_GETDBREGS) && defined(USE_SIGTRAP_SIGINFO) - int supports_stopped_by_hw_breakpoint () override; + bool supports_stopped_by_hw_breakpoint () override; #endif }; @@ -202,10 +202,10 @@ amd64_fbsd_nat_target::read_description () #if defined(HAVE_PT_GETDBREGS) && defined(USE_SIGTRAP_SIGINFO) /* Implement the supports_stopped_by_hw_breakpoints method. */ -int +bool amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint () { - return 1; + return true; } #endif diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 4b528d7..91a7049 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -87,11 +87,11 @@ public: int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; - int stopped_by_watchpoint () override; + bool stopped_by_watchpoint () override; - int stopped_data_address (CORE_ADDR *) override; + bool stopped_data_address (CORE_ADDR *) override; - int watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; + bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; const struct target_desc *read_description () override; }; @@ -1162,19 +1162,19 @@ arm_linux_nat_target::remove_watchpoint (CORE_ADDR addr, } /* What was the data address the target was stopped on accessing. */ -int +bool arm_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) { siginfo_t siginfo; int slot; if (!linux_nat_get_siginfo (inferior_ptid, &siginfo)) - return 0; + return false; /* This must be a hardware breakpoint. */ if (siginfo.si_signo != SIGTRAP || (siginfo.si_code & 0xffff) != 0x0004 /* TRAP_HWBKPT */) - return 0; + return false; /* We must be able to set hardware watchpoints. */ if (arm_linux_get_hw_watchpoint_count () == 0) @@ -1185,21 +1185,21 @@ arm_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) /* If we are in a positive slot then we're looking at a breakpoint and not a watchpoint. */ if (slot >= 0) - return 0; + return false; *addr_p = (CORE_ADDR) (uintptr_t) siginfo.si_addr; - return 1; + return true; } /* Has the target been stopped by hitting a watchpoint? */ -int +bool arm_linux_nat_target::stopped_by_watchpoint () { CORE_ADDR addr; return stopped_data_address (&addr); } -int +bool arm_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start, int length) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index f123357..779240b 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4733,7 +4733,7 @@ bpstats::bpstats () int watchpoints_triggered (struct target_waitstatus *ws) { - int stopped_by_watchpoint = target_stopped_by_watchpoint (); + bool stopped_by_watchpoint = target_stopped_by_watchpoint (); CORE_ADDR addr; struct breakpoint *b; diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c index 271bc64..af182e2 100644 --- a/gdb/bsd-kvm.c +++ b/gdb/bsd-kvm.c @@ -93,12 +93,12 @@ Optionally specify the filename of a core dump."); ULONGEST *xfered_len) override; void files_info () override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const char *pid_to_str (ptid_t) override; - int has_memory () override { return 1; } - int has_stack () override { return 1; } - int has_registers () override { return 1; } + bool has_memory () override { return true; } + bool has_stack () override { return true; } + bool has_registers () override { return true; } }; /* Target ops for libkvm interface. */ @@ -364,10 +364,10 @@ bsd_kvm_pcb_cmd (const char *arg, int fromtty) print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1); } -int +bool bsd_kvm_target::thread_alive (ptid_t ptid) { - return 1; + return true; } const char * diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 19d49c7..efcec1e 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -57,7 +57,7 @@ struct bsd_uthread_target final : public target_ops ptid_t wait (ptid_t, struct target_waitstatus *, int) override; void resume (ptid_t, int, enum gdb_signal) override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; void update_thread_list () override; @@ -437,7 +437,7 @@ bsd_uthread_target::resume (ptid_t ptid, int step, enum gdb_signal sig) beneath->resume (ptid, step, sig); } -int +bool bsd_uthread_target::thread_alive (ptid_t ptid) { enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); @@ -453,7 +453,7 @@ bsd_uthread_target::thread_alive (ptid_t ptid) state = read_memory_unsigned_integer (addr + offset, 4, byte_order); if (state == BSD_UTHREAD_PS_DEAD) - return 0; + return false; } return beneath->thread_alive (ptid); diff --git a/gdb/corelow.c b/gdb/corelow.c index f7202f7..e7d9a7e 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -83,16 +83,16 @@ Use a core file as a target. Specify the filename of the core file."); ULONGEST *xfered_len) override; void files_info () override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const struct target_desc *read_description () override; const char *pid_to_str (ptid_t) override; const char *thread_name (struct thread_info *) override; - int has_memory () override; - int has_stack () override; - int has_registers () override; + bool has_memory () override; + bool has_stack () override; + bool has_registers () override; bool info_proc (const char *, enum info_proc_what) override; }; @@ -922,10 +922,10 @@ core_target::xfer_partial (enum target_object object, const char *annex, to appear in an "info thread" command, which is quite a useful behaviour. */ -int +bool core_target::thread_alive (ptid_t ptid) { - return 1; + return true; } /* Ask the current architecture what it knows about this core file. @@ -989,19 +989,19 @@ core_target::thread_name (struct thread_info *thr) return NULL; } -int +bool core_target::has_memory () { return (core_bfd != NULL); } -int +bool core_target::has_stack () { return (core_bfd != NULL); } -int +bool core_target::has_registers () { return (core_bfd != NULL); diff --git a/gdb/ctf.c b/gdb/ctf.c index b09cebb..90d6f6c 100644 --- a/gdb/ctf.c +++ b/gdb/ctf.c @@ -62,7 +62,7 @@ Specify the filename of the CTF directory."); void files_info () override; int trace_find (enum trace_find_type type, int num, CORE_ADDR addr1, CORE_ADDR addr2, int *tpp) override; - int get_trace_state_variable_value (int tsv, LONGEST *val) override; + bool get_trace_state_variable_value (int tsv, LONGEST *val) override; traceframe_info_up traceframe_info () override; }; @@ -1430,11 +1430,11 @@ ctf_target::xfer_partial (enum target_object object, trace variable is found, set the value of it to *VAL and return true, otherwise return false. */ -int +bool ctf_target::get_trace_state_variable_value (int tsvnum, LONGEST *val) { struct bt_iter_pos *pos; - int found = 0; + bool found = false; gdb_assert (ctf_iter != NULL); /* Save the current position. */ @@ -1465,7 +1465,7 @@ ctf_target::get_trace_state_variable_value (int tsvnum, LONGEST *val) def = bt_ctf_get_field (event, scope, "val"); *val = bt_ctf_get_uint64 (def); - found = 1; + found = true; } } diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index dbcf77d..0b1a491 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -1959,10 +1959,10 @@ darwin_nat_target::pid_to_str (ptid_t ptid) return normal_pid_to_str (ptid); } -int +bool darwin_nat_target::thread_alive (ptid_t ptid) { - return 1; + return true; } /* If RDADDR is not NULL, read inferior task's LEN bytes from ADDR and @@ -2306,10 +2306,10 @@ darwin_nat_target::get_ada_task_ptid (long lwp, long thread) return null_ptid; } -int +bool darwin_nat_target::supports_multi_process () { - return 1; + return true; } void diff --git a/gdb/darwin-nat.h b/gdb/darwin-nat.h index d4a06d9..9d45bda 100644 --- a/gdb/darwin-nat.h +++ b/gdb/darwin-nat.h @@ -43,7 +43,7 @@ class darwin_nat_target : public inf_child_target void resume (ptid_t, int , enum gdb_signal) override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const char *pid_to_str (ptid_t) override; @@ -56,7 +56,7 @@ class darwin_nat_target : public inf_child_target ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) override; - int supports_multi_process () override; + bool supports_multi_process () override; ptid_t get_ada_task_ptid (long lwp, long thread) override; }; diff --git a/gdb/exec.c b/gdb/exec.c index 9b00c2e..b1c4ca1 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -80,7 +80,7 @@ Specify the filename of the executable file."); struct target_section_table *get_section_table () override; void files_info () override; - int has_memory () override; + bool has_memory () override; char *make_corefile_notes (bfd *, int *) override; int find_memory_regions (find_memory_region_ftype func, void *data) override; }; @@ -1031,7 +1031,7 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address) } } -int +bool exec_target::has_memory () { /* We can provide memory if we have any file/target sections to read diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 08976da..069e1e4 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -807,7 +807,7 @@ show_fbsd_nat_debug (struct ui_file *file, int from_tty, /* Return true if PTID is still active in the inferior. */ -int +bool fbsd_nat_target::thread_alive (ptid_t ptid) { if (ptid_lwp_p (ptid)) @@ -816,14 +816,14 @@ fbsd_nat_target::thread_alive (ptid_t ptid) if (ptrace (PT_LWPINFO, ptid_get_lwp (ptid), (caddr_t) &pl, sizeof pl) == -1) - return 0; + return false; #ifdef PL_FLAG_EXITED if (pl.pl_flags & PL_FLAG_EXITED) - return 0; + return false; #endif } - return 1; + return true; } /* Convert PTID to a string. Returns the string in a static @@ -1452,14 +1452,14 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, #ifdef USE_SIGTRAP_SIGINFO /* Implement the "stopped_by_sw_breakpoint" target_ops method. */ -int +bool fbsd_nat_target::stopped_by_sw_breakpoint () { struct ptrace_lwpinfo pl; if (ptrace (PT_LWPINFO, get_ptrace_pid (inferior_ptid), (caddr_t) &pl, sizeof pl) == -1) - return 0; + return false; return ((pl.pl_flags & PL_FLAG_SI) && pl.pl_siginfo.si_signo == SIGTRAP @@ -1469,10 +1469,10 @@ fbsd_nat_target::stopped_by_sw_breakpoint () /* Implement the "supports_stopped_by_sw_breakpoint" target_ops method. */ -int +bool fbsd_nat_target::supports_stopped_by_sw_breakpoint () { - return 1; + return true; } #endif diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h index 7792d45..8c90dd0 100644 --- a/gdb/fbsd-nat.h +++ b/gdb/fbsd-nat.h @@ -51,7 +51,7 @@ public: #endif #ifdef PT_LWPINFO - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const char *pid_to_str (ptid_t) override; #ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME @@ -71,8 +71,8 @@ public: void post_attach (int) override; #ifdef USE_SIGTRAP_SIGINFO - int supports_stopped_by_sw_breakpoint () override; - int stopped_by_sw_breakpoint () override; + bool supports_stopped_by_sw_breakpoint () override; + bool stopped_by_sw_breakpoint () override; #endif #ifdef TDP_RFPPWAIT diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index 89df55f..c7a4040 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2288,7 +2288,7 @@ gnu_nat_target::stop (ptid_t ptid) error (_("stop target function not implemented")); } -int +bool gnu_nat_target::thread_alive (ptid_t ptid) { inf_update_procs (gnu_current_inf); diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h index 4189eaf..f8ec692 100644 --- a/gdb/gnu-nat.h +++ b/gdb/gnu-nat.h @@ -130,7 +130,7 @@ struct gnu_nat_target : public inf_child_target void create_inferior (const char *, const std::string &, char **, int) override; void mourn_inferior () override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const char *pid_to_str (ptid_t) override; void stop (ptid_t) override; }; diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 1bb3330..32699ac 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -375,7 +375,7 @@ struct go32_nat_target final : public x86_nat_target void mourn_inferior () override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const char *pid_to_str (ptid_t) override; }; @@ -987,7 +987,7 @@ go32_nat_target::pass_ctrlc () { } -int +bool go32_nat_target::thread_alive (ptid_t ptid) { return !ptid_equal (ptid, null_ptid); diff --git a/gdb/i386-fbsd-nat.c b/gdb/i386-fbsd-nat.c index a5b20c2..f69dc60 100644 --- a/gdb/i386-fbsd-nat.c +++ b/gdb/i386-fbsd-nat.c @@ -46,7 +46,7 @@ public: void resume (ptid_t, int, enum gdb_signal) override; #if defined(HAVE_PT_GETDBREGS) && defined(USE_SIGTRAP_SIGINFO) - int supports_stopped_by_hw_breakpoint () override; + bool supports_stopped_by_hw_breakpoint () override; #endif }; @@ -167,10 +167,10 @@ i386_fbsd_nat_target::read_description () #if defined(HAVE_PT_GETDBREGS) && defined(USE_SIGTRAP_SIGINFO) /* Implement the supports_stopped_by_hw_breakpoints method. */ -int +bool i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint () { - return 1; + return true; } #endif diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index a11cb2c..9f74bb7 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -70,11 +70,11 @@ public: has determined that a hardware watchpoint has indeed been hit. The CPU will then be able to execute one instruction without triggering a watchpoint. */ - int have_steppable_watchpoint () { return 1; } + bool have_steppable_watchpoint () { return 1; } int can_use_hw_breakpoint (enum bptype, int, int) override; - int stopped_by_watchpoint () override; - int stopped_data_address (CORE_ADDR *) override; + bool stopped_by_watchpoint () override; + bool stopped_data_address (CORE_ADDR *) override; int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, @@ -688,7 +688,7 @@ ia64_linux_new_thread (struct lwp_info *lp) enable_watchpoints_in_psr (lp->ptid); } -int +bool ia64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) { CORE_ADDR psr; @@ -696,11 +696,11 @@ ia64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) struct regcache *regcache = get_current_regcache (); if (!linux_nat_get_siginfo (inferior_ptid, &siginfo)) - return 0; + return false; if (siginfo.si_signo != SIGTRAP || (siginfo.si_code & 0xffff) != 0x0004 /* TRAP_HWBKPT */) - return 0; + return false; regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr); psr |= IA64_PSR_DD; /* Set the dd bit - this will disable the watchpoint @@ -708,10 +708,10 @@ ia64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) regcache_cooked_write_unsigned (regcache, IA64_PSR_REGNUM, psr); *addr_p = (CORE_ADDR) siginfo.si_addr; - return 1; + return true; } -int +bool ia64_linux_nat_target::stopped_by_watchpoint () { CORE_ADDR addr; diff --git a/gdb/inf-child.c b/gdb/inf-child.c index 7b2f2a2..8e5ebfa 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -200,10 +200,10 @@ inf_child_target::post_startup_inferior (ptid_t ptid) operation by a debugger. */ } -int +bool inf_child_target::can_run () { - return 1; + return true; } bool @@ -226,31 +226,31 @@ inf_child_target::pid_to_exec_file (int pid) return NULL; } -int +bool inf_child_target::has_all_memory () { return default_child_has_all_memory (); } -int +bool inf_child_target::has_memory () { return default_child_has_memory (); } -int +bool inf_child_target::has_stack () { return default_child_has_stack (); } -int +bool inf_child_target::has_registers () { return default_child_has_registers (); } -int +bool inf_child_target::has_execution (ptid_t ptid) { return default_child_has_execution (ptid); @@ -404,19 +404,19 @@ inf_child_target::fileio_readlink (struct inferior *inf, const char *filename, #endif } -int -inf_child_target::use_agent (int use) +bool +inf_child_target::use_agent (bool use) { if (agent_loaded_p ()) { ::use_agent = use; - return 1; + return true; } else - return 0; + return false; } -int +bool inf_child_target::can_use_agent () { return agent_loaded_p (); diff --git a/gdb/inf-child.h b/gdb/inf-child.h index 99173ed..b754a95 100644 --- a/gdb/inf-child.h +++ b/gdb/inf-child.h @@ -65,7 +65,7 @@ public: void mourn_inferior () override; - int can_run () override; + bool can_run () override; bool can_create_inferior () override; void create_inferior (const char *, const std::string &, @@ -78,17 +78,17 @@ public: /* We must default these because they must be implemented by any target that can run. */ - int can_async_p () override { return 0; } - int supports_non_stop () override { return 0; } - int supports_disable_randomization () override { return 0; } + bool can_async_p () override { return false; } + bool supports_non_stop () override { return false; } + bool supports_disable_randomization () override { return false; } char *pid_to_exec_file (int pid) override; - int has_all_memory () override; - int has_memory () override; - int has_stack () override; - int has_registers () override; - int has_execution (ptid_t) override; + bool has_all_memory () override; + bool has_memory () override; + bool has_stack () override; + bool has_registers () override; + bool has_execution (ptid_t) override; int fileio_open (struct inferior *inf, const char *filename, int flags, int mode, int warn_if_slow, @@ -105,9 +105,9 @@ public: gdb::optional fileio_readlink (struct inferior *inf, const char *filename, int *target_errno) override; - int use_agent (int use) override; + bool use_agent (bool use) override; - int can_use_agent () override; + bool can_use_agent () override; protected: /* Unpush the target if it wasn't explicitly open with "target native" diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index 16075a9..945af83 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -610,7 +610,7 @@ inf_ptrace_target::xfer_partial (enum target_object object, /* Return non-zero if the thread specified by PTID is alive. */ -int +bool inf_ptrace_target::thread_alive (ptid_t ptid) { /* ??? Is kill the right way to do this? */ diff --git a/gdb/inf-ptrace.h b/gdb/inf-ptrace.h index bd9b609..de284f9 100644 --- a/gdb/inf-ptrace.h +++ b/gdb/inf-ptrace.h @@ -57,7 +57,7 @@ struct inf_ptrace_target : public inf_child_target void mourn_inferior () override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const char *pid_to_str (ptid_t) override; diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index bfc2e46..701a7db 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -2474,7 +2474,7 @@ check_stopped_by_watchpoint (struct lwp_info *lp) /* Returns true if the LWP had stopped for a watchpoint. */ -int +bool linux_nat_target::stopped_by_watchpoint () { struct lwp_info *lp = find_lwp_pid (inferior_ptid); @@ -2484,7 +2484,7 @@ linux_nat_target::stopped_by_watchpoint () return lp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT; } -int +bool linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) { struct lwp_info *lp = find_lwp_pid (inferior_ptid); @@ -2835,7 +2835,7 @@ save_stop_reason (struct lwp_info *lp) /* Returns true if the LWP had stopped for a software breakpoint. */ -int +bool linux_nat_target::stopped_by_sw_breakpoint () { struct lwp_info *lp = find_lwp_pid (inferior_ptid); @@ -2847,7 +2847,7 @@ linux_nat_target::stopped_by_sw_breakpoint () /* Implement the supports_stopped_by_sw_breakpoint method. */ -int +bool linux_nat_target::supports_stopped_by_sw_breakpoint () { return USE_SIGTRAP_SIGINFO; @@ -2856,7 +2856,7 @@ linux_nat_target::supports_stopped_by_sw_breakpoint () /* Returns true if the LWP had stopped for a hardware breakpoint/watchpoint. */ -int +bool linux_nat_target::stopped_by_hw_breakpoint () { struct lwp_info *lp = find_lwp_pid (inferior_ptid); @@ -2868,7 +2868,7 @@ linux_nat_target::stopped_by_hw_breakpoint () /* Implement the supports_stopped_by_hw_breakpoint method. */ -int +bool linux_nat_target::supports_stopped_by_hw_breakpoint () { return USE_SIGTRAP_SIGINFO; @@ -3940,7 +3940,7 @@ linux_nat_target::xfer_partial (enum target_object object, offset, len, xfered_len); } -int +bool linux_nat_target::thread_alive (ptid_t ptid) { /* As long as a PTID is in lwp list, consider it alive. */ @@ -4322,7 +4322,7 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid) /* target_is_async_p implementation. */ -int +bool linux_nat_target::is_async_p () { return linux_is_async_p (); @@ -4330,7 +4330,7 @@ linux_nat_target::is_async_p () /* target_can_async_p implementation. */ -int +bool linux_nat_target::can_async_p () { /* We're always async, unless the user explicitly prevented it with the @@ -4338,7 +4338,7 @@ linux_nat_target::can_async_p () return target_async_permitted; } -int +bool linux_nat_target::supports_non_stop () { return 1; @@ -4346,7 +4346,7 @@ linux_nat_target::supports_non_stop () /* to_always_non_stop_p implementation. */ -int +bool linux_nat_target::always_non_stop_p () { return 1; @@ -4357,13 +4357,13 @@ linux_nat_target::always_non_stop_p () int linux_multi_process = 1; -int +bool linux_nat_target::supports_multi_process () { return linux_multi_process; } -int +bool linux_nat_target::supports_disable_randomization () { #ifdef HAVE_PERSONALITY @@ -4574,13 +4574,13 @@ linux_nat_target::core_of_thread (ptid_t ptid) /* Implementation of to_filesystem_is_local. */ -int +bool linux_nat_target::filesystem_is_local () { struct inferior *inf = current_inferior (); if (inf->fake_pid_p || inf->pid == 0) - return 1; + return true; return linux_ns_same (inf->pid, LINUX_NS_MNT); } diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h index da5357a..fbee35e 100644 --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -57,7 +57,7 @@ public: void kill () override; void mourn_inferior () override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; void update_thread_list () override; @@ -67,23 +67,23 @@ public: struct address_space *thread_address_space (ptid_t) override; - int stopped_by_watchpoint () override; + bool stopped_by_watchpoint () override; - int stopped_data_address (CORE_ADDR *) override; + bool stopped_data_address (CORE_ADDR *) override; - int stopped_by_sw_breakpoint () override; - int supports_stopped_by_sw_breakpoint () override; + bool stopped_by_sw_breakpoint () override; + bool supports_stopped_by_sw_breakpoint () override; - int stopped_by_hw_breakpoint () override; - int supports_stopped_by_hw_breakpoint () override; + bool stopped_by_hw_breakpoint () override; + bool supports_stopped_by_hw_breakpoint () override; void thread_events (int) override; - int can_async_p () override; - int is_async_p () override; + bool can_async_p () override; + bool is_async_p () override; - int supports_non_stop () override; - int always_non_stop_p () override; + bool supports_non_stop () override; + bool always_non_stop_p () override; void async (int) override; @@ -91,13 +91,13 @@ public: void stop (ptid_t) override; - int supports_multi_process () override; + bool supports_multi_process () override; - int supports_disable_randomization () override; + bool supports_disable_randomization () override; int core_of_thread (ptid_t ptid) override; - int filesystem_is_local () override; + bool filesystem_is_local () override; int fileio_open (struct inferior *inf, const char *filename, int flags, int mode, int warn_if_slow, @@ -140,11 +140,11 @@ public: virtual void low_resume (ptid_t ptid, int step, enum gdb_signal sig) { inf_ptrace_target::resume (ptid, step, sig); } - virtual int low_stopped_by_watchpoint () - { return 0; } + virtual bool low_stopped_by_watchpoint () + { return false; } - virtual int low_stopped_data_address (CORE_ADDR *addr_p) - { return 0; } + virtual bool low_stopped_data_address (CORE_ADDR *addr_p) + { return false; } }; /* The final/concrete instance. */ diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 39bd03a..325a056 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -59,9 +59,9 @@ public: int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; - int stopped_by_watchpoint () override; + bool stopped_by_watchpoint () override; - int stopped_data_address (CORE_ADDR *) override; + bool stopped_data_address (CORE_ADDR *) override; int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; @@ -572,7 +572,7 @@ mips_linux_nat_target::can_use_hw_breakpoint (enum bptype type, stopped by watchpoint. The watchhi R and W bits indicate the watch register triggered. */ -int +bool mips_linux_nat_target::stopped_by_watchpoint () { int n; @@ -581,27 +581,27 @@ mips_linux_nat_target::stopped_by_watchpoint () if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid), &watch_readback, &watch_readback_valid, 1)) - return 0; + return false; num_valid = mips_linux_watch_get_num_valid (&watch_readback); for (n = 0; n < MAX_DEBUG_REGISTER && n < num_valid; n++) if (mips_linux_watch_get_watchhi (&watch_readback, n) & (R_MASK | W_MASK)) - return 1; + return true; - return 0; + return false; } /* Target to_stopped_data_address implementation. Set the address where the watch triggered (if known). Return 1 if the address was known. */ -int +bool mips_linux_nat_target::stopped_data_address (CORE_ADDR *paddr) { /* On mips we don't know the low order 3 bits of the data address, so we must return false. */ - return 0; + return false; } /* Target to_region_ok_for_hw_watchpoint implementation. Return 1 if diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 1ca4bac..f3ba877 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -100,7 +100,7 @@ struct nto_procfs_target : public inf_child_target int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; - int stopped_by_watchpoint () override; + bool stopped_by_watchpoint () override; void kill () override; @@ -111,7 +111,7 @@ struct nto_procfs_target : public inf_child_target void pass_signals (int, unsigned char *) override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; void update_thread_list () override; @@ -297,8 +297,9 @@ procfs_set_thread (ptid_t ptid) devctl (ctl_fd, DCMD_PROC_CURTHREAD, &tid, sizeof (tid), 0); } -/* Return nonzero if the thread TH is still alive. */ -int +/* Return true if the thread TH is still alive. */ + +bool nto_procfs_target::thread_alive (ptid_t ptid) { pid_t tid; @@ -310,12 +311,12 @@ nto_procfs_target::thread_alive (ptid_t ptid) pid = ptid_get_pid (ptid); if (kill (pid, 0) == -1) - return 0; + return false; status.tid = tid; if ((err = devctl (ctl_fd, DCMD_PROC_TIDSTATUS, &status, sizeof (status), 0)) != EOK) - return 0; + return false; /* Thread is alive or dead but not yet joined, or dead and there is an alive (or dead unjoined) thread with @@ -1583,7 +1584,7 @@ procfs_hw_watchpoint (int addr, int len, enum target_hw_bp_type type) return 0; } -int +bool nto_procfs_target::can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) { @@ -1606,7 +1607,7 @@ nto_procfs_target::insert_hw_watchpoint (CORE_ADDR addr, int len, return procfs_hw_watchpoint (addr, len, type); } -int +bool nto_procfs_target::stopped_by_watchpoint () { /* NOTE: nto_stopped_by_watchpoint will be called ONLY while we are diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index c9f0f9d..7362bee 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -296,13 +296,13 @@ struct ppc_linux_nat_target final : public linux_nat_target int remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, enum target_hw_bp_type) override; - int stopped_by_watchpoint () override; + bool stopped_by_watchpoint () override; - int stopped_data_address (CORE_ADDR *) override; + bool stopped_data_address (CORE_ADDR *) override; - int watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; + bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; - int can_accel_watchpoint_condition (CORE_ADDR, int, int, struct expression *) + bool can_accel_watchpoint_condition (CORE_ADDR, int, int, struct expression *) override; int masked_watch_num_registers (CORE_ADDR, CORE_ADDR) override; @@ -1986,7 +1986,7 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond, /* Return non-zero if the target is capable of using hardware to evaluate the condition expression, thus only triggering the watchpoint when it is true. */ -int +bool ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, struct expression *cond) @@ -2222,17 +2222,17 @@ ppc_linux_thread_exit (struct thread_info *tp, int silent) xfree (t); } -int +bool ppc_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) { siginfo_t siginfo; if (!linux_nat_get_siginfo (inferior_ptid, &siginfo)) - return 0; + return false; if (siginfo.si_signo != SIGTRAP || (siginfo.si_code & 0xffff) != 0x0004 /* TRAP_HWBKPT */) - return 0; + return false; if (have_ptrace_hwdebug_interface ()) { @@ -2253,22 +2253,22 @@ ppc_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) if (hw_breaks[i].hw_break && hw_breaks[i].slot == slot && hw_breaks[i].hw_break->trigger_type == PPC_BREAKPOINT_TRIGGER_EXECUTE) - return 0; + return false; } } *addr_p = (CORE_ADDR) (uintptr_t) siginfo.si_addr; - return 1; + return true; } -int +bool ppc_linux_nat_target::stopped_by_watchpoint () { CORE_ADDR addr; return stopped_data_address (&addr); } -int +bool ppc_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start, int length) diff --git a/gdb/procfs.c b/gdb/procfs.c index abae358..749b2b4 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -124,7 +124,7 @@ public: void update_thread_list () override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const char *pid_to_str (ptid_t) override; @@ -145,7 +145,7 @@ public: override; #endif - int stopped_by_watchpoint () override; + bool stopped_by_watchpoint () override; int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; @@ -156,7 +156,7 @@ public: int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; int can_use_hw_breakpoint (enum bptype, int, int) override; - int stopped_data_address (CORE_ADDR *) override; + bool stopped_data_address (CORE_ADDR *) override; }; static procfs_target the_procfs_target; @@ -3179,7 +3179,7 @@ procfs_target::update_thread_list () really seem to be doing his job. Got to investigate how to tell when a thread is really gone. */ -int +bool procfs_target::thread_alive (ptid_t ptid) { int proc, thread; @@ -3189,18 +3189,18 @@ procfs_target::thread_alive (ptid_t ptid) thread = ptid_get_lwp (ptid); /* If I don't know it, it ain't alive! */ if ((pi = find_procinfo (proc, thread)) == NULL) - return 0; + return false; /* If I can't get its status, it ain't alive! What's more, I need to forget about it! */ if (!proc_get_status (pi)) { destroy_procinfo (pi); - return 0; + return false; } /* I couldn't have got its status if it weren't alive, so it's alive. */ - return 1; + return true; } /* Convert PTID to a string. Returns the string in a static @@ -3301,7 +3301,7 @@ procfs_target::can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) /* Returns non-zero if process is stopped on a hardware watchpoint fault, else returns zero. */ -int +bool procfs_target::stopped_by_watchpoint () { procinfo *pi; @@ -3313,10 +3313,10 @@ procfs_target::stopped_by_watchpoint () if (proc_why (pi) == PR_FAULTED) { if (proc_what (pi) == FLTWATCH) - return 1; + return true; } } - return 0; + return false; } /* Returns 1 if the OS knows the position of the triggered watchpoint, @@ -3325,7 +3325,7 @@ procfs_target::stopped_by_watchpoint () procfs_stopped_by_watchpoint returned 1, thus no further checks are done. The function also assumes that ADDR is not NULL. */ -int +bool procfs_target::stopped_data_address (CORE_ADDR *addr) { procinfo *pi; diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index e850ef7..03cbe3d 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -95,15 +95,15 @@ struct ravenscar_thread_target final : public target_ops void prepare_to_store (struct regcache *) override; - int stopped_by_sw_breakpoint () override; + bool stopped_by_sw_breakpoint () override; - int stopped_by_hw_breakpoint () override; + bool stopped_by_hw_breakpoint () override; - int stopped_by_watchpoint () override; + bool stopped_by_watchpoint () override; - int stopped_data_address (CORE_ADDR *) override; + bool stopped_data_address (CORE_ADDR *) override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; int core_of_thread (ptid_t ptid) override; @@ -117,11 +117,11 @@ struct ravenscar_thread_target final : public target_ops void mourn_inferior () override; - int has_all_memory () override { return default_child_has_all_memory (); } - int has_memory () override { return default_child_has_memory (); } - int has_stack () override { return default_child_has_stack (); } - int has_registers () override { return default_child_has_registers (); } - int has_execution (ptid_t ptid) override + bool has_all_memory () override { return default_child_has_all_memory (); } + bool has_memory () override { return default_child_has_memory (); } + bool has_stack () override { return default_child_has_stack (); } + bool has_registers () override { return default_child_has_registers (); } + bool has_execution (ptid_t ptid) override { return default_child_has_execution (ptid); } }; @@ -396,11 +396,11 @@ ravenscar_thread_target::extra_thread_info (thread_info *tp) return "Ravenscar task"; } -int +bool ravenscar_thread_target::thread_alive (ptid_t ptid) { /* Ravenscar tasks are non-terminating. */ - return 1; + return true; } const char * @@ -475,12 +475,12 @@ ravenscar_thread_target::prepare_to_store (struct regcache *regcache) /* Implement the to_stopped_by_sw_breakpoint target_ops "method". */ -int +bool ravenscar_thread_target::stopped_by_sw_breakpoint () { ptid_t saved_ptid = inferior_ptid; struct target_ops *beneath = find_target_beneath (this); - int result; + bool result; inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid); result = beneath->stopped_by_sw_breakpoint (); @@ -490,12 +490,12 @@ ravenscar_thread_target::stopped_by_sw_breakpoint () /* Implement the to_stopped_by_hw_breakpoint target_ops "method". */ -int +bool ravenscar_thread_target::stopped_by_hw_breakpoint () { ptid_t saved_ptid = inferior_ptid; struct target_ops *beneath = find_target_beneath (this); - int result; + bool result; inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid); result = beneath->stopped_by_hw_breakpoint (); @@ -505,12 +505,12 @@ ravenscar_thread_target::stopped_by_hw_breakpoint () /* Implement the to_stopped_by_watchpoint target_ops "method". */ -int +bool ravenscar_thread_target::stopped_by_watchpoint () { ptid_t saved_ptid = inferior_ptid; struct target_ops *beneath = find_target_beneath (this); - int result; + bool result; inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid); result = beneath->stopped_by_watchpoint (); @@ -520,12 +520,12 @@ ravenscar_thread_target::stopped_by_watchpoint () /* Implement the to_stopped_data_address target_ops "method". */ -int +bool ravenscar_thread_target::stopped_data_address (CORE_ADDR *addr_p) { ptid_t saved_ptid = inferior_ptid; struct target_ops *beneath = find_target_beneath (this); - int result; + bool result; inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid); result = beneath->stopped_data_address (addr_p); diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 1f7821e..6362124 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -89,8 +89,8 @@ public: void call_history_range (ULONGEST begin, ULONGEST end, record_print_flags flags) override; - int record_is_replaying (ptid_t ptid) override; - int record_will_replay (ptid_t ptid, int dir) override; + bool record_is_replaying (ptid_t ptid) override; + bool record_will_replay (ptid_t ptid, int dir) override; void record_stop_replaying () override; enum target_xfer_status xfer_partial (enum target_object object, @@ -120,18 +120,18 @@ public: void stop (ptid_t) override; void update_thread_list () override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; void goto_record_begin () override; void goto_record_end () override; void goto_record (ULONGEST insn) override; - int can_execute_reverse () override; + bool can_execute_reverse () override; - int stopped_by_sw_breakpoint () override; - int supports_stopped_by_sw_breakpoint () override; + bool stopped_by_sw_breakpoint () override; + bool supports_stopped_by_sw_breakpoint () override; - int stopped_by_hw_breakpoint () override; - int supports_stopped_by_hw_breakpoint () override; + bool stopped_by_hw_breakpoint () override; + bool supports_stopped_by_hw_breakpoint () override; enum exec_direction_kind execution_direction () override; void prepare_to_generate_core () override; @@ -1396,21 +1396,21 @@ record_btrace_target::record_method (ptid_t ptid) /* The record_is_replaying method of target record-btrace. */ -int +bool record_btrace_target::record_is_replaying (ptid_t ptid) { struct thread_info *tp; ALL_NON_EXITED_THREADS (tp) if (ptid_match (tp->ptid, ptid) && btrace_is_replaying (tp)) - return 1; + return true; - return 0; + return false; } /* The record_will_replay method of target record-btrace. */ -int +bool record_btrace_target::record_will_replay (ptid_t ptid, int dir) { return dir == EXEC_REVERSE || record_is_replaying (ptid); @@ -2708,15 +2708,15 @@ record_btrace_target::stop (ptid_t ptid) /* The can_execute_reverse method of target record-btrace. */ -int +bool record_btrace_target::can_execute_reverse () { - return 1; + return true; } /* The stopped_by_sw_breakpoint method of target record-btrace. */ -int +bool record_btrace_target::stopped_by_sw_breakpoint () { if (record_is_replaying (minus_one_ptid)) @@ -2732,18 +2732,18 @@ record_btrace_target::stopped_by_sw_breakpoint () /* The supports_stopped_by_sw_breakpoint method of target record-btrace. */ -int +bool record_btrace_target::supports_stopped_by_sw_breakpoint () { if (record_is_replaying (minus_one_ptid)) - return 1; + return true; return this->beneath->supports_stopped_by_sw_breakpoint (); } /* The stopped_by_sw_breakpoint method of target record-btrace. */ -int +bool record_btrace_target::stopped_by_hw_breakpoint () { if (record_is_replaying (minus_one_ptid)) @@ -2759,11 +2759,11 @@ record_btrace_target::stopped_by_hw_breakpoint () /* The supports_stopped_by_hw_breakpoint method of target record-btrace. */ -int +bool record_btrace_target::supports_stopped_by_hw_breakpoint () { if (record_is_replaying (minus_one_ptid)) - return 1; + return true; return this->beneath->supports_stopped_by_hw_breakpoint (); } @@ -2783,7 +2783,7 @@ record_btrace_target::update_thread_list () /* The thread_alive method of target record-btrace. */ -int +bool record_btrace_target::thread_alive (ptid_t ptid) { /* We don't add or remove threads during replay. */ diff --git a/gdb/record-full.c b/gdb/record-full.c index de96574..58f4be4 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -227,16 +227,16 @@ public: void close () override; void async (int) override; ptid_t wait (ptid_t, struct target_waitstatus *, int) override; - int stopped_by_watchpoint () override; - int stopped_data_address (CORE_ADDR *) override; + bool stopped_by_watchpoint () override; + bool stopped_data_address (CORE_ADDR *) override; - int stopped_by_sw_breakpoint () override; - int supports_stopped_by_sw_breakpoint () override; + bool stopped_by_sw_breakpoint () override; + bool supports_stopped_by_sw_breakpoint () override; - int stopped_by_hw_breakpoint () override; - int supports_stopped_by_hw_breakpoint () override; + bool stopped_by_hw_breakpoint () override; + bool supports_stopped_by_hw_breakpoint () override; - int can_execute_reverse () override; + bool can_execute_reverse () override; /* Add bookmark target methods. */ gdb_byte *get_bookmark (const char *, int) override; @@ -247,8 +247,8 @@ public: void save_record (const char *filename) override; bool supports_delete_record () override; void delete_record () override; - int record_is_replaying (ptid_t ptid) override; - int record_will_replay (ptid_t ptid, int dir) override; + bool record_is_replaying (ptid_t ptid) override; + bool record_will_replay (ptid_t ptid, int dir) override; void record_stop_replaying () override; void goto_record_begin () override; void goto_record_end () override; @@ -309,7 +309,7 @@ public: struct bp_target_info *, enum remove_bp_reason) override; - int has_execution (ptid_t) override; + bool has_execution (ptid_t) override; }; static record_full_target record_full_ops; @@ -1463,7 +1463,7 @@ record_full_base_target::wait (ptid_t ptid, struct target_waitstatus *status, return return_ptid; } -int +bool record_full_base_target::stopped_by_watchpoint () { if (RECORD_FULL_IS_REPLAY) @@ -1472,18 +1472,18 @@ record_full_base_target::stopped_by_watchpoint () return beneath->stopped_by_watchpoint (); } -int +bool record_full_base_target::stopped_data_address (CORE_ADDR *addr_p) { if (RECORD_FULL_IS_REPLAY) - return 0; + return false; else return this->beneath->stopped_data_address (addr_p); } /* The stopped_by_sw_breakpoint method of target record-full. */ -int +bool record_full_base_target::stopped_by_sw_breakpoint () { return record_full_stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT; @@ -1492,15 +1492,15 @@ record_full_base_target::stopped_by_sw_breakpoint () /* The supports_stopped_by_sw_breakpoint method of target record-full. */ -int +bool record_full_base_target::supports_stopped_by_sw_breakpoint () { - return 1; + return true; } /* The stopped_by_hw_breakpoint method of target record-full. */ -int +bool record_full_base_target::stopped_by_hw_breakpoint () { return record_full_stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT; @@ -1509,10 +1509,10 @@ record_full_base_target::stopped_by_hw_breakpoint () /* The supports_stopped_by_sw_breakpoint method of target record-full. */ -int +bool record_full_base_target::supports_stopped_by_hw_breakpoint () { - return 1; + return true; } /* Record registers change (by user or by GDB) to list as an instruction. */ @@ -1834,10 +1834,10 @@ record_full_target::remove_breakpoint (struct gdbarch *gdbarch, /* "can_execute_reverse" method for process record target. */ -int +bool record_full_base_target::can_execute_reverse () { - return 1; + return true; } /* "get_bookmark" method for process record and prec over core. */ @@ -1962,7 +1962,7 @@ record_full_base_target::delete_record () /* The "record_is_replaying" target method. */ -int +bool record_full_base_target::record_is_replaying (ptid_t ptid) { return RECORD_FULL_IS_REPLAY; @@ -1970,7 +1970,7 @@ record_full_base_target::record_is_replaying (ptid_t ptid) /* The "record_will_replay" target method. */ -int +bool record_full_base_target::record_will_replay (ptid_t ptid, int dir) { /* We can currently only record when executing forwards. Should we be able @@ -2240,10 +2240,10 @@ record_full_core_target::remove_breakpoint (struct gdbarch *gdbarch, /* "has_execution" method for prec over corefile. */ -int +bool record_full_core_target::has_execution (ptid_t the_ptid) { - return 1; + return true; } /* Record log save-file format diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 0c58b85..bbbc02f 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -123,20 +123,20 @@ struct gdbsim_target final void interrupt () override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const char *pid_to_str (ptid_t) override; - int has_all_memory () override; - int has_memory () override; + bool has_all_memory () override; + bool has_memory () override; - int has_stack () override + bool has_stack () override { return default_child_has_stack (); } - int has_registers () override + bool has_registers () override { return default_child_has_registers (); } - int has_execution (ptid_t ptid) override + bool has_execution (ptid_t ptid) override { return default_child_has_execution (ptid); } }; @@ -1288,20 +1288,20 @@ sim_command_completer (struct cmd_list_element *ignore, /* Check to see if a thread is still alive. */ -int +bool gdbsim_target::thread_alive (ptid_t ptid) { struct sim_inferior_data *sim_data = get_sim_inferior_data_by_ptid (ptid, SIM_INSTANCE_NOT_NEEDED); if (sim_data == NULL) - return 0; + return false; if (ptid_equal (ptid, sim_data->remote_sim_ptid)) /* The simulators' task is always alive. */ - return 1; + return true; - return 0; + return false; } /* Convert a thread ID to a string. Returns the string in a static @@ -1315,28 +1315,28 @@ gdbsim_target::pid_to_str (ptid_t ptid) /* Simulator memory may be accessed after the program has been loaded. */ -int +bool gdbsim_target::has_all_memory () { struct sim_inferior_data *sim_data = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED); if (!sim_data->program_loaded) - return 0; + return false; - return 1; + return true; } -int +bool gdbsim_target::has_memory () { struct sim_inferior_data *sim_data = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED); if (!sim_data->program_loaded) - return 0; + return false; - return 1; + return true; } void diff --git a/gdb/remote.c b/gdb/remote.c index 1374fd3..09c23a3 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -125,18 +125,18 @@ Specify the serial device it is connected to\n\ enum remove_bp_reason) override; - int stopped_by_sw_breakpoint () override; - int supports_stopped_by_sw_breakpoint () override; + bool stopped_by_sw_breakpoint () override; + bool supports_stopped_by_sw_breakpoint () override; - int stopped_by_hw_breakpoint () override; + bool stopped_by_hw_breakpoint () override; - int supports_stopped_by_hw_breakpoint () override; + bool supports_stopped_by_hw_breakpoint () override; - int stopped_by_watchpoint () override; + bool stopped_by_watchpoint () override; - int stopped_data_address (CORE_ADDR *) override; + bool stopped_data_address (CORE_ADDR *) override; - int watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; + bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; int can_use_hw_breakpoint (enum bptype, int, int) override; @@ -165,7 +165,7 @@ Specify the serial device it is connected to\n\ void program_signals (int, unsigned char *) override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const char *thread_name (struct thread_info *) override; @@ -209,13 +209,13 @@ Specify the serial device it is connected to\n\ CORE_ADDR load_module_addr, CORE_ADDR offset) override; - int has_all_memory () override { return default_child_has_all_memory (); } - int has_memory () override { return default_child_has_memory (); } - int has_stack () override { return default_child_has_stack (); } - int has_registers () override { return default_child_has_registers (); } - int has_execution (ptid_t ptid) override { return default_child_has_execution (ptid); } + bool has_all_memory () override { return default_child_has_all_memory (); } + bool has_memory () override { return default_child_has_memory (); } + bool has_stack () override { return default_child_has_stack (); } + bool has_registers () override { return default_child_has_registers (); } + bool has_execution (ptid_t ptid) override { return default_child_has_execution (ptid); } - int can_execute_reverse () override; + bool can_execute_reverse () override; std::vector memory_map () override; @@ -229,9 +229,9 @@ Specify the serial device it is connected to\n\ const gdb_byte *pattern, ULONGEST pattern_len, CORE_ADDR *found_addrp) override; - int can_async_p () override; + bool can_async_p () override; - int is_async_p () override; + bool is_async_p () override; void async (int) override; @@ -243,13 +243,13 @@ Specify the serial device it is connected to\n\ void terminal_ours () override; - int supports_non_stop () override; + bool supports_non_stop () override; - int supports_multi_process () override; + bool supports_multi_process () override; - int supports_disable_randomization () override; + bool supports_disable_randomization () override; - int filesystem_is_local () override; + bool filesystem_is_local () override; int fileio_open (struct inferior *inf, const char *filename, @@ -275,19 +275,19 @@ Specify the serial device it is connected to\n\ const char *filename, int *target_errno) override; - int supports_enable_disable_tracepoint () override; + bool supports_enable_disable_tracepoint () override; - int supports_string_tracing () override; + bool supports_string_tracing () override; - int supports_evaluation_of_breakpoint_conditions () override; + bool supports_evaluation_of_breakpoint_conditions () override; - int can_run_breakpoint_commands () override; + bool can_run_breakpoint_commands () override; void trace_init () override; void download_tracepoint (struct bp_location *location) override; - int can_download_tracepoint () override; + bool can_download_tracepoint () override; void download_trace_state_variable (const trace_state_variable &tsv) override; @@ -309,7 +309,7 @@ Specify the serial device it is connected to\n\ int trace_find (enum trace_find_type type, int num, CORE_ADDR addr1, CORE_ADDR addr2, int *tpp) override; - int get_trace_state_variable_value (int tsv, LONGEST *val) override; + bool get_trace_state_variable_value (int tsv, LONGEST *val) override; int save_trace_data (const char *filename) override; @@ -327,8 +327,8 @@ Specify the serial device it is connected to\n\ void set_trace_buffer_size (LONGEST val) override; - int set_trace_notes (const char *user, const char *notes, - const char *stopnotes) override; + bool set_trace_notes (const char *user, const char *notes, + const char *stopnotes) override; int core_of_thread (ptid_t ptid) override; @@ -336,7 +336,7 @@ Specify the serial device it is connected to\n\ CORE_ADDR memaddr, ULONGEST size) override; - int get_tib_address (ptid_t ptid, CORE_ADDR *addr) override; + bool get_tib_address (ptid_t ptid, CORE_ADDR *addr) override; void set_permissions () override; @@ -349,8 +349,8 @@ Specify the serial device it is connected to\n\ traceframe_info_up traceframe_info () override; - int use_agent (int use) override; - int can_use_agent () override; + bool use_agent (bool use) override; + bool can_use_agent () override; struct btrace_target_info *enable_btrace (ptid_t ptid, const struct btrace_config *conf) override; @@ -364,7 +364,7 @@ Specify the serial device it is connected to\n\ enum btrace_read_type type) override; const struct btrace_config *btrace_conf (const struct btrace_target_info *) override; - int augmented_libraries_svr4_read () override; + bool augmented_libraries_svr4_read () override; int follow_fork (int, int) override; void follow_exec (struct inferior *, char *) override; int insert_fork_catchpoint (int) override; @@ -404,7 +404,7 @@ public: void attach (const char *, int) override; void post_attach (int) override; - int supports_disable_randomization () override; + bool supports_disable_randomization () override; }; /* Per-program-space data key. */ @@ -2518,7 +2518,7 @@ remote_thread_always_alive (ptid_t ptid) /* Return nonzero if the thread PTID is still alive on the remote system. */ -int +bool remote_target::thread_alive (ptid_t ptid) { struct remote_state *rs = get_remote_state (); @@ -9700,7 +9700,7 @@ remote_target::mourn_inferior () } } -int +bool extended_remote_target::supports_disable_randomization () { return packet_support (PACKET_QDisableRandomization) == PACKET_ENABLE; @@ -10158,7 +10158,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, _("remote_insert_watchpoint: reached end of function")); } -int +bool remote_target::watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start, int length) { @@ -10251,7 +10251,7 @@ remote_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot) /* The to_stopped_by_sw_breakpoint method of target remote. */ -int +bool remote_target::stopped_by_sw_breakpoint () { struct thread_info *thread = inferior_thread (); @@ -10264,7 +10264,7 @@ remote_target::stopped_by_sw_breakpoint () /* The to_supports_stopped_by_sw_breakpoint method of target remote. */ -int +bool remote_target::supports_stopped_by_sw_breakpoint () { return (packet_support (PACKET_swbreak_feature) == PACKET_ENABLE); @@ -10272,7 +10272,7 @@ remote_target::supports_stopped_by_sw_breakpoint () /* The to_stopped_by_hw_breakpoint method of target remote. */ -int +bool remote_target::stopped_by_hw_breakpoint () { struct thread_info *thread = inferior_thread (); @@ -10285,13 +10285,13 @@ remote_target::stopped_by_hw_breakpoint () /* The to_supports_stopped_by_hw_breakpoint method of target remote. */ -int +bool remote_target::supports_stopped_by_hw_breakpoint () { return (packet_support (PACKET_hwbreak_feature) == PACKET_ENABLE); } -int +bool remote_target::stopped_by_watchpoint () { struct thread_info *thread = inferior_thread (); @@ -10301,7 +10301,7 @@ remote_target::stopped_by_watchpoint () == TARGET_STOPPED_BY_WATCHPOINT)); } -int +bool remote_target::stopped_data_address (CORE_ADDR *addr_p) { struct thread_info *thread = inferior_thread (); @@ -10311,10 +10311,10 @@ remote_target::stopped_data_address (CORE_ADDR *addr_p) == TARGET_STOPPED_BY_WATCHPOINT)) { *addr_p = get_remote_thread_info (thread)->watch_data_address; - return 1; + return true; } - return 0; + return false; } @@ -11330,7 +11330,7 @@ remote_target::get_thread_local_address (ptid_t ptid, CORE_ADDR lm, /* Provide thread local base, i.e. Thread Information Block address. Returns 1 if ptid is found and thread_local_base is non zero. */ -int +bool remote_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr) { if (packet_support (PACKET_qGetTIBAddr) != PACKET_DISABLE) @@ -11356,7 +11356,7 @@ remote_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr) unpack_varlen_hex (rs->buf, &result); if (addr) *addr = (CORE_ADDR) result; - return 1; + return true; } else if (result == PACKET_UNKNOWN) error (_("Remote target doesn't support qGetTIBAddr packet")); @@ -11366,7 +11366,7 @@ remote_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr) else error (_("qGetTIBAddr not supported or disabled on this target")); /* Not reached. */ - return 0; + return false; } /* Support for inferring a target description based on the current @@ -12085,7 +12085,7 @@ remote_target::fileio_fstat (int fd, struct stat *st, int *remote_errno) /* Implementation of to_filesystem_is_local. */ -int +bool remote_target::filesystem_is_local () { /* Valgrind GDB presents itself as a remote target but works @@ -12127,11 +12127,11 @@ remote_target::filesystem_is_local () warning_issued = 1; } - return 1; + return true; } } - return 0; + return false; } static int @@ -12416,30 +12416,30 @@ remote_command (const char *args, int from_tty) help_list (remote_cmdlist, "remote ", all_commands, gdb_stdout); } -int +bool remote_target::can_execute_reverse () { if (packet_support (PACKET_bs) == PACKET_ENABLE || packet_support (PACKET_bc) == PACKET_ENABLE) - return 1; + return true; else - return 0; + return false; } -int +bool remote_target::supports_non_stop () { - return 1; + return true; } -int +bool remote_target::supports_disable_randomization () { /* Only supported in extended mode. */ - return 0; + return false; } -int +bool remote_target::supports_multi_process () { struct remote_state *rs = get_remote_state (); @@ -12453,7 +12453,7 @@ remote_supports_cond_tracepoints () return packet_support (PACKET_ConditionalTracepoints) == PACKET_ENABLE; } -int +bool remote_target::supports_evaluation_of_breakpoint_conditions () { return packet_support (PACKET_ConditionalBreakpoints) == PACKET_ENABLE; @@ -12477,20 +12477,20 @@ remote_supports_install_in_trace () return packet_support (PACKET_InstallInTrace) == PACKET_ENABLE; } -int +bool remote_target::supports_enable_disable_tracepoint () { return (packet_support (PACKET_EnableDisableTracepoints_feature) == PACKET_ENABLE); } -int +bool remote_target::supports_string_tracing () { return packet_support (PACKET_tracenz_feature) == PACKET_ENABLE; } -int +bool remote_target::can_run_breakpoint_commands () { return packet_support (PACKET_BreakpointCommands) == PACKET_ENABLE; @@ -12711,7 +12711,7 @@ remote_target::download_tracepoint (struct bp_location *loc) } } -int +bool remote_target::can_download_tracepoint () { struct remote_state *rs = get_remote_state (); @@ -12722,20 +12722,20 @@ remote_target::can_download_tracepoint () symbols, and fetched and merged the target's tracepoint list with ours. */ if (rs->starting_up) - return 0; + return false; ts = current_trace_status (); status = get_trace_status (ts); if (status == -1 || !ts->running_known || !ts->running) - return 0; + return false; /* If we are in a tracing experiment, but remote stub doesn't support installing tracepoint in trace, we have to return. */ if (!remote_supports_install_in_trace ()) - return 0; + return false; - return 1; + return true; } @@ -13053,7 +13053,7 @@ remote_target::trace_find (enum trace_find_type type, int num, return target_frameno; } -int +bool remote_target::get_trace_state_variable_value (int tsvnum, LONGEST *val) { struct remote_state *rs = get_remote_state (); @@ -13071,10 +13071,10 @@ remote_target::get_trace_state_variable_value (int tsvnum, LONGEST *val) { unpack_varlen_hex (reply + 1, &uval); *val = (LONGEST) uval; - return 1; + return true; } } - return 0; + return false; } int @@ -13266,7 +13266,7 @@ remote_target::set_trace_buffer_size (LONGEST val) } } -int +bool remote_target::set_trace_notes (const char *user, const char *notes, const char *stop_notes) { @@ -13304,16 +13304,16 @@ remote_target::set_trace_notes (const char *user, const char *notes, putpkt (rs->buf); reply = remote_get_noisy_reply (); if (*reply == '\0') - return 0; + return false; if (strcmp (reply, "OK") != 0) error (_("Bogus reply from target: %s"), reply); - return 1; + return true; } -int -remote_target::use_agent (int use) +bool +remote_target::use_agent (bool use) { if (packet_support (PACKET_QAgent) != PACKET_DISABLE) { @@ -13327,14 +13327,14 @@ remote_target::use_agent (int use) if (strcmp (rs->buf, "OK") == 0) { ::use_agent = use; - return 1; + return true; } } - return 0; + return false; } -int +bool remote_target::can_use_agent () { return (packet_support (PACKET_QAgent) != PACKET_DISABLE); @@ -13635,7 +13635,7 @@ remote_target::btrace_conf (const struct btrace_target_info *tinfo) return &tinfo->conf; } -int +bool remote_target::augmented_libraries_svr4_read () { return (packet_support (PACKET_augmented_libraries_svr4_read_feature) @@ -13745,7 +13745,7 @@ remote_target::thread_handle_to_thread_info (const gdb_byte *thread_handle, return NULL; } -int +bool remote_target::can_async_p () { struct remote_state *rs = get_remote_state (); @@ -13753,20 +13753,20 @@ remote_target::can_async_p () /* We don't go async if the user has explicitly prevented it with the "maint set target-async" command. */ if (!target_async_permitted) - return 0; + return false; /* We're async whenever the serial device is. */ return serial_can_async_p (rs->remote_desc); } -int +bool remote_target::is_async_p () { struct remote_state *rs = get_remote_state (); if (!target_async_permitted) /* We only enable async when the user specifically asks for it. */ - return 0; + return false; /* We're async whenever the serial device is. */ return serial_is_async_p (rs->remote_desc); diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index bc99855..8dd8bc0 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -122,9 +122,9 @@ public: int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override; int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; - int have_continuable_watchpoint () { return 1; } - int stopped_by_watchpoint () override; - int watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; + bool have_continuable_watchpoint () { return 1; } + bool stopped_by_watchpoint () override; + bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, @@ -657,21 +657,20 @@ s390_show_debug_regs (int tid, const char *where) per_info.lowcore.words.access_id); } -int +bool s390_linux_nat_target::stopped_by_watchpoint () { struct s390_debug_reg_state *state = s390_get_debug_reg_state (ptid_get_pid (inferior_ptid)); per_lowcore_bits per_lowcore; ptrace_area parea; - int result; if (show_debug_regs) s390_show_debug_regs (s390_inferior_tid (), "stop"); /* Speed up common case. */ if (VEC_empty (s390_watch_area, state->watch_areas)) - return 0; + return false; parea.len = sizeof (per_lowcore); parea.process_addr = (addr_t) & per_lowcore; @@ -679,8 +678,8 @@ s390_linux_nat_target::stopped_by_watchpoint () if (ptrace (PTRACE_PEEKUSR_AREA, s390_inferior_tid (), &parea, 0) < 0) perror_with_name (_("Couldn't retrieve watchpoint status")); - result = (per_lowcore.perc_storage_alteration == 1 - && per_lowcore.perc_store_real_address == 0); + bool result = (per_lowcore.perc_storage_alteration == 1 + && per_lowcore.perc_store_real_address == 0); if (result) { diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 9ee8849c..d5c2400 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -99,7 +99,7 @@ public: ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; void update_thread_list () override; }; @@ -700,7 +700,7 @@ sol_thread_target::mourn_inferior () /* Return true if PTID is still active in the inferior. */ -int +bool sol_thread_target::thread_alive (ptid_t ptid) { if (ptid_tid_p (ptid)) @@ -712,10 +712,10 @@ sol_thread_target::thread_alive (ptid_t ptid) pid = ptid_get_tid (ptid); if ((val = p_td_ta_map_id2thr (main_ta, pid, &th)) != TD_OK) - return 0; /* Thread not found. */ + return false; /* Thread not found. */ if ((val = p_td_thr_validate (&th)) != TD_OK) - return 0; /* Thread not valid. */ - return 1; /* Known thread. */ + return false; /* Thread not valid. */ + return true; /* Known thread. */ } else { diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c index 4e3397f..1886807 100644 --- a/gdb/spu-multiarch.c +++ b/gdb/spu-multiarch.c @@ -52,7 +52,7 @@ struct spu_multiarch_target final : public target_ops void mourn_inferior () override; - void fetch_registers (struct regcache *, int) override; + void fetch_registers (struct regcache *, int) override; void store_registers (struct regcache *, int) override; enum target_xfer_status xfer_partial (enum target_object object, @@ -162,6 +162,7 @@ spu_multiarch_target::thread_architecture (ptid_t ptid) } /* Override the to_region_ok_for_hw_watchpoint routine. */ + int spu_multiarch_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) { diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 3aea00e..c06b700 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -24,10 +24,10 @@ struct dummy_target : public target_ops void files_info () override; int insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override; int remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2) override; - int stopped_by_sw_breakpoint () override; - int supports_stopped_by_sw_breakpoint () override; - int stopped_by_hw_breakpoint () override; - int supports_stopped_by_hw_breakpoint () override; + bool stopped_by_sw_breakpoint () override; + bool supports_stopped_by_sw_breakpoint () override; + bool stopped_by_hw_breakpoint () override; + bool supports_stopped_by_hw_breakpoint () override; int can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2) override; int ranged_break_num_registers () override; int insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override; @@ -36,13 +36,13 @@ struct dummy_target : public target_ops int insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3) override; int insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) override; int remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) override; - int stopped_by_watchpoint () override; + bool stopped_by_watchpoint () override; int have_steppable_watchpoint () override; bool have_continuable_watchpoint () override; - int stopped_data_address (CORE_ADDR *arg0) override; - int watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; + bool stopped_data_address (CORE_ADDR *arg0) override; + bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; int region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) override; - int can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override; + bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override; int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override; int can_do_single_step () override; bool supports_terminal_ours () override; @@ -67,7 +67,7 @@ struct dummy_target : public target_ops void mourn_inferior () override; void pass_signals (int arg0, unsigned char * arg1) override; void program_signals (int arg0, unsigned char * arg1) override; - int thread_alive (ptid_t arg0) override; + bool thread_alive (ptid_t arg0) override; void update_thread_list () override; const char *pid_to_str (ptid_t arg0) override; const char *extra_thread_info (thread_info *arg0) override; @@ -82,12 +82,12 @@ struct dummy_target : public target_ops struct target_section_table *get_section_table () override; thread_control_capabilities get_thread_control_capabilities () override; bool attach_no_wait () override; - int can_async_p () override; - int is_async_p () override; + bool can_async_p () override; + bool is_async_p () override; void async (int arg0) override; void thread_events (int arg0) override; - int supports_non_stop () override; - int always_non_stop_p () override; + bool supports_non_stop () override; + bool always_non_stop_p () override; int find_memory_regions (find_memory_region_ftype arg0, void *arg1) override; char *make_corefile_notes (bfd *arg0, int *arg1) override; gdb_byte *get_bookmark (const char *arg0, int arg1) override; @@ -102,20 +102,20 @@ struct dummy_target : public target_ops ptid_t get_ada_task_ptid (long arg0, long arg1) override; int auxv_parse (gdb_byte **arg0, gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3) override; int search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4) override; - int can_execute_reverse () override; + bool can_execute_reverse () override; enum exec_direction_kind execution_direction () override; - int supports_multi_process () override; - int supports_enable_disable_tracepoint () override; - int supports_disable_randomization () override; - int supports_string_tracing () override; - int supports_evaluation_of_breakpoint_conditions () override; - int can_run_breakpoint_commands () override; + bool supports_multi_process () override; + bool supports_enable_disable_tracepoint () override; + bool supports_disable_randomization () override; + bool supports_string_tracing () override; + bool supports_evaluation_of_breakpoint_conditions () override; + bool can_run_breakpoint_commands () override; struct gdbarch *thread_architecture (ptid_t arg0) override; struct address_space *thread_address_space (ptid_t arg0) override; - int filesystem_is_local () override; + bool filesystem_is_local () override; void trace_init () override; void download_tracepoint (struct bp_location *arg0) override; - int can_download_tracepoint () override; + bool can_download_tracepoint () override; void download_trace_state_variable (const trace_state_variable &arg0) override; void enable_tracepoint (struct bp_location *arg0) override; void disable_tracepoint (struct bp_location *arg0) override; @@ -125,7 +125,7 @@ struct dummy_target : public target_ops void get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1) override; void trace_stop () override; int trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4) override; - int get_trace_state_variable_value (int arg0, LONGEST *arg1) override; + bool get_trace_state_variable_value (int arg0, LONGEST *arg1) override; int save_trace_data (const char *arg0) override; int upload_tracepoints (struct uploaded_tp **arg0) override; int upload_trace_state_variables (struct uploaded_tsv **arg0) override; @@ -134,16 +134,16 @@ struct dummy_target : public target_ops void set_disconnected_tracing (int arg0) override; void set_circular_trace_buffer (int arg0) override; void set_trace_buffer_size (LONGEST arg0) override; - int set_trace_notes (const char *arg0, const char *arg1, const char *arg2) override; + bool set_trace_notes (const char *arg0, const char *arg1, const char *arg2) override; int core_of_thread (ptid_t arg0) override; int verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2) override; - int get_tib_address (ptid_t arg0, CORE_ADDR *arg1) override; + bool get_tib_address (ptid_t arg0, CORE_ADDR *arg1) override; void set_permissions () override; bool static_tracepoint_marker_at (CORE_ADDR arg0, static_tracepoint_marker *arg1) override; std::vector static_tracepoint_markers_by_strid (const char *arg0) override; traceframe_info_up traceframe_info () override; - int use_agent (int arg0) override; - int can_use_agent () override; + bool use_agent (bool arg0) override; + bool can_use_agent () override; struct btrace_target_info *enable_btrace (ptid_t arg0, const struct btrace_config *arg1) override; void disable_btrace (struct btrace_target_info *arg0) override; void teardown_btrace (struct btrace_target_info *arg0) override; @@ -155,8 +155,8 @@ struct dummy_target : public target_ops void save_record (const char *arg0) override; bool supports_delete_record () override; void delete_record () override; - int record_is_replaying (ptid_t arg0) override; - int record_will_replay (ptid_t arg0, int arg1) override; + bool record_is_replaying (ptid_t arg0) override; + bool record_will_replay (ptid_t arg0, int arg1) override; void record_stop_replaying () override; void goto_record_begin () override; void goto_record_end () override; @@ -167,7 +167,7 @@ struct dummy_target : public target_ops void call_history (int arg0, record_print_flags arg1) override; void call_history_from (ULONGEST arg0, int arg1, record_print_flags arg2) override; void call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_flags arg2) override; - int augmented_libraries_svr4_read () override; + bool augmented_libraries_svr4_read () override; const struct frame_unwind *get_unwinder () override; const struct frame_unwind *get_tailcall_unwinder () override; void prepare_to_generate_core () override; @@ -194,10 +194,10 @@ struct debug_target : public target_ops void files_info () override; int insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override; int remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2) override; - int stopped_by_sw_breakpoint () override; - int supports_stopped_by_sw_breakpoint () override; - int stopped_by_hw_breakpoint () override; - int supports_stopped_by_hw_breakpoint () override; + bool stopped_by_sw_breakpoint () override; + bool supports_stopped_by_sw_breakpoint () override; + bool stopped_by_hw_breakpoint () override; + bool supports_stopped_by_hw_breakpoint () override; int can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2) override; int ranged_break_num_registers () override; int insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override; @@ -206,13 +206,13 @@ struct debug_target : public target_ops int insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3) override; int insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) override; int remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) override; - int stopped_by_watchpoint () override; + bool stopped_by_watchpoint () override; int have_steppable_watchpoint () override; bool have_continuable_watchpoint () override; - int stopped_data_address (CORE_ADDR *arg0) override; - int watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; + bool stopped_data_address (CORE_ADDR *arg0) override; + bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; int region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) override; - int can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override; + bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override; int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override; int can_do_single_step () override; bool supports_terminal_ours () override; @@ -237,7 +237,7 @@ struct debug_target : public target_ops void mourn_inferior () override; void pass_signals (int arg0, unsigned char * arg1) override; void program_signals (int arg0, unsigned char * arg1) override; - int thread_alive (ptid_t arg0) override; + bool thread_alive (ptid_t arg0) override; void update_thread_list () override; const char *pid_to_str (ptid_t arg0) override; const char *extra_thread_info (thread_info *arg0) override; @@ -252,12 +252,12 @@ struct debug_target : public target_ops struct target_section_table *get_section_table () override; thread_control_capabilities get_thread_control_capabilities () override; bool attach_no_wait () override; - int can_async_p () override; - int is_async_p () override; + bool can_async_p () override; + bool is_async_p () override; void async (int arg0) override; void thread_events (int arg0) override; - int supports_non_stop () override; - int always_non_stop_p () override; + bool supports_non_stop () override; + bool always_non_stop_p () override; int find_memory_regions (find_memory_region_ftype arg0, void *arg1) override; char *make_corefile_notes (bfd *arg0, int *arg1) override; gdb_byte *get_bookmark (const char *arg0, int arg1) override; @@ -272,20 +272,20 @@ struct debug_target : public target_ops ptid_t get_ada_task_ptid (long arg0, long arg1) override; int auxv_parse (gdb_byte **arg0, gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3) override; int search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4) override; - int can_execute_reverse () override; + bool can_execute_reverse () override; enum exec_direction_kind execution_direction () override; - int supports_multi_process () override; - int supports_enable_disable_tracepoint () override; - int supports_disable_randomization () override; - int supports_string_tracing () override; - int supports_evaluation_of_breakpoint_conditions () override; - int can_run_breakpoint_commands () override; + bool supports_multi_process () override; + bool supports_enable_disable_tracepoint () override; + bool supports_disable_randomization () override; + bool supports_string_tracing () override; + bool supports_evaluation_of_breakpoint_conditions () override; + bool can_run_breakpoint_commands () override; struct gdbarch *thread_architecture (ptid_t arg0) override; struct address_space *thread_address_space (ptid_t arg0) override; - int filesystem_is_local () override; + bool filesystem_is_local () override; void trace_init () override; void download_tracepoint (struct bp_location *arg0) override; - int can_download_tracepoint () override; + bool can_download_tracepoint () override; void download_trace_state_variable (const trace_state_variable &arg0) override; void enable_tracepoint (struct bp_location *arg0) override; void disable_tracepoint (struct bp_location *arg0) override; @@ -295,7 +295,7 @@ struct debug_target : public target_ops void get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1) override; void trace_stop () override; int trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4) override; - int get_trace_state_variable_value (int arg0, LONGEST *arg1) override; + bool get_trace_state_variable_value (int arg0, LONGEST *arg1) override; int save_trace_data (const char *arg0) override; int upload_tracepoints (struct uploaded_tp **arg0) override; int upload_trace_state_variables (struct uploaded_tsv **arg0) override; @@ -304,16 +304,16 @@ struct debug_target : public target_ops void set_disconnected_tracing (int arg0) override; void set_circular_trace_buffer (int arg0) override; void set_trace_buffer_size (LONGEST arg0) override; - int set_trace_notes (const char *arg0, const char *arg1, const char *arg2) override; + bool set_trace_notes (const char *arg0, const char *arg1, const char *arg2) override; int core_of_thread (ptid_t arg0) override; int verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2) override; - int get_tib_address (ptid_t arg0, CORE_ADDR *arg1) override; + bool get_tib_address (ptid_t arg0, CORE_ADDR *arg1) override; void set_permissions () override; bool static_tracepoint_marker_at (CORE_ADDR arg0, static_tracepoint_marker *arg1) override; std::vector static_tracepoint_markers_by_strid (const char *arg0) override; traceframe_info_up traceframe_info () override; - int use_agent (int arg0) override; - int can_use_agent () override; + bool use_agent (bool arg0) override; + bool can_use_agent () override; struct btrace_target_info *enable_btrace (ptid_t arg0, const struct btrace_config *arg1) override; void disable_btrace (struct btrace_target_info *arg0) override; void teardown_btrace (struct btrace_target_info *arg0) override; @@ -325,8 +325,8 @@ struct debug_target : public target_ops void save_record (const char *arg0) override; bool supports_delete_record () override; void delete_record () override; - int record_is_replaying (ptid_t arg0) override; - int record_will_replay (ptid_t arg0, int arg1) override; + bool record_is_replaying (ptid_t arg0) override; + bool record_will_replay (ptid_t arg0, int arg1) override; void record_stop_replaying () override; void goto_record_begin () override; void goto_record_end () override; @@ -337,7 +337,7 @@ struct debug_target : public target_ops void call_history (int arg0, record_print_flags arg1) override; void call_history_from (ULONGEST arg0, int arg1, record_print_flags arg2) override; void call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_flags arg2) override; - int augmented_libraries_svr4_read () override; + bool augmented_libraries_svr4_read () override; const struct frame_unwind *get_unwinder () override; const struct frame_unwind *get_tailcall_unwinder () override; void prepare_to_generate_core () override; @@ -635,102 +635,102 @@ debug_target::remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *ar return result; } -int +bool target_ops::stopped_by_sw_breakpoint () { return this->beneath->stopped_by_sw_breakpoint (); } -int +bool dummy_target::stopped_by_sw_breakpoint () { - return 0; + return false; } -int +bool debug_target::stopped_by_sw_breakpoint () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->stopped_by_sw_breakpoint (...)\n", this->beneath->shortname ()); result = this->beneath->stopped_by_sw_breakpoint (); fprintf_unfiltered (gdb_stdlog, "<- %s->stopped_by_sw_breakpoint (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::supports_stopped_by_sw_breakpoint () { return this->beneath->supports_stopped_by_sw_breakpoint (); } -int +bool dummy_target::supports_stopped_by_sw_breakpoint () { - return 0; + return false; } -int +bool debug_target::supports_stopped_by_sw_breakpoint () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->supports_stopped_by_sw_breakpoint (...)\n", this->beneath->shortname ()); result = this->beneath->supports_stopped_by_sw_breakpoint (); fprintf_unfiltered (gdb_stdlog, "<- %s->supports_stopped_by_sw_breakpoint (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::stopped_by_hw_breakpoint () { return this->beneath->stopped_by_hw_breakpoint (); } -int +bool dummy_target::stopped_by_hw_breakpoint () { - return 0; + return false; } -int +bool debug_target::stopped_by_hw_breakpoint () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->stopped_by_hw_breakpoint (...)\n", this->beneath->shortname ()); result = this->beneath->stopped_by_hw_breakpoint (); fprintf_unfiltered (gdb_stdlog, "<- %s->stopped_by_hw_breakpoint (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::supports_stopped_by_hw_breakpoint () { return this->beneath->supports_stopped_by_hw_breakpoint (); } -int +bool dummy_target::supports_stopped_by_hw_breakpoint () { - return 0; + return false; } -int +bool debug_target::supports_stopped_by_hw_breakpoint () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->supports_stopped_by_hw_breakpoint (...)\n", this->beneath->shortname ()); result = this->beneath->supports_stopped_by_hw_breakpoint (); fprintf_unfiltered (gdb_stdlog, "<- %s->supports_stopped_by_hw_breakpoint (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -970,27 +970,27 @@ debug_target::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum targe return result; } -int +bool target_ops::stopped_by_watchpoint () { return this->beneath->stopped_by_watchpoint (); } -int +bool dummy_target::stopped_by_watchpoint () { - return 0; + return false; } -int +bool debug_target::stopped_by_watchpoint () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->stopped_by_watchpoint (...)\n", this->beneath->shortname ()); result = this->beneath->stopped_by_watchpoint (); fprintf_unfiltered (gdb_stdlog, "<- %s->stopped_by_watchpoint (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -1004,7 +1004,7 @@ target_ops::have_steppable_watchpoint () int dummy_target::have_steppable_watchpoint () { - return 0; + return false; } int @@ -1029,7 +1029,7 @@ target_ops::have_continuable_watchpoint () bool dummy_target::have_continuable_watchpoint () { - return 0; + return false; } bool @@ -1045,48 +1045,48 @@ debug_target::have_continuable_watchpoint () return result; } -int +bool target_ops::stopped_data_address (CORE_ADDR *arg0) { return this->beneath->stopped_data_address (arg0); } -int +bool dummy_target::stopped_data_address (CORE_ADDR *arg0) { - return 0; + return false; } -int +bool debug_target::stopped_data_address (CORE_ADDR *arg0) { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->stopped_data_address (...)\n", this->beneath->shortname ()); result = this->beneath->stopped_data_address (arg0); fprintf_unfiltered (gdb_stdlog, "<- %s->stopped_data_address (", this->beneath->shortname ()); target_debug_print_CORE_ADDR_p (arg0); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) { return this->beneath->watchpoint_addr_within_range (arg0, arg1, arg2); } -int +bool dummy_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) { return default_watchpoint_addr_within_range (this, arg0, arg1, arg2); } -int +bool debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->watchpoint_addr_within_range (...)\n", this->beneath->shortname ()); result = this->beneath->watchpoint_addr_within_range (arg0, arg1, arg2); fprintf_unfiltered (gdb_stdlog, "<- %s->watchpoint_addr_within_range (", this->beneath->shortname ()); @@ -1096,7 +1096,7 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int fputs_unfiltered (", ", gdb_stdlog); target_debug_print_int (arg2); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -1129,22 +1129,22 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) return result; } -int +bool target_ops::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) { return this->beneath->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3); } -int +bool dummy_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) { - return 0; + return false; } -int +bool debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->can_accel_watchpoint_condition (...)\n", this->beneath->shortname ()); result = this->beneath->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3); fprintf_unfiltered (gdb_stdlog, "<- %s->can_accel_watchpoint_condition (", this->beneath->shortname ()); @@ -1156,7 +1156,7 @@ debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2 fputs_unfiltered (", ", gdb_stdlog); target_debug_print_struct_expression_p (arg3); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -1223,7 +1223,7 @@ target_ops::supports_terminal_ours () bool dummy_target::supports_terminal_ours () { - return 0; + return false; } bool @@ -1735,28 +1735,28 @@ debug_target::program_signals (int arg0, unsigned char * arg1) fputs_unfiltered (")\n", gdb_stdlog); } -int +bool target_ops::thread_alive (ptid_t arg0) { return this->beneath->thread_alive (arg0); } -int +bool dummy_target::thread_alive (ptid_t arg0) { - return 0; + return false; } -int +bool debug_target::thread_alive (ptid_t arg0) { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->thread_alive (...)\n", this->beneath->shortname ()); result = this->beneath->thread_alive (arg0); fprintf_unfiltered (gdb_stdlog, "<- %s->thread_alive (", this->beneath->shortname ()); target_debug_print_ptid_t (arg0); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -2097,52 +2097,52 @@ debug_target::attach_no_wait () return result; } -int +bool target_ops::can_async_p () { return this->beneath->can_async_p (); } -int +bool dummy_target::can_async_p () { - return 0; + return false; } -int +bool debug_target::can_async_p () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->can_async_p (...)\n", this->beneath->shortname ()); result = this->beneath->can_async_p (); fprintf_unfiltered (gdb_stdlog, "<- %s->can_async_p (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::is_async_p () { return this->beneath->is_async_p (); } -int +bool dummy_target::is_async_p () { - return 0; + return false; } -int +bool debug_target::is_async_p () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->is_async_p (...)\n", this->beneath->shortname ()); result = this->beneath->is_async_p (); fprintf_unfiltered (gdb_stdlog, "<- %s->is_async_p (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -2190,52 +2190,52 @@ debug_target::thread_events (int arg0) fputs_unfiltered (")\n", gdb_stdlog); } -int +bool target_ops::supports_non_stop () { return this->beneath->supports_non_stop (); } -int +bool dummy_target::supports_non_stop () { - return 0; + return false; } -int +bool debug_target::supports_non_stop () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->supports_non_stop (...)\n", this->beneath->shortname ()); result = this->beneath->supports_non_stop (); fprintf_unfiltered (gdb_stdlog, "<- %s->supports_non_stop (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::always_non_stop_p () { return this->beneath->always_non_stop_p (); } -int +bool dummy_target::always_non_stop_p () { - return 0; + return false; } -int +bool debug_target::always_non_stop_p () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->always_non_stop_p (...)\n", this->beneath->shortname ()); result = this->beneath->always_non_stop_p (); fprintf_unfiltered (gdb_stdlog, "<- %s->always_non_stop_p (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -2630,27 +2630,27 @@ debug_target::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2 return result; } -int +bool target_ops::can_execute_reverse () { return this->beneath->can_execute_reverse (); } -int +bool dummy_target::can_execute_reverse () { - return 0; + return false; } -int +bool debug_target::can_execute_reverse () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->can_execute_reverse (...)\n", this->beneath->shortname ()); result = this->beneath->can_execute_reverse (); fprintf_unfiltered (gdb_stdlog, "<- %s->can_execute_reverse (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -2680,152 +2680,152 @@ debug_target::execution_direction () return result; } -int +bool target_ops::supports_multi_process () { return this->beneath->supports_multi_process (); } -int +bool dummy_target::supports_multi_process () { - return 0; + return false; } -int +bool debug_target::supports_multi_process () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->supports_multi_process (...)\n", this->beneath->shortname ()); result = this->beneath->supports_multi_process (); fprintf_unfiltered (gdb_stdlog, "<- %s->supports_multi_process (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::supports_enable_disable_tracepoint () { return this->beneath->supports_enable_disable_tracepoint (); } -int +bool dummy_target::supports_enable_disable_tracepoint () { - return 0; + return false; } -int +bool debug_target::supports_enable_disable_tracepoint () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->supports_enable_disable_tracepoint (...)\n", this->beneath->shortname ()); result = this->beneath->supports_enable_disable_tracepoint (); fprintf_unfiltered (gdb_stdlog, "<- %s->supports_enable_disable_tracepoint (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::supports_disable_randomization () { return this->beneath->supports_disable_randomization (); } -int +bool dummy_target::supports_disable_randomization () { return find_default_supports_disable_randomization (this); } -int +bool debug_target::supports_disable_randomization () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->supports_disable_randomization (...)\n", this->beneath->shortname ()); result = this->beneath->supports_disable_randomization (); fprintf_unfiltered (gdb_stdlog, "<- %s->supports_disable_randomization (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::supports_string_tracing () { return this->beneath->supports_string_tracing (); } -int +bool dummy_target::supports_string_tracing () { - return 0; + return false; } -int +bool debug_target::supports_string_tracing () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->supports_string_tracing (...)\n", this->beneath->shortname ()); result = this->beneath->supports_string_tracing (); fprintf_unfiltered (gdb_stdlog, "<- %s->supports_string_tracing (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::supports_evaluation_of_breakpoint_conditions () { return this->beneath->supports_evaluation_of_breakpoint_conditions (); } -int +bool dummy_target::supports_evaluation_of_breakpoint_conditions () { - return 0; + return false; } -int +bool debug_target::supports_evaluation_of_breakpoint_conditions () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->supports_evaluation_of_breakpoint_conditions (...)\n", this->beneath->shortname ()); result = this->beneath->supports_evaluation_of_breakpoint_conditions (); fprintf_unfiltered (gdb_stdlog, "<- %s->supports_evaluation_of_breakpoint_conditions (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::can_run_breakpoint_commands () { return this->beneath->can_run_breakpoint_commands (); } -int +bool dummy_target::can_run_breakpoint_commands () { - return 0; + return false; } -int +bool debug_target::can_run_breakpoint_commands () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->can_run_breakpoint_commands (...)\n", this->beneath->shortname ()); result = this->beneath->can_run_breakpoint_commands (); fprintf_unfiltered (gdb_stdlog, "<- %s->can_run_breakpoint_commands (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -2882,27 +2882,27 @@ debug_target::thread_address_space (ptid_t arg0) return result; } -int +bool target_ops::filesystem_is_local () { return this->beneath->filesystem_is_local (); } -int +bool dummy_target::filesystem_is_local () { - return 1; + return true; } -int +bool debug_target::filesystem_is_local () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->filesystem_is_local (...)\n", this->beneath->shortname ()); result = this->beneath->filesystem_is_local (); fprintf_unfiltered (gdb_stdlog, "<- %s->filesystem_is_local (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -2950,27 +2950,27 @@ debug_target::download_tracepoint (struct bp_location *arg0) fputs_unfiltered (")\n", gdb_stdlog); } -int +bool target_ops::can_download_tracepoint () { return this->beneath->can_download_tracepoint (); } -int +bool dummy_target::can_download_tracepoint () { - return 0; + return false; } -int +bool debug_target::can_download_tracepoint () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->can_download_tracepoint (...)\n", this->beneath->shortname ()); result = this->beneath->can_download_tracepoint (); fprintf_unfiltered (gdb_stdlog, "<- %s->can_download_tracepoint (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -3188,22 +3188,22 @@ debug_target::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, C return result; } -int +bool target_ops::get_trace_state_variable_value (int arg0, LONGEST *arg1) { return this->beneath->get_trace_state_variable_value (arg0, arg1); } -int +bool dummy_target::get_trace_state_variable_value (int arg0, LONGEST *arg1) { - return 0; + return false; } -int +bool debug_target::get_trace_state_variable_value (int arg0, LONGEST *arg1) { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->get_trace_state_variable_value (...)\n", this->beneath->shortname ()); result = this->beneath->get_trace_state_variable_value (arg0, arg1); fprintf_unfiltered (gdb_stdlog, "<- %s->get_trace_state_variable_value (", this->beneath->shortname ()); @@ -3211,7 +3211,7 @@ debug_target::get_trace_state_variable_value (int arg0, LONGEST *arg1) fputs_unfiltered (", ", gdb_stdlog); target_debug_print_LONGEST_p (arg1); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -3412,22 +3412,22 @@ debug_target::set_trace_buffer_size (LONGEST arg0) fputs_unfiltered (")\n", gdb_stdlog); } -int +bool target_ops::set_trace_notes (const char *arg0, const char *arg1, const char *arg2) { return this->beneath->set_trace_notes (arg0, arg1, arg2); } -int +bool dummy_target::set_trace_notes (const char *arg0, const char *arg1, const char *arg2) { - return 0; + return false; } -int +bool debug_target::set_trace_notes (const char *arg0, const char *arg1, const char *arg2) { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->set_trace_notes (...)\n", this->beneath->shortname ()); result = this->beneath->set_trace_notes (arg0, arg1, arg2); fprintf_unfiltered (gdb_stdlog, "<- %s->set_trace_notes (", this->beneath->shortname ()); @@ -3437,7 +3437,7 @@ debug_target::set_trace_notes (const char *arg0, const char *arg1, const char *a fputs_unfiltered (", ", gdb_stdlog); target_debug_print_const_char_p (arg2); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -3498,22 +3498,22 @@ debug_target::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2 return result; } -int +bool target_ops::get_tib_address (ptid_t arg0, CORE_ADDR *arg1) { return this->beneath->get_tib_address (arg0, arg1); } -int +bool dummy_target::get_tib_address (ptid_t arg0, CORE_ADDR *arg1) { tcomplain (); } -int +bool debug_target::get_tib_address (ptid_t arg0, CORE_ADDR *arg1) { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->get_tib_address (...)\n", this->beneath->shortname ()); result = this->beneath->get_tib_address (arg0, arg1); fprintf_unfiltered (gdb_stdlog, "<- %s->get_tib_address (", this->beneath->shortname ()); @@ -3521,7 +3521,7 @@ debug_target::get_tib_address (ptid_t arg0, CORE_ADDR *arg1) fputs_unfiltered (", ", gdb_stdlog); target_debug_print_CORE_ADDR_p (arg1); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -3625,53 +3625,53 @@ debug_target::traceframe_info () return result; } -int -target_ops::use_agent (int arg0) +bool +target_ops::use_agent (bool arg0) { return this->beneath->use_agent (arg0); } -int -dummy_target::use_agent (int arg0) +bool +dummy_target::use_agent (bool arg0) { tcomplain (); } -int -debug_target::use_agent (int arg0) +bool +debug_target::use_agent (bool arg0) { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->use_agent (...)\n", this->beneath->shortname ()); result = this->beneath->use_agent (arg0); fprintf_unfiltered (gdb_stdlog, "<- %s->use_agent (", this->beneath->shortname ()); - target_debug_print_int (arg0); + target_debug_print_bool (arg0); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::can_use_agent () { return this->beneath->can_use_agent (); } -int +bool dummy_target::can_use_agent () { - return 0; + return false; } -int +bool debug_target::can_use_agent () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->can_use_agent (...)\n", this->beneath->shortname ()); result = this->beneath->can_use_agent (); fprintf_unfiltered (gdb_stdlog, "<- %s->can_use_agent (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -3938,48 +3938,48 @@ debug_target::delete_record () fputs_unfiltered (")\n", gdb_stdlog); } -int +bool target_ops::record_is_replaying (ptid_t arg0) { return this->beneath->record_is_replaying (arg0); } -int +bool dummy_target::record_is_replaying (ptid_t arg0) { - return 0; + return false; } -int +bool debug_target::record_is_replaying (ptid_t arg0) { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->record_is_replaying (...)\n", this->beneath->shortname ()); result = this->beneath->record_is_replaying (arg0); fprintf_unfiltered (gdb_stdlog, "<- %s->record_is_replaying (", this->beneath->shortname ()); target_debug_print_ptid_t (arg0); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } -int +bool target_ops::record_will_replay (ptid_t arg0, int arg1) { return this->beneath->record_will_replay (arg0, arg1); } -int +bool dummy_target::record_will_replay (ptid_t arg0, int arg1) { - return 0; + return false; } -int +bool debug_target::record_will_replay (ptid_t arg0, int arg1) { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->record_will_replay (...)\n", this->beneath->shortname ()); result = this->beneath->record_will_replay (arg0, arg1); fprintf_unfiltered (gdb_stdlog, "<- %s->record_will_replay (", this->beneath->shortname ()); @@ -3987,7 +3987,7 @@ debug_target::record_will_replay (ptid_t arg0, int arg1) fputs_unfiltered (", ", gdb_stdlog); target_debug_print_int (arg1); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } @@ -4228,27 +4228,27 @@ debug_target::call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_fla fputs_unfiltered (")\n", gdb_stdlog); } -int +bool target_ops::augmented_libraries_svr4_read () { return this->beneath->augmented_libraries_svr4_read (); } -int +bool dummy_target::augmented_libraries_svr4_read () { - return 0; + return false; } -int +bool debug_target::augmented_libraries_svr4_read () { - int result; + bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->augmented_libraries_svr4_read (...)\n", this->beneath->shortname ()); result = this->beneath->augmented_libraries_svr4_read (); fprintf_unfiltered (gdb_stdlog, "<- %s->augmented_libraries_svr4_read (", this->beneath->shortname ()); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); + target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } diff --git a/gdb/target.c b/gdb/target.c index 022da59..3ed5537 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2650,10 +2650,10 @@ target_ops::create_inferior (const char *, const std::string &, gdb_assert_not_reached ("target_ops::create_inferior called"); } -int +bool target_ops::can_run () { - return 0; + return false; } int diff --git a/gdb/target.h b/gdb/target.h index f78eb45..cd49fce 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -482,11 +482,11 @@ struct target_ops done from the target, so GDB needs to be able to tell whether it should ignore the event and whether it should adjust the PC. See adjust_pc_after_break. */ - virtual int stopped_by_sw_breakpoint () - TARGET_DEFAULT_RETURN (0); + virtual bool stopped_by_sw_breakpoint () + TARGET_DEFAULT_RETURN (false); /* Returns true if the above method is supported. */ - virtual int supports_stopped_by_sw_breakpoint () - TARGET_DEFAULT_RETURN (0); + virtual bool supports_stopped_by_sw_breakpoint () + TARGET_DEFAULT_RETURN (false); /* Returns true if the target stopped for a hardware breakpoint. Likewise, if the target supports hardware breakpoints, this @@ -495,11 +495,11 @@ struct target_ops require PC adjustment, GDB needs to be able to tell whether the hardware breakpoint event is a delayed event for a breakpoint that is already gone and should thus be ignored. */ - virtual int stopped_by_hw_breakpoint () - TARGET_DEFAULT_RETURN (0); + virtual bool stopped_by_hw_breakpoint () + TARGET_DEFAULT_RETURN (false); /* Returns true if the above method is supported. */ - virtual int supports_stopped_by_hw_breakpoint () - TARGET_DEFAULT_RETURN (0); + virtual bool supports_stopped_by_hw_breakpoint () + TARGET_DEFAULT_RETURN (false); virtual int can_use_hw_breakpoint (enum bptype, int, int) TARGET_DEFAULT_RETURN (0); @@ -527,15 +527,15 @@ struct target_ops virtual int remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, enum target_hw_bp_type) TARGET_DEFAULT_RETURN (1); - virtual int stopped_by_watchpoint () - TARGET_DEFAULT_RETURN (0); + virtual bool stopped_by_watchpoint () + TARGET_DEFAULT_RETURN (false); virtual int have_steppable_watchpoint () - TARGET_DEFAULT_RETURN (0); + TARGET_DEFAULT_RETURN (false); virtual bool have_continuable_watchpoint () - TARGET_DEFAULT_RETURN (0); - virtual int stopped_data_address (CORE_ADDR *) - TARGET_DEFAULT_RETURN (0); - virtual int watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) + TARGET_DEFAULT_RETURN (false); + virtual bool stopped_data_address (CORE_ADDR *) + TARGET_DEFAULT_RETURN (false); + virtual bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range); /* Documentation of this routine is provided with the corresponding @@ -543,9 +543,9 @@ struct target_ops virtual int region_ok_for_hw_watchpoint (CORE_ADDR, int) TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint); - virtual int can_accel_watchpoint_condition (CORE_ADDR, int, int, - struct expression *) - TARGET_DEFAULT_RETURN (0); + virtual bool can_accel_watchpoint_condition (CORE_ADDR, int, int, + struct expression *) + TARGET_DEFAULT_RETURN (false); virtual int masked_watch_num_registers (CORE_ADDR, CORE_ADDR) TARGET_DEFAULT_RETURN (-1); @@ -555,7 +555,7 @@ struct target_ops TARGET_DEFAULT_RETURN (-1); virtual bool supports_terminal_ours () - TARGET_DEFAULT_RETURN (0); + TARGET_DEFAULT_RETURN (false); virtual void terminal_init () TARGET_DEFAULT_IGNORE (); virtual void terminal_inferior () @@ -607,7 +607,7 @@ struct target_ops /* Note that can_run is special and can be invoked on an unpushed target. Targets defining this method must also define to_can_async_p and to_supports_non_stop. */ - virtual int can_run (); + virtual bool can_run (); /* Documentation of this routine is provided with the corresponding target_* macro. */ @@ -621,8 +621,8 @@ struct target_ops unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals)) TARGET_DEFAULT_IGNORE (); - virtual int thread_alive (ptid_t ptid) - TARGET_DEFAULT_RETURN (0); + virtual bool thread_alive (ptid_t ptid) + TARGET_DEFAULT_RETURN (false); virtual void update_thread_list () TARGET_DEFAULT_IGNORE (); virtual const char *pid_to_str (ptid_t) @@ -652,11 +652,11 @@ struct target_ops enum strata to_stratum; /* Provide default values for all "must have" methods. */ - virtual int has_all_memory () { return 0; } - virtual int has_memory () { return 0; } - virtual int has_stack () { return 0; } - virtual int has_registers () { return 0; } - virtual int has_execution (ptid_t) { return 0; } + virtual bool has_all_memory () { return false; } + virtual bool has_memory () { return false; } + virtual bool has_stack () { return false; } + virtual bool has_registers () { return false; } + virtual bool has_execution (ptid_t) { return false; } /* Control thread execution. */ virtual thread_control_capabilities get_thread_control_capabilities () @@ -665,22 +665,22 @@ struct target_ops TARGET_DEFAULT_RETURN (0); /* This method must be implemented in some situations. See the comment on 'can_run'. */ - virtual int can_async_p () - TARGET_DEFAULT_RETURN (0); - virtual int is_async_p () - TARGET_DEFAULT_RETURN (0); + virtual bool can_async_p () + TARGET_DEFAULT_RETURN (false); + virtual bool is_async_p () + TARGET_DEFAULT_RETURN (false); virtual void async (int) TARGET_DEFAULT_NORETURN (tcomplain ()); virtual void thread_events (int) TARGET_DEFAULT_IGNORE (); /* This method must be implemented in some situations. See the comment on 'can_run'. */ - virtual int supports_non_stop () - TARGET_DEFAULT_RETURN (0); + virtual bool supports_non_stop () + TARGET_DEFAULT_RETURN (false); /* Return true if the target operates in non-stop mode even with "set non-stop off". */ - virtual int always_non_stop_p () - TARGET_DEFAULT_RETURN (0); + virtual bool always_non_stop_p () + TARGET_DEFAULT_RETURN (false); /* find_memory_regions support method for gcore */ virtual int find_memory_regions (find_memory_region_ftype func, void *data) TARGET_DEFAULT_FUNC (dummy_find_memory_regions); @@ -815,8 +815,8 @@ struct target_ops TARGET_DEFAULT_FUNC (default_search_memory); /* Can target execute in reverse? */ - virtual int can_execute_reverse () - TARGET_DEFAULT_RETURN (0); + virtual bool can_execute_reverse () + TARGET_DEFAULT_RETURN (false); /* The direction the target is currently executing. Must be implemented on targets that support reverse execution and async @@ -826,31 +826,31 @@ struct target_ops /* Does this target support debugging multiple processes simultaneously? */ - virtual int supports_multi_process () - TARGET_DEFAULT_RETURN (0); + virtual bool supports_multi_process () + TARGET_DEFAULT_RETURN (false); /* Does this target support enabling and disabling tracepoints while a trace experiment is running? */ - virtual int supports_enable_disable_tracepoint () - TARGET_DEFAULT_RETURN (0); + virtual bool supports_enable_disable_tracepoint () + TARGET_DEFAULT_RETURN (false); /* Does this target support disabling address space randomization? */ - virtual int supports_disable_randomization () + virtual bool supports_disable_randomization () TARGET_DEFAULT_FUNC (find_default_supports_disable_randomization); /* Does this target support the tracenz bytecode for string collection? */ - virtual int supports_string_tracing () - TARGET_DEFAULT_RETURN (0); + virtual bool supports_string_tracing () + TARGET_DEFAULT_RETURN (false); /* Does this target support evaluation of breakpoint conditions on its end? */ - virtual int supports_evaluation_of_breakpoint_conditions () - TARGET_DEFAULT_RETURN (0); + virtual bool supports_evaluation_of_breakpoint_conditions () + TARGET_DEFAULT_RETURN (false); /* Does this target support evaluation of breakpoint commands on its end? */ - virtual int can_run_breakpoint_commands () - TARGET_DEFAULT_RETURN (0); + virtual bool can_run_breakpoint_commands () + TARGET_DEFAULT_RETURN (false); /* Determine current architecture of thread PTID. @@ -876,8 +876,8 @@ struct target_ops /* Return nonzero if the filesystem seen by the current inferior is the local filesystem, zero otherwise. */ - virtual int filesystem_is_local () - TARGET_DEFAULT_RETURN (1); + virtual bool filesystem_is_local () + TARGET_DEFAULT_RETURN (true); /* Open FILENAME on the target, in the filesystem as seen by INF, using FLAGS and MODE. If INF is NULL, use the filesystem seen @@ -944,8 +944,8 @@ struct target_ops /* Is the target able to download tracepoint locations in current state? */ - virtual int can_download_tracepoint () - TARGET_DEFAULT_RETURN (0); + virtual bool can_download_tracepoint () + TARGET_DEFAULT_RETURN (false); /* Send full details of a trace state variable to the target. */ virtual void download_trace_state_variable (const trace_state_variable &tsv) @@ -993,8 +993,8 @@ struct target_ops /* Get the value of the trace state variable number TSV, returning 1 if the value is known and writing the value itself into the location pointed to by VAL, else returning 0. */ - virtual int get_trace_state_variable_value (int tsv, LONGEST *val) - TARGET_DEFAULT_RETURN (0); + virtual bool get_trace_state_variable_value (int tsv, LONGEST *val) + TARGET_DEFAULT_RETURN (false); virtual int save_trace_data (const char *filename) TARGET_DEFAULT_NORETURN (tcomplain ()); @@ -1028,9 +1028,9 @@ struct target_ops /* Add/change textual notes about the trace run, returning 1 if successful, 0 otherwise. */ - virtual int set_trace_notes (const char *user, const char *notes, - const char *stopnotes) - TARGET_DEFAULT_RETURN (0); + virtual bool set_trace_notes (const char *user, const char *notes, + const char *stopnotes) + TARGET_DEFAULT_RETURN (false); /* Return the processor core that thread PTID was last seen on. This information is updated only when: @@ -1052,7 +1052,7 @@ struct target_ops /* Return the address of the start of the Thread Information Block a Windows OS specific feature. */ - virtual int get_tib_address (ptid_t ptid, CORE_ADDR *addr) + virtual bool get_tib_address (ptid_t ptid, CORE_ADDR *addr) TARGET_DEFAULT_NORETURN (tcomplain ()); /* Send the new settings of write permission variables. */ @@ -1078,14 +1078,14 @@ struct target_ops virtual traceframe_info_up traceframe_info () TARGET_DEFAULT_NORETURN (tcomplain ()); - /* Ask the target to use or not to use agent according to USE. Return 1 - successful, 0 otherwise. */ - virtual int use_agent (int use) + /* Ask the target to use or not to use agent according to USE. + Return true if successful, false otherwise. */ + virtual bool use_agent (bool use) TARGET_DEFAULT_NORETURN (tcomplain ()); /* Is the target able to use agent in current state? */ - virtual int can_use_agent () - TARGET_DEFAULT_RETURN (0); + virtual bool can_use_agent () + TARGET_DEFAULT_RETURN (false); /* Enable branch tracing for PTID using CONF configuration. Return a branch trace target information struct for reading and for @@ -1140,13 +1140,13 @@ struct target_ops TARGET_DEFAULT_NORETURN (tcomplain ()); /* Query if the record target is currently replaying PTID. */ - virtual int record_is_replaying (ptid_t ptid) - TARGET_DEFAULT_RETURN (0); + virtual bool record_is_replaying (ptid_t ptid) + TARGET_DEFAULT_RETURN (false); /* Query if the record target will replay PTID if it were resumed in execution direction DIR. */ - virtual int record_will_replay (ptid_t ptid, int dir) - TARGET_DEFAULT_RETURN (0); + virtual bool record_will_replay (ptid_t ptid, int dir) + TARGET_DEFAULT_RETURN (false); /* Stop replaying. */ virtual void record_stop_replaying () @@ -1203,10 +1203,10 @@ struct target_ops virtual void call_history_range (ULONGEST begin, ULONGEST end, record_print_flags flags) TARGET_DEFAULT_NORETURN (tcomplain ()); - /* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a + /* True if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a non-empty annex. */ - virtual int augmented_libraries_svr4_read () - TARGET_DEFAULT_RETURN (0); + virtual bool augmented_libraries_svr4_read () + TARGET_DEFAULT_RETURN (false); /* Those unwinders are tried before any other arch unwinders. If SELF doesn't have unwinders, it should delegate to the @@ -2481,19 +2481,19 @@ public: return NULL; } - int has_registers () override + bool has_registers () override { - return 1; + return true; } - int has_stack () override + bool has_stack () override { - return 1; + return true; } - int has_memory () override + bool has_memory () override { - return 1; + return true; } void prepare_to_store (regcache *regs) override diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index af8e3bd..d224ad9 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -67,7 +67,7 @@ Use a trace file as a target. Specify the filename of the trace file."); void files_info () override; int trace_find (enum trace_find_type type, int num, CORE_ADDR addr1, CORE_ADDR addr2, int *tpp) override; - int get_trace_state_variable_value (int tsv, LONGEST *val) override; + bool get_trace_state_variable_value (int tsv, LONGEST *val) override; traceframe_info_up traceframe_info () override; void get_tracepoint_status (struct breakpoint *tp, @@ -1033,11 +1033,11 @@ tfile_target::xfer_partial (enum target_object object, /* Iterate through the blocks of a trace frame, looking for a 'V' block with a matching tsv number. */ -int +bool tfile_target::get_trace_state_variable_value (int tsvnum, LONGEST *val) { int pos; - int found = 0; + bool found = false; /* Iterate over blocks in current frame and find the last 'V' block in which tsv number is TSVNUM. In one trace frame, there @@ -1058,7 +1058,7 @@ tfile_target::get_trace_state_variable_value (int tsvnum, LONGEST *val) *val = extract_signed_integer ((gdb_byte *) val, 8, gdbarch_byte_order (target_gdbarch ())); - found = 1; + found = true; } pos += (4 + 8); } diff --git a/gdb/tracefile.c b/gdb/tracefile.c index 9c9c753..f7e69f2 100644 --- a/gdb/tracefile.c +++ b/gdb/tracefile.c @@ -425,7 +425,7 @@ tracefile_fetch_registers (struct regcache *regcache, int regno) /* This is the implementation of target_ops method to_has_all_memory. */ -int +bool tracefile_target::has_all_memory () { return 1; @@ -433,7 +433,7 @@ tracefile_target::has_all_memory () /* This is the implementation of target_ops method to_has_memory. */ -int +bool tracefile_target::has_memory () { return 1; @@ -443,7 +443,7 @@ tracefile_target::has_memory () The target has a stack when GDB has already selected one trace frame. */ -int +bool tracefile_target::has_stack () { return get_traceframe_number () != -1; @@ -453,7 +453,7 @@ tracefile_target::has_stack () The target has registers when GDB has already selected one trace frame. */ -int +bool tracefile_target::has_registers () { return get_traceframe_number () != -1; @@ -462,7 +462,7 @@ tracefile_target::has_registers () /* This is the implementation of target_ops method to_thread_alive. tracefile has one thread faked by GDB. */ -int +bool tracefile_target::thread_alive (ptid_t ptid) { return 1; diff --git a/gdb/tracefile.h b/gdb/tracefile.h index accd038..47f8bee 100644 --- a/gdb/tracefile.h +++ b/gdb/tracefile.h @@ -122,11 +122,11 @@ public: tracefile_target (); int get_trace_status (trace_status *ts) override; - int has_all_memory () override; - int has_memory () override; - int has_stack () override; - int has_registers () override; - int thread_alive (ptid_t ptid) override; + bool has_all_memory () override; + bool has_memory () override; + bool has_stack () override; + bool has_registers () override; + bool thread_alive (ptid_t ptid) override; }; extern void tracefile_fetch_registers (struct regcache *regcache, int regno); diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 589ef47..f5a66c1 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -333,7 +333,7 @@ struct windows_nat_target final : public x86_nat_target void mourn_inferior () override; - int thread_alive (ptid_t ptid) override; + bool thread_alive (ptid_t ptid) override; const char *pid_to_str (ptid_t) override; @@ -343,7 +343,7 @@ struct windows_nat_target final : public x86_nat_target ptid_t get_ada_task_ptid (long lwp, long thread) override; - int get_tib_address (ptid_t ptid, CORE_ADDR *addr) override; + bool get_tib_address (ptid_t ptid, CORE_ADDR *addr) override; const char *thread_name (struct thread_info *) override; }; @@ -2975,19 +2975,19 @@ windows_nat_target::xfer_partial (enum target_object object, /* Provide thread local base, i.e. Thread Information Block address. Returns 1 if ptid is found and sets *ADDR to thread_local_base. */ -int +bool windows_nat_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr) { windows_thread_info *th; th = thread_rec (ptid_get_tid (ptid), 0); if (th == NULL) - return 0; + return false; if (addr != NULL) *addr = th->thread_local_base; - return 1; + return true; } ptid_t @@ -3156,7 +3156,7 @@ cygwin_get_dr7 (void) by "polling" it. If WaitForSingleObject returns WAIT_OBJECT_0 it means that the thread has died. Otherwise it is assumed to be alive. */ -int +bool windows_nat_target::thread_alive (ptid_t ptid) { int tid; @@ -3164,8 +3164,7 @@ windows_nat_target::thread_alive (ptid_t ptid) gdb_assert (ptid_get_tid (ptid) != 0); tid = ptid_get_tid (ptid); - return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) == WAIT_OBJECT_0 - ? FALSE : TRUE; + return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) != WAIT_OBJECT_0; } void diff --git a/gdb/x86-linux-nat.h b/gdb/x86-linux-nat.h index 0bafaaa..7cbb271 100644 --- a/gdb/x86-linux-nat.h +++ b/gdb/x86-linux-nat.h @@ -47,16 +47,16 @@ struct x86_linux_nat_target : public x86_nat_target stopped-by-watchpoint info as soon as an lwp stops (via the low_ methods) and caches the result, to be returned via the normal non-low methods. */ - int stopped_by_watchpoint () override + bool stopped_by_watchpoint () override { return linux_nat_target::stopped_by_watchpoint (); } - int stopped_data_address (CORE_ADDR *addr_p) override + bool stopped_data_address (CORE_ADDR *addr_p) override { return linux_nat_target::stopped_data_address (addr_p); } - int low_stopped_by_watchpoint () override + bool low_stopped_by_watchpoint () override { return x86_nat_target::stopped_by_watchpoint (); } - int low_stopped_data_address (CORE_ADDR *addr_p) override + bool low_stopped_data_address (CORE_ADDR *addr_p) override { return x86_nat_target::stopped_data_address (addr_p); } }; diff --git a/gdb/x86-nat.h b/gdb/x86-nat.h index 8ad1821..cc27fa4 100644 --- a/gdb/x86-nat.h +++ b/gdb/x86-nat.h @@ -103,16 +103,16 @@ struct x86_nat_target : public BaseTarget struct bp_target_info *bp_tgt) override { return x86_remove_hw_breakpoint (gdbarch, bp_tgt); } - int stopped_by_watchpoint () override + bool stopped_by_watchpoint () override { return x86_stopped_by_watchpoint (); } - int stopped_data_address (CORE_ADDR *addr_p) override + bool stopped_data_address (CORE_ADDR *addr_p) override { return x86_stopped_data_address (addr_p); } /* A target must provide an implementation of the "supports_stopped_by_hw_breakpoint" target method before this callback will be used. */ - int stopped_by_hw_breakpoint () override + bool stopped_by_hw_breakpoint () override { return x86_stopped_by_hw_breakpoint (); } }; -- cgit v1.1