diff options
author | Eugene Tarassov | 2014-09-17 19:07:07 +0000 |
---|---|---|
committer | Eugene Tarassov | 2014-09-17 19:07:07 +0000 |
commit | 06b2f6d76ca9fefc21007f4caa24600417681bb0 (patch) | |
tree | 36eb62cafa03a34ca715d033a37ef6782594139b | |
parent | fc070c0ba14af2127e66c75b01c8e11b4752baaa (diff) | |
download | org.eclipse.tcf.agent-06b2f6d76ca9fefc21007f4caa24600417681bb0.tar.gz org.eclipse.tcf.agent-06b2f6d76ca9fefc21007f4caa24600417681bb0.tar.xz org.eclipse.tcf.agent-06b2f6d76ca9fefc21007f4caa24600417681bb0.zip |
TCF Agent: added (partial) support for DW_OP_GNU_const_type
-rw-r--r-- | agent/tcf/services/dwarfecomp.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/agent/tcf/services/dwarfecomp.c b/agent/tcf/services/dwarfecomp.c index 15d2b025..6b6725bc 100644 --- a/agent/tcf/services/dwarfecomp.c +++ b/agent/tcf/services/dwarfecomp.c @@ -868,6 +868,41 @@ static void add_expression(DWARFExpressionInfo * info) { check_frame(); op_parameter_ref(); break; + case OP_GNU_const_type: + expr_pos++; + { + U8_T type = read_u8leb128(); + unsigned size = expr->expr_addr[expr_pos++]; + int sign = 0; + ObjectInfo * obj = find_object( + get_dwarf_cache(expr->object->mCompUnit->mFile), + expr->object->mCompUnit->mDesc.mSection->addr + + expr->object->mCompUnit->mDesc.mUnitOffs + type); + if (obj == NULL) str_exception(ERR_INV_DWARF, "Invalid reference in OP_GNU_const_type"); + if (obj->mTag != TAG_base_type) str_exception(ERR_INV_DWARF, "Invalid object tag in OP_GNU_const_type"); + switch (obj->u.mFundType) { + case ATE_address: + case ATE_unsigned: + case ATE_unsigned_char: + break; + case ATE_signed: + case ATE_signed_char: + sign = 1; + break; + default: + str_exception(ERR_INV_DWARF, "Unsupported type in OP_GNU_const_type"); + break; + } + switch (size) { + case 1: add(sign ? OP_const1s : OP_const1u); break; + case 2: add(sign ? OP_const2s : OP_const2u); break; + case 4: add(sign ? OP_const4s : OP_const4u); break; + case 8: add(sign ? OP_const8s : OP_const8u); break; + default: str_exception(ERR_INV_DWARF, "Invalid size in OP_GNU_const_type"); + } + copy(size); + } + break; case OP_GNU_regval_type: expr_pos++; { @@ -879,7 +914,7 @@ static void add_expression(DWARFExpressionInfo * info) { expr->object->mCompUnit->mDesc.mSection->addr + expr->object->mCompUnit->mDesc.mUnitOffs + type); if (obj == NULL) str_exception(ERR_INV_DWARF, "Invalid reference in OP_GNU_regval_type"); - if (!get_num_prop(obj, AT_byte_size, &size))str_exception(ERR_INV_DWARF, "Invalid reference in OP_GNU_regval_type"); + if (!get_num_prop(obj, AT_byte_size, &size)) str_exception(ERR_INV_DWARF, "Invalid reference in OP_GNU_regval_type"); add(OP_regx); add_uleb128(reg); add(OP_piece); |