| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/dwarf.h" | 5 #include "vm/dwarf.h" |
| 6 | 6 |
| 7 #include "vm/code_descriptors.h" | 7 #include "vm/code_descriptors.h" |
| 8 #include "vm/object_store.h" | 8 #include "vm/object_store.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 stream_->VPrint(format, args); | 147 stream_->VPrint(format, args); |
| 148 va_end(args); | 148 va_end(args); |
| 149 } | 149 } |
| 150 | 150 |
| 151 | 151 |
| 152 void Dwarf::WriteAbbreviations() { | 152 void Dwarf::WriteAbbreviations() { |
| 153 // Dwarf data mostly takes the form of a tree, whose nodes are called | 153 // Dwarf data mostly takes the form of a tree, whose nodes are called |
| 154 // DIEs. Each DIE begins with an abbreviation code, and the abbreviation | 154 // DIEs. Each DIE begins with an abbreviation code, and the abbreviation |
| 155 // describes the attributes of that DIE and their representation. | 155 // describes the attributes of that DIE and their representation. |
| 156 | 156 |
| 157 #if defined(HOST_OS_MACOS) | 157 #if defined(TARGET_OS_MACOS) || TARGET_OS_IOS |
| 158 Print(".section __DWARF,__debug_abbrev,regular,debug\n"); | 158 Print(".section __DWARF,__debug_abbrev,regular,debug\n"); |
| 159 #elif defined(TARGET_OS_LINUX) || defined(TARGET_OS_ANDROID) |
| 160 Print(".section .debug_abbrev,\"\"\n"); |
| 159 #else | 161 #else |
| 160 Print(".section .debug_abbrev,\"\"\n"); | 162 UNIMPLEMENTED(); |
| 161 #endif | 163 #endif |
| 162 | 164 |
| 163 uleb128(kCompilationUnit); // Abbrev code. | 165 uleb128(kCompilationUnit); // Abbrev code. |
| 164 uleb128(DW_TAG_compile_unit); // Type. | 166 uleb128(DW_TAG_compile_unit); // Type. |
| 165 u1(DW_CHILDREN_yes); | 167 u1(DW_CHILDREN_yes); |
| 166 uleb128(DW_AT_name); // Start of attributes. | 168 uleb128(DW_AT_name); // Start of attributes. |
| 167 uleb128(DW_FORM_string); | 169 uleb128(DW_FORM_string); |
| 168 uleb128(DW_AT_producer); | 170 uleb128(DW_AT_producer); |
| 169 uleb128(DW_FORM_string); | 171 uleb128(DW_FORM_string); |
| 170 uleb128(DW_AT_comp_dir); | 172 uleb128(DW_AT_comp_dir); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 uleb128(0); | 222 uleb128(0); |
| 221 uleb128(0); // End of attributes. | 223 uleb128(0); // End of attributes. |
| 222 | 224 |
| 223 uleb128(0); // End of abbreviations. | 225 uleb128(0); // End of abbreviations. |
| 224 } | 226 } |
| 225 | 227 |
| 226 | 228 |
| 227 void Dwarf::WriteCompilationUnit() { | 229 void Dwarf::WriteCompilationUnit() { |
| 228 // 7.5.1.1 Compilation Unit Header | 230 // 7.5.1.1 Compilation Unit Header |
| 229 | 231 |
| 230 #if defined(HOST_OS_MACOS) | 232 #if defined(TARGET_OS_MACOS) || TARGET_OS_IOS |
| 231 Print(".section __DWARF,__debug_info,regular,debug\n"); | 233 Print(".section __DWARF,__debug_info,regular,debug\n"); |
| 234 #elif defined(TARGET_OS_LINUX) || defined(TARGET_OS_ANDROID) |
| 235 Print(".section .debug_info,\"\"\n"); |
| 232 #else | 236 #else |
| 233 Print(".section .debug_info,\"\"\n"); | 237 UNIMPLEMENTED(); |
| 234 #endif | 238 #endif |
| 235 Print(".Ldebug_info:\n"); | 239 Print(".Ldebug_info:\n"); |
| 236 | 240 |
| 237 // Unit length. Assignment to temp works around buggy Mac assembler. | 241 // Unit length. Assignment to temp works around buggy Mac assembler. |
| 238 Print("Lcu_size = .Lcu_end - .Lcu_start\n"); | 242 Print("Lcu_size = .Lcu_end - .Lcu_start\n"); |
| 239 Print(".4byte Lcu_size\n"); | 243 Print(".4byte Lcu_size\n"); |
| 240 Print(".Lcu_start:\n"); | 244 Print(".Lcu_start:\n"); |
| 241 | 245 |
| 242 u2(2); // DWARF version 2 | 246 u2(2); // DWARF version 2 |
| 243 u4(0); // debug_abbrev_offset | 247 u4(0); // debug_abbrev_offset |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 for (InliningNode* child = node->children_head; child != NULL; | 452 for (InliningNode* child = node->children_head; child != NULL; |
| 449 child = child->children_next) { | 453 child = child->children_next) { |
| 450 WriteInliningNode(child, root_code_index, script); | 454 WriteInliningNode(child, root_code_index, script); |
| 451 } | 455 } |
| 452 | 456 |
| 453 uleb128(0); // End of children. | 457 uleb128(0); // End of children. |
| 454 } | 458 } |
| 455 | 459 |
| 456 | 460 |
| 457 void Dwarf::WriteLines() { | 461 void Dwarf::WriteLines() { |
| 458 #if defined(HOST_OS_MACOS) | 462 #if defined(TARGET_OS_MACOS) || TARGET_OS_IOS |
| 459 Print(".section __DWARF,__debug_line,regular,debug\n"); | 463 Print(".section __DWARF,__debug_line,regular,debug\n"); |
| 464 #elif defined(TARGET_OS_LINUX) || defined(TARGET_OS_ANDROID) |
| 465 Print(".section .debug_line,\"\"\n"); |
| 460 #else | 466 #else |
| 461 Print(".section .debug_line,\"\"\n"); | 467 UNIMPLEMENTED(); |
| 462 #endif | 468 #endif |
| 463 | 469 |
| 464 // 6.2.4 The Line Number Program Header | 470 // 6.2.4 The Line Number Program Header |
| 465 | 471 |
| 466 // 1. unit_length. This encoding implies 32-bit DWARF. | 472 // 1. unit_length. This encoding implies 32-bit DWARF. |
| 467 Print("Lline_size = .Lline_end - .Lline_start\n"); | 473 Print("Lline_size = .Lline_end - .Lline_start\n"); |
| 468 Print(".4byte Lline_size\n"); | 474 Print(".4byte Lline_size\n"); |
| 469 | 475 |
| 470 Print(".Lline_start:\n"); | 476 Print(".Lline_start:\n"); |
| 471 | 477 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 u1(0); // This is an extended opcode | 640 u1(0); // This is an extended opcode |
| 635 u1(1); // that is 1 byte long | 641 u1(1); // that is 1 byte long |
| 636 u1(DW_LNE_end_sequence); | 642 u1(DW_LNE_end_sequence); |
| 637 | 643 |
| 638 Print(".Lline_end:\n"); | 644 Print(".Lline_end:\n"); |
| 639 } | 645 } |
| 640 | 646 |
| 641 #endif // DART_PRECOMPILER | 647 #endif // DART_PRECOMPILER |
| 642 | 648 |
| 643 } // namespace dart | 649 } // namespace dart |
| OLD | NEW |