1800b99b8Sopenharmony_ci/*
2800b99b8Sopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
3800b99b8Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4800b99b8Sopenharmony_ci * you may not use this file except in compliance with the License.
5800b99b8Sopenharmony_ci * You may obtain a copy of the License at
6800b99b8Sopenharmony_ci *
7800b99b8Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
8800b99b8Sopenharmony_ci *
9800b99b8Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10800b99b8Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11800b99b8Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12800b99b8Sopenharmony_ci * See the License for the specific language governing permissions and
13800b99b8Sopenharmony_ci * limitations under the License.
14800b99b8Sopenharmony_ci */
15800b99b8Sopenharmony_ci
16800b99b8Sopenharmony_ci#include <gtest/gtest.h>
17800b99b8Sopenharmony_ci
18800b99b8Sopenharmony_ci#include <string>
19800b99b8Sopenharmony_ci#include <thread>
20800b99b8Sopenharmony_ci#include <vector>
21800b99b8Sopenharmony_ci
22800b99b8Sopenharmony_ci#include <unistd.h>
23800b99b8Sopenharmony_ci
24800b99b8Sopenharmony_ci#include "dfx_define.h"
25800b99b8Sopenharmony_ci#define private public
26800b99b8Sopenharmony_ci#define protected public
27800b99b8Sopenharmony_ci#include "arm_exidx.h"
28800b99b8Sopenharmony_ci#undef private
29800b99b8Sopenharmony_ci#undef protected
30800b99b8Sopenharmony_ci#include "dfx_memory.h"
31800b99b8Sopenharmony_ciusing namespace testing;
32800b99b8Sopenharmony_ciusing namespace testing::ext;
33800b99b8Sopenharmony_ci#if defined(__arm__)
34800b99b8Sopenharmony_cinamespace OHOS {
35800b99b8Sopenharmony_cinamespace HiviewDFX {
36800b99b8Sopenharmony_ciclass ArmExidxTest : public testing::Test {
37800b99b8Sopenharmony_cipublic:
38800b99b8Sopenharmony_ci    static void SetUpTestCase();
39800b99b8Sopenharmony_ci    static void TearDownTestCase();
40800b99b8Sopenharmony_ci    void SetUp();
41800b99b8Sopenharmony_ci    void TearDown();
42800b99b8Sopenharmony_ci};
43800b99b8Sopenharmony_ci
44800b99b8Sopenharmony_civoid ArmExidxTest::SetUpTestCase()
45800b99b8Sopenharmony_ci{}
46800b99b8Sopenharmony_ci
47800b99b8Sopenharmony_civoid ArmExidxTest::TearDownTestCase()
48800b99b8Sopenharmony_ci{}
49800b99b8Sopenharmony_ci
50800b99b8Sopenharmony_civoid ArmExidxTest::SetUp()
51800b99b8Sopenharmony_ci{}
52800b99b8Sopenharmony_ci
53800b99b8Sopenharmony_civoid ArmExidxTest::TearDown()
54800b99b8Sopenharmony_ci{}
55800b99b8Sopenharmony_ci
56800b99b8Sopenharmony_ci/**
57800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest001
58800b99b8Sopenharmony_ci * @tc.desc: test ExtractEntryData
59800b99b8Sopenharmony_ci * @tc.type: FUNC
60800b99b8Sopenharmony_ci */
61800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest001, TestSize.Level2)
62800b99b8Sopenharmony_ci{
63800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest001: start.";
64800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
65800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
66800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
67800b99b8Sopenharmony_ci    uint32_t values[] = {0x1, 0x1};
68800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
69800b99b8Sopenharmony_ci    // cant unwind
70800b99b8Sopenharmony_ci    ASSERT_FALSE(exidx.ExtractEntryData(entryOffset));
71800b99b8Sopenharmony_ci    ASSERT_EQ(exidx.GetLastErrorCode(), UNW_ERROR_CANT_UNWIND);
72800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest001: end.";
73800b99b8Sopenharmony_ci}
74800b99b8Sopenharmony_ci/**
75800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest002
76800b99b8Sopenharmony_ci * @tc.desc: test ExtractEntryData inline compact model
77800b99b8Sopenharmony_ci * @tc.type: FUNC
78800b99b8Sopenharmony_ci */
79800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest002, TestSize.Level2)
80800b99b8Sopenharmony_ci{
81800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest002: start.";
82800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
83800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
84800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
85800b99b8Sopenharmony_ci    // inline compact model
86800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x80c0c0c0};
87800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
88800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.ExtractEntryData(entryOffset));
89800b99b8Sopenharmony_ci    std::deque<uint8_t> data = exidx.ops_;
90800b99b8Sopenharmony_ci    ASSERT_EQ(data.size(), 4U);
91800b99b8Sopenharmony_ci    ASSERT_EQ(data[0], 0xc0U);
92800b99b8Sopenharmony_ci    ASSERT_EQ(data[1], 0xc0U);
93800b99b8Sopenharmony_ci    ASSERT_EQ(data[2], 0xc0U);
94800b99b8Sopenharmony_ci    ASSERT_EQ(data[3], 0xb0U);
95800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest002: end.";
96800b99b8Sopenharmony_ci}
97800b99b8Sopenharmony_ci/**
98800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest003
99800b99b8Sopenharmony_ci * @tc.desc: test ExtractEntryData highest bit is zero, point to .ARM.extab data
100800b99b8Sopenharmony_ci * @tc.type: FUNC
101800b99b8Sopenharmony_ci */
102800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest003, TestSize.Level2)
103800b99b8Sopenharmony_ci{
104800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest003: start.";
105800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
106800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
107800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
108800b99b8Sopenharmony_ci
109800b99b8Sopenharmony_ci    //personality 0
110800b99b8Sopenharmony_ci    uint32_t values0[] = {0x7fff2340, 0x00001111, 0x80c0c0c0};
111800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values0[0]);
112800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.ExtractEntryData(entryOffset));
113800b99b8Sopenharmony_ci    std::deque<uint8_t> data = exidx.ops_;
114800b99b8Sopenharmony_ci    ASSERT_EQ(data.size(), 4U);
115800b99b8Sopenharmony_ci    ASSERT_EQ(data[0], 0xc0U);
116800b99b8Sopenharmony_ci    ASSERT_EQ(data[1], 0xc0U);
117800b99b8Sopenharmony_ci    ASSERT_EQ(data[2], 0xc0U);
118800b99b8Sopenharmony_ci    ASSERT_EQ(data[3], 0xb0U);
119800b99b8Sopenharmony_ci
120800b99b8Sopenharmony_ci    //personality 1
121800b99b8Sopenharmony_ci    uint32_t values1[] = {0x7fff2340, 0x00001111, 0x8100c0c0};
122800b99b8Sopenharmony_ci    entryOffset = (uintptr_t)(&values1[0]);
123800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.ExtractEntryData(entryOffset));
124800b99b8Sopenharmony_ci    data = exidx.ops_;
125800b99b8Sopenharmony_ci    ASSERT_EQ(data.size(), 3U);
126800b99b8Sopenharmony_ci    ASSERT_EQ(data[0], 0xc0U);
127800b99b8Sopenharmony_ci    ASSERT_EQ(data[1], 0xc0U);
128800b99b8Sopenharmony_ci    ASSERT_EQ(data[2], 0xb0U);
129800b99b8Sopenharmony_ci
130800b99b8Sopenharmony_ci    //personality 2 MOREWORD 0
131800b99b8Sopenharmony_ci    uint32_t values2[] = {0x7fff2340, 0x00001111, 0x8200c0c0};
132800b99b8Sopenharmony_ci    entryOffset = (uintptr_t)(&values2[0]);
133800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.ExtractEntryData(entryOffset));
134800b99b8Sopenharmony_ci    data = exidx.ops_;
135800b99b8Sopenharmony_ci    ASSERT_EQ(data.size(), 3U);
136800b99b8Sopenharmony_ci    ASSERT_EQ(data[0], 0xc0U);
137800b99b8Sopenharmony_ci    ASSERT_EQ(data[1], 0xc0U);
138800b99b8Sopenharmony_ci    ASSERT_EQ(data[2], 0xb0U);
139800b99b8Sopenharmony_ci
140800b99b8Sopenharmony_ci    //personality 2 MOREWORD 1
141800b99b8Sopenharmony_ci    uint32_t values2m[] = {0x7fff2340, 0x00001111, 0x8201c0c0, 0xd0e0f0b0};
142800b99b8Sopenharmony_ci    entryOffset = (uintptr_t)(&values2m[0]);
143800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.ExtractEntryData(entryOffset));
144800b99b8Sopenharmony_ci    data = exidx.ops_;
145800b99b8Sopenharmony_ci    ASSERT_EQ(data.size(), 6U);
146800b99b8Sopenharmony_ci    ASSERT_EQ(data[0], 0xc0U);
147800b99b8Sopenharmony_ci    ASSERT_EQ(data[1], 0xc0U);
148800b99b8Sopenharmony_ci    ASSERT_EQ(data[2], 0xd0U);
149800b99b8Sopenharmony_ci    ASSERT_EQ(data[3], 0xe0U);
150800b99b8Sopenharmony_ci    ASSERT_EQ(data[4], 0xf0U);
151800b99b8Sopenharmony_ci    ASSERT_EQ(data[5], 0xb0U);
152800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest003: end.";
153800b99b8Sopenharmony_ci}
154800b99b8Sopenharmony_ci/**
155800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest004
156800b99b8Sopenharmony_ci * @tc.desc: test Step
157800b99b8Sopenharmony_ci * @tc.type: FUNC
158800b99b8Sopenharmony_ci */
159800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest004, TestSize.Level2)
160800b99b8Sopenharmony_ci{
161800b99b8Sopenharmony_ci    // 00xxxxxx: vsp = vsp + (xxxxxx << 2) + 4
162800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest004: start.";
163800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
164800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
165800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
166800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
167800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x810010b0};
168800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
169800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
170800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0x44);
171800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest004: end.";
172800b99b8Sopenharmony_ci}
173800b99b8Sopenharmony_ci
174800b99b8Sopenharmony_ci/**
175800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest005
176800b99b8Sopenharmony_ci * @tc.desc: test Step
177800b99b8Sopenharmony_ci * @tc.type: FUNC
178800b99b8Sopenharmony_ci */
179800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest005, TestSize.Level2)
180800b99b8Sopenharmony_ci{
181800b99b8Sopenharmony_ci    // 01xxxxxx: vsp = vsp - (xxxxxx << 2) - 4
182800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest005: start.";
183800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
184800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
185800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
186800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
187800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x810041b0};
188800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
189800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
190800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, -8);
191800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest005: end.";
192800b99b8Sopenharmony_ci}
193800b99b8Sopenharmony_ci
194800b99b8Sopenharmony_ci/**
195800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest006
196800b99b8Sopenharmony_ci * @tc.desc: test Step
197800b99b8Sopenharmony_ci * @tc.type: FUNC
198800b99b8Sopenharmony_ci */
199800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest006, TestSize.Level2)
200800b99b8Sopenharmony_ci{
201800b99b8Sopenharmony_ci    // 10000000 00000000: Refuse to unwind
202800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest006: start.";
203800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
204800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
205800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
206800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
207800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x81008000};
208800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
209800b99b8Sopenharmony_ci
210800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
211800b99b8Sopenharmony_ci    ASSERT_EQ(exidx.GetLastErrorCode(), UNW_ERROR_CANT_UNWIND);
212800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest006: end.";
213800b99b8Sopenharmony_ci}
214800b99b8Sopenharmony_ci
215800b99b8Sopenharmony_ci/**
216800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest007
217800b99b8Sopenharmony_ci * @tc.desc: test Step
218800b99b8Sopenharmony_ci * @tc.type: FUNC
219800b99b8Sopenharmony_ci */
220800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest007, TestSize.Level2)
221800b99b8Sopenharmony_ci{
222800b99b8Sopenharmony_ci    // 1000iiii iiiiiiii (i not all 0)
223800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest007: start.";
224800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
225800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
226800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
227800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
228800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x81008811};
229800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
230800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
231800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
232800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 12);
233800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[3].type, REG_LOC_MEM_OFFSET);
234800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[3].val, -4);
235800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest007: end.";
236800b99b8Sopenharmony_ci}
237800b99b8Sopenharmony_ci
238800b99b8Sopenharmony_ci/**
239800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest008
240800b99b8Sopenharmony_ci * @tc.desc: test Step
241800b99b8Sopenharmony_ci * @tc.type: FUNC
242800b99b8Sopenharmony_ci */
243800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest008, TestSize.Level2)
244800b99b8Sopenharmony_ci{
245800b99b8Sopenharmony_ci    // 10011101 || 10011111
246800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest008: start.";
247800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
248800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
249800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
250800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
251800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x81009db0};
252800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
253800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
254800b99b8Sopenharmony_ci    ASSERT_EQ(exidx.GetLastErrorCode(), UNW_ERROR_RESERVED_VALUE);
255800b99b8Sopenharmony_ci
256800b99b8Sopenharmony_ci    values[2] = 0x81009fb0;
257800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
258800b99b8Sopenharmony_ci    ASSERT_EQ(exidx.GetLastErrorCode(), UNW_ERROR_RESERVED_VALUE);
259800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest008: end.";
260800b99b8Sopenharmony_ci}
261800b99b8Sopenharmony_ci
262800b99b8Sopenharmony_ci/**
263800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest009
264800b99b8Sopenharmony_ci * @tc.desc: test Step
265800b99b8Sopenharmony_ci * @tc.type: FUNC
266800b99b8Sopenharmony_ci */
267800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest009, TestSize.Level2)
268800b99b8Sopenharmony_ci{
269800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest009: start.";
270800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
271800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
272800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
273800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
274800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x81009bb0};
275800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
276800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
277800b99b8Sopenharmony_ci
278800b99b8Sopenharmony_ci    // 1001nnnn(nnnn != 13, 15)
279800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, 11U);
280800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0);
281800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest009: end.";
282800b99b8Sopenharmony_ci}
283800b99b8Sopenharmony_ci
284800b99b8Sopenharmony_ci/**
285800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest010
286800b99b8Sopenharmony_ci * @tc.desc: test Step
287800b99b8Sopenharmony_ci * @tc.type: FUNC
288800b99b8Sopenharmony_ci */
289800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest010, TestSize.Level2)
290800b99b8Sopenharmony_ci{
291800b99b8Sopenharmony_ci    //10100nnn Pop r4-r[4+nnn]
292800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest010: start.";
293800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
294800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
295800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
296800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
297800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x8100a7b0};
298800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
299800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
300800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
301800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 32);
302800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[0].type, REG_LOC_MEM_OFFSET);
303800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[0].val, -20);
304800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[1].type, REG_LOC_MEM_OFFSET);
305800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[1].val, -4);
306800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest010: end.";
307800b99b8Sopenharmony_ci}
308800b99b8Sopenharmony_ci
309800b99b8Sopenharmony_ci/**
310800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest011
311800b99b8Sopenharmony_ci * @tc.desc: test Step
312800b99b8Sopenharmony_ci * @tc.type: FUNC
313800b99b8Sopenharmony_ci */
314800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest011, TestSize.Level2)
315800b99b8Sopenharmony_ci{
316800b99b8Sopenharmony_ci    // 10101nnn Pop r4-r[4+nnn], r14
317800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest011: start.";
318800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
319800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
320800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
321800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
322800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x8100afb0};
323800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
324800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
325800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
326800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 36);
327800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[0].type, REG_LOC_MEM_OFFSET);
328800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[0].val, -24);
329800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[1].type, REG_LOC_MEM_OFFSET);
330800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[1].val, -8);
331800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[4].type, REG_LOC_MEM_OFFSET);
332800b99b8Sopenharmony_ci    ASSERT_EQ(rs->locs[4].val, -4);
333800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest011: end.";
334800b99b8Sopenharmony_ci}
335800b99b8Sopenharmony_ci
336800b99b8Sopenharmony_ci/**
337800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest012
338800b99b8Sopenharmony_ci * @tc.desc: test Step
339800b99b8Sopenharmony_ci * @tc.type: FUNC
340800b99b8Sopenharmony_ci */
341800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest012, TestSize.Level2)
342800b99b8Sopenharmony_ci{
343800b99b8Sopenharmony_ci    // 10110000 Finish
344800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest012: start.";
345800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
346800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
347800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
348800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
349800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x8100b0b0};
350800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
351800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
352800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
353800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0);
354800b99b8Sopenharmony_ci    ASSERT_EQ(exidx.GetLastErrorCode(), UNW_ERROR_ARM_EXIDX_FINISH);
355800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest012: end.";
356800b99b8Sopenharmony_ci}
357800b99b8Sopenharmony_ci
358800b99b8Sopenharmony_ci/**
359800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest013
360800b99b8Sopenharmony_ci * @tc.desc: test Step
361800b99b8Sopenharmony_ci * @tc.type: FUNC
362800b99b8Sopenharmony_ci */
363800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest013, TestSize.Level2)
364800b99b8Sopenharmony_ci{
365800b99b8Sopenharmony_ci    // 10110001 00000000: Spare
366800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest013: start.";
367800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
368800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
369800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
370800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
371800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x8100b100};
372800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
373800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
374800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
375800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0);
376800b99b8Sopenharmony_ci    ASSERT_EQ(exidx.GetLastErrorCode(), UNW_ERROR_ARM_EXIDX_SPARE);
377800b99b8Sopenharmony_ci
378800b99b8Sopenharmony_ci    // 10110001 xxxxyyyy spare
379800b99b8Sopenharmony_ci
380800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest013: end.";
381800b99b8Sopenharmony_ci}
382800b99b8Sopenharmony_ci
383800b99b8Sopenharmony_ci/**
384800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest014
385800b99b8Sopenharmony_ci * @tc.desc: test Step
386800b99b8Sopenharmony_ci * @tc.type: FUNC
387800b99b8Sopenharmony_ci */
388800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest014, TestSize.Level2)
389800b99b8Sopenharmony_ci{
390800b99b8Sopenharmony_ci    // 10110001 0000iiii(i not all 0) Pop integer registers under mask{r3, r2,r1,r0}
391800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest014: start.";
392800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
393800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
394800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
395800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
396800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x8100b108};
397800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
398800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
399800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
400800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 4);
401800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest014: end.";
402800b99b8Sopenharmony_ci}
403800b99b8Sopenharmony_ci
404800b99b8Sopenharmony_ci/**
405800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest015
406800b99b8Sopenharmony_ci * @tc.desc: test Step
407800b99b8Sopenharmony_ci * @tc.type: FUNC
408800b99b8Sopenharmony_ci */
409800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest015, TestSize.Level2)
410800b99b8Sopenharmony_ci{
411800b99b8Sopenharmony_ci    // 10110010 uleb128 vsp = vsp + 0x204 + (uleb128 << 2)
412800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest015: start.";
413800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
414800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
415800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
416800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
417800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x8100b208};
418800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
419800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
420800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
421800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0x224);
422800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest015: end.";
423800b99b8Sopenharmony_ci}
424800b99b8Sopenharmony_ci
425800b99b8Sopenharmony_ci/**
426800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest016
427800b99b8Sopenharmony_ci * @tc.desc: test Step
428800b99b8Sopenharmony_ci * @tc.type: FUNC
429800b99b8Sopenharmony_ci */
430800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest016, TestSize.Level2)
431800b99b8Sopenharmony_ci{
432800b99b8Sopenharmony_ci    // 10110011 sssscccc: Pop VFP double precision registers D[ssss]-D[ssss+cccc] saved by FSTMFDX
433800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest016: start.";
434800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
435800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
436800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
437800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
438800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x8100b302};
439800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
440800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
441800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
442800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0x1c);
443800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest016: end.";
444800b99b8Sopenharmony_ci}
445800b99b8Sopenharmony_ci
446800b99b8Sopenharmony_ci
447800b99b8Sopenharmony_ci/**
448800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest017
449800b99b8Sopenharmony_ci * @tc.desc: test Step
450800b99b8Sopenharmony_ci * @tc.type: FUNC
451800b99b8Sopenharmony_ci */
452800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest017, TestSize.Level2)
453800b99b8Sopenharmony_ci{
454800b99b8Sopenharmony_ci    // 10111nnn:  VFP double-precision registers D[8]-D[8+nnn] saved by FSTMFDX
455800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest016: start.";
456800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
457800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
458800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
459800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
460800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x8100b9b0};
461800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
462800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
463800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
464800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0x14);
465800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest016: end.";
466800b99b8Sopenharmony_ci}
467800b99b8Sopenharmony_ci
468800b99b8Sopenharmony_ci/**
469800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest018
470800b99b8Sopenharmony_ci * @tc.desc: test Step
471800b99b8Sopenharmony_ci * @tc.type: FUNC
472800b99b8Sopenharmony_ci */
473800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest018, TestSize.Level2)
474800b99b8Sopenharmony_ci{
475800b99b8Sopenharmony_ci    /* 11000nnn (nnn != 6,7) : Intel Wireless MMX pop wR[10]-wR[10+nnn]
476800b99b8Sopenharmony_ci    *  11000110 sssscccc : Intel Wireless MMX pop wR[ssss]-wR[ssss+cccc]
477800b99b8Sopenharmony_ci    *  11000111 00000000 : spare
478800b99b8Sopenharmony_ci    *  11000111 0000iiii : Intel Wireless MMX pop wCGR register under mask {wCGR3,2,1,0}
479800b99b8Sopenharmony_ci    *  11000111 xxxxyyyy (xxxx!=0000): spare
480800b99b8Sopenharmony_ci    */
481800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest018: start.";
482800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
483800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
484800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
485800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
486800b99b8Sopenharmony_ci
487800b99b8Sopenharmony_ci
488800b99b8Sopenharmony_ci    // 11000nnn (nnn != 6,7)
489800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x8100c1b0};
490800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
491800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
492800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
493800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0x10);
494800b99b8Sopenharmony_ci
495800b99b8Sopenharmony_ci    // 11000110 sssscccc
496800b99b8Sopenharmony_ci    values[2] = 0x8100c602;
497800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
498800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
499800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0x18);
500800b99b8Sopenharmony_ci
501800b99b8Sopenharmony_ci    // 11000111 00000000 : spare
502800b99b8Sopenharmony_ci    values[2] = 0x8100c700;
503800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
504800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
505800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0);
506800b99b8Sopenharmony_ci    ASSERT_EQ(exidx.GetLastErrorCode(), UNW_ERROR_ARM_EXIDX_SPARE);
507800b99b8Sopenharmony_ci
508800b99b8Sopenharmony_ci    // 11000111 0000iiii : Intel Wireless MMX pop wCGR register under mask {wCGR3,2,1,0}
509800b99b8Sopenharmony_ci    values[2] = 0x8100c70f;
510800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
511800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
512800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0x10);
513800b99b8Sopenharmony_ci
514800b99b8Sopenharmony_ci    //11000111 xxxxyyyy (xxxx!=0000): spare
515800b99b8Sopenharmony_ci    values[2] = 0x8100c71f;
516800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
517800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
518800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0);
519800b99b8Sopenharmony_ci    ASSERT_EQ(exidx.GetLastErrorCode(), UNW_ERROR_ARM_EXIDX_SPARE);
520800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest018: end.";
521800b99b8Sopenharmony_ci}
522800b99b8Sopenharmony_ci
523800b99b8Sopenharmony_ci/**
524800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest019
525800b99b8Sopenharmony_ci * @tc.desc: test Step
526800b99b8Sopenharmony_ci * @tc.type: FUNC
527800b99b8Sopenharmony_ci */
528800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest019, TestSize.Level2)
529800b99b8Sopenharmony_ci{
530800b99b8Sopenharmony_ci    /**
531800b99b8Sopenharmony_ci     * 11001000 sssscccc Pop VFP double precision registers
532800b99b8Sopenharmony_ci     *    D[16+ssss]-D[16+ssss+cccc] saved (as if) by VPUSH (see remarks d,e)
533800b99b8Sopenharmony_ci     * 11001001 sssscccc Pop VFP double precision registers D[ssss]-D[ssss+cccc] saved (as if) by VPUSH (see remark d)
534800b99b8Sopenharmony_ci     * 11001yyy(yyy != 000, 001) Spare
535800b99b8Sopenharmony_ci    */
536800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest019: start.";
537800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
538800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
539800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
540800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
541800b99b8Sopenharmony_ci
542800b99b8Sopenharmony_ci    // 11001000 sssscccc
543800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x8100c801};
544800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
545800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
546800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
547800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0x10);
548800b99b8Sopenharmony_ci
549800b99b8Sopenharmony_ci    // 11001001 sssscccc
550800b99b8Sopenharmony_ci    values[2] = 0x8100c902;
551800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
552800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
553800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0x18);
554800b99b8Sopenharmony_ci
555800b99b8Sopenharmony_ci    // 11001yyy(yyy != 000, 001) Spare
556800b99b8Sopenharmony_ci    values[2] = 0x8100cbb0;
557800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
558800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
559800b99b8Sopenharmony_ci    ASSERT_EQ(exidx.GetLastErrorCode(), UNW_ERROR_ARM_EXIDX_SPARE);
560800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest019: end.";
561800b99b8Sopenharmony_ci}
562800b99b8Sopenharmony_ci
563800b99b8Sopenharmony_ci/**
564800b99b8Sopenharmony_ci * @tc.name: ArmExidxTest020
565800b99b8Sopenharmony_ci * @tc.desc: test Step
566800b99b8Sopenharmony_ci * @tc.type: FUNC
567800b99b8Sopenharmony_ci */
568800b99b8Sopenharmony_ciHWTEST_F(ArmExidxTest, ArmExidxTest020, TestSize.Level2)
569800b99b8Sopenharmony_ci{
570800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest020: start.";
571800b99b8Sopenharmony_ci    std::shared_ptr<DfxAccessorsLocal> acc = std::make_shared<DfxAccessorsLocal>();
572800b99b8Sopenharmony_ci    std::shared_ptr<DfxMemory> memory = std::make_shared<DfxMemory>(acc);
573800b99b8Sopenharmony_ci    ArmExidx exidx(memory);
574800b99b8Sopenharmony_ci    std::shared_ptr<RegLocState> rs = std::make_shared<RegLocState>();
575800b99b8Sopenharmony_ci
576800b99b8Sopenharmony_ci    // 11010nnn Pop VFP double-precision registers D[8]-D[8+nnn] saved (as if) by VPUSH (seeremark d)
577800b99b8Sopenharmony_ci    uint32_t values[] = {0x7fff2340, 0x00001111, 0x8100d1b0};
578800b99b8Sopenharmony_ci    uintptr_t entryOffset = (uintptr_t)(&values[0]);
579800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
580800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
581800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaRegOffset, 0x10);
582800b99b8Sopenharmony_ci
583800b99b8Sopenharmony_ci    // 11xxxyyy: Spare (xxx != 000, 001, 010)
584800b99b8Sopenharmony_ci    values[2] = 0x8100f8b0;
585800b99b8Sopenharmony_ci    ASSERT_TRUE(exidx.Step(entryOffset, rs));
586800b99b8Sopenharmony_ci    ASSERT_EQ(rs->cfaReg, REG_SP);
587800b99b8Sopenharmony_ci    ASSERT_EQ(exidx.GetLastErrorCode(), UNW_ERROR_ARM_EXIDX_SPARE);
588800b99b8Sopenharmony_ci    GTEST_LOG_(INFO) << "ArmExidxTest020: end.";
589800b99b8Sopenharmony_ci}
590800b99b8Sopenharmony_ci} // namespace HiviewDFX
591800b99b8Sopenharmony_ci} // namepsace OHOS
592800b99b8Sopenharmony_ci#endif
593