gdbserver/linux-low: turn the 'decr_pc_after_break' field into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn the 'decr_pc_after_break' linux_target_ops field into
	a method of linux_process_target.

	* linux-low.h (struct linux_target_ops)
	<decr_pc_after_break>: Remove.
	(class linux_process_target) <low_decr_pc_after_break>: New method
	declaration.
	* linux-low.cc (linux_process_target::low_decr_pc_after_break):
	New method implementation.

	Update the users below.

	(linux_process_target::save_stop_reason)
	(linux_process_target::wait_1)
	* linux-x86-low.cc (class x86_target) <low_decr_pc_after_break>:
	New declaration.
	(x86_target::low_decr_pc_after_break): New method implementation.
	(the_low_target): Remove the field.
	* linux-bfin-low.cc (class bfin_target) <low_decr_pc_after_break>:
	New declaration.
	(bfin_target::low_decr_pc_after_break): New method implementation.
	(the_low_target): Remove the field.
	* linux-m68k-low.cc (class m68k_target) <low_decr_pc_after_break>:
	New declaration.
	(m68k_target::low_decr_pc_after_break): New method implementation.
	(the_low_target): Remove the field.
	* linux-s390-low.cc (class s390_target) <low_decr_pc_after_break>:
	New declaration.
	(s390_target::low_decr_pc_after_break): New method implementation.
	(the_low_target): Remove the field.
	* linux-aarch64-low.cc (the_low_target): Remove the field.
	* linux-arm-low.cc (the_low_target): Remove the field.
	* linux-cris-low.cc (the_low_target): Remove the field.
	* linux-crisv32-low.cc (the_low_target): Remove the field.
	* linux-m32r-low.cc (the_low_target): Remove the field.
	* linux-mips-low.cc (the_low_target): Remove the field.
	* linux-nios2-low.cc (the_low_target): Remove the field.
	* linux-ppc-low.cc (the_low_target): Remove the field.
	* linux-riscv-low.cc (the_low_target): Remove the field.
	* linux-sh-low.cc (the_low_target): Remove the field.
	* linux-sparc-low.cc (the_low_target): Remove the field.
	* linux-tic6x-low.cc (the_low_target): Remove the field.
	* linux-tile-low.cc (the_low_target): Remove the field.
	* linux-xtensa-low.cc (the_low_target): Remove the field.
This commit is contained in:
Tankut Baris Aktemur 2020-04-02 15:11:26 +02:00
parent 7582c77c1d
commit d4807ea231
21 changed files with 91 additions and 21 deletions

View File

