From: Philipp Rudo <prudo@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: Andreas Arnez <arnez@linux.vnet.ibm.com>,
Ulrich Weigand <uweigand@de.ibm.com>
Subject: [PATCH v2 01/11] s390: Remove duplicate checks for cached gdbarch at init
Date: Tue, 05 Dec 2017 12:29:00 -0000 [thread overview]
Message-ID: <20171205122859.2919-2-prudo@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171205122859.2919-1-prudo@linux.vnet.ibm.com>
When initializing the gdbarch there is a check whether an appropriate
gdbarch already exists in the gdbarch_list. If any of the checks fails
this would lead to a different target description. However
gdbarch_list_lookup_by_info already checks for
if (info->target_desc != arches->gdbarch->target_desc)
continue;
So it never returns a gdbarch where any of the checks can fail.
Remove the duplicate check. This also allows to move the lookup at the
start of the function.
gdb/ChangeLog:
* s390-linux-tdep.c (s390_gdbarch_init): Remove douplicate checks when
looking for cached gdbarch and move to start of function
---
gdb/s390-linux-tdep.c | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index a0d4cdd740..e3e036a70d 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -7829,6 +7829,11 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
static const char *const stap_register_indirection_suffixes[] = { ")",
NULL };
+ /* Find a candidate among extant architectures. */
+ arches = gdbarch_list_lookup_by_info (arches, &info);
+ if (arches != NULL)
+ return arches->gdbarch;
+
/* Default ABI and register size. */
switch (info.bfd_arch_info->mach)
{
@@ -8040,27 +8045,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
vector_abi = S390_VECTOR_ABI_128;
#endif
- /* Find a candidate among extant architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
- arches = gdbarch_list_lookup_by_info (arches->next, &info))
- {
- tdep = gdbarch_tdep (arches->gdbarch);
- if (!tdep)
- continue;
- if (tdep->abi != tdep_abi)
- continue;
- if (tdep->vector_abi != vector_abi)
- continue;
- if ((tdep->gpr_full_regnum != -1) != have_upper)
- continue;
- if (tdep->have_gs != have_gs)
- continue;
- if (tdesc_data != NULL)
- tdesc_data_cleanup (tdesc_data);
- return arches->gdbarch;
- }
-
/* Otherwise create a new gdbarch for the specified machine type. */
tdep = XCNEW (struct gdbarch_tdep);
tdep->abi = tdep_abi;
--
2.13.5
next prev parent reply other threads:[~2017-12-05 12:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-05 12:29 [PATCH v2 00/11] Split up s390-linux-tdep.c Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 09/11] s390: Clean " Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 05/11] s390: Move tdesc validation to separate function Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 02/11] s390: Allocate gdbarch & tdep at start of gdbarch init Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 04/11] s390: gdbarch_tdep add field tdesc Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 11/11] s390: Add comments to uncommented functions in s390-linux-tdep.c Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 10/11] s390: Add comments to uncommented functions in s390-tdep.c Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 03/11] s390: gdbarch_tdep.have_* int -> bool Philipp Rudo
2017-12-05 12:29 ` Philipp Rudo [this message]
2017-12-05 16:16 ` [PATCH v2 01/11] s390: Remove duplicate checks for cached gdbarch at init Yao Qi
2017-12-06 9:56 ` Philipp Rudo
2017-12-06 10:28 ` [PATCH v2 01/11] s390: Remove duplicate checks for cached gdbarch@init Ulrich Weigand
2017-12-07 9:18 ` Philipp Rudo
2017-12-07 9:59 ` Yao Qi
2017-12-05 12:29 ` [PATCH v2 07/11] s390: Hook s390 into OSABI mechanism Philipp Rudo
2017-12-05 13:21 ` Ulrich Weigand
2017-12-05 17:06 ` Philipp Rudo
2017-12-05 17:44 ` Ulrich Weigand
2017-12-06 11:39 ` Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 06/11] s390: if -> gdb_assert for tdesc_has_registers check Philipp Rudo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171205122859.2919-2-prudo@linux.vnet.ibm.com \
--to=prudo@linux.vnet.ibm.com \
--cc=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox