diff options
author | Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> | 2020-04-02 15:11:26 +0200 |
---|---|---|
committer | Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> | 2020-04-02 15:11:26 +0200 |
commit | d4807ea231eea599a474a9ad75a0552ef7217e1f (patch) | |
tree | 2ff3b7cae1f974e7f6a36f6a8323a551ac5fda32 | |
parent | 7582c77c1d2cab3f53b70697529c1644ceeb94a2 (diff) | |
download | gdb-d4807ea231eea599a474a9ad75a0552ef7217e1f.zip gdb-d4807ea231eea599a474a9ad75a0552ef7217e1f.tar.gz gdb-d4807ea231eea599a474a9ad75a0552ef7217e1f.tar.bz2 |
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.
-rw-r--r-- | gdbserver/ChangeLog | 47 | ||||
-rw-r--r-- | gdbserver/linux-aarch64-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-arm-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-bfin-low.cc | 9 | ||||
-rw-r--r-- | gdbserver/linux-cris-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-crisv32-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-low.cc | 10 | ||||
-rw-r--r-- | gdbserver/linux-low.h | 4 | ||||
-rw-r--r-- | gdbserver/linux-m32r-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-m68k-low.cc | 9 | ||||
-rw-r--r-- | gdbserver/linux-mips-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-nios2-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-ppc-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-riscv-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-s390-low.cc | 9 | ||||
-rw-r--r-- | gdbserver/linux-sh-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-sparc-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-tic6x-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-tile-low.cc | 1 | ||||
-rw-r--r-- | gdbserver/linux-x86-low.cc | 10 | ||||
-rw-r--r-- | gdbserver/linux-xtensa-low.cc | 1 |
21 files changed, 91 insertions, 21 deletions
diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index f9a3df2..4fc0609 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,5 +1,52 @@ 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 the concrete linux target define it by overriding the op in process_stratum_target. diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index 11c3296..988aa93 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -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, diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc index bd42feba..18f4272 100644 --- a/gdbserver/linux-arm-low.cc +++ b/gdbserver/linux-arm-low.cc @@ -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, diff --git a/gdbserver/linux-bfin-low.cc b/gdbserver/linux-bfin-low.cc index 17948ed..23d0342 100644 --- a/gdbserver/linux-bfin-low.cc +++ b/gdbserver/linux-bfin-low.cc @@ -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 */ diff --git a/gdbserver/linux-cris-low.cc b/gdbserver/linux-cris-low.cc index 99060de..5fb40bf 100644 --- a/gdbserver/linux-cris-low.cc +++ b/gdbserver/linux-cris-low.cc @@ -158,7 +158,6 @@ cris_target::get_regs_info () } struct linux_target_ops the_low_target = { - 0, cris_breakpoint_at, }; diff --git a/gdbserver/linux-crisv32-low.cc b/gdbserver/linux-crisv32-low.cc index c75e428..b55a017 100644 --- a/gdbserver/linux-crisv32-low.cc +++ b/gdbserver/linux-crisv32-low.cc @@ -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, diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index 8eca077..fd22578 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -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) { diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index 2202a65..5867960 100644 --- a/gdbserver/linux-low.h +++ b/gdbserver/linux-low.h @@ -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; diff --git a/gdbserver/linux-m32r-low.cc b/gdbserver/linux-m32r-low.cc index 78e002d..1d23438 100644 --- a/gdbserver/linux-m32r-low.cc +++ b/gdbserver/linux-m32r-low.cc @@ -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 */ diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc index 00851af..33e0d7b 100644 --- a/gdbserver/linux-m68k-low.cc +++ b/gdbserver/linux-m68k-low.cc @@ -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 */ diff --git a/gdbserver/linux-mips-low.cc b/gdbserver/linux-mips-low.cc index 710245c..82e141f 100644 --- a/gdbserver/linux-mips-low.cc +++ b/gdbserver/linux-mips-low.cc @@ -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, diff --git a/gdbserver/linux-nios2-low.cc b/gdbserver/linux-nios2-low.cc index 3cae8da..2544b49 100644 --- a/gdbserver/linux-nios2-low.cc +++ b/gdbserver/linux-nios2-low.cc @@ -277,7 +277,6 @@ nios2_target::get_regs_info () struct linux_target_ops the_low_target = { - 0, nios2_breakpoint_at, }; diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc index af9dc0b..e488b7d 100644 --- a/gdbserver/linux-ppc-low.cc +++ b/gdbserver/linux-ppc-low.cc @@ -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, diff --git a/gdbserver/linux-riscv-low.cc b/gdbserver/linux-riscv-low.cc index 9e96504..9f3ea59 100644 --- a/gdbserver/linux-riscv-low.cc +++ b/gdbserver/linux-riscv-low.cc @@ -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, }; diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc index 4c4b877..f944431 100644 --- a/gdbserver/linux-s390-low.cc +++ b/gdbserver/linux-s390-low.cc @@ -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, diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc index 47242da..77a4f10 100644 --- a/gdbserver/linux-sh-low.cc +++ b/gdbserver/linux-sh-low.cc @@ -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 */ diff --git a/gdbserver/linux-sparc-low.cc b/gdbserver/linux-sparc-low.cc index f724cb8..81eb362 100644 --- a/gdbserver/linux-sparc-low.cc +++ b/gdbserver/linux-sparc-low.cc @@ -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, diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc index 347b79e..51453c6 100644 --- a/gdbserver/linux-tic6x-low.cc +++ b/gdbserver/linux-tic6x-low.cc @@ -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 */ diff --git a/gdbserver/linux-tile-low.cc b/gdbserver/linux-tile-low.cc index 86191b9..53d39c4 100644 --- a/gdbserver/linux-tile-low.cc +++ b/gdbserver/linux-tile-low.cc @@ -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 */ diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index 59c6b38..eb36ace 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -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, diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc index 320ac92..606204b 100644 --- a/gdbserver/linux-xtensa-low.cc +++ b/gdbserver/linux-xtensa-low.cc @@ -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 */ |