@ -1,3 +1,50 @@
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'decr_pc_after_break' linux_target_ops field into
a method of linux_process_target.
* linux-low.h (struct linux_target_ops)
<decr_pc_after_break>: Remove.
(class linux_process_target) <low_decr_pc_after_break>: New method
declaration.
* linux-low.cc (linux_process_target::low_decr_pc_after_break):
New method implementation.
Update the users below.
(linux_process_target::save_stop_reason)
(linux_process_target::wait_1)
* linux-x86-low.cc (class x86_target) <low_decr_pc_after_break>:
New declaration.
(x86_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-bfin-low.cc (class bfin_target) <low_decr_pc_after_break>:
New declaration.
(bfin_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-m68k-low.cc (class m68k_target) <low_decr_pc_after_break>:
New declaration.
(m68k_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-s390-low.cc (class s390_target) <low_decr_pc_after_break>:
New declaration.
(s390_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-aarch64-low.cc (the_low_target): Remove the field.
* linux-arm-low.cc (the_low_target): Remove the field.
* linux-cris-low.cc (the_low_target): Remove the field.
* linux-crisv32-low.cc (the_low_target): Remove the field.
* linux-m32r-low.cc (the_low_target): Remove the field.
* linux-mips-low.cc (the_low_target): Remove the field.
* linux-nios2-low.cc (the_low_target): Remove the field.
* linux-ppc-low.cc (the_low_target): Remove the field.
* linux-riscv-low.cc (the_low_target): Remove the field.
* linux-sh-low.cc (the_low_target): Remove the field.
* linux-sparc-low.cc (the_low_target): Remove the field.
* linux-tic6x-low.cc (the_low_target): Remove the field.
* linux-tile-low.cc (the_low_target): Remove the field.
* linux-xtensa-low.cc (the_low_target): Remove the field.
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'supports_software_single_step' linux target op and let

View File

@ -3103,7 +3103,6 @@ aarch64_supports_hardware_single_step (void)
struct linux_target_ops the_low_target =
{
0, /* decr_pc_after_break */
aarch64_breakpoint_at,
aarch64_supports_z_point_type,
aarch64_insert_point,

View File

@ -1085,7 +1085,6 @@ arm_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
0,
arm_breakpoint_at,
arm_supports_z_point_type,
arm_insert_point,

View File

@ -46,6 +46,8 @@ protected:
CORE_ADDR low_get_pc (regcache *regcache) override;
void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
int low_decr_pc_after_break () override;
};
/* The singleton target ops object. */
@ -70,6 +72,12 @@ bfin_target::low_set_pc (regcache *regcache, CORE_ADDR pc)
linux_set_pc_32bit (regcache, pc);
}
int
bfin_target::low_decr_pc_after_break ()
{
return 2;
}
/* Defined in auto-generated file reg-bfin.c. */
void init_registers_bfin (void);
extern const struct target_desc *tdesc_bfin;
@ -161,7 +169,6 @@ bfin_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
2,
bfin_breakpoint_at,
NULL, /* supports_z_point_type */
NULL, /* insert_point */

View File

@ -158,7 +158,6 @@ cris_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
0,
cris_breakpoint_at,
};

View File

@ -455,7 +455,6 @@ crisv32_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
0,
cris_breakpoint_at,
cris_supports_z_point_type,
cris_insert_point,

View File

@ -317,6 +317,12 @@ linux_process_target::low_get_next_pcs (regcache *regcache)
"implemented");
}
int
linux_process_target::low_decr_pc_after_break ()
{
return 0;
}
/* Returns true if this target can support fast tracepoints. This
does not mean that the in-process agent has been loaded in the
inferior. */
@ -796,7 +802,7 @@ linux_process_target::save_stop_reason (lwp_info *lwp)
return false;
pc = get_pc (lwp);
sw_breakpoint_pc = pc - the_low_target.decr_pc_after_break;
sw_breakpoint_pc = pc - low_decr_pc_after_break ();
/* breakpoint_at reads from the current thread. */
saved_thread = current_thread;
@ -3694,7 +3700,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
if (event_child->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT
&& !cs.swbreak_feature)
{
int decr_pc = the_low_target.decr_pc_after_break;
int decr_pc = low_decr_pc_after_break ();
if (decr_pc != 0)
{

View File

@ -131,7 +131,6 @@ struct lwp_info;
struct linux_target_ops
{
int decr_pc_after_break;
int (*breakpoint_at) (CORE_ADDR pc);
/* Breakpoint and watchpoint related functions. See target.h for
@ -666,6 +665,9 @@ protected:
Targets that override this method should also override
'supports_software_single_step' to return true. */
virtual std::vector<CORE_ADDR> low_get_next_pcs (regcache *regcache);
/* How many bytes the PC should be decremented after a break. */
virtual int low_decr_pc_after_break ();
};
extern linux_process_target *the_linux_target;

View File

@ -160,7 +160,6 @@ m32r_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
0,
m32r_breakpoint_at,
NULL, /* supports_z_point_type */
NULL, /* insert_point */

View File

@ -42,6 +42,8 @@ protected:
CORE_ADDR low_get_pc (regcache *regcache) override;
void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
int low_decr_pc_after_break () override;
};
/* The singleton target ops object. */
@ -66,6 +68,12 @@ m68k_target::low_set_pc (regcache *regcache, CORE_ADDR pc)
linux_set_pc_32bit (regcache, pc);
}
int
m68k_target::low_decr_pc_after_break ()
{
return 2;
}
/* Defined in auto-generated file reg-m68k.c. */
void init_registers_m68k (void);
extern const struct target_desc *tdesc_m68k;
@ -255,7 +263,6 @@ m68k_supports_hardware_single_step (void)
}
struct linux_target_ops the_low_target = {
2,
m68k_breakpoint_at,
NULL, /* supports_z_point_type */
NULL, /* insert_point */

View File

@ -966,7 +966,6 @@ mips_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
0,
mips_breakpoint_at,
mips_supports_z_point_type,
mips_insert_point,

View File

@ -277,7 +277,6 @@ nios2_target::get_regs_info ()
struct linux_target_ops the_low_target =
{
0,
nios2_breakpoint_at,
};

View File

@ -3406,7 +3406,6 @@ ppc_get_ipa_tdesc_idx (void)
}
struct linux_target_ops the_low_target = {
0,
ppc_breakpoint_at,
ppc_supports_z_point_type,
ppc_insert_point,

View File

@ -309,7 +309,6 @@ riscv_breakpoint_at (CORE_ADDR pc)
/* RISC-V/Linux target operations. */
struct linux_target_ops the_low_target =
{
0, /* decr_pc_after_break */
riscv_breakpoint_at,
};

View File

@ -74,6 +74,8 @@ protected:
CORE_ADDR low_get_pc (regcache *regcache) override;
void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
int low_decr_pc_after_break () override;
};
/* The singleton target ops object. */
@ -502,6 +504,12 @@ s390_target::low_set_pc (regcache *regcache, CORE_ADDR newpc)
}
}
int
s390_target::low_decr_pc_after_break ()
{
return s390_breakpoint_len;
}
/* Determine the word size for the given PID, in bytes. */
#ifdef __s390x__
@ -2826,7 +2834,6 @@ s390_emit_ops (void)
}
struct linux_target_ops the_low_target = {
s390_breakpoint_len,
s390_breakpoint_at,
s390_supports_z_point_type,
NULL,

View File

@ -190,7 +190,6 @@ sh_target::low_arch_setup ()
}
struct linux_target_ops the_low_target = {
0,
sh_breakpoint_at,
NULL, /* supports_z_point_type */
NULL, /* insert_point */

View File

@ -339,7 +339,6 @@ sparc_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
0,
sparc_breakpoint_at,
NULL, /* supports_z_point_type */
NULL, NULL, NULL, NULL,

View File

@ -421,7 +421,6 @@ tic6x_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
0,
tic6x_breakpoint_at,
NULL, /* supports_z_point_type */
NULL, /* insert_point */

View File

@ -222,7 +222,6 @@ tile_supports_hardware_single_step (void)
struct linux_target_ops the_low_target =
{
0,
tile_breakpoint_at,
NULL, /* supports_z_point_type */
NULL, /* insert_point */

View File

@ -121,6 +121,8 @@ protected:
CORE_ADDR low_get_pc (regcache *regcache) override;
void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
int low_decr_pc_after_break () override;
};
/* The singleton target ops object. */
@ -547,6 +549,13 @@ x86_target::low_set_pc (regcache *regcache, CORE_ADDR pc)
supply_register_by_name (regcache, "eip", &newpc);
}
}
int
x86_target::low_decr_pc_after_break ()
{
return 1;
}
static const gdb_byte x86_breakpoint[] = { 0xCC };
#define x86_breakpoint_len 1
@ -2899,7 +2908,6 @@ x86_get_ipa_tdesc_idx (void)
struct linux_target_ops the_low_target =
{
1,
x86_breakpoint_at,
x86_supports_z_point_type,
x86_insert_point,

View File

@ -328,7 +328,6 @@ xtensa_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
0,
xtensa_breakpoint_at,
NULL, /* supports_z_point_type */
NULL, /* insert_point */