This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC 08/13] mips: Fix fetching params of type long on mips kernel


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;
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]