OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 return false; | 210 return false; |
211 } | 211 } |
212 | 212 |
213 typedef THeader Header; | 213 typedef THeader Header; |
214 }; | 214 }; |
215 | 215 |
216 | 216 |
217 struct MachOSectionHeader { | 217 struct MachOSectionHeader { |
218 char sectname[16]; | 218 char sectname[16]; |
219 char segname[16]; | 219 char segname[16]; |
220 #if defined(V8_TARGET_ARCH_IA32) | 220 #if V8_TARGET_ARCH_IA32 |
221 uint32_t addr; | 221 uint32_t addr; |
222 uint32_t size; | 222 uint32_t size; |
223 #else | 223 #else |
224 uint64_t addr; | 224 uint64_t addr; |
225 uint64_t size; | 225 uint64_t size; |
226 #endif | 226 #endif |
227 uint32_t offset; | 227 uint32_t offset; |
228 uint32_t align; | 228 uint32_t align; |
229 uint32_t reloff; | 229 uint32_t reloff; |
230 uint32_t nreloc; | 230 uint32_t nreloc; |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 | 518 |
519 private: | 519 private: |
520 struct MachOHeader { | 520 struct MachOHeader { |
521 uint32_t magic; | 521 uint32_t magic; |
522 uint32_t cputype; | 522 uint32_t cputype; |
523 uint32_t cpusubtype; | 523 uint32_t cpusubtype; |
524 uint32_t filetype; | 524 uint32_t filetype; |
525 uint32_t ncmds; | 525 uint32_t ncmds; |
526 uint32_t sizeofcmds; | 526 uint32_t sizeofcmds; |
527 uint32_t flags; | 527 uint32_t flags; |
528 #if defined(V8_TARGET_ARCH_X64) | 528 #if V8_TARGET_ARCH_X64 |
529 uint32_t reserved; | 529 uint32_t reserved; |
530 #endif | 530 #endif |
531 }; | 531 }; |
532 | 532 |
533 struct MachOSegmentCommand { | 533 struct MachOSegmentCommand { |
534 uint32_t cmd; | 534 uint32_t cmd; |
535 uint32_t cmdsize; | 535 uint32_t cmdsize; |
536 char segname[16]; | 536 char segname[16]; |
537 #if defined(V8_TARGET_ARCH_IA32) | 537 #if V8_TARGET_ARCH_IA32 |
538 uint32_t vmaddr; | 538 uint32_t vmaddr; |
539 uint32_t vmsize; | 539 uint32_t vmsize; |
540 uint32_t fileoff; | 540 uint32_t fileoff; |
541 uint32_t filesize; | 541 uint32_t filesize; |
542 #else | 542 #else |
543 uint64_t vmaddr; | 543 uint64_t vmaddr; |
544 uint64_t vmsize; | 544 uint64_t vmsize; |
545 uint64_t fileoff; | 545 uint64_t fileoff; |
546 uint64_t filesize; | 546 uint64_t filesize; |
547 #endif | 547 #endif |
548 uint32_t maxprot; | 548 uint32_t maxprot; |
549 uint32_t initprot; | 549 uint32_t initprot; |
550 uint32_t nsects; | 550 uint32_t nsects; |
551 uint32_t flags; | 551 uint32_t flags; |
552 }; | 552 }; |
553 | 553 |
554 enum MachOLoadCommandCmd { | 554 enum MachOLoadCommandCmd { |
555 LC_SEGMENT_32 = 0x00000001u, | 555 LC_SEGMENT_32 = 0x00000001u, |
556 LC_SEGMENT_64 = 0x00000019u | 556 LC_SEGMENT_64 = 0x00000019u |
557 }; | 557 }; |
558 | 558 |
559 | 559 |
560 Writer::Slot<MachOHeader> WriteHeader(Writer* w) { | 560 Writer::Slot<MachOHeader> WriteHeader(Writer* w) { |
561 ASSERT(w->position() == 0); | 561 ASSERT(w->position() == 0); |
562 Writer::Slot<MachOHeader> header = w->CreateSlotHere<MachOHeader>(); | 562 Writer::Slot<MachOHeader> header = w->CreateSlotHere<MachOHeader>(); |
563 #if defined(V8_TARGET_ARCH_IA32) | 563 #if V8_TARGET_ARCH_IA32 |
564 header->magic = 0xFEEDFACEu; | 564 header->magic = 0xFEEDFACEu; |
565 header->cputype = 7; // i386 | 565 header->cputype = 7; // i386 |
566 header->cpusubtype = 3; // CPU_SUBTYPE_I386_ALL | 566 header->cpusubtype = 3; // CPU_SUBTYPE_I386_ALL |
567 #elif defined(V8_TARGET_ARCH_X64) | 567 #elif V8_TARGET_ARCH_X64 |
568 header->magic = 0xFEEDFACFu; | 568 header->magic = 0xFEEDFACFu; |
569 header->cputype = 7 | 0x01000000; // i386 | 64-bit ABI | 569 header->cputype = 7 | 0x01000000; // i386 | 64-bit ABI |
570 header->cpusubtype = 3; // CPU_SUBTYPE_I386_ALL | 570 header->cpusubtype = 3; // CPU_SUBTYPE_I386_ALL |
571 header->reserved = 0; | 571 header->reserved = 0; |
572 #else | 572 #else |
573 #error Unsupported target architecture. | 573 #error Unsupported target architecture. |
574 #endif | 574 #endif |
575 header->filetype = 0x1; // MH_OBJECT | 575 header->filetype = 0x1; // MH_OBJECT |
576 header->ncmds = 1; | 576 header->ncmds = 1; |
577 header->sizeofcmds = 0; | 577 header->sizeofcmds = 0; |
578 header->flags = 0; | 578 header->flags = 0; |
579 return header; | 579 return header; |
580 } | 580 } |
581 | 581 |
582 | 582 |
583 Writer::Slot<MachOSegmentCommand> WriteSegmentCommand(Writer* w, | 583 Writer::Slot<MachOSegmentCommand> WriteSegmentCommand(Writer* w, |
584 uintptr_t code_start, | 584 uintptr_t code_start, |
585 uintptr_t code_size) { | 585 uintptr_t code_size) { |
586 Writer::Slot<MachOSegmentCommand> cmd = | 586 Writer::Slot<MachOSegmentCommand> cmd = |
587 w->CreateSlotHere<MachOSegmentCommand>(); | 587 w->CreateSlotHere<MachOSegmentCommand>(); |
588 #if defined(V8_TARGET_ARCH_IA32) | 588 #if V8_TARGET_ARCH_IA32 |
589 cmd->cmd = LC_SEGMENT_32; | 589 cmd->cmd = LC_SEGMENT_32; |
590 #else | 590 #else |
591 cmd->cmd = LC_SEGMENT_64; | 591 cmd->cmd = LC_SEGMENT_64; |
592 #endif | 592 #endif |
593 cmd->vmaddr = code_start; | 593 cmd->vmaddr = code_start; |
594 cmd->vmsize = code_size; | 594 cmd->vmsize = code_size; |
595 cmd->fileoff = 0; | 595 cmd->fileoff = 0; |
596 cmd->filesize = 0; | 596 cmd->filesize = 0; |
597 cmd->maxprot = 7; | 597 cmd->maxprot = 7; |
598 cmd->initprot = 7; | 598 cmd->initprot = 7; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 uint16_t pht_entry_num; | 665 uint16_t pht_entry_num; |
666 uint16_t sht_entry_size; | 666 uint16_t sht_entry_size; |
667 uint16_t sht_entry_num; | 667 uint16_t sht_entry_num; |
668 uint16_t sht_strtab_index; | 668 uint16_t sht_strtab_index; |
669 }; | 669 }; |
670 | 670 |
671 | 671 |
672 void WriteHeader(Writer* w) { | 672 void WriteHeader(Writer* w) { |
673 ASSERT(w->position() == 0); | 673 ASSERT(w->position() == 0); |
674 Writer::Slot<ELFHeader> header = w->CreateSlotHere<ELFHeader>(); | 674 Writer::Slot<ELFHeader> header = w->CreateSlotHere<ELFHeader>(); |
675 #if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_ARM) | 675 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM |
676 const uint8_t ident[16] = | 676 const uint8_t ident[16] = |
677 { 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | 677 { 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
678 #elif defined(V8_TARGET_ARCH_X64) | 678 #elif V8_TARGET_ARCH_X64 |
679 const uint8_t ident[16] = | 679 const uint8_t ident[16] = |
680 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | 680 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
681 #else | 681 #else |
682 #error Unsupported target architecture. | 682 #error Unsupported target architecture. |
683 #endif | 683 #endif |
684 OS::MemCopy(header->ident, ident, 16); | 684 OS::MemCopy(header->ident, ident, 16); |
685 header->type = 1; | 685 header->type = 1; |
686 #if defined(V8_TARGET_ARCH_IA32) | 686 #if V8_TARGET_ARCH_IA32 |
687 header->machine = 3; | 687 header->machine = 3; |
688 #elif defined(V8_TARGET_ARCH_X64) | 688 #elif V8_TARGET_ARCH_X64 |
689 // Processor identification value for x64 is 62 as defined in | 689 // Processor identification value for x64 is 62 as defined in |
690 // System V ABI, AMD64 Supplement | 690 // System V ABI, AMD64 Supplement |
691 // http://www.x86-64.org/documentation/abi.pdf | 691 // http://www.x86-64.org/documentation/abi.pdf |
692 header->machine = 62; | 692 header->machine = 62; |
693 #elif defined(V8_TARGET_ARCH_ARM) | 693 #elif V8_TARGET_ARCH_ARM |
694 // Set to EM_ARM, defined as 40, in "ARM ELF File Format" at | 694 // Set to EM_ARM, defined as 40, in "ARM ELF File Format" at |
695 // infocenter.arm.com/help/topic/com.arm.doc.dui0101a/DUI0101A_Elf.pdf | 695 // infocenter.arm.com/help/topic/com.arm.doc.dui0101a/DUI0101A_Elf.pdf |
696 header->machine = 40; | 696 header->machine = 40; |
697 #else | 697 #else |
698 #error Unsupported target architecture. | 698 #error Unsupported target architecture. |
699 #endif | 699 #endif |
700 header->version = 1; | 700 header->version = 1; |
701 header->entry = 0; | 701 header->entry = 0; |
702 header->pht_offset = 0; | 702 header->pht_offset = 0; |
703 header->sht_offset = sizeof(ELFHeader); // Section table follows header. | 703 header->sht_offset = sizeof(ELFHeader); // Section table follows header. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 value(value), | 777 value(value), |
778 size(size), | 778 size(size), |
779 info((binding << 4) | type), | 779 info((binding << 4) | type), |
780 other(0), | 780 other(0), |
781 section(section) { | 781 section(section) { |
782 } | 782 } |
783 | 783 |
784 Binding binding() const { | 784 Binding binding() const { |
785 return static_cast<Binding>(info >> 4); | 785 return static_cast<Binding>(info >> 4); |
786 } | 786 } |
787 #if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_ARM) | 787 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM |
788 struct SerializedLayout { | 788 struct SerializedLayout { |
789 SerializedLayout(uint32_t name, | 789 SerializedLayout(uint32_t name, |
790 uintptr_t value, | 790 uintptr_t value, |
791 uintptr_t size, | 791 uintptr_t size, |
792 Binding binding, | 792 Binding binding, |
793 Type type, | 793 Type type, |
794 uint16_t section) | 794 uint16_t section) |
795 : name(name), | 795 : name(name), |
796 value(value), | 796 value(value), |
797 size(size), | 797 size(size), |
798 info((binding << 4) | type), | 798 info((binding << 4) | type), |
799 other(0), | 799 other(0), |
800 section(section) { | 800 section(section) { |
801 } | 801 } |
802 | 802 |
803 uint32_t name; | 803 uint32_t name; |
804 uintptr_t value; | 804 uintptr_t value; |
805 uintptr_t size; | 805 uintptr_t size; |
806 uint8_t info; | 806 uint8_t info; |
807 uint8_t other; | 807 uint8_t other; |
808 uint16_t section; | 808 uint16_t section; |
809 }; | 809 }; |
810 #elif defined(V8_TARGET_ARCH_X64) | 810 #elif V8_TARGET_ARCH_X64 |
811 struct SerializedLayout { | 811 struct SerializedLayout { |
812 SerializedLayout(uint32_t name, | 812 SerializedLayout(uint32_t name, |
813 uintptr_t value, | 813 uintptr_t value, |
814 uintptr_t size, | 814 uintptr_t size, |
815 Binding binding, | 815 Binding binding, |
816 Type type, | 816 Type type, |
817 uint16_t section) | 817 uint16_t section) |
818 : name(name), | 818 : name(name), |
819 info((binding << 4) | type), | 819 info((binding << 4) | type), |
820 other(0), | 820 other(0), |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 } | 914 } |
915 | 915 |
916 ZoneList<ELFSymbol> locals_; | 916 ZoneList<ELFSymbol> locals_; |
917 ZoneList<ELFSymbol> globals_; | 917 ZoneList<ELFSymbol> globals_; |
918 }; | 918 }; |
919 #endif // defined(__ELF) | 919 #endif // defined(__ELF) |
920 | 920 |
921 | 921 |
922 class CodeDescription BASE_EMBEDDED { | 922 class CodeDescription BASE_EMBEDDED { |
923 public: | 923 public: |
924 #ifdef V8_TARGET_ARCH_X64 | 924 #if V8_TARGET_ARCH_X64 |
925 enum StackState { | 925 enum StackState { |
926 POST_RBP_PUSH, | 926 POST_RBP_PUSH, |
927 POST_RBP_SET, | 927 POST_RBP_SET, |
928 POST_RBP_POP, | 928 POST_RBP_POP, |
929 STACK_STATE_MAX | 929 STACK_STATE_MAX |
930 }; | 930 }; |
931 #endif | 931 #endif |
932 | 932 |
933 CodeDescription(const char* name, | 933 CodeDescription(const char* name, |
934 Code* code, | 934 Code* code, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 } | 977 } |
978 | 978 |
979 bool IsLineInfoAvailable() { | 979 bool IsLineInfoAvailable() { |
980 return !script_.is_null() && | 980 return !script_.is_null() && |
981 script_->source()->IsString() && | 981 script_->source()->IsString() && |
982 script_->HasValidSource() && | 982 script_->HasValidSource() && |
983 script_->name()->IsString() && | 983 script_->name()->IsString() && |
984 lineinfo_ != NULL; | 984 lineinfo_ != NULL; |
985 } | 985 } |
986 | 986 |
987 #ifdef V8_TARGET_ARCH_X64 | 987 #if V8_TARGET_ARCH_X64 |
988 uintptr_t GetStackStateStartAddress(StackState state) const { | 988 uintptr_t GetStackStateStartAddress(StackState state) const { |
989 ASSERT(state < STACK_STATE_MAX); | 989 ASSERT(state < STACK_STATE_MAX); |
990 return stack_state_start_addresses_[state]; | 990 return stack_state_start_addresses_[state]; |
991 } | 991 } |
992 | 992 |
993 void SetStackStateStartAddress(StackState state, uintptr_t addr) { | 993 void SetStackStateStartAddress(StackState state, uintptr_t addr) { |
994 ASSERT(state < STACK_STATE_MAX); | 994 ASSERT(state < STACK_STATE_MAX); |
995 stack_state_start_addresses_[state] = addr; | 995 stack_state_start_addresses_[state] = addr; |
996 } | 996 } |
997 #endif | 997 #endif |
998 | 998 |
999 SmartArrayPointer<char> GetFilename() { | 999 SmartArrayPointer<char> GetFilename() { |
1000 return String::cast(script_->name())->ToCString(); | 1000 return String::cast(script_->name())->ToCString(); |
1001 } | 1001 } |
1002 | 1002 |
1003 int GetScriptLineNumber(int pos) { | 1003 int GetScriptLineNumber(int pos) { |
1004 return GetScriptLineNumberSafe(script_, pos) + 1; | 1004 return GetScriptLineNumberSafe(script_, pos) + 1; |
1005 } | 1005 } |
1006 | 1006 |
1007 | 1007 |
1008 private: | 1008 private: |
1009 const char* name_; | 1009 const char* name_; |
1010 Code* code_; | 1010 Code* code_; |
1011 Handle<Script> script_; | 1011 Handle<Script> script_; |
1012 GDBJITLineInfo* lineinfo_; | 1012 GDBJITLineInfo* lineinfo_; |
1013 GDBJITInterface::CodeTag tag_; | 1013 GDBJITInterface::CodeTag tag_; |
1014 CompilationInfo* info_; | 1014 CompilationInfo* info_; |
1015 #ifdef V8_TARGET_ARCH_X64 | 1015 #if V8_TARGET_ARCH_X64 |
1016 uintptr_t stack_state_start_addresses_[STACK_STATE_MAX]; | 1016 uintptr_t stack_state_start_addresses_[STACK_STATE_MAX]; |
1017 #endif | 1017 #endif |
1018 }; | 1018 }; |
1019 | 1019 |
1020 #if defined(__ELF) | 1020 #if defined(__ELF) |
1021 static void CreateSymbolsTable(CodeDescription* desc, | 1021 static void CreateSymbolsTable(CodeDescription* desc, |
1022 Zone* zone, | 1022 Zone* zone, |
1023 ELF* elf, | 1023 ELF* elf, |
1024 int text_section_index) { | 1024 int text_section_index) { |
1025 ELFSymbolTable* symtab = new(zone) ELFSymbolTable(".symtab", zone); | 1025 ELFSymbolTable* symtab = new(zone) ELFSymbolTable(".symtab", zone); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 w->WriteString("v8value"); | 1099 w->WriteString("v8value"); |
1100 | 1100 |
1101 if (desc_->IsInfoAvailable()) { | 1101 if (desc_->IsInfoAvailable()) { |
1102 Scope* scope = desc_->info()->scope(); | 1102 Scope* scope = desc_->info()->scope(); |
1103 w->WriteULEB128(2); | 1103 w->WriteULEB128(2); |
1104 w->WriteString(desc_->name()); | 1104 w->WriteString(desc_->name()); |
1105 w->Write<intptr_t>(desc_->CodeStart()); | 1105 w->Write<intptr_t>(desc_->CodeStart()); |
1106 w->Write<intptr_t>(desc_->CodeStart() + desc_->CodeSize()); | 1106 w->Write<intptr_t>(desc_->CodeStart() + desc_->CodeSize()); |
1107 Writer::Slot<uint32_t> fb_block_size = w->CreateSlotHere<uint32_t>(); | 1107 Writer::Slot<uint32_t> fb_block_size = w->CreateSlotHere<uint32_t>(); |
1108 uintptr_t fb_block_start = w->position(); | 1108 uintptr_t fb_block_start = w->position(); |
1109 #if defined(V8_TARGET_ARCH_IA32) | 1109 #if V8_TARGET_ARCH_IA32 |
1110 w->Write<uint8_t>(DW_OP_reg5); // The frame pointer's here on ia32 | 1110 w->Write<uint8_t>(DW_OP_reg5); // The frame pointer's here on ia32 |
1111 #elif defined(V8_TARGET_ARCH_X64) | 1111 #elif V8_TARGET_ARCH_X64 |
1112 w->Write<uint8_t>(DW_OP_reg6); // and here on x64. | 1112 w->Write<uint8_t>(DW_OP_reg6); // and here on x64. |
1113 #elif defined(V8_TARGET_ARCH_ARM) | 1113 #elif V8_TARGET_ARCH_ARM |
1114 UNIMPLEMENTED(); | 1114 UNIMPLEMENTED(); |
1115 #elif defined(V8_TARGET_ARCH_MIPS) | 1115 #elif V8_TARGET_ARCH_MIPS |
1116 UNIMPLEMENTED(); | 1116 UNIMPLEMENTED(); |
1117 #else | 1117 #else |
1118 #error Unsupported target architecture. | 1118 #error Unsupported target architecture. |
1119 #endif | 1119 #endif |
1120 fb_block_size.set(static_cast<uint32_t>(w->position() - fb_block_start)); | 1120 fb_block_size.set(static_cast<uint32_t>(w->position() - fb_block_start)); |
1121 | 1121 |
1122 int params = scope->num_parameters(); | 1122 int params = scope->num_parameters(); |
1123 int slots = scope->num_stack_slots(); | 1123 int slots = scope->num_stack_slots(); |
1124 int context_slots = scope->ContextLocalCount(); | 1124 int context_slots = scope->ContextLocalCount(); |
1125 // The real slot ID is internal_slots + context_slot_id. | 1125 // The real slot ID is internal_slots + context_slot_id. |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 return +1; | 1556 return +1; |
1557 } else { | 1557 } else { |
1558 return -1; | 1558 return -1; |
1559 } | 1559 } |
1560 } | 1560 } |
1561 | 1561 |
1562 CodeDescription* desc_; | 1562 CodeDescription* desc_; |
1563 }; | 1563 }; |
1564 | 1564 |
1565 | 1565 |
1566 #ifdef V8_TARGET_ARCH_X64 | 1566 #if V8_TARGET_ARCH_X64 |
1567 | 1567 |
1568 class UnwindInfoSection : public DebugSection { | 1568 class UnwindInfoSection : public DebugSection { |
1569 public: | 1569 public: |
1570 explicit UnwindInfoSection(CodeDescription* desc); | 1570 explicit UnwindInfoSection(CodeDescription* desc); |
1571 virtual bool WriteBodyInternal(Writer* w); | 1571 virtual bool WriteBodyInternal(Writer* w); |
1572 | 1572 |
1573 int WriteCIE(Writer* w); | 1573 int WriteCIE(Writer* w); |
1574 void WriteFDE(Writer* w, int); | 1574 void WriteFDE(Writer* w, int); |
1575 | 1575 |
1576 void WriteFDEStateOnEntry(Writer* w); | 1576 void WriteFDEStateOnEntry(Writer* w); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 #endif // V8_TARGET_ARCH_X64 | 1790 #endif // V8_TARGET_ARCH_X64 |
1791 | 1791 |
1792 static void CreateDWARFSections(CodeDescription* desc, | 1792 static void CreateDWARFSections(CodeDescription* desc, |
1793 Zone* zone, | 1793 Zone* zone, |
1794 DebugObject* obj) { | 1794 DebugObject* obj) { |
1795 if (desc->IsLineInfoAvailable()) { | 1795 if (desc->IsLineInfoAvailable()) { |
1796 obj->AddSection(new(zone) DebugInfoSection(desc), zone); | 1796 obj->AddSection(new(zone) DebugInfoSection(desc), zone); |
1797 obj->AddSection(new(zone) DebugAbbrevSection(desc), zone); | 1797 obj->AddSection(new(zone) DebugAbbrevSection(desc), zone); |
1798 obj->AddSection(new(zone) DebugLineSection(desc), zone); | 1798 obj->AddSection(new(zone) DebugLineSection(desc), zone); |
1799 } | 1799 } |
1800 #ifdef V8_TARGET_ARCH_X64 | 1800 #if V8_TARGET_ARCH_X64 |
1801 obj->AddSection(new(zone) UnwindInfoSection(desc), zone); | 1801 obj->AddSection(new(zone) UnwindInfoSection(desc), zone); |
1802 #endif | 1802 #endif |
1803 } | 1803 } |
1804 | 1804 |
1805 | 1805 |
1806 // ------------------------------------------------------------------- | 1806 // ------------------------------------------------------------------- |
1807 // Binary GDB JIT Interface as described in | 1807 // Binary GDB JIT Interface as described in |
1808 // http://sourceware.org/gdb/onlinedocs/gdb/Declarations.html | 1808 // http://sourceware.org/gdb/onlinedocs/gdb/Declarations.html |
1809 extern "C" { | 1809 extern "C" { |
1810 typedef enum { | 1810 typedef enum { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 if (!name.is_null() && name->IsString()) { | 2008 if (!name.is_null() && name->IsString()) { |
2009 SmartArrayPointer<char> name_cstring = | 2009 SmartArrayPointer<char> name_cstring = |
2010 Handle<String>::cast(name)->ToCString(DISALLOW_NULLS); | 2010 Handle<String>::cast(name)->ToCString(DISALLOW_NULLS); |
2011 AddCode(*name_cstring, *code, GDBJITInterface::FUNCTION, *script, info); | 2011 AddCode(*name_cstring, *code, GDBJITInterface::FUNCTION, *script, info); |
2012 } else { | 2012 } else { |
2013 AddCode("", *code, GDBJITInterface::FUNCTION, *script, info); | 2013 AddCode("", *code, GDBJITInterface::FUNCTION, *script, info); |
2014 } | 2014 } |
2015 } | 2015 } |
2016 | 2016 |
2017 static void AddUnwindInfo(CodeDescription* desc) { | 2017 static void AddUnwindInfo(CodeDescription* desc) { |
2018 #ifdef V8_TARGET_ARCH_X64 | 2018 #if V8_TARGET_ARCH_X64 |
2019 if (desc->tag() == GDBJITInterface::FUNCTION) { | 2019 if (desc->tag() == GDBJITInterface::FUNCTION) { |
2020 // To avoid propagating unwinding information through | 2020 // To avoid propagating unwinding information through |
2021 // compilation pipeline we use an approximation. | 2021 // compilation pipeline we use an approximation. |
2022 // For most use cases this should not affect usability. | 2022 // For most use cases this should not affect usability. |
2023 static const int kFramePointerPushOffset = 1; | 2023 static const int kFramePointerPushOffset = 1; |
2024 static const int kFramePointerSetOffset = 4; | 2024 static const int kFramePointerSetOffset = 4; |
2025 static const int kFramePointerPopOffset = -3; | 2025 static const int kFramePointerPopOffset = -3; |
2026 | 2026 |
2027 uintptr_t frame_pointer_push_address = | 2027 uintptr_t frame_pointer_push_address = |
2028 desc->CodeStart() + kFramePointerPushOffset; | 2028 desc->CodeStart() + kFramePointerPushOffset; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 ScopedLock lock(mutex.Pointer()); | 2171 ScopedLock lock(mutex.Pointer()); |
2172 ASSERT(!IsLineInfoTagged(line_info)); | 2172 ASSERT(!IsLineInfoTagged(line_info)); |
2173 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 2173 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
2174 ASSERT(e->value == NULL); | 2174 ASSERT(e->value == NULL); |
2175 e->value = TagLineInfo(line_info); | 2175 e->value = TagLineInfo(line_info); |
2176 } | 2176 } |
2177 | 2177 |
2178 | 2178 |
2179 } } // namespace v8::internal | 2179 } } // namespace v8::internal |
2180 #endif | 2180 #endif |
OLD | NEW |