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

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: Remove extra blank lines as requested by reviewer. 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
« no previous file with comments | « runtime/vm/debuginfo_linux.cc ('k') | runtime/vm/gdbjit_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 5 #ifndef VM_ELFGEN_H_
6 #define VM_ELFGEN_H_
6 7
7 #include "platform/utils.h"
8 #include "vm/gdbjit_linux.h"
9 #include "vm/os.h"
10 #include "vm/thread.h" 8 #include "vm/thread.h"
11 9
12 namespace dart { 10 namespace dart {
13 11
14 // ----------------------------------------------------------------------------- 12 // -----------------------------------------------------------------------------
15 // Implementation of ElfGen 13 // Implementation of ElfGen
16 // 14 //
17 // Specification documents: 15 // Specification documents:
18 // http://refspecs.freestandards.org 16 // http://refspecs.freestandards.org
19 // 17 //
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 offset += (*writer)(handle, section_buf_[i]); 486 offset += (*writer)(handle, section_buf_[i]);
489 } 487 }
490 // Write section header table. 488 // Write section header table.
491 ASSERT(offset == shoff); 489 ASSERT(offset == shoff);
492 offset += (*writer)(handle, sheaders_); 490 offset += (*writer)(handle, sheaders_);
493 ASSERT(offset == shoff + kNumSections * kSectionHeaderEntrySize); 491 ASSERT(offset == shoff + kNumSections * kSectionHeaderEntrySize);
494 492
495 return true; 493 return true;
496 } 494 }
497 495
496 } // namespace dart
498 497
499 DebugInfo::DebugInfo() { 498 #endif // VM_ELFGEN_H_
500 handle_ = reinterpret_cast<void*>(new ElfGen());
501 ASSERT(handle_ != NULL);
502 }
503
504
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
« no previous file with comments | « runtime/vm/debuginfo_linux.cc ('k') | runtime/vm/gdbjit_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698