This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] backends: Always set *prefix to "" when not used in register_info hook.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 28 Aug 2013 16:06:58 +0200
- Subject: [PATCH] backends: Always set *prefix to "" when not used in register_info hook.
For ia64 and tilegx *prefix was already set to the empty string, but
arm, ppc and sh used NULL to indicate no prefix preceded the register
name in the canonical assembler syntax. Consistently use the empty string
in all backends since dwfl_module_register_names says: 'a prefix used in
assembler syntax (such as "%" or "$", may be "")'. So users had to handle
the empty string already, and might forget to handle the NULL case
(like our own addrcfi testcase).
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
backends/ChangeLog | 6 ++++++
backends/arm_regs.c | 2 +-
backends/ppc_regs.c | 2 +-
backends/sh_regs.c | 2 +-
4 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/backends/ChangeLog b/backends/ChangeLog
index 646a7da..64e5efd 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,9 @@
+2013-08-28 Mark Wielaard <mjw@redhat.com>
+
+ * arm_regs.c (arm_register_info): Set *prefix to "".
+ * ppc_regs.c (ppc_register_info): Likewise.
+ * sh_regs.c (sh_register_info): Likewise.
+
2013-08-27 Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.am (ppc_SRCS, ppc64_SRCS): Add ppc_cfi.c.
diff --git a/backends/arm_regs.c b/backends/arm_regs.c
index 0155149..21c5ad3 100644
--- a/backends/arm_regs.c
+++ b/backends/arm_regs.c
@@ -48,7 +48,7 @@ arm_register_info (Ebl *ebl __attribute__ ((unused)),
if (regno < 0 || regno > 320 || namelen < 5)
return -1;
- *prefix = NULL;
+ *prefix = "";
*bits = 32;
*type = DW_ATE_signed;
*setname = "integer";
diff --git a/backends/ppc_regs.c b/backends/ppc_regs.c
index 9c2d7e8..4b92a9a 100644
--- a/backends/ppc_regs.c
+++ b/backends/ppc_regs.c
@@ -48,7 +48,7 @@ ppc_register_info (Ebl *ebl __attribute__ ((unused)),
if (regno < 0 || regno > 1155 || namelen < 8)
return -1;
- *prefix = NULL;
+ *prefix = "";
*bits = ebl->machine == EM_PPC64 ? 64 : 32;
*type = (regno < 32 ? DW_ATE_signed
: regno < 64 ? DW_ATE_float : DW_ATE_unsigned);
diff --git a/backends/sh_regs.c b/backends/sh_regs.c
index 3d323a9..d433236 100644
--- a/backends/sh_regs.c
+++ b/backends/sh_regs.c
@@ -50,7 +50,7 @@ sh_register_info (Ebl *ebl __attribute__ ((unused)),
if (regno < 0 || regno > 103 || namelen < 6)
return -1;
- *prefix = NULL;
+ *prefix = "";
*bits = 32;
*type = DW_ATE_signed;
--
1.7.1