diff options
author | Chris Packham <judge.packham@gmail.com> | 2021-09-15 08:20:47 (GMT) |
---|---|---|
committer | Chris Packham <judge.packham@gmail.com> | 2021-09-15 08:20:57 (GMT) |
commit | f7e3d756271001782dafcffc311e76f146334993 (patch) | |
tree | 066ff738b0063888f411241e75534cb9f5e84c91 /packages/gdb/10.2/0007-arc-Take-into-account-the-REGNUM-in-supply-collect-g.patch | |
parent | e5aaa1ca7a7876861d3b3900251c67d280bfafdf (diff) | |
parent | 8099a7475083e04429990c53cd490cda9eb63d68 (diff) |
Merge branch 'gdb10-arc-fixes' of https://github.com/foss-for-synopsys-dwc-arc-processors/crosstool-ng
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Diffstat (limited to 'packages/gdb/10.2/0007-arc-Take-into-account-the-REGNUM-in-supply-collect-g.patch')
-rw-r--r-- | packages/gdb/10.2/0007-arc-Take-into-account-the-REGNUM-in-supply-collect-g.patch | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/packages/gdb/10.2/0007-arc-Take-into-account-the-REGNUM-in-supply-collect-g.patch b/packages/gdb/10.2/0007-arc-Take-into-account-the-REGNUM-in-supply-collect-g.patch new file mode 100644 index 0000000..98a889f --- /dev/null +++ b/packages/gdb/10.2/0007-arc-Take-into-account-the-REGNUM-in-supply-collect-g.patch @@ -0,0 +1,110 @@ +From 7cf6f67aee277a37a7c648ca41a46a2c04aec2ed Mon Sep 17 00:00:00 2001 +From: Shahab Vahedi <shahab@synopsys.com> +Date: Tue, 10 Nov 2020 19:34:57 +0100 +Subject: [PATCH 08/20] arc: Take into account the REGNUM in supply/collect gdb + hooks + +All the arc_linux_supply_*() target operations and the +arc_linux_collect_v2_regset() in arc-linux-tdep.c were +supplying/collecting all the registers in regcache as if the +REGNUM was set to -1. + +The more efficient behavior is to examine the REGNUM and act +accordingly. That is what this patch does. + +gdb/ChangeLog: + + * arc-linux-tdep.c (supply_register): New. + (arc_linux_supply_gregset, arc_linux_supply_v2_regset, + arc_linux_collect_v2_regset): Consider REGNUM. + +Will be a part of GDB 11: +https://sourceware.org/git?p=binutils-gdb.git;a=commit;h=46023bbe81355230b4e7b76d3084337823d02362 +--- + gdb/ChangeLog | 6 ++++++ + gdb/arc-linux-tdep.c | 41 ++++++++++++++++++++++++++++++++--------- + 2 files changed, 38 insertions(+), 9 deletions(-) + +--- a/gdb/ChangeLog ++++ b/gdb/ChangeLog +@@ -1,3 +1,9 @@ ++2020-12-22 Shahab Vahedi <shahab@synopsys.com> ++ ++ * arc-linux-tdep.c (supply_register): New. ++ (arc_linux_supply_gregset, arc_linux_supply_v2_regset, ++ arc_linux_collect_v2_regset): Consider REGNUM. ++ + 2020-12-22 Anton Kolesov <anton.kolesov@synopsys.com> + + * arc-linux-tdep.c (arc_linux_sc_reg_offsets): New static variable. +--- a/gdb/arc-linux-tdep.c ++++ b/gdb/arc-linux-tdep.c +@@ -535,6 +535,18 @@ + } + } + ++/* Populate REGCACHE with register REGNUM from BUF. */ ++ ++static void ++supply_register (struct regcache *regcache, int regnum, const gdb_byte *buf) ++{ ++ /* Skip non-existing registers. */ ++ if ((arc_linux_core_reg_offsets[regnum] == ARC_OFFSET_NO_REGISTER)) ++ return; ++ ++ regcache->raw_supply (regnum, buf + arc_linux_core_reg_offsets[regnum]); ++} ++ + void + arc_linux_supply_gregset (const struct regset *regset, + struct regcache *regcache, +@@ -545,9 +557,14 @@ + + const bfd_byte *buf = (const bfd_byte *) gregs; + +- for (int reg = 0; reg <= ARC_LAST_REGNUM; reg++) +- if (arc_linux_core_reg_offsets[reg] != ARC_OFFSET_NO_REGISTER) +- regcache->raw_supply (reg, buf + arc_linux_core_reg_offsets[reg]); ++ /* regnum == -1 means writing all the registers. */ ++ if (regnum == -1) ++ for (int reg = 0; reg <= ARC_LAST_REGNUM; reg++) ++ supply_register (regcache, reg, buf); ++ else if (regnum <= ARC_LAST_REGNUM) ++ supply_register (regcache, regnum, buf); ++ else ++ gdb_assert_not_reached ("Invalid regnum in arc_linux_supply_gregset."); + } + + void +@@ -558,9 +575,12 @@ + const bfd_byte *buf = (const bfd_byte *) v2_regs; + + /* user_regs_arcv2 is defined in linux arch/arc/include/uapi/asm/ptrace.h. */ +- regcache->raw_supply (ARC_R30_REGNUM, buf); +- regcache->raw_supply (ARC_R58_REGNUM, buf + REGOFF (1)); +- regcache->raw_supply (ARC_R59_REGNUM, buf + REGOFF (2)); ++ if (regnum == -1 || regnum == ARC_R30_REGNUM) ++ regcache->raw_supply (ARC_R30_REGNUM, buf); ++ if (regnum == -1 || regnum == ARC_R58_REGNUM) ++ regcache->raw_supply (ARC_R58_REGNUM, buf + REGOFF (1)); ++ if (regnum == -1 || regnum == ARC_R59_REGNUM) ++ regcache->raw_supply (ARC_R59_REGNUM, buf + REGOFF (2)); + } + + /* Populate BUF with register REGNUM from the REGCACHE. */ +@@ -618,9 +638,12 @@ + { + bfd_byte *buf = (bfd_byte *) v2_regs; + +- regcache->raw_collect (ARC_R30_REGNUM, buf); +- regcache->raw_collect (ARC_R58_REGNUM, buf + REGOFF (1)); +- regcache->raw_collect (ARC_R59_REGNUM, buf + REGOFF (2)); ++ if (regnum == -1 || regnum == ARC_R30_REGNUM) ++ regcache->raw_collect (ARC_R30_REGNUM, buf); ++ if (regnum == -1 || regnum == ARC_R58_REGNUM) ++ regcache->raw_collect (ARC_R58_REGNUM, buf + REGOFF (1)); ++ if (regnum == -1 || regnum == ARC_R59_REGNUM) ++ regcache->raw_collect (ARC_R59_REGNUM, buf + REGOFF (2)); + } + + /* Linux regset definitions. */ |