| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifdef ENABLE_GDB_JIT_INTERFACE | 5 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 6 #include "src/v8.h" | 6 #include "src/v8.h" |
| 7 | 7 |
| 8 #include "src/base/bits.h" |
| 8 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 9 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| 10 #include "src/compiler.h" | 11 #include "src/compiler.h" |
| 11 #include "src/frames-inl.h" | 12 #include "src/frames-inl.h" |
| 12 #include "src/frames.h" | 13 #include "src/frames.h" |
| 13 #include "src/gdb-jit.h" | 14 #include "src/gdb-jit.h" |
| 14 #include "src/global-handles.h" | 15 #include "src/global-handles.h" |
| 15 #include "src/messages.h" | 16 #include "src/messages.h" |
| 16 #include "src/natives.h" | 17 #include "src/natives.h" |
| 17 #include "src/ostreams.h" | 18 #include "src/ostreams.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 class MachOSection : public DebugSectionBase<MachOSectionHeader> { | 216 class MachOSection : public DebugSectionBase<MachOSectionHeader> { |
| 216 public: | 217 public: |
| 217 enum Type { | 218 enum Type { |
| 218 S_REGULAR = 0x0u, | 219 S_REGULAR = 0x0u, |
| 219 S_ATTR_COALESCED = 0xbu, | 220 S_ATTR_COALESCED = 0xbu, |
| 220 S_ATTR_SOME_INSTRUCTIONS = 0x400u, | 221 S_ATTR_SOME_INSTRUCTIONS = 0x400u, |
| 221 S_ATTR_DEBUG = 0x02000000u, | 222 S_ATTR_DEBUG = 0x02000000u, |
| 222 S_ATTR_PURE_INSTRUCTIONS = 0x80000000u | 223 S_ATTR_PURE_INSTRUCTIONS = 0x80000000u |
| 223 }; | 224 }; |
| 224 | 225 |
| 225 MachOSection(const char* name, | 226 MachOSection(const char* name, const char* segment, uint32_t align, |
| 226 const char* segment, | |
| 227 uintptr_t align, | |
| 228 uint32_t flags) | 227 uint32_t flags) |
| 229 : name_(name), | 228 : name_(name), segment_(segment), align_(align), flags_(flags) { |
| 230 segment_(segment), | |
| 231 align_(align), | |
| 232 flags_(flags) { | |
| 233 if (align_ != 0) { | 229 if (align_ != 0) { |
| 234 DCHECK(IsPowerOf2(align)); | 230 DCHECK(base::bits::IsPowerOfTwo32(align)); |
| 235 align_ = WhichPowerOf2(align_); | 231 align_ = WhichPowerOf2(align_); |
| 236 } | 232 } |
| 237 } | 233 } |
| 238 | 234 |
| 239 virtual ~MachOSection() { } | 235 virtual ~MachOSection() { } |
| 240 | 236 |
| 241 virtual void PopulateHeader(Writer::Slot<Header> header) { | 237 virtual void PopulateHeader(Writer::Slot<Header> header) { |
| 242 header->addr = 0; | 238 header->addr = 0; |
| 243 header->size = 0; | 239 header->size = 0; |
| 244 header->offset = 0; | 240 header->offset = 0; |
| 245 header->align = align_; | 241 header->align = align_; |
| 246 header->reloff = 0; | 242 header->reloff = 0; |
| 247 header->nreloc = 0; | 243 header->nreloc = 0; |
| 248 header->flags = flags_; | 244 header->flags = flags_; |
| 249 header->reserved1 = 0; | 245 header->reserved1 = 0; |
| 250 header->reserved2 = 0; | 246 header->reserved2 = 0; |
| 251 memset(header->sectname, 0, sizeof(header->sectname)); | 247 memset(header->sectname, 0, sizeof(header->sectname)); |
| 252 memset(header->segname, 0, sizeof(header->segname)); | 248 memset(header->segname, 0, sizeof(header->segname)); |
| 253 DCHECK(strlen(name_) < sizeof(header->sectname)); | 249 DCHECK(strlen(name_) < sizeof(header->sectname)); |
| 254 DCHECK(strlen(segment_) < sizeof(header->segname)); | 250 DCHECK(strlen(segment_) < sizeof(header->segname)); |
| 255 strncpy(header->sectname, name_, sizeof(header->sectname)); | 251 strncpy(header->sectname, name_, sizeof(header->sectname)); |
| 256 strncpy(header->segname, segment_, sizeof(header->segname)); | 252 strncpy(header->segname, segment_, sizeof(header->segname)); |
| 257 } | 253 } |
| 258 | 254 |
| 259 private: | 255 private: |
| 260 const char* name_; | 256 const char* name_; |
| 261 const char* segment_; | 257 const char* segment_; |
| 262 uintptr_t align_; | 258 uint32_t align_; |
| 263 uint32_t flags_; | 259 uint32_t flags_; |
| 264 }; | 260 }; |
| 265 | 261 |
| 266 | 262 |
| 267 struct ELFSectionHeader { | 263 struct ELFSectionHeader { |
| 268 uint32_t name; | 264 uint32_t name; |
| 269 uint32_t type; | 265 uint32_t type; |
| 270 uintptr_t flags; | 266 uintptr_t flags; |
| 271 uintptr_t address; | 267 uintptr_t address; |
| 272 uintptr_t offset; | 268 uintptr_t offset; |
| (...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2199 reinterpret_cast<Address>(event->code_start)); | 2195 reinterpret_cast<Address>(event->code_start)); |
| 2200 RegisterDetailedLineInfo(code, line_info); | 2196 RegisterDetailedLineInfo(code, line_info); |
| 2201 break; | 2197 break; |
| 2202 } | 2198 } |
| 2203 } | 2199 } |
| 2204 } | 2200 } |
| 2205 | 2201 |
| 2206 | 2202 |
| 2207 } } // namespace v8::internal | 2203 } } // namespace v8::internal |
| 2208 #endif | 2204 #endif |
| OLD | NEW |