| 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 580 |
| 581 // 2. Update LNP line. | 581 // 2. Update LNP line. |
| 582 TokenPosition pos = token_positions.Last(); | 582 TokenPosition pos = token_positions.Last(); |
| 583 intptr_t line = pos.value(); | 583 intptr_t line = pos.value(); |
| 584 if (line != previous_line) { | 584 if (line != previous_line) { |
| 585 u1(DW_LNS_advance_line); | 585 u1(DW_LNS_advance_line); |
| 586 sleb128(line - previous_line); | 586 sleb128(line - previous_line); |
| 587 previous_line = line; | 587 previous_line = line; |
| 588 } | 588 } |
| 589 | 589 |
| 590 // 3. Update LNP pc. | 590 // 3. Emit LNP row. |
| 591 u1(DW_LNS_copy); |
| 592 |
| 593 // 4. Update LNP pc. |
| 591 if (previous_code_index == -1) { | 594 if (previous_code_index == -1) { |
| 592 // This variant is relocatable. | 595 // This variant is relocatable. |
| 593 u1(0); // This is an extended opcode | 596 u1(0); // This is an extended opcode |
| 594 u1(1 + sizeof(void*)); // that is 5 or 9 bytes long | 597 u1(1 + sizeof(void*)); // that is 5 or 9 bytes long |
| 595 u1(DW_LNE_set_address); | 598 u1(DW_LNE_set_address); |
| 596 Print(FORM_ADDR " .Lcode%" Pd " + %" Pd "\n", i, current_pc_offset); | 599 Print(FORM_ADDR " .Lcode%" Pd " + %" Pd "\n", i, current_pc_offset); |
| 597 } else { | 600 } else { |
| 598 u1(DW_LNS_advance_pc); | 601 u1(DW_LNS_advance_pc); |
| 599 Print(".uleb128 .Lcode%" Pd " - .Lcode%" Pd " + %" Pd "\n", i, | 602 Print(".uleb128 .Lcode%" Pd " - .Lcode%" Pd " + %" Pd "\n", i, |
| 600 previous_code_index, current_pc_offset - previous_pc_offset); | 603 previous_code_index, current_pc_offset - previous_pc_offset); |
| 601 } | 604 } |
| 602 previous_code_index = i; | 605 previous_code_index = i; |
| 603 previous_pc_offset = current_pc_offset; | 606 previous_pc_offset = current_pc_offset; |
| 604 | |
| 605 // 4. Emit LNP row. | |
| 606 u1(DW_LNS_copy); | |
| 607 | |
| 608 break; | 607 break; |
| 609 } | 608 } |
| 610 case CodeSourceMapBuilder::kPushFunction: { | 609 case CodeSourceMapBuilder::kPushFunction: { |
| 611 int32_t func_index = stream.Read<int32_t>(); | 610 int32_t func_index = stream.Read<int32_t>(); |
| 612 const Function& child_func = Function::Handle( | 611 const Function& child_func = Function::Handle( |
| 613 zone_, Function::RawCast(functions.At(func_index))); | 612 zone_, Function::RawCast(functions.At(func_index))); |
| 614 function_stack.Add(&child_func); | 613 function_stack.Add(&child_func); |
| 615 token_positions.Add(CodeSourceMapBuilder::kInitialPosition); | 614 token_positions.Add(CodeSourceMapBuilder::kInitialPosition); |
| 616 break; | 615 break; |
| 617 } | 616 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 640 u1(0); // This is an extended opcode | 639 u1(0); // This is an extended opcode |
| 641 u1(1); // that is 1 byte long | 640 u1(1); // that is 1 byte long |
| 642 u1(DW_LNE_end_sequence); | 641 u1(DW_LNE_end_sequence); |
| 643 | 642 |
| 644 Print(".Lline_end:\n"); | 643 Print(".Lline_end:\n"); |
| 645 } | 644 } |
| 646 | 645 |
| 647 #endif // DART_PRECOMPILER | 646 #endif // DART_PRECOMPILER |
| 648 | 647 |
| 649 } // namespace dart | 648 } // namespace dart |
| OLD | NEW |