summaryrefslogtreecommitdiffstats
path: root/libunwindstack
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2018-02-12 20:18:03 -0800
committerChristopher Ferris <cferris@google.com>2018-02-13 16:45:38 -0800
commit559c7f209295a7070515bba9fa3985edf53d13a0 (patch)
tree3c4d389dd713cf1b388d58ecdf121e1c2c6989fd /libunwindstack
parent71fa8125b90a99329561c2dd13c055adf52dd25a (diff)
downloadcore-559c7f209295a7070515bba9fa3985edf53d13a0.tar.gz
core-559c7f209295a7070515bba9fa3985edf53d13a0.tar.bz2
core-559c7f209295a7070515bba9fa3985edf53d13a0.zip
Implement new DEX PC lookup scheme.
GDB wasn't handling the old one gracefully. - Create a RegsInfo structure that can be used to properly eval expression data. - Remove the versions on Dwarf ops. It doesn't work the in the real world and doesn't add useful information. - Fix dex pc frame number bug. Test: testrunner.py -j40 --host --cdex-fast -t 137 Test: libunwindstack_test Test: All unit tests pass. Change-Id: Iac4fea651b81cb6087fd237a9a5027a352a49245
Diffstat (limited to 'libunwindstack')
-rw-r--r--libunwindstack/DwarfOp.cpp54
-rw-r--r--libunwindstack/DwarfOp.h386
-rw-r--r--libunwindstack/DwarfSection.cpp80
-rw-r--r--libunwindstack/RegsInfo.h66
-rw-r--r--libunwindstack/Unwinder.cpp1
-rw-r--r--libunwindstack/include/unwindstack/DwarfSection.h6
-rw-r--r--libunwindstack/tests/DwarfOpTest.cpp457
-rw-r--r--libunwindstack/tests/DwarfSectionImplTest.cpp17
8 files changed, 490 insertions, 577 deletions
diff --git a/libunwindstack/DwarfOp.cpp b/libunwindstack/DwarfOp.cpp
index dcf04e6ff..5bc60b9d1 100644
--- a/libunwindstack/DwarfOp.cpp
+++ b/libunwindstack/DwarfOp.cpp
@@ -36,13 +36,45 @@ template <typename AddressType>
constexpr typename DwarfOp<AddressType>::OpCallback DwarfOp<AddressType>::kCallbackTable[256];
template <typename AddressType>
-bool DwarfOp<AddressType>::Eval(uint64_t start, uint64_t end, uint8_t dwarf_version) {
- uint32_t iterations = 0;
+bool DwarfOp<AddressType>::Eval(uint64_t start, uint64_t end) {
is_register_ = false;
stack_.clear();
memory_->set_cur_offset(start);
+ dex_pc_set_ = false;
+
+ // Unroll the first Decode calls to be able to check for a special
+ // sequence of ops and values that indicate this is the dex pc.
+ // The pattern is:
+ // OP_const4u (0x0c) 'D' 'E' 'X' '1'
+ // OP_drop (0x13)
+ if (memory_->cur_offset() < end) {
+ if (!Decode()) {
+ return false;
+ }
+ } else {
+ return true;
+ }
+ bool check_for_drop;
+ if (cur_op_ == 0x0c && operands_.back() == 0x31584544) {
+ check_for_drop = true;
+ } else {
+ check_for_drop = false;
+ }
+ if (memory_->cur_offset() < end) {
+ if (!Decode()) {
+ return false;
+ }
+ } else {
+ return true;
+ }
+
+ if (check_for_drop && cur_op_ == 0x13) {
+ dex_pc_set_ = true;
+ }
+
+ uint32_t iterations = 2;
while (memory_->cur_offset() < end) {
- if (!Decode(dwarf_version)) {
+ if (!Decode()) {
return false;
}
// To protect against a branch that creates an infinite loop,
@@ -56,7 +88,7 @@ bool DwarfOp<AddressType>::Eval(uint64_t start, uint64_t end, uint8_t dwarf_vers
}
template <typename AddressType>
-bool DwarfOp<AddressType>::Decode(uint8_t dwarf_version) {
+bool DwarfOp<AddressType>::Decode() {
last_error_.code = DWARF_ERROR_NONE;
if (!memory_->ReadBytes(&cur_op_, 1)) {
last_error_.code = DWARF_ERROR_MEMORY_INVALID;
@@ -71,12 +103,6 @@ bool DwarfOp<AddressType>::Decode(uint8_t dwarf_version) {
return false;
}
- // Check for an unsupported opcode.
- if (dwarf_version < op->supported_version) {
- last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
- return false;
- }
-
// Make sure that the required number of stack elements is available.
if (stack_.size() < op->num_required_stack_values) {
last_error_.code = DWARF_ERROR_STACK_INDEX_NOT_VALID;
@@ -434,22 +460,22 @@ bool DwarfOp<AddressType>::op_regx() {
template <typename AddressType>
bool DwarfOp<AddressType>::op_breg() {
uint16_t reg = cur_op() - 0x70;
- if (reg >= regs_->total_regs()) {
+ if (reg >= regs_info_->Total()) {
last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
return false;
}
- stack_.push_front((*regs_)[reg] + OperandAt(0));
+ stack_.push_front(regs_info_->Get(reg) + OperandAt(0));
return true;
}
template <typename AddressType>
bool DwarfOp<AddressType>::op_bregx() {
AddressType reg = OperandAt(0);
- if (reg >= regs_->total_regs()) {
+ if (reg >= regs_info_->Total()) {
last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
return false;
}
- stack_.push_front((*regs_)[reg] + OperandAt(1));
+ stack_.push_front(regs_info_->Get(reg) + OperandAt(1));
return true;
}
diff --git a/libunwindstack/DwarfOp.h b/libunwindstack/DwarfOp.h
index 40b7b23b7..4c69b3d25 100644
--- a/libunwindstack/DwarfOp.h
+++ b/libunwindstack/DwarfOp.h
@@ -27,16 +27,10 @@
#include <unwindstack/DwarfError.h>
#include "DwarfEncoding.h"
+#include "RegsInfo.h"
namespace unwindstack {
-enum DwarfVersion : uint8_t {
- DWARF_VERSION_2 = 2,
- DWARF_VERSION_3 = 3,
- DWARF_VERSION_4 = 4,
- DWARF_VERSION_MAX = DWARF_VERSION_4,
-};
-
// Forward declarations.
class DwarfMemory;
class Memory;
@@ -51,7 +45,6 @@ class DwarfOp {
struct OpCallback {
const char* name;
bool (DwarfOp::*handle_func)();
- uint8_t supported_version;
uint8_t num_required_stack_values;
uint8_t num_operands;
uint8_t operands[2];
@@ -62,21 +55,23 @@ class DwarfOp {
: memory_(memory), regular_memory_(regular_memory) {}
virtual ~DwarfOp() = default;
- bool Decode(uint8_t dwarf_version);
+ bool Decode();
- bool Eval(uint64_t start, uint64_t end, uint8_t dwarf_version);
+ bool Eval(uint64_t start, uint64_t end);
void GetLogInfo(uint64_t start, uint64_t end, std::vector<std::string>* lines);
AddressType StackAt(size_t index) { return stack_[index]; }
size_t StackSize() { return stack_.size(); }
- void set_regs(RegsImpl<AddressType>* regs) { regs_ = regs; }
+ void set_regs_info(RegsInfo<AddressType>* regs_info) { regs_info_ = regs_info; }
const DwarfErrorData& last_error() { return last_error_; }
DwarfErrorCode LastErrorCode() { return last_error_.code; }
uint64_t LastErrorAddress() { return last_error_.address; }
+ bool dex_pc_set() { return dex_pc_set_; }
+
bool is_register() { return is_register_; }
uint8_t cur_op() { return cur_op_; }
@@ -97,7 +92,8 @@ class DwarfOp {
DwarfMemory* memory_;
Memory* regular_memory_;
- RegsImpl<AddressType>* regs_;
+ RegsInfo<AddressType>* regs_info_;
+ bool dex_pc_set_ = false;
bool is_register_ = false;
DwarfErrorData last_error_{DWARF_ERROR_NONE, 0};
uint8_t cur_op_;
@@ -148,35 +144,32 @@ class DwarfOp {
bool op_not_implemented();
constexpr static OpCallback kCallbackTable[256] = {
- {nullptr, nullptr, 0, 0, 0, {}}, // 0x00 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0x01 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0x02 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0x00 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0x01 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0x02 illegal op
{
// 0x03 DW_OP_addr
"DW_OP_addr",
&DwarfOp::op_push,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_absptr},
},
- {nullptr, nullptr, 0, 0, 0, {}}, // 0x04 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0x05 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0x04 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0x05 illegal op
{
// 0x06 DW_OP_deref
"DW_OP_deref",
&DwarfOp::op_deref,
- DWARF_VERSION_2,
1,
0,
{},
},
- {nullptr, nullptr, 0, 0, 0, {}}, // 0x07 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0x07 illegal op
{
// 0x08 DW_OP_const1u
"DW_OP_const1u",
&DwarfOp::op_push,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_udata1},
@@ -185,7 +178,6 @@ class DwarfOp {
// 0x09 DW_OP_const1s
"DW_OP_const1s",
&DwarfOp::op_push,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sdata1},
@@ -194,7 +186,6 @@ class DwarfOp {
// 0x0a DW_OP_const2u
"DW_OP_const2u",
&DwarfOp::op_push,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_udata2},
@@ -203,7 +194,6 @@ class DwarfOp {
// 0x0b DW_OP_const2s
"DW_OP_const2s",
&DwarfOp::op_push,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sdata2},
@@ -212,7 +202,6 @@ class DwarfOp {
// 0x0c DW_OP_const4u
"DW_OP_const4u",
&DwarfOp::op_push,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_udata4},
@@ -221,7 +210,6 @@ class DwarfOp {
// 0x0d DW_OP_const4s
"DW_OP_const4s",
&DwarfOp::op_push,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sdata4},
@@ -230,7 +218,6 @@ class DwarfOp {
// 0x0e DW_OP_const8u
"DW_OP_const8u",
&DwarfOp::op_push,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_udata8},
@@ -239,7 +226,6 @@ class DwarfOp {
// 0x0f DW_OP_const8s
"DW_OP_const8s",
&DwarfOp::op_push,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sdata8},
@@ -248,7 +234,6 @@ class DwarfOp {
// 0x10 DW_OP_constu
"DW_OP_constu",
&DwarfOp::op_push,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_uleb128},
@@ -257,7 +242,6 @@ class DwarfOp {
// 0x11 DW_OP_consts
"DW_OP_consts",
&DwarfOp::op_push,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -266,7 +250,6 @@ class DwarfOp {
// 0x12 DW_OP_dup
"DW_OP_dup",
&DwarfOp::op_dup,
- DWARF_VERSION_2,
1,
0,
{},
@@ -275,7 +258,6 @@ class DwarfOp {
// 0x13 DW_OP_drop
"DW_OP_drop",
&DwarfOp::op_drop,
- DWARF_VERSION_2,
1,
0,
{},
@@ -284,7 +266,6 @@ class DwarfOp {
// 0x14 DW_OP_over
"DW_OP_over",
&DwarfOp::op_over,
- DWARF_VERSION_2,
2,
0,
{},
@@ -293,7 +274,6 @@ class DwarfOp {
// 0x15 DW_OP_pick
"DW_OP_pick",
&DwarfOp::op_pick,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_udata1},
@@ -302,7 +282,6 @@ class DwarfOp {
// 0x16 DW_OP_swap
"DW_OP_swap",
&DwarfOp::op_swap,
- DWARF_VERSION_2,
2,
0,
{},
@@ -311,7 +290,6 @@ class DwarfOp {
// 0x17 DW_OP_rot
"DW_OP_rot",
&DwarfOp::op_rot,
- DWARF_VERSION_2,
3,
0,
{},
@@ -320,7 +298,6 @@ class DwarfOp {
// 0x18 DW_OP_xderef
"DW_OP_xderef",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_2,
2,
0,
{},
@@ -329,7 +306,6 @@ class DwarfOp {
// 0x19 DW_OP_abs
"DW_OP_abs",
&DwarfOp::op_abs,
- DWARF_VERSION_2,
1,
0,
{},
@@ -338,7 +314,6 @@ class DwarfOp {
// 0x1a DW_OP_and
"DW_OP_and",
&DwarfOp::op_and,
- DWARF_VERSION_2,
2,
0,
{},
@@ -347,7 +322,6 @@ class DwarfOp {
// 0x1b DW_OP_div
"DW_OP_div",
&DwarfOp::op_div,
- DWARF_VERSION_2,
2,
0,
{},
@@ -356,7 +330,6 @@ class DwarfOp {
// 0x1c DW_OP_minus
"DW_OP_minus",
&DwarfOp::op_minus,
- DWARF_VERSION_2,
2,
0,
{},
@@ -365,7 +338,6 @@ class DwarfOp {
// 0x1d DW_OP_mod
"DW_OP_mod",
&DwarfOp::op_mod,
- DWARF_VERSION_2,
2,
0,
{},
@@ -374,7 +346,6 @@ class DwarfOp {
// 0x1e DW_OP_mul
"DW_OP_mul",
&DwarfOp::op_mul,
- DWARF_VERSION_2,
2,
0,
{},
@@ -383,7 +354,6 @@ class DwarfOp {
// 0x1f DW_OP_neg
"DW_OP_neg",
&DwarfOp::op_neg,
- DWARF_VERSION_2,
1,
0,
{},
@@ -392,7 +362,6 @@ class DwarfOp {
// 0x20 DW_OP_not
"DW_OP_not",
&DwarfOp::op_not,
- DWARF_VERSION_2,
1,
0,
{},
@@ -401,7 +370,6 @@ class DwarfOp {
// 0x21 DW_OP_or
"DW_OP_or",
&DwarfOp::op_or,
- DWARF_VERSION_2,
2,
0,
{},
@@ -410,7 +378,6 @@ class DwarfOp {
// 0x22 DW_OP_plus
"DW_OP_plus",
&DwarfOp::op_plus,
- DWARF_VERSION_2,
2,
0,
{},
@@ -419,7 +386,6 @@ class DwarfOp {
// 0x23 DW_OP_plus_uconst
"DW_OP_plus_uconst",
&DwarfOp::op_plus_uconst,
- DWARF_VERSION_2,
1,
1,
{DW_EH_PE_uleb128},
@@ -428,7 +394,6 @@ class DwarfOp {
// 0x24 DW_OP_shl
"DW_OP_shl",
&DwarfOp::op_shl,
- DWARF_VERSION_2,
2,
0,
{},
@@ -437,7 +402,6 @@ class DwarfOp {
// 0x25 DW_OP_shr
"DW_OP_shr",
&DwarfOp::op_shr,
- DWARF_VERSION_2,
2,
0,
{},
@@ -446,7 +410,6 @@ class DwarfOp {
// 0x26 DW_OP_shra
"DW_OP_shra",
&DwarfOp::op_shra,
- DWARF_VERSION_2,
2,
0,
{},
@@ -455,7 +418,6 @@ class DwarfOp {
// 0x27 DW_OP_xor
"DW_OP_xor",
&DwarfOp::op_xor,
- DWARF_VERSION_2,
2,
0,
{},
@@ -464,7 +426,6 @@ class DwarfOp {
// 0x28 DW_OP_bra
"DW_OP_bra",
&DwarfOp::op_bra,
- DWARF_VERSION_2,
1,
1,
{DW_EH_PE_sdata2},
@@ -473,7 +434,6 @@ class DwarfOp {
// 0x29 DW_OP_eq
"DW_OP_eq",
&DwarfOp::op_eq,
- DWARF_VERSION_2,
2,
0,
{},
@@ -482,7 +442,6 @@ class DwarfOp {
// 0x2a DW_OP_ge
"DW_OP_ge",
&DwarfOp::op_ge,
- DWARF_VERSION_2,
2,
0,
{},
@@ -491,7 +450,6 @@ class DwarfOp {
// 0x2b DW_OP_gt
"DW_OP_gt",
&DwarfOp::op_gt,
- DWARF_VERSION_2,
2,
0,
{},
@@ -500,7 +458,6 @@ class DwarfOp {
// 0x2c DW_OP_le
"DW_OP_le",
&DwarfOp::op_le,
- DWARF_VERSION_2,
2,
0,
{},
@@ -509,7 +466,6 @@ class DwarfOp {
// 0x2d DW_OP_lt
"DW_OP_lt",
&DwarfOp::op_lt,
- DWARF_VERSION_2,
2,
0,
{},
@@ -518,7 +474,6 @@ class DwarfOp {
// 0x2e DW_OP_ne
"DW_OP_ne",
&DwarfOp::op_ne,
- DWARF_VERSION_2,
2,
0,
{},
@@ -527,7 +482,6 @@ class DwarfOp {
// 0x2f DW_OP_skip
"DW_OP_skip",
&DwarfOp::op_skip,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sdata2},
@@ -536,7 +490,6 @@ class DwarfOp {
// 0x30 DW_OP_lit0
"DW_OP_lit0",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -545,7 +498,6 @@ class DwarfOp {
// 0x31 DW_OP_lit1
"DW_OP_lit1",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -554,7 +506,6 @@ class DwarfOp {
// 0x32 DW_OP_lit2
"DW_OP_lit2",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -563,7 +514,6 @@ class DwarfOp {
// 0x33 DW_OP_lit3
"DW_OP_lit3",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -572,7 +522,6 @@ class DwarfOp {
// 0x34 DW_OP_lit4
"DW_OP_lit4",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -581,7 +530,6 @@ class DwarfOp {
// 0x35 DW_OP_lit5
"DW_OP_lit5",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -590,7 +538,6 @@ class DwarfOp {
// 0x36 DW_OP_lit6
"DW_OP_lit6",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -599,7 +546,6 @@ class DwarfOp {
// 0x37 DW_OP_lit7
"DW_OP_lit7",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -608,7 +554,6 @@ class DwarfOp {
// 0x38 DW_OP_lit8
"DW_OP_lit8",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -617,7 +562,6 @@ class DwarfOp {
// 0x39 DW_OP_lit9
"DW_OP_lit9",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -626,7 +570,6 @@ class DwarfOp {
// 0x3a DW_OP_lit10
"DW_OP_lit10",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -635,7 +578,6 @@ class DwarfOp {
// 0x3b DW_OP_lit11
"DW_OP_lit11",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -644,7 +586,6 @@ class DwarfOp {
// 0x3c DW_OP_lit12
"DW_OP_lit12",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -653,7 +594,6 @@ class DwarfOp {
// 0x3d DW_OP_lit13
"DW_OP_lit13",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -662,7 +602,6 @@ class DwarfOp {
// 0x3e DW_OP_lit14
"DW_OP_lit14",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -671,7 +610,6 @@ class DwarfOp {
// 0x3f DW_OP_lit15
"DW_OP_lit15",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -680,7 +618,6 @@ class DwarfOp {
// 0x40 DW_OP_lit16
"DW_OP_lit16",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -689,7 +626,6 @@ class DwarfOp {
// 0x41 DW_OP_lit17
"DW_OP_lit17",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -698,7 +634,6 @@ class DwarfOp {
// 0x42 DW_OP_lit18
"DW_OP_lit18",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -707,7 +642,6 @@ class DwarfOp {
// 0x43 DW_OP_lit19
"DW_OP_lit19",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -716,7 +650,6 @@ class DwarfOp {
// 0x44 DW_OP_lit20
"DW_OP_lit20",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -725,7 +658,6 @@ class DwarfOp {
// 0x45 DW_OP_lit21
"DW_OP_lit21",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -734,7 +666,6 @@ class DwarfOp {
// 0x46 DW_OP_lit22
"DW_OP_lit22",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -743,7 +674,6 @@ class DwarfOp {
// 0x47 DW_OP_lit23
"DW_OP_lit23",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -752,7 +682,6 @@ class DwarfOp {
// 0x48 DW_OP_lit24
"DW_OP_lit24",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -761,7 +690,6 @@ class DwarfOp {
// 0x49 DW_OP_lit25
"DW_OP_lit25",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -770,7 +698,6 @@ class DwarfOp {
// 0x4a DW_OP_lit26
"DW_OP_lit26",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -779,7 +706,6 @@ class DwarfOp {
// 0x4b DW_OP_lit27
"DW_OP_lit27",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -788,7 +714,6 @@ class DwarfOp {
// 0x4c DW_OP_lit28
"DW_OP_lit28",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -797,7 +722,6 @@ class DwarfOp {
// 0x4d DW_OP_lit29
"DW_OP_lit29",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -806,7 +730,6 @@ class DwarfOp {
// 0x4e DW_OP_lit30
"DW_OP_lit30",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -815,7 +738,6 @@ class DwarfOp {
// 0x4f DW_OP_lit31
"DW_OP_lit31",
&DwarfOp::op_lit,
- DWARF_VERSION_2,
0,
0,
{},
@@ -824,7 +746,6 @@ class DwarfOp {
// 0x50 DW_OP_reg0
"DW_OP_reg0",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -833,7 +754,6 @@ class DwarfOp {
// 0x51 DW_OP_reg1
"DW_OP_reg1",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -842,7 +762,6 @@ class DwarfOp {
// 0x52 DW_OP_reg2
"DW_OP_reg2",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -851,7 +770,6 @@ class DwarfOp {
// 0x53 DW_OP_reg3
"DW_OP_reg3",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -860,7 +778,6 @@ class DwarfOp {
// 0x54 DW_OP_reg4
"DW_OP_reg4",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -869,7 +786,6 @@ class DwarfOp {
// 0x55 DW_OP_reg5
"DW_OP_reg5",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -878,7 +794,6 @@ class DwarfOp {
// 0x56 DW_OP_reg6
"DW_OP_reg6",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -887,7 +802,6 @@ class DwarfOp {
// 0x57 DW_OP_reg7
"DW_OP_reg7",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -896,7 +810,6 @@ class DwarfOp {
// 0x58 DW_OP_reg8
"DW_OP_reg8",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -905,7 +818,6 @@ class DwarfOp {
// 0x59 DW_OP_reg9
"DW_OP_reg9",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -914,7 +826,6 @@ class DwarfOp {
// 0x5a DW_OP_reg10
"DW_OP_reg10",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -923,7 +834,6 @@ class DwarfOp {
// 0x5b DW_OP_reg11
"DW_OP_reg11",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -932,7 +842,6 @@ class DwarfOp {
// 0x5c DW_OP_reg12
"DW_OP_reg12",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -941,7 +850,6 @@ class DwarfOp {
// 0x5d DW_OP_reg13
"DW_OP_reg13",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -950,7 +858,6 @@ class DwarfOp {
// 0x5e DW_OP_reg14
"DW_OP_reg14",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -959,7 +866,6 @@ class DwarfOp {
// 0x5f DW_OP_reg15
"DW_OP_reg15",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -968,7 +874,6 @@ class DwarfOp {
// 0x60 DW_OP_reg16
"DW_OP_reg16",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -977,7 +882,6 @@ class DwarfOp {
// 0x61 DW_OP_reg17
"DW_OP_reg17",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -986,7 +890,6 @@ class DwarfOp {
// 0x62 DW_OP_reg18
"DW_OP_reg18",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -995,7 +898,6 @@ class DwarfOp {
// 0x63 DW_OP_reg19
"DW_OP_reg19",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1004,7 +906,6 @@ class DwarfOp {
// 0x64 DW_OP_reg20
"DW_OP_reg20",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1013,7 +914,6 @@ class DwarfOp {
// 0x65 DW_OP_reg21
"DW_OP_reg21",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1022,7 +922,6 @@ class DwarfOp {
// 0x66 DW_OP_reg22
"DW_OP_reg22",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1031,7 +930,6 @@ class DwarfOp {
// 0x67 DW_OP_reg23
"DW_OP_reg23",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1040,7 +938,6 @@ class DwarfOp {
// 0x68 DW_OP_reg24
"DW_OP_reg24",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1049,7 +946,6 @@ class DwarfOp {
// 0x69 DW_OP_reg25
"DW_OP_reg25",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1058,7 +954,6 @@ class DwarfOp {
// 0x6a DW_OP_reg26
"DW_OP_reg26",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1067,7 +962,6 @@ class DwarfOp {
// 0x6b DW_OP_reg27
"DW_OP_reg27",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1076,7 +970,6 @@ class DwarfOp {
// 0x6c DW_OP_reg28
"DW_OP_reg28",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1085,7 +978,6 @@ class DwarfOp {
// 0x6d DW_OP_reg29
"DW_OP_reg29",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1094,7 +986,6 @@ class DwarfOp {
// 0x6e DW_OP_reg30
"DW_OP_reg30",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1103,7 +994,6 @@ class DwarfOp {
// 0x6f DW_OP_reg31
"DW_OP_reg31",
&DwarfOp::op_reg,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1112,7 +1002,6 @@ class DwarfOp {
// 0x70 DW_OP_breg0
"DW_OP_breg0",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1121,7 +1010,6 @@ class DwarfOp {
// 0x71 DW_OP_breg1
"DW_OP_breg1",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1130,7 +1018,6 @@ class DwarfOp {
// 0x72 DW_OP_breg2
"DW_OP_breg2",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1139,7 +1026,6 @@ class DwarfOp {
// 0x73 DW_OP_breg3
"DW_OP_breg3",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1148,7 +1034,6 @@ class DwarfOp {
// 0x74 DW_OP_breg4
"DW_OP_breg4",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1157,7 +1042,6 @@ class DwarfOp {
// 0x75 DW_OP_breg5
"DW_OP_breg5",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1166,7 +1050,6 @@ class DwarfOp {
// 0x76 DW_OP_breg6
"DW_OP_breg6",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1175,7 +1058,6 @@ class DwarfOp {
// 0x77 DW_OP_breg7
"DW_OP_breg7",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1184,7 +1066,6 @@ class DwarfOp {
// 0x78 DW_OP_breg8
"DW_OP_breg8",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1193,7 +1074,6 @@ class DwarfOp {
// 0x79 DW_OP_breg9
"DW_OP_breg9",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1202,7 +1082,6 @@ class DwarfOp {
// 0x7a DW_OP_breg10
"DW_OP_breg10",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1211,7 +1090,6 @@ class DwarfOp {
// 0x7b DW_OP_breg11
"DW_OP_breg11",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1220,7 +1098,6 @@ class DwarfOp {
// 0x7c DW_OP_breg12
"DW_OP_breg12",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1229,7 +1106,6 @@ class DwarfOp {
// 0x7d DW_OP_breg13
"DW_OP_breg13",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1238,7 +1114,6 @@ class DwarfOp {
// 0x7e DW_OP_breg14
"DW_OP_breg14",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1247,7 +1122,6 @@ class DwarfOp {
// 0x7f DW_OP_breg15
"DW_OP_breg15",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1256,7 +1130,6 @@ class DwarfOp {
// 0x80 DW_OP_breg16
"DW_OP_breg16",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1265,7 +1138,6 @@ class DwarfOp {
// 0x81 DW_OP_breg17
"DW_OP_breg17",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1274,7 +1146,6 @@ class DwarfOp {
// 0x82 DW_OP_breg18
"DW_OP_breg18",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1283,7 +1154,6 @@ class DwarfOp {
// 0x83 DW_OP_breg19
"DW_OP_breg19",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1292,7 +1162,6 @@ class DwarfOp {
// 0x84 DW_OP_breg20
"DW_OP_breg20",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1301,7 +1170,6 @@ class DwarfOp {
// 0x85 DW_OP_breg21
"DW_OP_breg21",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1310,7 +1178,6 @@ class DwarfOp {
// 0x86 DW_OP_breg22
"DW_OP_breg22",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1319,7 +1186,6 @@ class DwarfOp {
// 0x87 DW_OP_breg23
"DW_OP_breg23",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1328,7 +1194,6 @@ class DwarfOp {
// 0x88 DW_OP_breg24
"DW_OP_breg24",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1337,7 +1202,6 @@ class DwarfOp {
// 0x89 DW_OP_breg25
"DW_OP_breg25",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1346,7 +1210,6 @@ class DwarfOp {
// 0x8a DW_OP_breg26
"DW_OP_breg26",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1355,7 +1218,6 @@ class DwarfOp {
// 0x8b DW_OP_breg27
"DW_OP_breg27",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1364,7 +1226,6 @@ class DwarfOp {
// 0x8c DW_OP_breg28
"DW_OP_breg28",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1373,7 +1234,6 @@ class DwarfOp {
// 0x8d DW_OP_breg29
"DW_OP_breg29",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1382,7 +1242,6 @@ class DwarfOp {
// 0x8e DW_OP_breg30
"DW_OP_breg30",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1391,7 +1250,6 @@ class DwarfOp {
// 0x8f DW_OP_breg31
"DW_OP_breg31",
&DwarfOp::op_breg,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1400,7 +1258,6 @@ class DwarfOp {
// 0x90 DW_OP_regx
"DW_OP_regx",
&DwarfOp::op_regx,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_uleb128},
@@ -1409,7 +1266,6 @@ class DwarfOp {
// 0x91 DW_OP_fbreg
"DW_OP_fbreg",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_sleb128},
@@ -1418,7 +1274,6 @@ class DwarfOp {
// 0x92 DW_OP_bregx
"DW_OP_bregx",
&DwarfOp::op_bregx,
- DWARF_VERSION_2,
0,
2,
{DW_EH_PE_uleb128, DW_EH_PE_sleb128},
@@ -1427,7 +1282,6 @@ class DwarfOp {
// 0x93 DW_OP_piece
"DW_OP_piece",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_uleb128},
@@ -1436,7 +1290,6 @@ class DwarfOp {
// 0x94 DW_OP_deref_size
"DW_OP_deref_size",
&DwarfOp::op_deref_size,
- DWARF_VERSION_2,
1,
1,
{DW_EH_PE_udata1},
@@ -1445,7 +1298,6 @@ class DwarfOp {
// 0x95 DW_OP_xderef_size
"DW_OP_xderef_size",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_2,
0,
1,
{DW_EH_PE_udata1},
@@ -1454,7 +1306,6 @@ class DwarfOp {
// 0x96 DW_OP_nop
"DW_OP_nop",
&DwarfOp::op_nop,
- DWARF_VERSION_2,
0,
0,
{},
@@ -1463,7 +1314,6 @@ class DwarfOp {
// 0x97 DW_OP_push_object_address
"DW_OP_push_object_address",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_3,
0,
0,
{},
@@ -1472,7 +1322,6 @@ class DwarfOp {
// 0x98 DW_OP_call2
"DW_OP_call2",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_3,
0,
1,
{DW_EH_PE_udata2},
@@ -1481,7 +1330,6 @@ class DwarfOp {
// 0x99 DW_OP_call4
"DW_OP_call4",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_3,
0,
1,
{DW_EH_PE_udata4},
@@ -1490,7 +1338,6 @@ class DwarfOp {
// 0x9a DW_OP_call_ref
"DW_OP_call_ref",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_3,
0,
0, // Has a different sized operand (4 bytes or 8 bytes).
{},
@@ -1499,7 +1346,6 @@ class DwarfOp {
// 0x9b DW_OP_form_tls_address
"DW_OP_form_tls_address",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_3,
0,
0,
{},
@@ -1508,7 +1354,6 @@ class DwarfOp {
// 0x9c DW_OP_call_frame_cfa
"DW_OP_call_frame_cfa",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_3,
0,
0,
{},
@@ -1517,7 +1362,6 @@ class DwarfOp {
// 0x9d DW_OP_bit_piece
"DW_OP_bit_piece",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_3,
0,
2,
{DW_EH_PE_uleb128, DW_EH_PE_uleb128},
@@ -1526,7 +1370,6 @@ class DwarfOp {
// 0x9e DW_OP_implicit_value
"DW_OP_implicit_value",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_4,
0,
1,
{DW_EH_PE_uleb128},
@@ -1535,107 +1378,106 @@ class DwarfOp {
// 0x9f DW_OP_stack_value
"DW_OP_stack_value",
&DwarfOp::op_not_implemented,
- DWARF_VERSION_4,
- 1,
- 0,
- {},
- },
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xa0 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xa1 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xa2 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xa3 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xa4 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xa5 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xa6 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xa7 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xa8 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xa9 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xaa illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xab illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xac illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xad illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xae illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xaf illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xb0 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xb1 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xb2 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xb3 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xb4 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xb5 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xb6 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xb7 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xb8 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xb9 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xba illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xbb illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xbc illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xbd illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xbe illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xbf illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xc0 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xc1 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xc2 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xc3 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xc4 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xc5 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xc6 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xc7 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xc8 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xc9 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xca illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xcb illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xcc illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xcd illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xce illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xcf illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xd0 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xd1 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xd2 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xd3 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xd4 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xd5 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xd6 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xd7 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xd8 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xd9 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xda illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xdb illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xdc illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xdd illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xde illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xdf illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xe0 DW_OP_lo_user
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xe1 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xe2 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xe3 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xe4 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xe5 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xe6 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xe7 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xe8 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xe9 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xea illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xeb illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xec illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xed illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xee illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xef illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xf0 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xf1 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xf2 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xf3 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xf4 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xf5 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xf6 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xf7 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xf8 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xf9 illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xfa illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xfb illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xfc illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xfd illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xfe illegal op
- {nullptr, nullptr, 0, 0, 0, {}}, // 0xff DW_OP_hi_user
+ 1,
+ 0,
+ {},
+ },
+ {nullptr, nullptr, 0, 0, {}}, // 0xa0 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xa1 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xa2 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xa3 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xa4 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xa5 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xa6 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xa7 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xa8 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xa9 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xaa illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xab illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xac illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xad illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xae illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xaf illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xb0 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xb1 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xb2 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xb3 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xb4 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xb5 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xb6 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xb7 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xb8 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xb9 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xba illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xbb illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xbc illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xbd illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xbe illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xbf illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xc0 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xc1 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xc2 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xc3 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xc4 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xc5 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xc6 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xc7 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xc8 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xc9 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xca illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xcb illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xcc illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xcd illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xce illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xcf illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xd0 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xd1 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xd2 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xd3 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xd4 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xd5 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xd6 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xd7 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xd8 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xd9 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xda illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xdb illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xdc illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xdd illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xde illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xdf illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xe0 DW_OP_lo_user
+ {nullptr, nullptr, 0, 0, {}}, // 0xe1 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xe2 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xe3 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xe4 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xe5 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xe6 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xe7 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xe8 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xe9 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xea illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xeb illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xec illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xed illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xee illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xef illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xf0 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xf1 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xf2 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xf3 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xf4 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xf5 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xf6 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xf7 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xf8 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xf9 illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xfa illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xfb illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xfc illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xfd illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xfe illegal op
+ {nullptr, nullptr, 0, 0, {}}, // 0xff DW_OP_hi_user
};
};
diff --git a/libunwindstack/DwarfSection.cpp b/libunwindstack/DwarfSection.cpp
index 4e94f887d..764979863 100644
--- a/libunwindstack/DwarfSection.cpp
+++ b/libunwindstack/DwarfSection.cpp
@@ -26,16 +26,14 @@
#include <unwindstack/Regs.h>
#include "DwarfCfa.h"
-#include "DwarfEncoding.h"
-#include "DwarfOp.h"
-
#include "DwarfDebugFrame.h"
#include "DwarfEhFrame.h"
+#include "DwarfEncoding.h"
+#include "DwarfOp.h"
+#include "RegsInfo.h"
namespace unwindstack {
-constexpr uint64_t DEX_PC_REG = 0x20444558;
-
DwarfSection::DwarfSection(Memory* memory) : memory_(memory) {}
const DwarfFde* DwarfSection::GetFdeFromPc(uint64_t pc) {
@@ -75,14 +73,17 @@ bool DwarfSection::Step(uint64_t pc, Regs* regs, Memory* process_memory, bool* f
}
template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::EvalExpression(const DwarfLocation& loc, uint8_t version,
- Memory* regular_memory, AddressType* value) {
+bool DwarfSectionImpl<AddressType>::EvalExpression(const DwarfLocation& loc, Memory* regular_memory,
+ AddressType* value,
+ RegsInfo<AddressType>* regs_info,
+ bool* is_dex_pc) {
DwarfOp<AddressType> op(&memory_, regular_memory);
+ op.set_regs_info(regs_info);
// Need to evaluate the op data.
- uint64_t start = loc.values[1];
- uint64_t end = start + loc.values[0];
- if (!op.Eval(start, end, version)) {
+ uint64_t end = loc.values[1];
+ uint64_t start = end - loc.values[0];
+ if (!op.Eval(start, end)) {
last_error_ = op.last_error();
return false;
}
@@ -96,6 +97,9 @@ bool DwarfSectionImpl<AddressType>::EvalExpression(const DwarfLocation& loc, uin
return false;
}
*value = op.StackAt(0);
+ if (is_dex_pc != nullptr && op.dex_pc_set()) {
+ *is_dex_pc = true;
+ }
return true;
}
@@ -103,12 +107,10 @@ template <typename AddressType>
struct EvalInfo {
const dwarf_loc_regs_t* loc_regs;
const DwarfCie* cie;
- RegsImpl<AddressType>* cur_regs;
Memory* regular_memory;
AddressType cfa;
bool return_address_undefined = false;
- uint64_t reg_map = 0;
- AddressType reg_values[64];
+ RegsInfo<AddressType> regs_info;
};
template <typename AddressType>
@@ -129,32 +131,18 @@ bool DwarfSectionImpl<AddressType>::EvalRegister(const DwarfLocation* loc, uint3
break;
case DWARF_LOCATION_REGISTER: {
uint32_t cur_reg = loc->values[0];
- if (cur_reg >= eval_info->cur_regs->total_regs()) {
+ if (cur_reg >= eval_info->regs_info.Total()) {
last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
return false;
}
- AddressType* cur_reg_ptr = &(*eval_info->cur_regs)[cur_reg];
- const auto& entry = eval_info->loc_regs->find(cur_reg);
- if (entry != eval_info->loc_regs->end()) {
- if (!(eval_info->reg_map & (1 << cur_reg))) {
- eval_info->reg_map |= 1 << cur_reg;
- eval_info->reg_values[cur_reg] = *cur_reg_ptr;
- if (!EvalRegister(&entry->second, cur_reg, cur_reg_ptr, eval_info)) {
- return false;
- }
- }
-
- // Use the register value from before any evaluations.
- *reg_ptr = eval_info->reg_values[cur_reg] + loc->values[1];
- } else {
- *reg_ptr = *cur_reg_ptr + loc->values[1];
- }
+ *reg_ptr = eval_info->regs_info.Get(cur_reg) + loc->values[1];
break;
}
case DWARF_LOCATION_EXPRESSION:
case DWARF_LOCATION_VAL_EXPRESSION: {
AddressType value;
- if (!EvalExpression(*loc, eval_info->cie->version, regular_memory, &value)) {
+ bool is_dex_pc = false;
+ if (!EvalExpression(*loc, regular_memory, &value, &eval_info->regs_info, &is_dex_pc)) {
return false;
}
if (loc->type == DWARF_LOCATION_EXPRESSION) {
@@ -165,6 +153,9 @@ bool DwarfSectionImpl<AddressType>::EvalRegister(const DwarfLocation* loc, uint3
}
} else {
*reg_ptr = value;
+ if (is_dex_pc) {
+ eval_info->regs_info.regs->set_dex_pc(value);
+ }
}
break;
}
@@ -201,8 +192,10 @@ bool DwarfSectionImpl<AddressType>::Eval(const DwarfCie* cie, Memory* regular_me
AddressType prev_cfa = regs->sp();
- EvalInfo<AddressType> eval_info{
- .loc_regs = &loc_regs, .cie = cie, .regular_memory = regular_memory, .cur_regs = cur_regs};
+ EvalInfo<AddressType> eval_info{.loc_regs = &loc_regs,
+ .cie = cie,
+ .regular_memory = regular_memory,
+ .regs_info = RegsInfo<AddressType>(cur_regs)};
const DwarfLocation* loc = &cfa_entry->second;
// Only a few location types are valid for the cfa.
switch (loc->type) {
@@ -224,7 +217,7 @@ bool DwarfSectionImpl<AddressType>::Eval(const DwarfCie* cie, Memory* regular_me
case DWARF_LOCATION_EXPRESSION:
case DWARF_LOCATION_VAL_EXPRESSION: {
AddressType value;
- if (!EvalExpression(*loc, cie->version, regular_memory, &value)) {
+ if (!EvalExpression(*loc, regular_memory, &value, &eval_info.regs_info, nullptr)) {
return false;
}
if (loc->type == DWARF_LOCATION_EXPRESSION) {
@@ -249,28 +242,15 @@ bool DwarfSectionImpl<AddressType>::Eval(const DwarfCie* cie, Memory* regular_me
if (reg == CFA_REG) continue;
AddressType* reg_ptr;
- AddressType dex_pc = 0;
- if (reg == DEX_PC_REG) {
- // Special register that indicates this is a dex pc.
- dex_pc = 0;
- reg_ptr = &dex_pc;
- } else if (reg >= cur_regs->total_regs() || eval_info.reg_map & (1 << reg)) {
- // Skip this unknown register, or a register that has already been
- // processed.
+ if (reg >= cur_regs->total_regs()) {
+ // Skip this unknown register.
continue;
- } else {
- reg_ptr = &(*cur_regs)[reg];
- eval_info.reg_map |= 1 << reg;
- eval_info.reg_values[reg] = *reg_ptr;
}
+ reg_ptr = eval_info.regs_info.Save(reg);
if (!EvalRegister(&entry.second, reg, reg_ptr, &eval_info)) {
return false;
}
-
- if (reg == DEX_PC_REG) {
- cur_regs->set_dex_pc(dex_pc);
- }
}
// Find the return address location.
diff --git a/libunwindstack/RegsInfo.h b/libunwindstack/RegsInfo.h
new file mode 100644
index 000000000..47825f534
--- /dev/null
+++ b/libunwindstack/RegsInfo.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _LIBUNWINDSTACK_REGS_INFO_H
+#define _LIBUNWINDSTACK_REGS_INFO_H
+
+#include <stdint.h>
+
+#include <unwindstack/Regs.h>
+
+namespace unwindstack {
+
+template <typename AddressType>
+struct RegsInfo {
+ RegsInfo(RegsImpl<AddressType>* regs) : regs(regs) {}
+
+ RegsImpl<AddressType>* regs = nullptr;
+ uint64_t saved_reg_map = 0;
+ AddressType saved_regs[64];
+
+ inline AddressType Get(uint32_t reg) {
+ if (IsSaved(reg)) {
+ return saved_regs[reg];
+ }
+ return (*regs)[reg];
+ }
+
+ inline AddressType* Save(uint32_t reg) {
+ if (reg > sizeof(saved_regs) / sizeof(AddressType)) {
+ // This should never happen as since all currently supported
+ // architectures have the total number of registers < 64.
+ abort();
+ }
+ saved_reg_map |= 1 << reg;
+ saved_regs[reg] = (*regs)[reg];
+ return &(*regs)[reg];
+ }
+
+ inline bool IsSaved(uint32_t reg) {
+ if (reg > sizeof(saved_regs) / sizeof(AddressType)) {
+ // This should never happen as since all currently supported
+ // architectures have the total number of registers < 64.
+ abort();
+ }
+ return saved_reg_map & (1 << reg);
+ }
+
+ inline uint16_t Total() { return regs->total_regs(); }
+};
+
+} // namespace unwindstack
+
+#endif // _LIBUNWINDSTACK_REGS_INFO_H
diff --git a/libunwindstack/Unwinder.cpp b/libunwindstack/Unwinder.cpp
index 5e3293325..d52a0bf99 100644
--- a/libunwindstack/Unwinder.cpp
+++ b/libunwindstack/Unwinder.cpp
@@ -48,6 +48,7 @@ void Unwinder::FillInDexFrame() {
size_t frame_num = frames_.size();
frames_.resize(frame_num + 1);
FrameData* frame = &frames_.at(frame_num);
+ frame->num = frame_num;
uint64_t dex_pc = regs_->dex_pc();
frame->pc = dex_pc;
diff --git a/libunwindstack/include/unwindstack/DwarfSection.h b/libunwindstack/include/unwindstack/DwarfSection.h
index 03f40d699..da91fd087 100644
--- a/libunwindstack/include/unwindstack/DwarfSection.h
+++ b/libunwindstack/include/unwindstack/DwarfSection.h
@@ -32,6 +32,8 @@ namespace unwindstack {
// Forward declarations.
class Memory;
class Regs;
+template <typename AddressType>
+struct RegsInfo;
class DwarfSection {
public:
@@ -149,8 +151,8 @@ class DwarfSectionImpl : public DwarfSection {
bool Log(uint8_t indent, uint64_t pc, uint64_t load_bias, const DwarfFde* fde) override;
protected:
- bool EvalExpression(const DwarfLocation& loc, uint8_t version, Memory* regular_memory,
- AddressType* value);
+ bool EvalExpression(const DwarfLocation& loc, Memory* regular_memory, AddressType* value,
+ RegsInfo<AddressType>* regs_info, bool* is_dex_pc);
bool GetCieInfo(uint8_t* segment_size, uint8_t* encoding);
diff --git a/libunwindstack/tests/DwarfOpTest.cpp b/libunwindstack/tests/DwarfOpTest.cpp
index 036226d03..6e15227b3 100644
--- a/libunwindstack/tests/DwarfOpTest.cpp
+++ b/libunwindstack/tests/DwarfOpTest.cpp
@@ -52,14 +52,14 @@ TYPED_TEST_CASE_P(DwarfOpTest);
TYPED_TEST_P(DwarfOpTest, decode) {
// Memory error.
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_MEMORY_INVALID, this->op_->LastErrorCode());
EXPECT_EQ(0U, this->op_->LastErrorAddress());
// No error.
this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x96});
this->mem_->set_cur_offset(0);
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_NONE, this->op_->LastErrorCode());
ASSERT_EQ(0x96U, this->op_->cur_op());
ASSERT_EQ(1U, this->mem_->cur_offset());
@@ -67,14 +67,14 @@ TYPED_TEST_P(DwarfOpTest, decode) {
TYPED_TEST_P(DwarfOpTest, eval) {
// Memory error.
- ASSERT_FALSE(this->op_->Eval(0, 2, DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Eval(0, 2));
ASSERT_EQ(DWARF_ERROR_MEMORY_INVALID, this->op_->LastErrorCode());
EXPECT_EQ(0U, this->op_->LastErrorAddress());
// Register set.
// Do this first, to verify that subsequent calls reset the value.
this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x50});
- ASSERT_TRUE(this->op_->Eval(0, 1, DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Eval(0, 1));
ASSERT_TRUE(this->op_->is_register());
ASSERT_EQ(1U, this->mem_->cur_offset());
ASSERT_EQ(1U, this->op_->StackSize());
@@ -85,7 +85,7 @@ TYPED_TEST_P(DwarfOpTest, eval) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_TRUE(this->op_->Eval(0, 8, DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Eval(0, 8));
ASSERT_EQ(DWARF_ERROR_NONE, this->op_->LastErrorCode());
ASSERT_FALSE(this->op_->is_register());
ASSERT_EQ(8U, this->mem_->cur_offset());
@@ -97,7 +97,7 @@ TYPED_TEST_P(DwarfOpTest, eval) {
// Infinite loop.
this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x2f, 0xfd, 0xff});
- ASSERT_FALSE(this->op_->Eval(0, 4, DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Eval(0, 4));
ASSERT_EQ(DWARF_ERROR_TOO_MANY_ITERATIONS, this->op_->LastErrorCode());
ASSERT_FALSE(this->op_->is_register());
ASSERT_EQ(0U, this->op_->StackSize());
@@ -112,29 +112,7 @@ TYPED_TEST_P(DwarfOpTest, illegal_opcode) {
this->op_memory_.SetMemory(0, opcode_buffer);
for (size_t i = 0; i < opcode_buffer.size(); i++) {
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
- ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
- ASSERT_EQ(opcode_buffer[i], this->op_->cur_op());
- }
-}
-
-TYPED_TEST_P(DwarfOpTest, illegal_in_version3) {
- std::vector<uint8_t> opcode_buffer = {0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d};
- this->op_memory_.SetMemory(0, opcode_buffer);
-
- for (size_t i = 0; i < opcode_buffer.size(); i++) {
- ASSERT_FALSE(this->op_->Decode(2));
- ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
- ASSERT_EQ(opcode_buffer[i], this->op_->cur_op());
- }
-}
-
-TYPED_TEST_P(DwarfOpTest, illegal_in_version4) {
- std::vector<uint8_t> opcode_buffer = {0x9e, 0x9f};
- this->op_memory_.SetMemory(0, opcode_buffer);
-
- for (size_t i = 0; i < opcode_buffer.size(); i++) {
- ASSERT_FALSE(this->op_->Decode(3));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
ASSERT_EQ(opcode_buffer[i], this->op_->cur_op());
}
@@ -174,12 +152,12 @@ TYPED_TEST_P(DwarfOpTest, not_implemented) {
this->op_memory_.SetMemory(0, opcode_buffer);
// Push the stack values.
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
+ ASSERT_TRUE(this->op_->Decode());
+ ASSERT_TRUE(this->op_->Decode());
while (this->mem_->cur_offset() < opcode_buffer.size()) {
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_NOT_IMPLEMENTED, this->op_->LastErrorCode());
}
}
@@ -194,7 +172,7 @@ TYPED_TEST_P(DwarfOpTest, op_addr) {
}
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x03, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
if (sizeof(TypeParam) == 4) {
@@ -217,17 +195,17 @@ TYPED_TEST_P(DwarfOpTest, op_deref) {
TypeParam value = 0x12345678;
this->regular_memory_.SetMemory(0x2010, &value, sizeof(value));
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x06, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(value, this->op_->StackAt(0));
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_MEMORY_INVALID, this->op_->LastErrorCode());
ASSERT_EQ(0x12345678U, this->op_->LastErrorAddress());
}
@@ -237,14 +215,14 @@ TYPED_TEST_P(DwarfOpTest, op_deref_size) {
TypeParam value = 0x12345678;
this->regular_memory_.SetMemory(0x2010, &value, sizeof(value));
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
// Read all byte sizes up to the sizeof the type.
for (size_t i = 1; i < sizeof(TypeParam); i++) {
this->op_memory_.SetMemory(
0, std::vector<uint8_t>{0x0a, 0x10, 0x20, 0x94, static_cast<uint8_t>(i)});
- ASSERT_TRUE(this->op_->Eval(0, 5, DWARF_VERSION_MAX)) << "Failed at size " << i;
+ ASSERT_TRUE(this->op_->Eval(0, 5)) << "Failed at size " << i;
ASSERT_EQ(1U, this->op_->StackSize()) << "Failed at size " << i;
ASSERT_EQ(0x94, this->op_->cur_op()) << "Failed at size " << i;
TypeParam expected_value = 0;
@@ -254,17 +232,17 @@ TYPED_TEST_P(DwarfOpTest, op_deref_size) {
// Zero byte read.
this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x0a, 0x10, 0x20, 0x94, 0x00});
- ASSERT_FALSE(this->op_->Eval(0, 5, DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Eval(0, 5));
ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
// Read too many bytes.
this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x0a, 0x10, 0x20, 0x94, sizeof(TypeParam) + 1});
- ASSERT_FALSE(this->op_->Eval(0, 5, DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Eval(0, 5));
ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
// Force bad memory read.
this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x0a, 0x10, 0x40, 0x94, 0x01});
- ASSERT_FALSE(this->op_->Eval(0, 5, DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Eval(0, 5));
ASSERT_EQ(DWARF_ERROR_MEMORY_INVALID, this->op_->LastErrorCode());
EXPECT_EQ(0x4010U, this->op_->LastErrorAddress());
}
@@ -284,40 +262,40 @@ TYPED_TEST_P(DwarfOpTest, const_unsigned) {
this->op_memory_.SetMemory(0, opcode_buffer);
// const1u
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x08, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x12U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x08, this->op_->cur_op());
ASSERT_EQ(2U, this->op_->StackSize());
ASSERT_EQ(0xffU, this->op_->StackAt(0));
// const2u
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0a, this->op_->cur_op());
ASSERT_EQ(3U, this->op_->StackSize());
ASSERT_EQ(0x1245U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0a, this->op_->cur_op());
ASSERT_EQ(4U, this->op_->StackSize());
ASSERT_EQ(0xff00U, this->op_->StackAt(0));
// const4u
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0c, this->op_->cur_op());
ASSERT_EQ(5U, this->op_->StackSize());
ASSERT_EQ(0x45342312U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0c, this->op_->cur_op());
ASSERT_EQ(6U, this->op_->StackSize());
ASSERT_EQ(0xff010203U, this->op_->StackAt(0));
// const8u
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0e, this->op_->cur_op());
ASSERT_EQ(7U, this->op_->StackSize());
if (sizeof(TypeParam) == 4) {
@@ -326,7 +304,7 @@ TYPED_TEST_P(DwarfOpTest, const_unsigned) {
ASSERT_EQ(0x0102030405060708ULL, this->op_->StackAt(0));
}
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0e, this->op_->cur_op());
ASSERT_EQ(8U, this->op_->StackSize());
if (sizeof(TypeParam) == 4) {
@@ -351,40 +329,40 @@ TYPED_TEST_P(DwarfOpTest, const_signed) {
this->op_memory_.SetMemory(0, opcode_buffer);
// const1s
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x09, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x12U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x09, this->op_->cur_op());
ASSERT_EQ(2U, this->op_->StackSize());
ASSERT_EQ(static_cast<TypeParam>(-1), this->op_->StackAt(0));
// const2s
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0b, this->op_->cur_op());
ASSERT_EQ(3U, this->op_->StackSize());
ASSERT_EQ(0x3221U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0b, this->op_->cur_op());
ASSERT_EQ(4U, this->op_->StackSize());
ASSERT_EQ(static_cast<TypeParam>(-248), this->op_->StackAt(0));
// const4s
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0d, this->op_->cur_op());
ASSERT_EQ(5U, this->op_->StackSize());
ASSERT_EQ(0x12233445U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0d, this->op_->cur_op());
ASSERT_EQ(6U, this->op_->StackSize());
ASSERT_EQ(static_cast<TypeParam>(-16580095), this->op_->StackAt(0));
// const8s
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0f, this->op_->cur_op());
ASSERT_EQ(7U, this->op_->StackSize());
if (sizeof(TypeParam) == 4) {
@@ -393,7 +371,7 @@ TYPED_TEST_P(DwarfOpTest, const_signed) {
ASSERT_EQ(0x1223344556677889ULL, this->op_->StackAt(0));
}
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x0f, this->op_->cur_op());
ASSERT_EQ(8U, this->op_->StackSize());
if (sizeof(TypeParam) == 4) {
@@ -414,28 +392,28 @@ TYPED_TEST_P(DwarfOpTest, const_uleb) {
this->op_memory_.SetMemory(0, opcode_buffer);
// Single byte ULEB128
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x10, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x22U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x10, this->op_->cur_op());
ASSERT_EQ(2U, this->op_->StackSize());
ASSERT_EQ(0x7fU, this->op_->StackAt(0));
// Multi byte ULEB128
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x10, this->op_->cur_op());
ASSERT_EQ(3U, this->op_->StackSize());
ASSERT_EQ(0x1122U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x10, this->op_->cur_op());
ASSERT_EQ(4U, this->op_->StackSize());
ASSERT_EQ(0x3a22U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x10, this->op_->cur_op());
ASSERT_EQ(5U, this->op_->StackSize());
if (sizeof(TypeParam) == 4) {
@@ -444,7 +422,7 @@ TYPED_TEST_P(DwarfOpTest, const_uleb) {
ASSERT_EQ(0x9101c305080c101ULL, this->op_->StackAt(0));
}
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x10, this->op_->cur_op());
ASSERT_EQ(6U, this->op_->StackSize());
if (sizeof(TypeParam) == 4) {
@@ -480,28 +458,28 @@ TYPED_TEST_P(DwarfOpTest, const_sleb) {
this->op_memory_.SetMemory(0, opcode_buffer);
// Single byte SLEB128
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x11, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x22U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x11, this->op_->cur_op());
ASSERT_EQ(2U, this->op_->StackSize());
ASSERT_EQ(static_cast<TypeParam>(-1), this->op_->StackAt(0));
// Multi byte SLEB128
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x11, this->op_->cur_op());
ASSERT_EQ(3U, this->op_->StackSize());
ASSERT_EQ(0x1122U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x11, this->op_->cur_op());
ASSERT_EQ(4U, this->op_->StackSize());
ASSERT_EQ(static_cast<TypeParam>(-1502), this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x11, this->op_->cur_op());
ASSERT_EQ(5U, this->op_->StackSize());
if (sizeof(TypeParam) == 4) {
@@ -510,7 +488,7 @@ TYPED_TEST_P(DwarfOpTest, const_sleb) {
ASSERT_EQ(0x9101c305080c101ULL, this->op_->StackAt(0));
}
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x11, this->op_->cur_op());
ASSERT_EQ(6U, this->op_->StackSize());
if (sizeof(TypeParam) == 4) {
@@ -531,21 +509,21 @@ TYPED_TEST_P(DwarfOpTest, op_dup) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(0x12, this->op_->cur_op());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x12, this->op_->cur_op());
ASSERT_EQ(2U, this->op_->StackSize());
ASSERT_EQ(0x15U, this->op_->StackAt(0));
ASSERT_EQ(0x15U, this->op_->StackAt(1));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(3U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x12, this->op_->cur_op());
ASSERT_EQ(4U, this->op_->StackSize());
ASSERT_EQ(0x23U, this->op_->StackAt(0));
@@ -565,21 +543,21 @@ TYPED_TEST_P(DwarfOpTest, op_drop) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x13, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x10U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x13, this->op_->cur_op());
ASSERT_EQ(0U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(0x13, this->op_->cur_op());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
}
@@ -597,24 +575,24 @@ TYPED_TEST_P(DwarfOpTest, op_over) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x14, this->op_->cur_op());
ASSERT_EQ(3U, this->op_->StackSize());
ASSERT_EQ(0x1aU, this->op_->StackAt(0));
ASSERT_EQ(0xedU, this->op_->StackAt(1));
ASSERT_EQ(0x1aU, this->op_->StackAt(2));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(0x14, this->op_->cur_op());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
}
@@ -632,14 +610,14 @@ TYPED_TEST_P(DwarfOpTest, op_pick) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(3U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x15, this->op_->cur_op());
ASSERT_EQ(4U, this->op_->StackSize());
ASSERT_EQ(0xedU, this->op_->StackAt(0));
@@ -647,7 +625,7 @@ TYPED_TEST_P(DwarfOpTest, op_pick) {
ASSERT_EQ(0xedU, this->op_->StackAt(2));
ASSERT_EQ(0x1aU, this->op_->StackAt(3));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x15, this->op_->cur_op());
ASSERT_EQ(5U, this->op_->StackSize());
ASSERT_EQ(0x1aU, this->op_->StackAt(0));
@@ -656,7 +634,7 @@ TYPED_TEST_P(DwarfOpTest, op_pick) {
ASSERT_EQ(0xedU, this->op_->StackAt(3));
ASSERT_EQ(0x1aU, this->op_->StackAt(4));
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(0x15, this->op_->cur_op());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
}
@@ -672,23 +650,23 @@ TYPED_TEST_P(DwarfOpTest, op_swap) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
ASSERT_EQ(0xabU, this->op_->StackAt(0));
ASSERT_EQ(0x26U, this->op_->StackAt(1));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x16, this->op_->cur_op());
ASSERT_EQ(2U, this->op_->StackSize());
ASSERT_EQ(0x26U, this->op_->StackAt(0));
ASSERT_EQ(0xabU, this->op_->StackAt(1));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(0x16, this->op_->cur_op());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
}
@@ -706,28 +684,28 @@ TYPED_TEST_P(DwarfOpTest, op_rot) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(3U, this->op_->StackSize());
ASSERT_EQ(0x30U, this->op_->StackAt(0));
ASSERT_EQ(0x20U, this->op_->StackAt(1));
ASSERT_EQ(0x10U, this->op_->StackAt(2));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x17, this->op_->cur_op());
ASSERT_EQ(3U, this->op_->StackSize());
ASSERT_EQ(0x20U, this->op_->StackAt(0));
@@ -756,30 +734,30 @@ TYPED_TEST_P(DwarfOpTest, op_abs) {
opcode_buffer.push_back(0x19);
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x10U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x19, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x10U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x19, this->op_->cur_op());
ASSERT_EQ(2U, this->op_->StackSize());
ASSERT_EQ(0x1U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(3U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x19, this->op_->cur_op());
ASSERT_EQ(3U, this->op_->StackSize());
if (sizeof(TypeParam) == 4) {
@@ -808,56 +786,56 @@ TYPED_TEST_P(DwarfOpTest, op_and) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
// Two positive values.
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x1b, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x10U, this->op_->StackAt(0));
// Two negative values.
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(3U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x1b, this->op_->cur_op());
ASSERT_EQ(2U, this->op_->StackSize());
ASSERT_EQ(0x04U, this->op_->StackAt(0));
// One negative value, one positive value.
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(3U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(4U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x1b, this->op_->cur_op());
ASSERT_EQ(3U, this->op_->StackSize());
ASSERT_EQ(static_cast<TypeParam>(-4), this->op_->StackAt(0));
// Divide by zero.
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(4U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(5U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
}
@@ -874,19 +852,19 @@ TYPED_TEST_P(DwarfOpTest, op_div) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x1a, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x40U, this->op_->StackAt(0));
@@ -905,19 +883,19 @@ TYPED_TEST_P(DwarfOpTest, op_minus) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x1c, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x44U, this->op_->StackAt(0));
@@ -938,29 +916,29 @@ TYPED_TEST_P(DwarfOpTest, op_mod) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x1d, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x03U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(3U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
}
@@ -977,19 +955,19 @@ TYPED_TEST_P(DwarfOpTest, op_mul) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x1e, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x120U, this->op_->StackAt(0));
@@ -1006,21 +984,21 @@ TYPED_TEST_P(DwarfOpTest, op_neg) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x1f, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(static_cast<TypeParam>(-72), this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x1f, this->op_->cur_op());
ASSERT_EQ(2U, this->op_->StackSize());
ASSERT_EQ(0x01U, this->op_->StackAt(0));
@@ -1037,21 +1015,21 @@ TYPED_TEST_P(DwarfOpTest, op_not) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x20, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(static_cast<TypeParam>(-5), this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x20, this->op_->cur_op());
ASSERT_EQ(2U, this->op_->StackSize());
ASSERT_EQ(0x03U, this->op_->StackAt(0));
@@ -1070,19 +1048,19 @@ TYPED_TEST_P(DwarfOpTest, op_or) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x21, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0xfcU, this->op_->StackAt(0));
@@ -1101,19 +1079,19 @@ TYPED_TEST_P(DwarfOpTest, op_plus) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x22, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x1f1U, this->op_->StackAt(0));
@@ -1128,13 +1106,13 @@ TYPED_TEST_P(DwarfOpTest, op_plus_uconst) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x23, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x28d0U, this->op_->StackAt(0));
@@ -1153,19 +1131,19 @@ TYPED_TEST_P(DwarfOpTest, op_shl) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x24, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x338U, this->op_->StackAt(0));
@@ -1184,19 +1162,19 @@ TYPED_TEST_P(DwarfOpTest, op_shr) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x25, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
if (sizeof(TypeParam) == 4) {
@@ -1219,19 +1197,19 @@ TYPED_TEST_P(DwarfOpTest, op_shra) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x26, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(static_cast<TypeParam>(-2), this->op_->StackAt(0));
@@ -1250,19 +1228,19 @@ TYPED_TEST_P(DwarfOpTest, op_xor) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(2U, this->op_->StackSize());
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x27, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x50U, this->op_->StackAt(0));
@@ -1283,48 +1261,48 @@ TYPED_TEST_P(DwarfOpTest, op_bra) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Decode());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
// Push on a non-zero value with a positive branch.
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
uint64_t offset = this->mem_->cur_offset() + 3;
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x28, this->op_->cur_op());
ASSERT_EQ(0U, this->op_->StackSize());
ASSERT_EQ(offset + 0x102, this->mem_->cur_offset());
// Push on a zero value with a positive branch.
this->mem_->set_cur_offset(offset);
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
offset = this->mem_->cur_offset() + 3;
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x28, this->op_->cur_op());
ASSERT_EQ(0U, this->op_->StackSize());
ASSERT_EQ(offset - 5, this->mem_->cur_offset());
// Push on a non-zero value with a negative branch.
this->mem_->set_cur_offset(offset);
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
offset = this->mem_->cur_offset() + 3;
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x28, this->op_->cur_op());
ASSERT_EQ(0U, this->op_->StackSize());
ASSERT_EQ(offset - 4, this->mem_->cur_offset());
// Push on a zero value with a negative branch.
this->mem_->set_cur_offset(offset);
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(1U, this->op_->StackSize());
offset = this->mem_->cur_offset() + 3;
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x28, this->op_->cur_op());
ASSERT_EQ(0U, this->op_->StackSize());
ASSERT_EQ(offset + 16, this->mem_->cur_offset());
@@ -1344,11 +1322,11 @@ TYPED_TEST_P(DwarfOpTest, compare_opcode_stack_error) {
opcode_buffer[3] = opcode;
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_FALSE(this->op_->Eval(0, 1, DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Eval(0, 1));
ASSERT_EQ(opcode, this->op_->cur_op());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
- ASSERT_FALSE(this->op_->Eval(1, 4, DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Eval(1, 4));
ASSERT_EQ(opcode, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
@@ -1387,7 +1365,7 @@ TYPED_TEST_P(DwarfOpTest, compare_opcodes) {
opcode_buffer[14] = expected[i];
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_TRUE(this->op_->Eval(0, 15, DWARF_VERSION_MAX))
+ ASSERT_TRUE(this->op_->Eval(0, 15))
<< "Op: 0x" << std::hex << static_cast<uint32_t>(expected[i]) << " failed";
ASSERT_EQ(3U, this->op_->StackSize());
@@ -1407,14 +1385,14 @@ TYPED_TEST_P(DwarfOpTest, op_skip) {
this->op_memory_.SetMemory(0, opcode_buffer);
uint64_t offset = this->mem_->cur_offset() + 3;
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x2f, this->op_->cur_op());
ASSERT_EQ(0U, this->op_->StackSize());
ASSERT_EQ(offset + 0x2010, this->mem_->cur_offset());
this->mem_->set_cur_offset(offset);
offset = this->mem_->cur_offset() + 3;
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x2f, this->op_->cur_op());
ASSERT_EQ(0U, this->op_->StackSize());
ASSERT_EQ(offset - 3, this->mem_->cur_offset());
@@ -1431,7 +1409,7 @@ TYPED_TEST_P(DwarfOpTest, op_lit) {
for (size_t i = 0; i < opcode_buffer.size(); i++) {
uint32_t op = opcode_buffer[i];
- ASSERT_TRUE(this->op_->Eval(i, i + 1, DWARF_VERSION_MAX)) << "Failed op: 0x" << std::hex << op;
+ ASSERT_TRUE(this->op_->Eval(i, i + 1)) << "Failed op: 0x" << std::hex << op;
ASSERT_EQ(op, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize()) << "Failed op: 0x" << std::hex << op;
ASSERT_EQ(op - 0x30U, this->op_->StackAt(0)) << "Failed op: 0x" << std::hex << op;
@@ -1449,7 +1427,7 @@ TYPED_TEST_P(DwarfOpTest, op_reg) {
for (size_t i = 0; i < opcode_buffer.size(); i++) {
uint32_t op = opcode_buffer[i];
- ASSERT_TRUE(this->op_->Eval(i, i + 1, DWARF_VERSION_MAX)) << "Failed op: 0x" << std::hex << op;
+ ASSERT_TRUE(this->op_->Eval(i, i + 1)) << "Failed op: 0x" << std::hex << op;
ASSERT_EQ(op, this->op_->cur_op());
ASSERT_TRUE(this->op_->is_register()) << "Failed op: 0x" << std::hex << op;
ASSERT_EQ(1U, this->op_->StackSize()) << "Failed op: 0x" << std::hex << op;
@@ -1463,13 +1441,13 @@ TYPED_TEST_P(DwarfOpTest, op_regx) {
};
this->op_memory_.SetMemory(0, opcode_buffer);
- ASSERT_TRUE(this->op_->Eval(0, 2, DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Eval(0, 2));
ASSERT_EQ(0x90, this->op_->cur_op());
ASSERT_TRUE(this->op_->is_register());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x02U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Eval(2, 5, DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Eval(2, 5));
ASSERT_EQ(0x90, this->op_->cur_op());
ASSERT_TRUE(this->op_->is_register());
ASSERT_EQ(1U, this->op_->StackSize());
@@ -1494,21 +1472,20 @@ TYPED_TEST_P(DwarfOpTest, op_breg) {
for (size_t i = 0; i < 32; i++) {
regs[i] = i + 10;
}
- this->op_->set_regs(&regs);
+ RegsInfo<TypeParam> regs_info(&regs);
+ this->op_->set_regs_info(&regs_info);
uint64_t offset = 0;
for (uint32_t op = 0x70; op <= 0x8f; op++) {
// Positive value added to register.
- ASSERT_TRUE(this->op_->Eval(offset, offset + 2, DWARF_VERSION_MAX)) << "Failed op: 0x"
- << std::hex << op;
+ ASSERT_TRUE(this->op_->Eval(offset, offset + 2)) << "Failed op: 0x" << std::hex << op;
ASSERT_EQ(op, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize()) << "Failed op: 0x" << std::hex << op;
ASSERT_EQ(op - 0x70 + 10 + 0x12, this->op_->StackAt(0)) << "Failed op: 0x" << std::hex << op;
offset += 2;
// Negative value added to register.
- ASSERT_TRUE(this->op_->Eval(offset, offset + 2, DWARF_VERSION_MAX)) << "Failed op: 0x"
- << std::hex << op;
+ ASSERT_TRUE(this->op_->Eval(offset, offset + 2)) << "Failed op: 0x" << std::hex << op;
ASSERT_EQ(op, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize()) << "Failed op: 0x" << std::hex << op;
ASSERT_EQ(op - 0x70 + 10 - 2, this->op_->StackAt(0)) << "Failed op: 0x" << std::hex << op;
@@ -1526,16 +1503,17 @@ TYPED_TEST_P(DwarfOpTest, op_breg_invalid_register) {
for (size_t i = 0; i < 16; i++) {
regs[i] = i + 10;
}
- this->op_->set_regs(&regs);
+ RegsInfo<TypeParam> regs_info(&regs);
+ this->op_->set_regs_info(&regs_info);
// Should pass since this references the last regsister.
- ASSERT_TRUE(this->op_->Eval(0, 2, DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Eval(0, 2));
ASSERT_EQ(0x7fU, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x2bU, this->op_->StackAt(0));
// Should fail since this references a non-existent register.
- ASSERT_FALSE(this->op_->Eval(2, 4, DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Eval(2, 4));
ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
}
@@ -1551,38 +1529,55 @@ TYPED_TEST_P(DwarfOpTest, op_bregx) {
RegsImplFake<TypeParam> regs(10, 10);
regs[5] = 0x45;
regs[6] = 0x190;
- this->op_->set_regs(&regs);
+ RegsInfo<TypeParam> regs_info(&regs);
+ this->op_->set_regs_info(&regs_info);
- ASSERT_TRUE(this->op_->Eval(0, 3, DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Eval(0, 3));
ASSERT_EQ(0x92, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x65U, this->op_->StackAt(0));
- ASSERT_TRUE(this->op_->Eval(3, 7, DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Eval(3, 7));
ASSERT_EQ(0x92, this->op_->cur_op());
ASSERT_EQ(1U, this->op_->StackSize());
ASSERT_EQ(0x90U, this->op_->StackAt(0));
- ASSERT_FALSE(this->op_->Eval(7, 12, DWARF_VERSION_MAX));
+ ASSERT_FALSE(this->op_->Eval(7, 12));
ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
}
TYPED_TEST_P(DwarfOpTest, op_nop) {
this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x96});
- ASSERT_TRUE(this->op_->Decode(DWARF_VERSION_MAX));
+ ASSERT_TRUE(this->op_->Decode());
ASSERT_EQ(0x96, this->op_->cur_op());
ASSERT_EQ(0U, this->op_->StackSize());
}
-REGISTER_TYPED_TEST_CASE_P(DwarfOpTest, decode, eval, illegal_opcode, illegal_in_version3,
- illegal_in_version4, not_implemented, op_addr, op_deref, op_deref_size,
- const_unsigned, const_signed, const_uleb, const_sleb, op_dup, op_drop,
- op_over, op_pick, op_swap, op_rot, op_abs, op_and, op_div, op_minus,
- op_mod, op_mul, op_neg, op_not, op_or, op_plus, op_plus_uconst, op_shl,
- op_shr, op_shra, op_xor, op_bra, compare_opcode_stack_error,
- compare_opcodes, op_skip, op_lit, op_reg, op_regx, op_breg,
- op_breg_invalid_register, op_bregx, op_nop);
+TYPED_TEST_P(DwarfOpTest, is_dex_pc) {
+ // Special sequence that indicates this is a dex pc.
+ this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x0c, 'D', 'E', 'X', '1', 0x13});
+
+ ASSERT_TRUE(this->op_->Eval(0, 6));
+ EXPECT_TRUE(this->op_->dex_pc_set());
+
+ // Try without the last op.
+ ASSERT_TRUE(this->op_->Eval(0, 5));
+ EXPECT_FALSE(this->op_->dex_pc_set());
+
+ // Change the constant.
+ this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x0c, 'D', 'E', 'X', '2', 0x13});
+ ASSERT_TRUE(this->op_->Eval(0, 6));
+ EXPECT_FALSE(this->op_->dex_pc_set());
+}
+
+REGISTER_TYPED_TEST_CASE_P(DwarfOpTest, decode, eval, illegal_opcode, not_implemented, op_addr,
+ op_deref, op_deref_size, const_unsigned, const_signed, const_uleb,
+ const_sleb, op_dup, op_drop, op_over, op_pick, op_swap, op_rot, op_abs,
+ op_and, op_div, op_minus, op_mod, op_mul, op_neg, op_not, op_or, op_plus,
+ op_plus_uconst, op_shl, op_shr, op_shra, op_xor, op_bra,
+ compare_opcode_stack_error, compare_opcodes, op_skip, op_lit, op_reg,
+ op_regx, op_breg, op_breg_invalid_register, op_bregx, op_nop, is_dex_pc);
typedef ::testing::Types<uint32_t, uint64_t> DwarfOpTestTypes;
INSTANTIATE_TYPED_TEST_CASE_P(, DwarfOpTest, DwarfOpTestTypes);
diff --git a/libunwindstack/tests/DwarfSectionImplTest.cpp b/libunwindstack/tests/DwarfSectionImplTest.cpp
index 7e10935eb..37305b26b 100644
--- a/libunwindstack/tests/DwarfSectionImplTest.cpp
+++ b/libunwindstack/tests/DwarfSectionImplTest.cpp
@@ -99,7 +99,7 @@ TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_expr_eval_fail) {
regs.set_sp(0x2000);
regs[5] = 0x20;
regs[9] = 0x3000;
- loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x2, 0x5000}};
+ loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x2, 0x5002}};
bool finished;
ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
EXPECT_EQ(DWARF_ERROR_MEMORY_INVALID, this->section_->LastErrorCode());
@@ -116,7 +116,7 @@ TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_expr_no_stack) {
regs[5] = 0x20;
regs[9] = 0x3000;
this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x96, 0x96, 0x96});
- loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x2, 0x5000}};
+ loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x2, 0x5002}};
bool finished;
ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
EXPECT_EQ(DWARF_ERROR_ILLEGAL_STATE, this->section_->LastErrorCode());
@@ -134,7 +134,7 @@ TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_expr) {
this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x0c, 0x00, 0x00, 0x00, 0x80});
TypeParam cfa_value = 0x12345;
this->memory_.SetMemory(0x80000000, &cfa_value, sizeof(cfa_value));
- loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x4, 0x5000}};
+ loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x4, 0x5004}};
bool finished;
ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
EXPECT_FALSE(finished);
@@ -152,7 +152,7 @@ TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_val_expr) {
regs[5] = 0x20;
regs[9] = 0x3000;
this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x0c, 0x00, 0x00, 0x00, 0x80});
- loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_VAL_EXPRESSION, {0x4, 0x5000}};
+ loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_VAL_EXPRESSION, {0x4, 0x5004}};
bool finished;
ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
ASSERT_FALSE(finished);
@@ -170,7 +170,7 @@ TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_expr_is_register) {
regs[5] = 0x20;
regs[9] = 0x3000;
this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x50, 0x96, 0x96});
- loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x2, 0x5000}};
+ loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x2, 0x5002}};
bool finished;
ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
EXPECT_EQ(DWARF_ERROR_NOT_IMPLEMENTED, this->section_->LastErrorCode());
@@ -322,7 +322,8 @@ TYPED_TEST_P(DwarfSectionImplTest, Eval_dex_pc) {
regs[0] = 0x10;
regs[8] = 0x20;
loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
- loc_regs[0x20444558] = DwarfLocation{DWARF_LOCATION_REGISTER, {0, 1}};
+ loc_regs[1] = DwarfLocation{DWARF_LOCATION_VAL_EXPRESSION, {0x8, 0x5008}};
+ this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x0c, 'D', 'E', 'X', '1', 0x13, 0x08, 0x11});
bool finished;
ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
EXPECT_EQ(0x10U, regs[0]);
@@ -462,7 +463,7 @@ TYPED_TEST_P(DwarfSectionImplTest, Eval_reg_expr) {
TypeParam cfa_value = 0x12345;
this->memory_.SetMemory(0x80000000, &cfa_value, sizeof(cfa_value));
loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
- loc_regs[5] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x4, 0x5000}};
+ loc_regs[5] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x4, 0x5004}};
bool finished;
ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
EXPECT_FALSE(finished);
@@ -480,7 +481,7 @@ TYPED_TEST_P(DwarfSectionImplTest, Eval_reg_val_expr) {
regs[8] = 0x3000;
this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x0c, 0x00, 0x00, 0x00, 0x80});
loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
- loc_regs[5] = DwarfLocation{DWARF_LOCATION_VAL_EXPRESSION, {0x4, 0x5000}};
+ loc_regs[5] = DwarfLocation{DWARF_LOCATION_VAL_EXPRESSION, {0x4, 0x5004}};
bool finished;
ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
EXPECT_FALSE(finished);