#include "elf/common.h"
#include "elf/s390.h"
#include "elf-bfd.h"
+#include <algorithm>
#include "features/s390-linux32.c"
#include "features/s390-linux32v1.c"
process about 4kiB of it each time, leading to O(n**2) memory and time
complexity. */
-static int
+static VEC (CORE_ADDR) *
s390_software_single_step (struct frame_info *frame)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len;
uint16_t insn;
+ VEC (CORE_ADDR) *next_pcs = NULL;
/* Special handling only if recording. */
if (!record_full_is_used ())
- return 0;
+ return NULL;
/* First, match a partial instruction. */
if (!s390_is_partial_instruction (gdbarch, loc, &len))
- return 0;
+ return NULL;
loc += len;
/* Second, look for a branch back to it. */
insn = read_memory_integer (loc, 2, byte_order);
if (insn != 0xa714) /* BRC with mask 1 */
- return 0;
+ return NULL;
insn = read_memory_integer (loc + 2, 2, byte_order);
if (insn != (uint16_t) -(len / 2))
- return 0;
+ return NULL;
loc += 4;
/* Found it, step past the whole thing. */
+ VEC_safe_push (CORE_ADDR, next_pcs, loc);
- insert_single_step_breakpoint (gdbarch, aspace, loc);
-
- return 1;
+ return next_pcs;
}
static int
cb (".reg-s390-last-break", 8,
(gdbarch_ptr_bit (gdbarch) == 32
? &s390_last_break_regset : &s390x_last_break_regset),
- "s930 last-break address", cb_data);
+ "s390 last-break address", cb_data);
if (tdep->have_linux_v2)
cb (".reg-s390-system-call", 4, &s390_system_call_regset,
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
}
skip_pc = s390_analyze_prologue (gdbarch, pc, (CORE_ADDR)-1, &data);
/* Breakpoints. */
+constexpr gdb_byte s390_break_insn[] = { 0x0, 0x1 };
-static const gdb_byte *
-s390_breakpoint_from_pc (struct gdbarch *gdbarch,
- CORE_ADDR *pcptr, int *lenptr)
-{
- static const gdb_byte breakpoint[] = { 0x0, 0x1 };
-
- *lenptr = sizeof (breakpoint);
- return breakpoint;
-}
-
+typedef BP_MANIPULATION (s390_break_insn) s390_breakpoint;
/* Address handling. */
set_gdbarch_decr_pc_after_break (gdbarch, 2);
/* Stack grows downward. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, s390_breakpoint_from_pc);
+ set_gdbarch_breakpoint_kind_from_pc (gdbarch, s390_breakpoint::kind_from_pc);
+ set_gdbarch_sw_breakpoint_from_kind (gdbarch, s390_breakpoint::bp_from_kind);
set_gdbarch_software_single_step (gdbarch, s390_software_single_step);
set_gdbarch_displaced_step_hw_singlestep (gdbarch, s390_displaced_step_hw_singlestep);
set_gdbarch_skip_prologue (gdbarch, s390_skip_prologue);