003 File Manager
Current Path:
/usr/src/contrib/llvm-project/lldb/source/Core
usr
/
src
/
contrib
/
llvm-project
/
lldb
/
source
/
Core
/
📁
..
📄
Address.cpp
(34.46 KB)
📄
AddressRange.cpp
(6.35 KB)
📄
AddressResolver.cpp
(1.15 KB)
📄
AddressResolverFileLine.cpp
(2.99 KB)
📄
AddressResolverName.cpp
(6.52 KB)
📄
Communication.cpp
(14.89 KB)
📄
CoreProperties.td
(9.46 KB)
📄
Debugger.cpp
(56.35 KB)
📄
Disassembler.cpp
(45.47 KB)
📄
DumpDataExtractor.cpp
(26.28 KB)
📄
DumpRegisterValue.cpp
(2.88 KB)
📄
DynamicLoader.cpp
(8.11 KB)
📄
EmulateInstruction.cpp
(19.28 KB)
📄
FileLineResolver.cpp
(2.85 KB)
📄
FileSpecList.cpp
(4.02 KB)
📄
FormatEntity.cpp
(83.74 KB)
📄
Highlighter.cpp
(2.91 KB)
📄
IOHandler.cpp
(18.81 KB)
📄
IOHandlerCursesGUI.cpp
(126.73 KB)
📄
Mangled.cpp
(14.82 KB)
📄
Module.cpp
(60.79 KB)
📄
ModuleChild.cpp
(872 B)
📄
ModuleList.cpp
(35.29 KB)
📄
Opcode.cpp
(3.79 KB)
📄
PluginManager.cpp
(52.59 KB)
📄
RichManglingContext.cpp
(5.2 KB)
📄
SearchFilter.cpp
(27.24 KB)
📄
Section.cpp
(19.21 KB)
📄
SourceManager.cpp
(23.03 KB)
📄
StreamAsynchronousIO.cpp
(1.11 KB)
📄
StreamFile.cpp
(1.71 KB)
📄
UserSettingsController.cpp
(3.76 KB)
📄
Value.cpp
(22.68 KB)
📄
ValueObject.cpp
(115.6 KB)
📄
ValueObjectCast.cpp
(3.12 KB)
📄
ValueObjectChild.cpp
(9.28 KB)
📄
ValueObjectConstResult.cpp
(11.81 KB)
📄
ValueObjectConstResultCast.cpp
(2.05 KB)
📄
ValueObjectConstResultChild.cpp
(2.65 KB)
📄
ValueObjectConstResultImpl.cpp
(6.26 KB)
📄
ValueObjectDynamicValue.cpp
(12.25 KB)
📄
ValueObjectList.cpp
(3.31 KB)
📄
ValueObjectMemory.cpp
(8.3 KB)
📄
ValueObjectRegister.cpp
(9.77 KB)
📄
ValueObjectSyntheticFilter.cpp
(13.73 KB)
📄
ValueObjectVariable.cpp
(14.44 KB)
Editing: Opcode.cpp
//===-- Opcode.cpp --------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "lldb/Core/Opcode.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" #include "lldb/Utility/Stream.h" #include "lldb/lldb-forward.h" #include <memory> #include <inttypes.h> using namespace lldb; using namespace lldb_private; int Opcode::Dump(Stream *s, uint32_t min_byte_width) { const uint32_t previous_bytes = s->GetWrittenBytes(); switch (m_type) { case Opcode::eTypeInvalid: s->PutCString("<invalid>"); break; case Opcode::eType8: s->Printf("0x%2.2x", m_data.inst8); break; case Opcode::eType16: s->Printf("0x%4.4x", m_data.inst16); break; case Opcode::eType16_2: case Opcode::eType32: s->Printf("0x%8.8x", m_data.inst32); break; case Opcode::eType64: s->Printf("0x%16.16" PRIx64, m_data.inst64); break; case Opcode::eTypeBytes: for (uint32_t i = 0; i < m_data.inst.length; ++i) { if (i > 0) s->PutChar(' '); s->Printf("%2.2x", m_data.inst.bytes[i]); } break; } uint32_t bytes_written_so_far = s->GetWrittenBytes() - previous_bytes; // Add spaces to make sure bytes display comes out even in case opcodes aren't // all the same size. if (bytes_written_so_far < min_byte_width) s->Printf("%*s", min_byte_width - bytes_written_so_far, ""); return s->GetWrittenBytes() - previous_bytes; } lldb::ByteOrder Opcode::GetDataByteOrder() const { if (m_byte_order != eByteOrderInvalid) { return m_byte_order; } switch (m_type) { case Opcode::eTypeInvalid: break; case Opcode::eType8: case Opcode::eType16: case Opcode::eType16_2: case Opcode::eType32: case Opcode::eType64: return endian::InlHostByteOrder(); case Opcode::eTypeBytes: break; } return eByteOrderInvalid; } uint32_t Opcode::GetData(DataExtractor &data) const { uint32_t byte_size = GetByteSize(); uint8_t swap_buf[8]; const void *buf = nullptr; if (byte_size > 0) { if (!GetEndianSwap()) { if (m_type == Opcode::eType16_2) { // 32 bit thumb instruction, we need to sizzle this a bit swap_buf[0] = m_data.inst.bytes[2]; swap_buf[1] = m_data.inst.bytes[3]; swap_buf[2] = m_data.inst.bytes[0]; swap_buf[3] = m_data.inst.bytes[1]; buf = swap_buf; } else { buf = GetOpcodeDataBytes(); } } else { switch (m_type) { case Opcode::eTypeInvalid: break; case Opcode::eType8: buf = GetOpcodeDataBytes(); break; case Opcode::eType16: *(uint16_t *)swap_buf = llvm::ByteSwap_16(m_data.inst16); buf = swap_buf; break; case Opcode::eType16_2: swap_buf[0] = m_data.inst.bytes[1]; swap_buf[1] = m_data.inst.bytes[0]; swap_buf[2] = m_data.inst.bytes[3]; swap_buf[3] = m_data.inst.bytes[2]; buf = swap_buf; break; case Opcode::eType32: *(uint32_t *)swap_buf = llvm::ByteSwap_32(m_data.inst32); buf = swap_buf; break; case Opcode::eType64: *(uint32_t *)swap_buf = llvm::ByteSwap_64(m_data.inst64); buf = swap_buf; break; case Opcode::eTypeBytes: buf = GetOpcodeDataBytes(); break; } } } if (buf != nullptr) { DataBufferSP buffer_sp; buffer_sp = std::make_shared<DataBufferHeap>(buf, byte_size); data.SetByteOrder(GetDataByteOrder()); data.SetData(buffer_sp); return byte_size; } data.Clear(); return 0; }
Upload File
Create Folder