blob: c10ffebbbcca9359f53af3b7fac8f3c6d5e356c2 [file] [log] [blame]
David Srbecky3b9d57a2015-04-10 00:22:14 +01001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "elf_writer_debug.h"
18
David Srbecky626a1662015-04-12 13:12:26 +010019#include <unordered_set>
20
Andreas Gampee3d623e2015-05-01 16:11:04 -070021#include "base/casts.h"
David Srbecky3b9d57a2015-04-10 00:22:14 +010022#include "compiled_method.h"
23#include "driver/compiler_driver.h"
24#include "dex_file-inl.h"
25#include "dwarf/headers.h"
26#include "dwarf/register.h"
27#include "oat_writer.h"
Vladimir Marko80afd022015-05-19 18:08:00 +010028#include "utils.h"
David Srbecky3b9d57a2015-04-10 00:22:14 +010029
30namespace art {
31namespace dwarf {
32
David Srbeckyad5fa8c2015-05-06 18:27:35 +010033static void WriteDebugFrameCIE(InstructionSet isa,
34 ExceptionHeaderValueApplication addr_type,
35 CFIFormat format,
36 std::vector<uint8_t>* eh_frame) {
David Srbecky3b9d57a2015-04-10 00:22:14 +010037 // Scratch registers should be marked as undefined. This tells the
38 // debugger that its value in the previous frame is not recoverable.
39 bool is64bit = Is64BitInstructionSet(isa);
40 switch (isa) {
41 case kArm:
42 case kThumb2: {
43 DebugFrameOpCodeWriter<> opcodes;
44 opcodes.DefCFA(Reg::ArmCore(13), 0); // R13(SP).
45 // core registers.
46 for (int reg = 0; reg < 13; reg++) {
47 if (reg < 4 || reg == 12) {
48 opcodes.Undefined(Reg::ArmCore(reg));
49 } else {
50 opcodes.SameValue(Reg::ArmCore(reg));
51 }
52 }
53 // fp registers.
54 for (int reg = 0; reg < 32; reg++) {
55 if (reg < 16) {
56 opcodes.Undefined(Reg::ArmFp(reg));
57 } else {
58 opcodes.SameValue(Reg::ArmFp(reg));
59 }
60 }
David Srbecky527c9c72015-04-17 21:14:10 +010061 auto return_reg = Reg::ArmCore(14); // R14(LR).
David Srbeckyad5fa8c2015-05-06 18:27:35 +010062 WriteDebugFrameCIE(is64bit, addr_type, return_reg,
63 opcodes, format, eh_frame);
David Srbecky3b9d57a2015-04-10 00:22:14 +010064 return;
65 }
66 case kArm64: {
67 DebugFrameOpCodeWriter<> opcodes;
68 opcodes.DefCFA(Reg::Arm64Core(31), 0); // R31(SP).
69 // core registers.
70 for (int reg = 0; reg < 30; reg++) {
71 if (reg < 8 || reg == 16 || reg == 17) {
72 opcodes.Undefined(Reg::Arm64Core(reg));
73 } else {
74 opcodes.SameValue(Reg::Arm64Core(reg));
75 }
76 }
77 // fp registers.
78 for (int reg = 0; reg < 32; reg++) {
79 if (reg < 8 || reg >= 16) {
80 opcodes.Undefined(Reg::Arm64Fp(reg));
81 } else {
82 opcodes.SameValue(Reg::Arm64Fp(reg));
83 }
84 }
David Srbecky527c9c72015-04-17 21:14:10 +010085 auto return_reg = Reg::Arm64Core(30); // R30(LR).
David Srbeckyad5fa8c2015-05-06 18:27:35 +010086 WriteDebugFrameCIE(is64bit, addr_type, return_reg,
87 opcodes, format, eh_frame);
David Srbecky3b9d57a2015-04-10 00:22:14 +010088 return;
89 }
90 case kMips:
91 case kMips64: {
92 DebugFrameOpCodeWriter<> opcodes;
93 opcodes.DefCFA(Reg::MipsCore(29), 0); // R29(SP).
94 // core registers.
95 for (int reg = 1; reg < 26; reg++) {
96 if (reg < 16 || reg == 24 || reg == 25) { // AT, V*, A*, T*.
97 opcodes.Undefined(Reg::MipsCore(reg));
98 } else {
99 opcodes.SameValue(Reg::MipsCore(reg));
100 }
101 }
David Srbecky527c9c72015-04-17 21:14:10 +0100102 auto return_reg = Reg::MipsCore(31); // R31(RA).
David Srbeckyad5fa8c2015-05-06 18:27:35 +0100103 WriteDebugFrameCIE(is64bit, addr_type, return_reg,
104 opcodes, format, eh_frame);
David Srbecky3b9d57a2015-04-10 00:22:14 +0100105 return;
106 }
107 case kX86: {
David Srbecky8a813f72015-04-20 16:43:52 +0100108 // FIXME: Add fp registers once libunwind adds support for them. Bug: 20491296
109 constexpr bool generate_opcodes_for_x86_fp = false;
David Srbecky3b9d57a2015-04-10 00:22:14 +0100110 DebugFrameOpCodeWriter<> opcodes;
111 opcodes.DefCFA(Reg::X86Core(4), 4); // R4(ESP).
112 opcodes.Offset(Reg::X86Core(8), -4); // R8(EIP).
113 // core registers.
114 for (int reg = 0; reg < 8; reg++) {
115 if (reg <= 3) {
116 opcodes.Undefined(Reg::X86Core(reg));
117 } else if (reg == 4) {
118 // Stack pointer.
119 } else {
120 opcodes.SameValue(Reg::X86Core(reg));
121 }
122 }
123 // fp registers.
David Srbecky8a813f72015-04-20 16:43:52 +0100124 if (generate_opcodes_for_x86_fp) {
125 for (int reg = 0; reg < 8; reg++) {
126 opcodes.Undefined(Reg::X86Fp(reg));
127 }
David Srbecky3b9d57a2015-04-10 00:22:14 +0100128 }
David Srbecky527c9c72015-04-17 21:14:10 +0100129 auto return_reg = Reg::X86Core(8); // R8(EIP).
David Srbeckyad5fa8c2015-05-06 18:27:35 +0100130 WriteDebugFrameCIE(is64bit, addr_type, return_reg,
131 opcodes, format, eh_frame);
David Srbecky3b9d57a2015-04-10 00:22:14 +0100132 return;
133 }
134 case kX86_64: {
135 DebugFrameOpCodeWriter<> opcodes;
136 opcodes.DefCFA(Reg::X86_64Core(4), 8); // R4(RSP).
137 opcodes.Offset(Reg::X86_64Core(16), -8); // R16(RIP).
138 // core registers.
139 for (int reg = 0; reg < 16; reg++) {
140 if (reg == 4) {
141 // Stack pointer.
142 } else if (reg < 12 && reg != 3 && reg != 5) { // except EBX and EBP.
143 opcodes.Undefined(Reg::X86_64Core(reg));
144 } else {
145 opcodes.SameValue(Reg::X86_64Core(reg));
146 }
147 }
148 // fp registers.
149 for (int reg = 0; reg < 16; reg++) {
150 if (reg < 12) {
151 opcodes.Undefined(Reg::X86_64Fp(reg));
152 } else {
153 opcodes.SameValue(Reg::X86_64Fp(reg));
154 }
155 }
David Srbecky527c9c72015-04-17 21:14:10 +0100156 auto return_reg = Reg::X86_64Core(16); // R16(RIP).
David Srbeckyad5fa8c2015-05-06 18:27:35 +0100157 WriteDebugFrameCIE(is64bit, addr_type, return_reg,
158 opcodes, format, eh_frame);
David Srbecky3b9d57a2015-04-10 00:22:14 +0100159 return;
160 }
161 case kNone:
162 break;
163 }
164 LOG(FATAL) << "Can not write CIE frame for ISA " << isa;
165 UNREACHABLE();
166}
167
David Srbeckyad5fa8c2015-05-06 18:27:35 +0100168void WriteCFISection(const CompilerDriver* compiler,
169 const OatWriter* oat_writer,
170 ExceptionHeaderValueApplication address_type,
171 CFIFormat format,
172 std::vector<uint8_t>* debug_frame,
173 std::vector<uintptr_t>* debug_frame_patches,
174 std::vector<uint8_t>* eh_frame_hdr,
175 std::vector<uintptr_t>* eh_frame_hdr_patches) {
David Srbecky8dc73242015-04-12 11:40:39 +0100176 const auto& method_infos = oat_writer->GetMethodDebugInfo();
177 const InstructionSet isa = compiler->GetInstructionSet();
David Srbecky527c9c72015-04-17 21:14:10 +0100178
David Srbeckyad5fa8c2015-05-06 18:27:35 +0100179 // Write .eh_frame/.debug_frame section.
David Srbecky033d7452015-04-30 19:57:35 +0100180 std::map<uint32_t, size_t> address_to_fde_offset_map;
David Srbeckyad5fa8c2015-05-06 18:27:35 +0100181 size_t cie_offset = debug_frame->size();
182 WriteDebugFrameCIE(isa, address_type, format, debug_frame);
David Srbecky8dc73242015-04-12 11:40:39 +0100183 for (const OatWriter::DebugInfo& mi : method_infos) {
David Srbecky6d73c9d2015-05-01 15:00:40 +0100184 if (!mi.deduped_) { // Only one FDE per unique address.
185 const SwapVector<uint8_t>* opcodes = mi.compiled_method_->GetCFIInfo();
186 if (opcodes != nullptr) {
David Srbeckyad5fa8c2015-05-06 18:27:35 +0100187 address_to_fde_offset_map.emplace(mi.low_pc_, debug_frame->size());
188 WriteDebugFrameFDE(Is64BitInstructionSet(isa), cie_offset,
189 mi.low_pc_, mi.high_pc_ - mi.low_pc_,
190 opcodes, format, debug_frame, debug_frame_patches);
David Srbecky6d73c9d2015-05-01 15:00:40 +0100191 }
David Srbecky8dc73242015-04-12 11:40:39 +0100192 }
193 }
David Srbecky527c9c72015-04-17 21:14:10 +0100194
David Srbeckyad5fa8c2015-05-06 18:27:35 +0100195 if (format == DW_EH_FRAME_FORMAT) {
196 // Write .eh_frame_hdr section.
197 Writer<> header(eh_frame_hdr);
198 header.PushUint8(1); // Version.
199 // Encoding of .eh_frame pointer - libunwind does not honor datarel here,
200 // so we have to use pcrel which means relative to the pointer's location.
201 header.PushUint8(DW_EH_PE_pcrel | DW_EH_PE_sdata4);
202 // Encoding of binary search table size.
203 header.PushUint8(DW_EH_PE_udata4);
204 // Encoding of binary search table addresses - libunwind supports only this
205 // specific combination, which means relative to the start of .eh_frame_hdr.
206 header.PushUint8(DW_EH_PE_datarel | DW_EH_PE_sdata4);
207 // .eh_frame pointer - .eh_frame_hdr section is after .eh_frame section
208 const int32_t relative_eh_frame_begin = -static_cast<int32_t>(debug_frame->size());
209 header.PushInt32(relative_eh_frame_begin - 4U);
210 // Binary search table size (number of entries).
211 header.PushUint32(dchecked_integral_cast<uint32_t>(address_to_fde_offset_map.size()));
212 // Binary search table.
213 for (const auto& address_to_fde_offset : address_to_fde_offset_map) {
214 u_int32_t code_address = address_to_fde_offset.first;
215 int32_t fde_address = dchecked_integral_cast<int32_t>(address_to_fde_offset.second);
216 eh_frame_hdr_patches->push_back(header.data()->size());
217 header.PushUint32(code_address);
218 // We know the exact layout (eh_frame is immediately before eh_frame_hdr)
219 // and the data is relative to the start of the eh_frame_hdr,
220 // so patching isn't necessary (in contrast to the code address above).
221 header.PushInt32(relative_eh_frame_begin + fde_address);
222 }
David Srbecky033d7452015-04-30 19:57:35 +0100223 }
David Srbecky8dc73242015-04-12 11:40:39 +0100224}
225
David Srbecky3b9d57a2015-04-10 00:22:14 +0100226/*
227 * @brief Generate the DWARF sections.
228 * @param oat_writer The Oat file Writer.
229 * @param eh_frame Call Frame Information.
230 * @param debug_info Compilation unit information.
David Srbecky527c9c72015-04-17 21:14:10 +0100231 * @param debug_info_patches Address locations to be patched.
David Srbecky3b9d57a2015-04-10 00:22:14 +0100232 * @param debug_abbrev Abbreviations used to generate dbg_info.
233 * @param debug_str Debug strings.
234 * @param debug_line Line number table.
David Srbecky527c9c72015-04-17 21:14:10 +0100235 * @param debug_line_patches Address locations to be patched.
David Srbecky3b9d57a2015-04-10 00:22:14 +0100236 */
237void WriteDebugSections(const CompilerDriver* compiler,
David Srbecky527c9c72015-04-17 21:14:10 +0100238 const OatWriter* oat_writer,
David Srbecky3b9d57a2015-04-10 00:22:14 +0100239 std::vector<uint8_t>* debug_info,
David Srbecky527c9c72015-04-17 21:14:10 +0100240 std::vector<uintptr_t>* debug_info_patches,
David Srbecky3b9d57a2015-04-10 00:22:14 +0100241 std::vector<uint8_t>* debug_abbrev,
242 std::vector<uint8_t>* debug_str,
David Srbecky527c9c72015-04-17 21:14:10 +0100243 std::vector<uint8_t>* debug_line,
244 std::vector<uintptr_t>* debug_line_patches) {
David Srbecky3b9d57a2015-04-10 00:22:14 +0100245 const std::vector<OatWriter::DebugInfo>& method_infos = oat_writer->GetMethodDebugInfo();
246 const InstructionSet isa = compiler->GetInstructionSet();
David Srbecky297ed222015-04-15 01:18:12 +0100247 const bool is64bit = Is64BitInstructionSet(isa);
David Srbecky3b9d57a2015-04-10 00:22:14 +0100248
David Srbecky626a1662015-04-12 13:12:26 +0100249 // Find all addresses (low_pc) which contain deduped methods.
250 // The first instance of method is not marked deduped_, but the rest is.
251 std::unordered_set<uint32_t> deduped_addresses;
Nicolas Geoffrayc04c8002015-07-14 11:37:54 +0100252 for (const OatWriter::DebugInfo& mi : method_infos) {
253 if (mi.deduped_) {
254 deduped_addresses.insert(mi.low_pc_);
David Srbecky626a1662015-04-12 13:12:26 +0100255 }
256 }
257
David Srbecky799b8c42015-04-14 01:57:43 +0100258 // Group the methods into compilation units based on source file.
259 std::vector<std::vector<const OatWriter::DebugInfo*>> compilation_units;
260 const char* last_source_file = nullptr;
Nicolas Geoffrayc04c8002015-07-14 11:37:54 +0100261 for (const OatWriter::DebugInfo& mi : method_infos) {
David Srbecky799b8c42015-04-14 01:57:43 +0100262 // Attribute given instruction range only to single method.
263 // Otherwise the debugger might get really confused.
264 if (!mi.deduped_) {
265 auto& dex_class_def = mi.dex_file_->GetClassDef(mi.class_def_index_);
266 const char* source_file = mi.dex_file_->GetSourceFile(dex_class_def);
267 if (compilation_units.empty() || source_file != last_source_file) {
268 compilation_units.push_back(std::vector<const OatWriter::DebugInfo*>());
269 }
270 compilation_units.back().push_back(&mi);
271 last_source_file = source_file;
272 }
273 }
274
David Srbecky3b9d57a2015-04-10 00:22:14 +0100275 // Write .debug_info section.
David Srbecky799b8c42015-04-14 01:57:43 +0100276 for (const auto& compilation_unit : compilation_units) {
277 uint32_t cunit_low_pc = 0xFFFFFFFFU;
278 uint32_t cunit_high_pc = 0;
279 for (auto method_info : compilation_unit) {
280 cunit_low_pc = std::min(cunit_low_pc, method_info->low_pc_);
281 cunit_high_pc = std::max(cunit_high_pc, method_info->high_pc_);
David Srbecky3b9d57a2015-04-10 00:22:14 +0100282 }
283
David Srbecky799b8c42015-04-14 01:57:43 +0100284 size_t debug_abbrev_offset = debug_abbrev->size();
David Srbecky297ed222015-04-15 01:18:12 +0100285 DebugInfoEntryWriter<> info(is64bit, debug_abbrev);
David Srbecky799b8c42015-04-14 01:57:43 +0100286 info.StartTag(DW_TAG_compile_unit, DW_CHILDREN_yes);
287 info.WriteStrp(DW_AT_producer, "Android dex2oat", debug_str);
288 info.WriteData1(DW_AT_language, DW_LANG_Java);
David Srbecky527c9c72015-04-17 21:14:10 +0100289 info.WriteAddr(DW_AT_low_pc, cunit_low_pc);
290 info.WriteAddr(DW_AT_high_pc, cunit_high_pc);
David Srbecky799b8c42015-04-14 01:57:43 +0100291 info.WriteData4(DW_AT_stmt_list, debug_line->size());
292 for (auto method_info : compilation_unit) {
293 std::string method_name = PrettyMethod(method_info->dex_method_index_,
294 *method_info->dex_file_, true);
295 if (deduped_addresses.find(method_info->low_pc_) != deduped_addresses.end()) {
296 method_name += " [DEDUPED]";
David Srbecky3b9d57a2015-04-10 00:22:14 +0100297 }
David Srbecky799b8c42015-04-14 01:57:43 +0100298 info.StartTag(DW_TAG_subprogram, DW_CHILDREN_no);
299 info.WriteStrp(DW_AT_name, method_name.data(), debug_str);
David Srbecky527c9c72015-04-17 21:14:10 +0100300 info.WriteAddr(DW_AT_low_pc, method_info->low_pc_);
301 info.WriteAddr(DW_AT_high_pc, method_info->high_pc_);
David Srbecky799b8c42015-04-14 01:57:43 +0100302 info.EndTag(); // DW_TAG_subprogram
David Srbecky3b9d57a2015-04-10 00:22:14 +0100303 }
David Srbecky799b8c42015-04-14 01:57:43 +0100304 info.EndTag(); // DW_TAG_compile_unit
David Srbecky799b8c42015-04-14 01:57:43 +0100305 WriteDebugInfoCU(debug_abbrev_offset, info, debug_info, debug_info_patches);
David Srbecky3b9d57a2015-04-10 00:22:14 +0100306
David Srbecky799b8c42015-04-14 01:57:43 +0100307 // Write .debug_line section.
308 std::vector<FileEntry> files;
309 std::unordered_map<std::string, size_t> files_map;
310 std::vector<std::string> directories;
311 std::unordered_map<std::string, size_t> directories_map;
312 int code_factor_bits_ = 0;
313 int dwarf_isa = -1;
314 switch (isa) {
315 case kArm: // arm actually means thumb2.
316 case kThumb2:
317 code_factor_bits_ = 1; // 16-bit instuctions
318 dwarf_isa = 1; // DW_ISA_ARM_thumb.
319 break;
320 case kArm64:
321 case kMips:
322 case kMips64:
323 code_factor_bits_ = 2; // 32-bit instructions
324 break;
325 case kNone:
326 case kX86:
327 case kX86_64:
328 break;
329 }
David Srbecky297ed222015-04-15 01:18:12 +0100330 DebugLineOpCodeWriter<> opcodes(is64bit, code_factor_bits_);
David Srbecky527c9c72015-04-17 21:14:10 +0100331 opcodes.SetAddress(cunit_low_pc);
David Srbecky799b8c42015-04-14 01:57:43 +0100332 if (dwarf_isa != -1) {
333 opcodes.SetISA(dwarf_isa);
334 }
335 for (const OatWriter::DebugInfo* mi : compilation_unit) {
336 struct DebugInfoCallbacks {
337 static bool NewPosition(void* ctx, uint32_t address, uint32_t line) {
338 auto* context = reinterpret_cast<DebugInfoCallbacks*>(ctx);
339 context->dex2line_.push_back({address, static_cast<int32_t>(line)});
340 return false;
David Srbecky3b9d57a2015-04-10 00:22:14 +0100341 }
David Srbecky799b8c42015-04-14 01:57:43 +0100342 DefaultSrcMap dex2line_;
343 } debug_info_callbacks;
344
345 const DexFile* dex = mi->dex_file_;
346 if (mi->code_item_ != nullptr) {
347 dex->DecodeDebugInfo(mi->code_item_,
348 (mi->access_flags_ & kAccStatic) != 0,
349 mi->dex_method_index_,
350 DebugInfoCallbacks::NewPosition,
351 nullptr,
352 &debug_info_callbacks);
David Srbecky3b9d57a2015-04-10 00:22:14 +0100353 }
354
David Srbecky799b8c42015-04-14 01:57:43 +0100355 // Get and deduplicate directory and filename.
356 int file_index = 0; // 0 - primary source file of the compilation.
357 auto& dex_class_def = dex->GetClassDef(mi->class_def_index_);
358 const char* source_file = dex->GetSourceFile(dex_class_def);
359 if (source_file != nullptr) {
360 std::string file_name(source_file);
361 size_t file_name_slash = file_name.find_last_of('/');
362 std::string class_name(dex->GetClassDescriptor(dex_class_def));
363 size_t class_name_slash = class_name.find_last_of('/');
364 std::string full_path(file_name);
David Srbecky3b9d57a2015-04-10 00:22:14 +0100365
David Srbecky799b8c42015-04-14 01:57:43 +0100366 // Guess directory from package name.
367 int directory_index = 0; // 0 - current directory of the compilation.
368 if (file_name_slash == std::string::npos && // Just filename.
369 class_name.front() == 'L' && // Type descriptor for a class.
370 class_name_slash != std::string::npos) { // Has package name.
371 std::string package_name = class_name.substr(1, class_name_slash - 1);
372 auto it = directories_map.find(package_name);
373 if (it == directories_map.end()) {
374 directory_index = 1 + directories.size();
375 directories_map.emplace(package_name, directory_index);
376 directories.push_back(package_name);
377 } else {
378 directory_index = it->second;
379 }
380 full_path = package_name + "/" + file_name;
381 }
382
383 // Add file entry.
384 auto it2 = files_map.find(full_path);
385 if (it2 == files_map.end()) {
386 file_index = 1 + files.size();
387 files_map.emplace(full_path, file_index);
388 files.push_back(FileEntry {
389 file_name,
390 directory_index,
391 0, // Modification time - NA.
392 0, // File size - NA.
393 });
394 } else {
395 file_index = it2->second;
396 }
397 }
398 opcodes.SetFile(file_index);
399
400 // Generate mapping opcodes from PC to Java lines.
401 const DefaultSrcMap& dex2line_map = debug_info_callbacks.dex2line_;
David Srbecky799b8c42015-04-14 01:57:43 +0100402 if (file_index != 0 && !dex2line_map.empty()) {
403 bool first = true;
404 for (SrcMapElem pc2dex : mi->compiled_method_->GetSrcMappingTable()) {
405 uint32_t pc = pc2dex.from_;
406 int dex_pc = pc2dex.to_;
407 auto dex2line = dex2line_map.Find(static_cast<uint32_t>(dex_pc));
408 if (dex2line.first) {
409 int line = dex2line.second;
410 if (first) {
411 first = false;
412 if (pc > 0) {
413 // Assume that any preceding code is prologue.
414 int first_line = dex2line_map.front().to_;
415 // Prologue is not a sensible place for a breakpoint.
416 opcodes.NegateStmt();
David Srbecky527c9c72015-04-17 21:14:10 +0100417 opcodes.AddRow(mi->low_pc_, first_line);
David Srbecky799b8c42015-04-14 01:57:43 +0100418 opcodes.NegateStmt();
419 opcodes.SetPrologueEnd();
420 }
David Srbecky527c9c72015-04-17 21:14:10 +0100421 opcodes.AddRow(mi->low_pc_ + pc, line);
David Srbecky799b8c42015-04-14 01:57:43 +0100422 } else if (line != opcodes.CurrentLine()) {
David Srbecky527c9c72015-04-17 21:14:10 +0100423 opcodes.AddRow(mi->low_pc_ + pc, line);
David Srbecky3b9d57a2015-04-10 00:22:14 +0100424 }
David Srbecky3b9d57a2015-04-10 00:22:14 +0100425 }
426 }
David Srbecky799b8c42015-04-14 01:57:43 +0100427 } else {
428 // line 0 - instruction cannot be attributed to any source line.
David Srbecky527c9c72015-04-17 21:14:10 +0100429 opcodes.AddRow(mi->low_pc_, 0);
David Srbecky3b9d57a2015-04-10 00:22:14 +0100430 }
David Srbecky3b9d57a2015-04-10 00:22:14 +0100431 }
David Srbecky527c9c72015-04-17 21:14:10 +0100432 opcodes.AdvancePC(cunit_high_pc);
David Srbecky799b8c42015-04-14 01:57:43 +0100433 opcodes.EndSequence();
David Srbecky799b8c42015-04-14 01:57:43 +0100434 WriteDebugLineTable(directories, files, opcodes, debug_line, debug_line_patches);
David Srbecky3b9d57a2015-04-10 00:22:14 +0100435 }
David Srbecky3b9d57a2015-04-10 00:22:14 +0100436}
437
438} // namespace dwarf
439} // namespace art