• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂6cdd651fda1315cb43a6a50223350da0da3f6dcf (tree)
時間2019-11-21 01:57:34
作者Luis Machado <luis.machado@lina...>
CommiterLuis Machado

Log Message

Improve target description check for SVE in gdbserver

The current code checks for the presence of a SVE target description by
comparing the number of registers. This is a bit fragile since the number
of registers can change whenever we add new sets. Like PAC, for example.

If the comparison breaks, then we're left with SVE registers in the
description, but gdbserver doesn't send the registers to GDB, which in
turn displays stale information to the user.

The following patch changes the check to use the SVE feature string instead,
which hopefully should be more stable.

gdb/gdbserver/ChangeLog:

2019-11-20 Luis Machado <luis.machado@linaro.org>

* linux-aarch64-low.c (is_sve_tdesc): Check against target feature
instead of register count.
* tdesc.c (tdesc_contains_feature): New function.
* tdesc.h (tdesc_contains_feature): New prototype.

Change-Id: I28b782cb1677560ca9a06a1be442974b25aabae4

Change Summary

差異

--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,10 @@
1+2019-11-20 Luis Machado <luis.machado@linaro.org>
2+
3+ * linux-aarch64-low.c (is_sve_tdesc): Check against target feature
4+ instead of register count.
5+ * tdesc.c (tdesc_contains_feature): New function.
6+ * tdesc.h (tdesc_contains_feature): New prototype.
7+
18 2019-11-15 Christian Biesinger <cbiesinger@google.com>
29
310 * Makefile.in: Add safe-strerror.c.
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -83,7 +83,7 @@ is_sve_tdesc (void)
8383 {
8484 struct regcache *regcache = get_thread_regcache (current_thread, 0);
8585
86- return regcache->tdesc->reg_defs.size () == AARCH64_SVE_NUM_REGS;
86+ return tdesc_contains_feature (regcache->tdesc, "org.gnu.gdb.aarch64.sve");
8787 }
8888
8989 static void
--- a/gdb/gdbserver/tdesc.c
+++ b/gdb/gdbserver/tdesc.c
@@ -186,3 +186,19 @@ tdesc_create_feature (struct target_desc *tdesc, const char *name)
186186 tdesc->features.emplace_back (new_feature);
187187 return new_feature;
188188 }
189+
190+/* See gdbsupport/tdesc.h. */
191+
192+bool
193+tdesc_contains_feature (const target_desc *tdesc, const std::string &feature)
194+{
195+ gdb_assert (tdesc != nullptr);
196+
197+ for (const tdesc_feature_up &f : tdesc->features)
198+ {
199+ if (f->name == feature)
200+ return true;
201+ }
202+
203+ return false;
204+}
--- a/gdb/gdbserver/tdesc.h
+++ b/gdb/gdbserver/tdesc.h
@@ -93,4 +93,9 @@ void init_target_desc (struct target_desc *tdesc,
9393
9494 const struct target_desc *current_target_desc (void);
9595
96+/* Return true if TDESC contains the feature described by string FEATURE.
97+ Return false otherwise. */
98+bool tdesc_contains_feature (const target_desc *tdesc,
99+ const std::string &feature);
100+
96101 #endif /* GDBSERVER_TDESC_H */