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

Side by Side Diff: runtime/vm/elfgen.h

Issue 10827327: Add GDB JIT support back into Android build. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move common ELF generation code into a shared header file. Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/debuginfo.h"
6 5
7 #include "platform/utils.h" 6 #ifndef VM_ELFGEN_H_
8 #include "vm/gdbjit_linux.h" 7 #define VM_ELFGEN_H_
9 #include "vm/os.h" 8
10 #include "vm/thread.h" 9 #include "vm/thread.h"
11 10
12 namespace dart { 11 namespace dart {
13 12
14 // ----------------------------------------------------------------------------- 13 // -----------------------------------------------------------------------------
15 // Implementation of ElfGen 14 // Implementation of ElfGen
16 // 15 //
17 // Specification documents: 16 // Specification documents:
18 // http://refspecs.freestandards.org 17 // http://refspecs.freestandards.org
19 // 18 //
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 offset += (*writer)(handle, section_buf_[i]); 487 offset += (*writer)(handle, section_buf_[i]);
489 } 488 }
490 // Write section header table. 489 // Write section header table.
491 ASSERT(offset == shoff); 490 ASSERT(offset == shoff);
492 offset += (*writer)(handle, sheaders_); 491 offset += (*writer)(handle, sheaders_);
493 ASSERT(offset == shoff + kNumSections * kSectionHeaderEntrySize); 492 ASSERT(offset == shoff + kNumSections * kSectionHeaderEntrySize);
494 493
495 return true; 494 return true;
496 } 495 }
497 496
498 497
cshapiro 2012/08/15 01:45:07 Remove line 497
499 DebugInfo::DebugInfo() { 498 } // namespace dart
500 handle_ = reinterpret_cast<void*>(new ElfGen());
501 ASSERT(handle_ != NULL);
502 }
503 499
504 500 #endif // VM_ELFGEN_H_
505 DebugInfo::~DebugInfo() {
506 ElfGen* elf_gen = reinterpret_cast<ElfGen*>(handle_);
507 delete elf_gen;
508 }
509
510
511 void DebugInfo::AddCode(uword pc, intptr_t size) {
512 ElfGen* elf_gen = reinterpret_cast<ElfGen*>(handle_);
513 elf_gen->AddCode(pc, size);
514 }
515
516
517 void DebugInfo::AddCodeRegion(const char* name, uword pc, intptr_t size) {
518 ElfGen* elf_gen = reinterpret_cast<ElfGen*>(handle_);
519 elf_gen->AddCodeRegion(name, pc, size);
520 }
521
522
523 bool DebugInfo::WriteToMemory(ByteBuffer* region) {
524 ElfGen* elf_gen = reinterpret_cast<ElfGen*>(handle_);
525 return elf_gen->WriteToMemory(region);
526 }
527
528
529 DebugInfo* DebugInfo::NewGenerator() {
530 return new DebugInfo();
531 }
532
533
534 void DebugInfo::RegisterSection(const char* name,
535 uword entry_point,
536 intptr_t size) {
537 ElfGen* elf_section = new ElfGen();
538 ASSERT(elf_section != NULL);
539 elf_section->AddCode(entry_point, size);
540 elf_section->AddCodeRegion(name, entry_point, size);
541
542 ByteBuffer* dynamic_region = new ByteBuffer();
543 ASSERT(dynamic_region != NULL);
544
545 elf_section->WriteToMemory(dynamic_region);
546
547 ::addDynamicSection(reinterpret_cast<const char*>(dynamic_region->data()),
548 dynamic_region->size());
549 dynamic_region->set_data(NULL);
550 delete dynamic_region;
551 delete elf_section;
552 }
553
554
555 void DebugInfo::UnregisterAllSections() {
556 ::deleteDynamicSections();
557 }
558
559 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698