From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: lgustavo@codesourcery.com
Cc: gdb-patches@sourceware.org, Ulrich.Weigand@de.ibm.com
Subject: Re: [ping 2] [RFA][PATCH v4 0/5] Add TDB regset support
Date: Tue, 16 Jul 2013 15:26:00 -0000 [thread overview]
Message-ID: <87wqoqle5v.fsf@br87z6lw.de.ibm.com> (raw)
In-Reply-To: <87vc4bss41.fsf@br87z6lw.de.ibm.com> (Andreas Arnez's message of "Mon, 15 Jul 2013 18:30:38 +0200")
Andreas Arnez <arnez@linux.vnet.ibm.com> writes:
> In the scope of this patch set the PowerPC change is purely optional.
> I'll just remove it from the next version of the patch set.
Actually, before I do that, here's another try.
Would it help to merge the iterator function with the logic of
ppc_regset_from_core_section(), like outlined in the patch below?
I see the following advantages:
- One less gdbarch function needed: gdbarch_regset_from_core_section
becomes obsolete.
- The regset description is more "self-contained": it now includes the
name, description, and size.
- Even less code than the previous version, all condensed in a single
function.
Thoughts?
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index fc09560..854b356 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -256,54 +256,6 @@ ppc_linux_return_value (struct gdbarch *gdbarch, struct value *function,
readbuf, writebuf);
}
-static struct core_regset_section ppc_linux_vsx_regset_sections[] =
-{
- { ".reg", 48 * 4, "general-purpose" },
- { ".reg2", 264, "floating-point" },
- { ".reg-ppc-vmx", 544, "ppc Altivec" },
- { ".reg-ppc-vsx", 256, "POWER7 VSX" },
- { NULL, 0}
-};
-
-static struct core_regset_section ppc_linux_vmx_regset_sections[] =
-{
- { ".reg", 48 * 4, "general-purpose" },
- { ".reg2", 264, "floating-point" },
- { ".reg-ppc-vmx", 544, "ppc Altivec" },
- { NULL, 0}
-};
-
-static struct core_regset_section ppc_linux_fp_regset_sections[] =
-{
- { ".reg", 48 * 4, "general-purpose" },
- { ".reg2", 264, "floating-point" },
- { NULL, 0}
-};
-
-static struct core_regset_section ppc64_linux_vsx_regset_sections[] =
-{
- { ".reg", 48 * 8, "general-purpose" },
- { ".reg2", 264, "floating-point" },
- { ".reg-ppc-vmx", 544, "ppc Altivec" },
- { ".reg-ppc-vsx", 256, "POWER7 VSX" },
- { NULL, 0}
-};
-
-static struct core_regset_section ppc64_linux_vmx_regset_sections[] =
-{
- { ".reg", 48 * 8, "general-purpose" },
- { ".reg2", 264, "floating-point" },
- { ".reg-ppc-vmx", 544, "ppc Altivec" },
- { NULL, 0}
-};
-
-static struct core_regset_section ppc64_linux_fp_regset_sections[] =
-{
- { ".reg", 48 * 8, "general-purpose" },
- { ".reg2", 264, "floating-point" },
- { NULL, 0}
-};
-
/* PLT stub in executable. */
static struct ppc_insn_pattern powerpc32_plt_stub[] =
{
@@ -498,35 +450,40 @@ static const struct regset ppc32_linux_gregset = {
&ppc32_linux_reg_offsets,
ppc_linux_supply_gregset,
ppc_linux_collect_gregset,
- NULL
+ NULL,
+ ".reg", "general-purpose", 48 * 4
};
static const struct regset ppc64_linux_gregset = {
&ppc64_linux_reg_offsets,
ppc_linux_supply_gregset,
ppc_linux_collect_gregset,
- NULL
+ NULL,
+ ".reg", "general-purpose", 48 * 8
};
static const struct regset ppc32_linux_fpregset = {
&ppc32_linux_reg_offsets,
ppc_supply_fpregset,
ppc_collect_fpregset,
- NULL
+ NULL,
+ ".reg2", "floating-point", 264
};
static const struct regset ppc32_linux_vrregset = {
&ppc32_linux_reg_offsets,
ppc_supply_vrregset,
ppc_collect_vrregset,
- NULL
+ NULL,
+ ".reg-ppc-vmx", "ppc Altivec", 544
};
static const struct regset ppc32_linux_vsxregset = {
&ppc32_linux_reg_offsets,
ppc_supply_vsxregset,
ppc_collect_vsxregset,
- NULL
+ NULL,
+ ".reg-ppc-vsx", "POWER7 VSX", 256
};
const struct regset *
@@ -541,25 +498,26 @@ ppc_linux_fpregset (void)
return &ppc32_linux_fpregset;
}
-static const struct regset *
-ppc_linux_regset_from_core_section (struct gdbarch *core_arch,
- const char *sect_name, size_t sect_size)
+static void
+ppc_linux_iterate_over_regset_sections (struct gdbarch *core_arch,
+ iterate_over_regset_sections_cb *cb,
+ void *cb_data,
+ const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (core_arch);
- if (strcmp (sect_name, ".reg") == 0)
- {
- if (tdep->wordsize == 4)
- return &ppc32_linux_gregset;
- else
- return &ppc64_linux_gregset;
- }
- if (strcmp (sect_name, ".reg2") == 0)
- return &ppc32_linux_fpregset;
- if (strcmp (sect_name, ".reg-ppc-vmx") == 0)
- return &ppc32_linux_vrregset;
- if (strcmp (sect_name, ".reg-ppc-vsx") == 0)
- return &ppc32_linux_vsxregset;
- return NULL;
+ int have_vsx = tdep->ppc_vr0_regnum != -1;
+ int have_altivec = tdep->ppc_vsr0_upper_regnum != -1;
+ int res;
+
+ res = cb (tdep->wordsize == 4 ?
+ &ppc32_linux_gregset : &ppc64_linux_gregset,
+ cb_data);
+ if (!res)
+ res = cb (&ppc32_linux_fpregset, cb_data);
+ if (!res && have_altivec)
+ res = cb (&ppc32_linux_vrregset, cb_data);
+ if (!res && have_vsx)
+ cb (&ppc32_linux_vsxregset, cb_data);
}
static void
@@ -1305,19 +1263,6 @@ ppc_linux_init_abi (struct gdbarch_info info,
else
set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpc");
- /* Supported register sections. */
- if (tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.power.vsx"))
- set_gdbarch_core_regset_sections (gdbarch,
- ppc_linux_vsx_regset_sections);
- else if (tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.power.altivec"))
- set_gdbarch_core_regset_sections (gdbarch,
- ppc_linux_vmx_regset_sections);
- else
- set_gdbarch_core_regset_sections (gdbarch,
- ppc_linux_fp_regset_sections);
-
if (powerpc_so_ops.in_dynsym_resolve_code == NULL)
{
powerpc_so_ops = svr4_so_ops;
@@ -1359,19 +1304,6 @@ ppc_linux_init_abi (struct gdbarch_info info,
set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpcle");
else
set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc");
-
- /* Supported register sections. */
- if (tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.power.vsx"))
- set_gdbarch_core_regset_sections (gdbarch,
- ppc64_linux_vsx_regset_sections);
- else if (tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.power.altivec"))
- set_gdbarch_core_regset_sections (gdbarch,
- ppc64_linux_vmx_regset_sections);
- else
- set_gdbarch_core_regset_sections (gdbarch,
- ppc64_linux_fp_regset_sections);
}
/* PPC32 uses a different prpsinfo32 compared to most other Linux
@@ -1383,6 +1315,8 @@ ppc_linux_init_abi (struct gdbarch_info info,
set_gdbarch_regset_from_core_section (gdbarch,
ppc_linux_regset_from_core_section);
set_gdbarch_core_read_description (gdbarch, ppc_linux_core_read_description);
+ set_gdbarch_iterate_over_regset_sections (gdbarch,
+ ppc_linux_iterate_over_regset_sections);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
next prev parent reply other threads:[~2013-07-16 15:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-03 16:57 Andreas Arnez
2013-07-03 17:00 ` [RFA][PATCH v4 1/5] S/390 regmap rework Andreas Arnez
2013-07-15 14:46 ` Luis Machado
2013-07-15 17:15 ` Andreas Arnez
2013-07-03 17:02 ` [RFA][PATCH v4 2/5] S/390: Add TDB regset Andreas Arnez
2013-07-03 19:25 ` Eli Zaretskii
2013-07-03 17:04 ` [RFA][PATCH v4 3/5] Dynamic core regset sections support Andreas Arnez
2013-07-03 17:11 ` [RFA][PATCH v4 4/5] S/390: Exploit dynamic core regset sections Andreas Arnez
2013-07-03 17:21 ` [RFA][PATCH v4 5/5] PowerPC: " Andreas Arnez
2013-07-08 15:44 ` [ping] [RFA][PATCH v4 0/5] Add TDB regset support Andreas Arnez
2013-07-15 8:49 ` [ping 2] " Andreas Arnez
2013-07-15 13:27 ` Luis Machado
2013-07-15 15:34 ` Andreas Arnez
2013-07-15 15:40 ` Luis Machado
2013-07-15 16:30 ` Andreas Arnez
2013-07-16 15:26 ` Andreas Arnez [this message]
2013-07-16 16:03 ` Ulrich Weigand
2013-07-16 17:06 ` Andreas Arnez
2013-07-15 15:58 ` Mark Kettenis
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=87wqoqle5v.fsf@br87z6lw.de.ibm.com \
--to=arnez@linux.vnet.ibm.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=lgustavo@codesourcery.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