Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | |
|
cshapiro
2012/08/15 01:45:07
Remove this.
| |
| 5 #include "vm/debuginfo.h" | 6 #include "vm/debuginfo.h" |
| 6 | 7 |
| 8 #include "vm/elfgen.h" | |
| 9 #include "vm/gdbjit_android.h" | |
| 7 | 10 |
| 8 namespace dart { | 11 namespace dart { |
| 9 | 12 |
| 10 DebugInfo::DebugInfo() { | 13 DebugInfo::DebugInfo() { |
| 11 handle_ = NULL; | 14 handle_ = reinterpret_cast<void*>(new ElfGen()); |
| 15 ASSERT(handle_ != NULL); | |
| 12 } | 16 } |
| 13 | 17 |
| 14 | 18 |
| 15 DebugInfo::~DebugInfo() { | 19 DebugInfo::~DebugInfo() { |
| 20 ElfGen* elf_gen = reinterpret_cast<ElfGen*>(handle_); | |
| 21 delete elf_gen; | |
| 16 } | 22 } |
| 17 | 23 |
| 18 | 24 |
| 19 void DebugInfo::AddCode(uword pc, intptr_t size) { | 25 void DebugInfo::AddCode(uword pc, intptr_t size) { |
| 20 // Nothing to do as there is no support for this on Android. | 26 ElfGen* elf_gen = reinterpret_cast<ElfGen*>(handle_); |
| 27 elf_gen->AddCode(pc, size); | |
| 21 } | 28 } |
| 22 | 29 |
| 23 | 30 |
| 24 void DebugInfo::AddCodeRegion(const char* name, uword pc, intptr_t size) { | 31 void DebugInfo::AddCodeRegion(const char* name, uword pc, intptr_t size) { |
| 25 // Nothing to do as there is no support for this on Android. | 32 ElfGen* elf_gen = reinterpret_cast<ElfGen*>(handle_); |
| 33 elf_gen->AddCodeRegion(name, pc, size); | |
| 26 } | 34 } |
| 27 | 35 |
| 28 | 36 |
| 29 bool DebugInfo::WriteToMemory(ByteBuffer* region) { | 37 bool DebugInfo::WriteToMemory(ByteBuffer* region) { |
| 30 // Nothing to do as there is no support for this on Android. | 38 ElfGen* elf_gen = reinterpret_cast<ElfGen*>(handle_); |
| 31 return false; | 39 return elf_gen->WriteToMemory(region); |
| 32 } | 40 } |
| 33 | 41 |
| 34 | 42 |
| 35 DebugInfo* DebugInfo::NewGenerator() { | 43 DebugInfo* DebugInfo::NewGenerator() { |
| 36 return new DebugInfo(); | 44 return new DebugInfo(); |
| 37 } | 45 } |
| 38 | 46 |
| 39 | 47 |
| 40 void DebugInfo::RegisterSection(const char* name, | 48 void DebugInfo::RegisterSection(const char* name, |
| 41 uword entry_point, | 49 uword entry_point, |
| 42 intptr_t size) { | 50 intptr_t size) { |
| 43 // Nothing to do as there is no support for this on Android. | 51 ElfGen* elf_section = new ElfGen(); |
| 52 ASSERT(elf_section != NULL); | |
| 53 elf_section->AddCode(entry_point, size); | |
| 54 elf_section->AddCodeRegion(name, entry_point, size); | |
| 55 | |
| 56 ByteBuffer* dynamic_region = new ByteBuffer(); | |
| 57 ASSERT(dynamic_region != NULL); | |
| 58 | |
| 59 elf_section->WriteToMemory(dynamic_region); | |
| 60 | |
| 61 ::addDynamicSection(reinterpret_cast<const char*>(dynamic_region->data()), | |
| 62 dynamic_region->size()); | |
| 63 dynamic_region->set_data(NULL); | |
| 64 delete dynamic_region; | |
| 65 delete elf_section; | |
| 44 } | 66 } |
| 45 | 67 |
| 46 | 68 |
| 47 void DebugInfo::UnregisterAllSections() { | 69 void DebugInfo::UnregisterAllSections() { |
| 48 // Nothing to do as there is no support for this on Android. | 70 ::deleteDynamicSections(); |
| 49 } | 71 } |
| 50 | 72 |
| 73 | |
|
cshapiro
2012/08/15 01:45:07
Remove this.
| |
| 51 } // namespace dart | 74 } // namespace dart |
| OLD | NEW |