diff options
author | roland <roland> | 2005-11-22 00:29:54 +0000 |
---|---|---|
committer | roland <roland> | 2005-11-22 00:29:54 +0000 |
commit | d1531387ba69eb6b31197a5be26a63ce20bb9d40 (patch) | |
tree | ce9d6d4d872a2650e7d6ebf8cb8fef0f3093bf08 /tapsets.cxx | |
parent | 422d1ceb1e08c1174154cf19bb03f788e1e10fb8 (diff) | |
download | systemtap-steved-d1531387ba69eb6b31197a5be26a63ce20bb9d40.tar.gz systemtap-steved-d1531387ba69eb6b31197a5be26a63ce20bb9d40.tar.xz systemtap-steved-d1531387ba69eb6b31197a5be26a63ce20bb9d40.zip |
2005-11-21 Roland McGrath <roland@redhat.com>
* loc2c.c (c_translate_location): Take Dwarf_Op vector as argument
directly, not Dwarf_Attribute.p
* loc2c.h: Update decl.
* loc2c-test.c (get_location): New function.
(handle_variable): Use it.
* tapsets.cxx (dwflpp::translate_location): New method.
(dwflpp::translate_components, dwflpp::literal_stmt_for_local): Use it.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index 5e6497f4..fdf1b999 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -934,6 +934,37 @@ dwflpp } + struct location * + translate_location(struct obstack *pool, + Dwarf_Attribute *attr, Dwarf_Addr pc, + Dwarf_Attribute *fb_attr, + struct location **tail) + { + Dwarf_Op *expr; + size_t len; + + switch (dwarf_getlocation_addr (attr, pc - module_bias, &expr, &len, 1)) + { + case 1: /* Should always happen. */ + if (len > 0) + break; + /* Fall through. */ + + case 0: /* Shouldn't happen. */ + throw semantic_error ("not accessible at this address"); + + default: /* Shouldn't happen. */ + case -1: + throw semantic_error (string ("dwarf_getlocation_addr failed") + + string (dwarf_errmsg (-1))); + } + + return c_translate_location (pool, &loc2c_error, this, + &loc2c_emit_address, + 1, module_bias, + pc, expr, len, tail, fb_attr); + } + Dwarf_Die * translate_components(struct obstack *pool, struct location **tail, @@ -1015,9 +1046,7 @@ dwflpp + " :" + string(dwarf_errmsg (-1))); } else - c_translate_location (pool, NULL, NULL, NULL, 1, - module_bias, attr_mem, pc, - tail, NULL); + translate_location (pool, attr_mem, pc, NULL, tail); ++i; break; @@ -1195,11 +1224,8 @@ dwflpp /* Given $foo->bar->baz[NN], translate the location of foo. */ - struct location *head = c_translate_location (&pool, &loc2c_error, this, - &loc2c_emit_address, - 1, module_bias, - &attr_mem, pc, - &tail, fb_attr); + struct location *head = translate_location (&pool, + &attr_mem, pc, fb_attr, &tail); if (dwarf_attr_integrate (&vardie, DW_AT_type, &attr_mem) == NULL) throw semantic_error("failed to retrieve type " |