diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 0ecc3e0c0f2..5904e65f3bc 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -171,7 +171,7 @@ static const char *const aarch64_gcs_linux_register_names[] = { "gcs_features_locked", }; -static int aarch64_stack_frame_destroyed_p (struct gdbarch *, CORE_ADDR); +static bool aarch64_stack_frame_destroyed_p (struct gdbarch *, CORE_ADDR); /* AArch64 prologue cache structure. */ struct aarch64_prologue_cache @@ -4157,25 +4157,25 @@ aarch64_cannot_store_register (struct gdbarch *gdbarch, int regnum) /* Implement the stack_frame_destroyed_p gdbarch method. */ -static int +static bool aarch64_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR func_start, func_end; if (!find_pc_partial_function (pc, NULL, &func_start, &func_end)) - return 0; + return false; enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch); ULONGEST insn_from_memory; if (!safe_read_memory_unsigned_integer (pc, 4, byte_order_for_code, &insn_from_memory)) - return 0; + return false; uint32_t insn = insn_from_memory; aarch64_inst inst; if (aarch64_decode_insn (insn, &inst, 1, nullptr) != 0) - return 0; + return false; return streq (inst.opcode->name, "ret"); } diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 66411b48777..25889603620 100755 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -3197,7 +3197,7 @@ static const struct frame_base amd64_frame_base = /* Implement core of the stack_frame_destroyed_p gdbarch method. */ -static int +static bool amd64_stack_frame_destroyed_p_1 (struct gdbarch *gdbarch, CORE_ADDR pc) { gdb_byte insn; @@ -3211,12 +3211,12 @@ amd64_stack_frame_destroyed_p_1 (struct gdbarch *gdbarch, CORE_ADDR pc) return pc > epilogue; if (target_read_memory (pc, &insn, 1)) - return 0; /* Can't read memory at pc. */ + return false; /* Can't read memory at pc. */ if (insn != 0xc3) /* 'ret' instruction. */ - return 0; + return false; - return 1; + return true; } /* Normal frames, but in a function epilogue. */ @@ -3227,7 +3227,7 @@ amd64_stack_frame_destroyed_p_1 (struct gdbarch *gdbarch, CORE_ADDR pc) follow any instruction such as 'leave' or 'pop %ebp' that destroys the function's stack frame. */ -static int +static bool amd64_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { struct compunit_symtab *cust = find_compunit_symtab_for_pc (pc); @@ -3236,7 +3236,7 @@ amd64_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) && producer_is_llvm (cust->producer ())) return amd64_stack_frame_destroyed_p_1 (gdbarch, pc); - return 0; + return false; } static int diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 66a52bb8e51..af0ef8c7f1a 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -159,10 +159,10 @@ generic_in_solib_return_trampoline (struct gdbarch *gdbarch, return false; } -int +bool generic_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { - return 0; + return false; } bool diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 56d9b172f20..1849fe3b1c8 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -252,8 +252,8 @@ extern bool generic_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name); -extern int generic_stack_frame_destroyed_p (struct gdbarch *gdbarch, - CORE_ADDR pc); +extern bool generic_stack_frame_destroyed_p (struct gdbarch *gdbarch, + CORE_ADDR pc); extern bool default_code_of_frame_writable (struct gdbarch *gdbarch, const frame_info_ptr &frame); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 3a80b64804b..2435a5398b8 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -3262,10 +3262,10 @@ arm_epilogue_frame_prev_register (const frame_info_ptr &this_frame, return arm_prologue_prev_register (this_frame, this_cache, regnum); } -static int arm_stack_frame_destroyed_p_1 (struct gdbarch *gdbarch, - CORE_ADDR pc); -static int thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, - CORE_ADDR pc); +static bool arm_stack_frame_destroyed_p_1 (struct gdbarch *gdbarch, + CORE_ADDR pc); +static bool thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, + CORE_ADDR pc); /* Implementation of function hook 'sniffer' in 'struct frame_uwnind' for epilogue unwinder. */ @@ -4126,18 +4126,19 @@ arm_dwarf2_prev_register (const frame_info_ptr &this_frame, void **this_cache, /* Implement the stack_frame_destroyed_p gdbarch method. */ -static int +static bool thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch); unsigned int insn, insn2; - int found_return = 0, found_stack_adjust = 0; + int found_return = 0; + bool found_stack_adjust = false; CORE_ADDR func_start, func_end; CORE_ADDR scan_pc; gdb_byte buf[4]; if (!find_pc_partial_function (pc, NULL, &func_start, &func_end)) - return 0; + return false; /* The epilogue is a sequence of instructions along the following lines: @@ -4204,7 +4205,7 @@ thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) } if (!found_return) - return 0; + return false; /* Since any instruction in the epilogue sequence, with the possible exception of return itself, updates the stack pointer, we need to @@ -4213,28 +4214,28 @@ thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) too much about false positives. */ if (pc - 4 < func_start) - return 0; + return false; if (target_read_memory (pc - 4, buf, 4)) - return 0; + return false; insn = extract_unsigned_integer (buf, 2, byte_order_for_code); insn2 = extract_unsigned_integer (buf + 2, 2, byte_order_for_code); if (thumb_instruction_restores_sp (insn2)) - found_stack_adjust = 1; + found_stack_adjust = true; else if (insn == 0xe8bd) /* ldm.w sp!, */ - found_stack_adjust = 1; + found_stack_adjust = true; else if (insn == 0xf85d /* ldr.w , [sp], #4 */ && (insn2 & 0x0fff) == 0x0b04) - found_stack_adjust = 1; + found_stack_adjust = true; else if ((insn & 0xffbf) == 0xecbd /* vldm sp!, */ && (insn2 & 0x0e00) == 0x0a00) - found_stack_adjust = 1; + found_stack_adjust = true; return found_stack_adjust; } -static int +static bool arm_stack_frame_destroyed_p_1 (struct gdbarch *gdbarch, CORE_ADDR pc) { enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch); @@ -4285,7 +4286,7 @@ arm_stack_frame_destroyed_p_1 (struct gdbarch *gdbarch, CORE_ADDR pc) /* Implement the stack_frame_destroyed_p gdbarch method. */ -static int +static bool arm_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { if (arm_pc_is_thumb (gdbarch, pc)) diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c index da9cdc6e535..a6f03add248 100644 --- a/gdb/csky-tdep.c +++ b/gdb/csky-tdep.c @@ -1939,7 +1939,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch, /* Detect whether PC is at a point where the stack frame has been destroyed. */ -static int +static bool csky_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { unsigned int insn; @@ -1947,7 +1947,7 @@ csky_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) CORE_ADDR func_start, func_end; if (!find_pc_partial_function (pc, NULL, &func_start, &func_end)) - return 0; + return false; bool fp_saved = false; int insn_len; @@ -1967,7 +1967,7 @@ csky_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) return pc >= addr; } } - return 0; + return false; } /* Implement the skip_prologue gdbarch hook. */ diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c index ab786ba6eb4..1239e8e6daa 100644 --- a/gdb/gdbarch-gen.c +++ b/gdb/gdbarch-gen.c @@ -3352,7 +3352,7 @@ set_gdbarch_in_indirect_branch_thunk (struct gdbarch *gdbarch, gdbarch->in_indirect_branch_thunk = in_indirect_branch_thunk; } -int +bool gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr) { gdb_assert (gdbarch != NULL); diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h index 601d327396a..89f15a7a31a 100644 --- a/gdb/gdbarch-gen.h +++ b/gdb/gdbarch-gen.h @@ -819,15 +819,15 @@ extern void set_gdbarch_in_indirect_branch_thunk (struct gdbarch *gdbarch, gdbar /* A target might have problems with watchpoints as soon as the stack frame of the current function has been destroyed. This mostly happens as the first action in a function's epilogue. stack_frame_destroyed_p() - is defined to return a non-zero value if either the given addr is one + is defined to return true if either the given addr is one instruction after the stack destroying instruction up to the trailing return instruction or if we can figure out that the stack frame has already been invalidated regardless of the value of addr. Targets which don't suffer from that problem could just let this functionality untouched. */ -typedef int (gdbarch_stack_frame_destroyed_p_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); -extern int gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr); +typedef bool (gdbarch_stack_frame_destroyed_p_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); +extern bool gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr); extern void set_gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, gdbarch_stack_frame_destroyed_p_ftype *stack_frame_destroyed_p); /* Process an ELF symbol in the minimal symbol table in a backend-specific diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py index b1b0f79adc8..ef3603504f8 100644 --- a/gdb/gdbarch_components.py +++ b/gdb/gdbarch_components.py @@ -1433,14 +1433,14 @@ Method( A target might have problems with watchpoints as soon as the stack frame of the current function has been destroyed. This mostly happens as the first action in a function's epilogue. stack_frame_destroyed_p() -is defined to return a non-zero value if either the given addr is one +is defined to return true if either the given addr is one instruction after the stack destroying instruction up to the trailing return instruction or if we can figure out that the stack frame has already been invalidated regardless of the value of addr. Targets which don't suffer from that problem could just let this functionality untouched. """, - type="int", + type="bool", name="stack_frame_destroyed_p", params=[("CORE_ADDR", "addr")], predefault="generic_stack_frame_destroyed_p", diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 7cd6f2c11b6..302511b604f 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -558,7 +558,7 @@ find_unwind_entry (CORE_ADDR pc) We do not assume that the epilogue is at the end of a function as we can also have return sequences in the middle of a function. */ -static int +static bool hppa_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -568,7 +568,7 @@ hppa_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) status = target_read_memory (pc, buf, 4); if (status != 0) - return 0; + return false; inst = extract_unsigned_integer (buf, 4, byte_order); @@ -576,19 +576,19 @@ hppa_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) We are destroying a stack frame if the offset is negative. */ if ((inst & 0xffffc000) == 0x37de0000 && hppa_extract_14 (inst) < 0) - return 1; + return true; /* ldw,mb D(sp),X or ldd,mb D(sp),X */ if (((inst & 0x0fc010e0) == 0x0fc010e0 || (inst & 0x0fc010e0) == 0x0fc010e0) && hppa_extract_14 (inst) < 0) - return 1; + return true; /* bv %r0(%rp) or bv,n %r0(%rp) */ if (inst == 0xe840c000 || inst == 0xe840c002) - return 1; + return true; - return 0; + return false; } constexpr gdb_byte hppa_break_insn[] = {0x00, 0x01, 0x00, 0x04}; diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 8200683a6b7..4ef9837570b 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2132,17 +2132,17 @@ static const struct frame_unwind_legacy i386_frame_unwind ( follow any instruction such as 'leave' or 'pop %ebp' that destroys the function's stack frame. */ -static int +static bool i386_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { gdb_byte insn; if (target_read_memory (pc, &insn, 1)) - return 0; /* Can't read memory at pc. */ + return false; /* Can't read memory at pc. */ if (insn != 0xc3) /* 'ret' instruction. */ - return 0; + return false; - return 1; + return true; } static int diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 3678e4dfbb1..27ac746bcf9 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -6730,7 +6730,7 @@ mips_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) /* Implement the stack_frame_destroyed_p gdbarch method (32-bit version). This is a helper function for mips_stack_frame_destroyed_p. */ -static int +static bool mips32_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR func_addr = 0, func_end = 0; @@ -6743,7 +6743,7 @@ mips32_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) if (addr < func_addr + 4) addr = func_addr + 4; if (pc < addr) - return 0; + return false; for (; pc < func_end; pc += MIPS_INSN32_SIZE) { @@ -6757,19 +6757,19 @@ mips32_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) && high_word != 0x67bd /* daddiu $sp,$sp,offset */ && inst != 0x03e00008 /* jr $ra */ && inst != 0x00000000) /* nop */ - return 0; + return false; } - return 1; + return true; } - return 0; + return false; } /* Implement the stack_frame_destroyed_p gdbarch method (microMIPS version). This is a helper function for mips_stack_frame_destroyed_p. */ -static int +static bool micromips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR func_addr = 0; @@ -6782,7 +6782,7 @@ micromips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) int loc; if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end)) - return 0; + return false; /* The microMIPS epilogue is max. 12 bytes long. */ addr = func_end - 12; @@ -6790,7 +6790,7 @@ micromips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) if (addr < func_addr + 2) addr = func_addr + 2; if (pc < addr) - return 0; + return false; for (; pc < func_end; pc += loc) { @@ -6816,10 +6816,10 @@ micromips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) /* (D)ADDIU $sp, imm */ && offset >= 0) break; - return 0; + return false; default: - return 0; + return false; } break; @@ -6833,7 +6833,7 @@ micromips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) if (sreg == 0 && dreg == 0) /* MOVE $zero, $zero aka NOP */ break; - return 0; + return false; case 0x11: /* POOL16C: bits 010001 */ if (b5s5_op (insn) == 0x18 @@ -6843,7 +6843,7 @@ micromips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) && b0s5_reg (insn) == MIPS_RA_REGNUM)) /* JRC $ra */ break; - return 0; + return false; case 0x13: /* POOL16D: bits 010011 */ offset = micromips_decode_imm9 (b1s9_imm (insn)); @@ -6851,21 +6851,21 @@ micromips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) /* ADDIUSP: bits 010011 1 */ && offset > 0) break; - return 0; + return false; default: - return 0; + return false; } } } - return 1; + return true; } /* Implement the stack_frame_destroyed_p gdbarch method (16-bit version). This is a helper function for mips_stack_frame_destroyed_p. */ -static int +static bool mips16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR func_addr = 0, func_end = 0; @@ -6878,7 +6878,7 @@ mips16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) if (addr < func_addr + 4) addr = func_addr + 4; if (pc < addr) - return 0; + return false; for (; pc < func_end; pc += MIPS_INSN16_SIZE) { @@ -6894,13 +6894,13 @@ mips16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) && inst != 0xe820 /* jr $ra */ && inst != 0xe8a0 /* jrc $ra */ && inst != 0x6500) /* nop */ - return 0; + return false; } - return 1; + return true; } - return 0; + return false; } /* Implement the stack_frame_destroyed_p gdbarch method. @@ -6908,7 +6908,7 @@ mips16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) The epilogue is defined here as the area at the end of a function, after an instruction which destroys the function's stack frame. */ -static int +static bool mips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { if (mips_pc_is_mips16 (gdbarch, pc)) diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c index 4278c92d5f3..e2efe4fcdda 100644 --- a/gdb/nds32-tdep.c +++ b/gdb/nds32-tdep.c @@ -1217,7 +1217,7 @@ nds32_analyze_epilogue (struct gdbarch *gdbarch, CORE_ADDR pc, /* Implement the "stack_frame_destroyed_p" gdbarch method. */ -static int +static bool nds32_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr) { nds32_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -1243,13 +1243,13 @@ nds32_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr) } if (insn_type == INSN_NORMAL || insn_type == INSN_RESET_SP) - return 0; + return false; /* Search the required 'return' instruction within the following reasonable instructions. */ ret_found = nds32_analyze_epilogue (gdbarch, addr, NULL); if (ret_found == 0) - return 0; + return false; /* Scan backwards to make sure that the last instruction has adjusted stack. Both a 16-bit and a 32-bit instruction will be tried. This is @@ -1263,7 +1263,7 @@ nds32_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr) insn_type = nds32_analyze_epilogue_insn16 (insn >> 16, NULL); if (insn_type == INSN_RECOVER) - return 1; + return true; } insn = read_memory_unsigned_integer (addr - 4, 4, BFD_ENDIAN_BIG); @@ -1277,10 +1277,10 @@ nds32_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr) insn_type = nds32_analyze_epilogue_insn32 (abi_use_fpr, insn, NULL); if (insn_type == INSN_RECOVER || insn_type == INSN_RESET_SP) - return 1; + return true; } - return 0; + return false; } /* Implement the "sniffer" frame_unwind method. */ diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 1d9ff3d84c6..f6b8963b9cc 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -802,7 +802,7 @@ rs6000_in_function_epilogue_frame_p (const frame_info_ptr &curfrm, /* Implement the stack_frame_destroyed_p gdbarch method. */ -static int +static bool rs6000_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { return rs6000_in_function_epilogue_frame_p (get_current_frame (), diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 3c36ab12acb..5b17d5da89b 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -2206,7 +2206,7 @@ s390_get_return_buf_addr (struct type *val_type, /* Implement the stack_frame_destroyed_p gdbarch method. */ -static int +static bool s390_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { int word_size = gdbarch_ptr_bit (gdbarch) / 8; @@ -2238,21 +2238,21 @@ s390_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) && !target_read_memory (pc - 4, insn, 4) && is_rs (insn, op_lm, &r1, &r3, &d2, &b2) && r3 == S390_SP_REGNUM - S390_R0_REGNUM) - return 1; + return true; if (word_size == 4 && !target_read_memory (pc - 6, insn, 6) && is_rsy (insn, op1_lmy, op2_lmy, &r1, &r3, &d2, &b2) && r3 == S390_SP_REGNUM - S390_R0_REGNUM) - return 1; + return true; if (word_size == 8 && !target_read_memory (pc - 6, insn, 6) && is_rsy (insn, op1_lmg, op2_lmg, &r1, &r3, &d2, &b2) && r3 == S390_SP_REGNUM - S390_R0_REGNUM) - return 1; + return true; - return 0; + return false; } /* Implement unwind_pc gdbarch method. */ diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 251d58ff76e..c74114b2687 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2033,7 +2033,7 @@ static const struct frame_unwind_legacy sh_stub_unwind ( either on the `ret' instruction itself or after an instruction which destroys the function's stack frame. */ -static int +static bool sh_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -2050,14 +2050,14 @@ sh_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) if (addr < func_addr + 4) addr = func_addr + 4; if (pc < addr) - return 0; + return false; /* First search forward until hitting an rts. */ while (addr < func_end && !IS_RTS (read_memory_unsigned_integer (addr, 2, byte_order))) addr += 2; if (addr >= func_end) - return 0; + return false; /* At this point we should find a mov.l @r15+,r14 instruction, either before or after the rts. If not, then the function has @@ -2068,7 +2068,7 @@ sh_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) addr -= 2; else if (!IS_RESTORE_FP (read_memory_unsigned_integer (addr + 2, 2, byte_order))) - return 0; + return false; inst = read_memory_unsigned_integer (addr - 2, 2, byte_order); @@ -2112,9 +2112,9 @@ sh_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) addr -= 4; if (pc >= addr) - return 1; + return true; } - return 0; + return false; } diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index e495d13a904..b16af5953f7 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -550,7 +550,7 @@ sparc32_pseudo_register_write (struct gdbarch *gdbarch, /* Implement the stack_frame_destroyed_p gdbarch method. */ -int +bool sparc_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { /* This function must return true if we are one instruction after an diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h index cb766c8eaf7..4f5710ecfa8 100644 --- a/gdb/sparc-tdep.h +++ b/gdb/sparc-tdep.h @@ -212,10 +212,8 @@ extern struct sparc_frame_cache * extern struct sparc_frame_cache * sparc32_frame_cache (const frame_info_ptr &this_frame, void **this_cache); -extern int - sparc_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc); - - +extern bool sparc_stack_frame_destroyed_p (struct gdbarch *gdbarch, + CORE_ADDR pc); extern void sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum); diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c index 0fa66f49553..1730a75cd47 100644 --- a/gdb/tic6x-tdep.c +++ b/gdb/tic6x-tdep.c @@ -1080,7 +1080,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* This is the implementation of gdbarch method stack_frame_destroyed_p. */ -static int +static bool tic6x_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { unsigned long inst = tic6x_fetch_instruction (gdbarch, pc); @@ -1091,10 +1091,10 @@ tic6x_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) INST_S_BIT (inst), INST_X_BIT (inst)); if (src2 == TIC6X_RA_REGNUM) - return 1; + return true; } - return 0; + return false; } /* This is the implementation of gdbarch method get_longjmp_target. */ diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c index d2114c585c3..40a30ccc6bf 100644 --- a/gdb/tilegx-tdep.c +++ b/gdb/tilegx-tdep.c @@ -754,7 +754,7 @@ tilegx_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) /* This is the implementation of gdbarch method stack_frame_destroyed_p. */ -static int +static bool tilegx_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR func_addr = 0, func_end = 0; @@ -766,9 +766,9 @@ tilegx_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) /* FIXME: Find the actual epilogue. */ /* HACK: Just assume the final bundle is the "ret" instruction". */ if (pc > addr) - return 1; + return true; } - return 0; + return false; } /* This is the implementation of gdbarch method get_longjmp_target. */ diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index c8a613ff6d5..1916b8cfdfe 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -450,7 +450,7 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) either on the `ret' instruction itself or after an instruction which destroys the function's stack frame. */ -static int +static bool xstormy16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -463,14 +463,14 @@ xstormy16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) /* The Xstormy16 epilogue is max. 14 bytes long. */ if (pc < func_end - 7 * xstormy16_inst_size) - return 0; + return false; /* Check if we're on a `ret' instruction. Otherwise it's too dangerous to proceed. */ inst = read_memory_unsigned_integer (addr, xstormy16_inst_size, byte_order); if (inst != 0x0003) - return 0; + return false; while ((addr -= xstormy16_inst_size) >= func_addr) { @@ -489,12 +489,12 @@ xstormy16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) addr -= xstormy16_inst_size; break; } - return 0; + return false; } if (pc > addr) - return 1; + return true; } - return 0; + return false; } constexpr gdb_byte xstormy16_break_insn[] = { 0x06, 0x0 };