Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: test/cctest/test-eh-frame-hdr.cc

Issue 2023503002: Reland Implement .eh_frame writer and disassembler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@eh-frame-base
Patch Set: Improve disassembler, get rid of PatchProcedureBoundariesInEhFrame. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/eh-frame.cc ('K') | « src/x64/eh-frame-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/eh-frame.h" 5 #include "src/eh-frame.h"
6 #include "src/objects.h" 6 #include "src/objects.h"
7 #include "test/cctest/cctest.h" 7 #include "test/cctest/cctest.h"
8 8
9 using namespace v8::internal; 9 using namespace v8::internal;
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // | offset to | | 61 // | offset to | |
62 // | .eh_frame | | 62 // | .eh_frame | |
63 // +---------------+ | 63 // +---------------+ |
64 // | ... | ... 64 // | ... | ...
65 // 65 //
66 // (*) the size of the CIE is platform dependent. 66 // (*) the size of the CIE is platform dependent.
67 // 67 //
68 CHECK_EQ(eh_frame_hdr.offset_to_eh_frame(), -(4 + 30)); // A -> D 68 CHECK_EQ(eh_frame_hdr.offset_to_eh_frame(), -(4 + 30)); // A -> D
69 CHECK_EQ(eh_frame_hdr.offset_to_procedure(), -(30 + 6 + 10)); // B -> E 69 CHECK_EQ(eh_frame_hdr.offset_to_procedure(), -(30 + 6 + 10)); // B -> E
70 CHECK_EQ(eh_frame_hdr.offset_to_fde(), 70 CHECK_EQ(eh_frame_hdr.offset_to_fde(),
71 -(30 - EhFrameHdr::kCIESize)); // B -> C 71 -(30 - EhFrameWriter::kCIESize)); // B -> C
72 } 72 }
73 73
74 TEST(DummyEhFrameHdr) { 74 TEST(DummyEhFrameHdr) {
75 CcTest::InitializeVM(); 75 CcTest::InitializeVM();
76 HandleScope handle_scope(CcTest::i_isolate()); 76 HandleScope handle_scope(CcTest::i_isolate());
77 77
78 byte buffer[10] = {0}; // The content is not relevant in this test 78 byte buffer[10] = {0}; // The content is not relevant in this test
79 79
80 CodeDesc code_desc; 80 CodeDesc code_desc;
81 code_desc.buffer = &buffer[0]; 81 code_desc.buffer = &buffer[0];
82 code_desc.buffer_size = sizeof(buffer); 82 code_desc.buffer_size = sizeof(buffer);
83 code_desc.constant_pool_size = 0; 83 code_desc.constant_pool_size = 0;
84 code_desc.instr_size = sizeof(buffer); 84 code_desc.instr_size = sizeof(buffer);
85 code_desc.reloc_size = 0; 85 code_desc.reloc_size = 0;
86 code_desc.origin = nullptr; 86 code_desc.origin = nullptr;
87 code_desc.unwinding_info = nullptr; 87 code_desc.unwinding_info = nullptr;
88 code_desc.unwinding_info_size = 0; 88 code_desc.unwinding_info_size = 0;
89 89
90 Handle<Code> code = CcTest::i_isolate()->factory()->NewCode( 90 Handle<Code> code = CcTest::i_isolate()->factory()->NewCode(
91 code_desc, 0, Handle<Object>::null()); 91 code_desc, 0, Handle<Object>::null());
92 92
93 EhFrameHdr eh_frame_hdr(*code); 93 EhFrameHdr eh_frame_hdr(*code);
94 // A dummy header has an empty LUT 94 // A dummy header has an empty LUT
95 CHECK_EQ(eh_frame_hdr.lut_entries_number(), 0); 95 CHECK_EQ(eh_frame_hdr.lut_entries_number(), 0);
96 // These values should be irrelevant, but check that they have been zeroed. 96 // These values should be irrelevant, but check that they have been zeroed.
97 CHECK_EQ(eh_frame_hdr.offset_to_eh_frame(), 0); 97 CHECK_EQ(eh_frame_hdr.offset_to_eh_frame(), 0);
98 CHECK_EQ(eh_frame_hdr.offset_to_procedure(), 0); 98 CHECK_EQ(eh_frame_hdr.offset_to_procedure(), 0);
99 CHECK_EQ(eh_frame_hdr.offset_to_fde(), 0); 99 CHECK_EQ(eh_frame_hdr.offset_to_fde(), 0);
100 } 100 }
OLDNEW
« src/eh-frame.cc ('K') | « src/x64/eh-frame-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698