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