This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[RFC 09/13] mips: dwflpp hack for struct fields being DW_OP_constu instead of DW_OP_plus_uconst
- From: Crestez Dan Leonard <cdleonard at gmail dot com>
- To: systemtap at sourceware dot org
- Date: Thu, 31 Jul 2014 23:21:14 +0300
- Subject: [RFC 09/13] mips: dwflpp hack for struct fields being DW_OP_constu instead of DW_OP_plus_uconst
- 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>
---
dwflpp.cxx | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/dwflpp.cxx b/dwflpp.cxx
index 10f4abb..16e968a 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -3170,6 +3170,24 @@ dwflpp::translate_location(struct obstack *pool,
else
cfa_ops = NULL;
+ Dwarf_Op expr_hack[1];
+ if (len == 1 && expr[0].atom == DW_OP_constu && tail)
+ {
+ Dwarf_Addr bias;
+ Elf* elf = (dwarf_getelf (module_dwarf)
+ ?: dwfl_module_getelf (this->module, &bias));
+ GElf_Ehdr ehdr_mem;
+ GElf_Ehdr* ehdr = gelf_getehdr (elf, &ehdr_mem);
+ if (ehdr->e_machine == EM_MIPS)
+ {
+ /* Force sign extension */
+ if (sess.verbose > 2)
+ clog << "translate_location hack to interpret single DW_OP_constu as DW_OP_plus_uconst on mips" << endl;
+ expr_hack[0] = expr[0];
+ expr_hack[0].atom = DW_OP_plus_uconst;
+ expr = expr_hack;
+ }
+ }
return c_translate_location (pool, &loc2c_error, this,
&loc2c_emit_address,
1, 0 /* PR9768 */,