llvm/lldb/source/API/SBInstruction.cpp

//===-- SBInstruction.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/API/SBInstruction.h"
#include "lldb/Utility/Instrumentation.h"

#include "lldb/API/SBAddress.h"
#include "lldb/API/SBFrame.h"
#include "lldb/API/SBFile.h"

#include "lldb/API/SBInstruction.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBTarget.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/EmulateInstruction.h"
#include "lldb/Core/Module.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/StreamFile.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"

#include <memory>

// We recently fixed a leak in one of the Instruction subclasses where the
// instruction will only hold a weak reference to the disassembler to avoid a
// cycle that was keeping both objects alive (leak) and we need the
// InstructionImpl class to make sure our public API behaves as users would
// expect. Calls in our public API allow clients to do things like:
//
// 1  lldb::SBInstruction inst;
// 2  inst = target.ReadInstructions(pc, 1).GetInstructionAtIndex(0)
// 3  if (inst.DoesBranch())
// 4  ...
//
// There was a temporary lldb::DisassemblerSP object created in the
// SBInstructionList that was returned by lldb.target.ReadInstructions() that
// will go away after line 2 but the "inst" object should be able to still
// answer questions about itself. So we make sure that any SBInstruction
// objects that are given out have a strong reference to the disassembler and
// the instruction so that the object can live and successfully respond to all
// queries.
class InstructionImpl {};

usingnamespacelldb;
usingnamespacelldb_private;

SBInstruction::SBInstruction() {}

SBInstruction::SBInstruction(const lldb::DisassemblerSP &disasm_sp,
                             const lldb::InstructionSP &inst_sp)
    :{}

SBInstruction::SBInstruction(const SBInstruction &rhs)
    :{}

const SBInstruction &SBInstruction::operator=(const SBInstruction &rhs) {}

SBInstruction::~SBInstruction() = default;

bool SBInstruction::IsValid() {}
operator bool()

SBAddress SBInstruction::GetAddress() {}

const char *SBInstruction::GetMnemonic(SBTarget target) {}

const char *SBInstruction::GetOperands(SBTarget target) {}

const char *SBInstruction::GetComment(SBTarget target) {}

lldb::InstructionControlFlowKind SBInstruction::GetControlFlowKind(lldb::SBTarget target) {}

size_t SBInstruction::GetByteSize() {}

SBData SBInstruction::GetData(SBTarget target) {}

bool SBInstruction::DoesBranch() {}

bool SBInstruction::HasDelaySlot() {}

bool SBInstruction::CanSetBreakpoint() {}

lldb::InstructionSP SBInstruction::GetOpaque() {}

void SBInstruction::SetOpaque(const lldb::DisassemblerSP &disasm_sp,
                              const lldb::InstructionSP &inst_sp) {}

bool SBInstruction::GetDescription(lldb::SBStream &s) {}

void SBInstruction::Print(FILE *outp) {}

void SBInstruction::Print(SBFile out) {}

void SBInstruction::Print(FileSP out_sp) {}

bool SBInstruction::EmulateWithFrame(lldb::SBFrame &frame,
                                     uint32_t evaluate_options) {}

bool SBInstruction::DumpEmulation(const char *triple) {}

bool SBInstruction::TestEmulation(lldb::SBStream &output_stream,
                                  const char *test_file) {}