This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[RFC 08/13] mips: Fix fetching params of type long on mips kernel
- From: Crestez Dan Leonard <cdleonard at gmail dot com>
- To: systemtap at sourceware dot org
- Date: Thu, 31 Jul 2014 23:21:13 +0300
- Subject: [RFC 08/13] mips: Fix fetching params of type long on mips kernel
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1406837921 dot git dot cdleonard at gmail dot com>
- References: <cover dot 1406837921 dot git dot cdleonard at gmail dot com>
Signed-off-by: Crestez Dan Leonard <cdleonard@gmail.com>
---
loc2c.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/loc2c.c b/loc2c.c
index 64f34e6..a9bdb1f 100644
--- a/loc2c.c
+++ b/loc2c.c
@@ -1917,6 +1917,15 @@ translate_base_fetch (struct obstack *pool, int indent,
*input = loc;
}
+static bool
+is_elf_mips64(Elf *elf)
+{
+ GElf_Ehdr ehdr_mem;
+ GElf_Ehdr* ehdr = gelf_getehdr (elf, &ehdr_mem);
+ return ehdr->e_machine == EM_MIPS &&
+ ehdr->e_ident[EI_CLASS] == ELFCLASS64;
+}
+
/* Determine the maximum size of a base type, from some DIE in the CU. */
static Dwarf_Word
max_fetch_size (struct location *loc, Dwarf_Die *die)
@@ -1929,6 +1938,13 @@ max_fetch_size (struct location *loc, Dwarf_Die *die)
FAIL (loc, N_("cannot determine CU address size from %s: %s"),
dwarf_diename (die), dwarf_errmsg (-1));
+ if (address_size == 4)
+ {
+ if (is_elf_mips64(dwarf_getelf (loc->context->dwarf)))
+ {
+ address_size = 8;
+ }
+ }
return address_size;
}