diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-07-07 14:35:10 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-07-08 16:20:48 +0200 |
commit | 619d9aaf011c975159a79d34259083a596162bf1 (patch) | |
tree | 16599882e087d793b4ba69c602b46271204f0ec2 /loc2c-test.c | |
parent | 51305196f1d078849da1718bb6ccfbed5af182ed (diff) | |
download | systemtap-steved-619d9aaf011c975159a79d34259083a596162bf1.tar.gz systemtap-steved-619d9aaf011c975159a79d34259083a596162bf1.tar.xz systemtap-steved-619d9aaf011c975159a79d34259083a596162bf1.zip |
Add support for constant struct member field offsets.
* loc2c.h (c_translate_add_offset): New function prototype.
* loc2c.c (c_translate_add_offset): New function implementation.
* loc2c-test.c (handle_variable): Use c_translate_add_offset if appropriate.
* dwflpp.cxx (translate_location): Likewise.
Diffstat (limited to 'loc2c-test.c')
-rw-r--r-- | loc2c-test.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/loc2c-test.c b/loc2c-test.c index 01108573..688f4a8b 100644 --- a/loc2c-test.c +++ b/loc2c-test.c @@ -214,10 +214,35 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out, } else { - locexpr = get_location (cubias, pc, &attr_mem, &locexpr_len); - c_translate_location (&pool, NULL, NULL, NULL, - 1, cubias, pc, locexpr, locexpr_len, - &tail, NULL); + /* We are expection a block, constant or loclistptr. */ + unsigned int form = dwarf_whatform (&attr_mem); + Dwarf_Sword off; + switch (form) + { + /* constant */ + case DW_FORM_data1: + case DW_FORM_data2: + case DW_FORM_sdata: + case DW_FORM_udata: + if (dwarf_formsdata (&attr_mem, &off) != 0) + error (2, 0, _("Bad offset for %s %s: %s"), + typetag == DW_TAG_union_type ? "union" : "struct", + dwarf_diename_integrate (die) ?: "<anonymous>", + dwarf_errmsg (-1)); + if (off != 0) + c_translate_add_offset (&pool, 1, + dwarf_diename_integrate (die) + ?: "", off, &tail); + break; + + default: + locexpr = get_location (cubias, pc, &attr_mem, + &locexpr_len); + c_translate_location (&pool, NULL, NULL, NULL, + 1, cubias, pc, locexpr, locexpr_len, + &tail, NULL); + break; + } } ++fields; break; |