124943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner//===-- SBInstruction.cpp ---------------------------------------*- C++ -*-===//
224943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner//
324943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner//                     The LLVM Compiler Infrastructure
424943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner//
524943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner// This file is distributed under the University of Illinois Open Source
624943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner// License. See LICENSE.TXT for details.
724943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner//
824943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner//===----------------------------------------------------------------------===//
924943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner
1024943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner#include "lldb/API/SBInstruction.h"
1124943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner
125c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton#include "lldb/API/SBAddress.h"
13af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice#include "lldb/API/SBFrame.h"
145c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton#include "lldb/API/SBInstruction.h"
155c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton#include "lldb/API/SBStream.h"
16af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice#include "lldb/API/SBTarget.h"
175c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton
18af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice#include "lldb/Core/ArchSpec.h"
1923b8abbe214c252028f6e09f79169529c846409dGreg Clayton#include "lldb/Core/DataBufferHeap.h"
2049ce8969d3154e1560106cfe530444c09410f217Greg Clayton#include "lldb/Core/DataExtractor.h"
2124943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner#include "lldb/Core/Disassembler.h"
22af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice#include "lldb/Core/EmulateInstruction.h"
235c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton#include "lldb/Core/StreamFile.h"
24af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice#include "lldb/Target/ExecutionContext.h"
25af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice#include "lldb/Target/StackFrame.h"
26af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice#include "lldb/Target/Target.h"
2724943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner
2824943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattnerusing namespace lldb;
2924943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattnerusing namespace lldb_private;
3024943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner
3124943d2ee8bfaa7cf5893e4709143924157a5c1eChris LattnerSBInstruction::SBInstruction ()
3224943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner{
3324943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner}
3424943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner
355c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg ClaytonSBInstruction::SBInstruction (const lldb::InstructionSP& inst_sp) :
365c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    m_opaque_sp (inst_sp)
375c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton{
385c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton}
395c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton
40538eb82a89a68dbc57251915080bd5152b333978Greg ClaytonSBInstruction::SBInstruction(const SBInstruction &rhs) :
41538eb82a89a68dbc57251915080bd5152b333978Greg Clayton    m_opaque_sp (rhs.m_opaque_sp)
42538eb82a89a68dbc57251915080bd5152b333978Greg Clayton{
43538eb82a89a68dbc57251915080bd5152b333978Greg Clayton}
44538eb82a89a68dbc57251915080bd5152b333978Greg Clayton
45538eb82a89a68dbc57251915080bd5152b333978Greg Claytonconst SBInstruction &
46538eb82a89a68dbc57251915080bd5152b333978Greg ClaytonSBInstruction::operator = (const SBInstruction &rhs)
47538eb82a89a68dbc57251915080bd5152b333978Greg Clayton{
48538eb82a89a68dbc57251915080bd5152b333978Greg Clayton    if (this != &rhs)
49538eb82a89a68dbc57251915080bd5152b333978Greg Clayton        m_opaque_sp = rhs.m_opaque_sp;
50538eb82a89a68dbc57251915080bd5152b333978Greg Clayton    return *this;
51538eb82a89a68dbc57251915080bd5152b333978Greg Clayton}
52538eb82a89a68dbc57251915080bd5152b333978Greg Clayton
5324943d2ee8bfaa7cf5893e4709143924157a5c1eChris LattnerSBInstruction::~SBInstruction ()
5424943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner{
5524943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner}
5624943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner
575c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Claytonbool
585c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg ClaytonSBInstruction::IsValid()
595c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton{
605c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    return (m_opaque_sp.get() != NULL);
615c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton}
625c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton
635c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg ClaytonSBAddress
645c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg ClaytonSBInstruction::GetAddress()
655c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton{
665c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    SBAddress sb_addr;
675c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    if (m_opaque_sp && m_opaque_sp->GetAddress().IsValid())
685c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton        sb_addr.SetAddress(&m_opaque_sp->GetAddress());
695c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    return sb_addr;
705c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton}
715c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton
7223b8abbe214c252028f6e09f79169529c846409dGreg Claytonconst char *
73d9b4425303fd48210ab104ca6573c869083a8480Greg ClaytonSBInstruction::GetMnemonic(SBTarget target)
7423b8abbe214c252028f6e09f79169529c846409dGreg Clayton{
7523b8abbe214c252028f6e09f79169529c846409dGreg Clayton    if (m_opaque_sp)
7623b8abbe214c252028f6e09f79169529c846409dGreg Clayton    {
7723b8abbe214c252028f6e09f79169529c846409dGreg Clayton        Mutex::Locker api_locker;
7823b8abbe214c252028f6e09f79169529c846409dGreg Clayton        ExecutionContext exe_ctx;
79334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton        TargetSP target_sp (target.GetSP());
80334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton        if (target_sp)
8123b8abbe214c252028f6e09f79169529c846409dGreg Clayton        {
821b584ebc1de8b50fe375cffb5fb33ad13be10046Jim Ingham            api_locker.Lock (target_sp->GetAPIMutex());
83334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton            target_sp->CalculateExecutionContext (exe_ctx);
84334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton            exe_ctx.SetProcessSP(target_sp->GetProcessSP());
8523b8abbe214c252028f6e09f79169529c846409dGreg Clayton        }
860fef968c843be422d6facc2e8d54d8471eee88edGreg Clayton        return m_opaque_sp->GetMnemonic(&exe_ctx);
8723b8abbe214c252028f6e09f79169529c846409dGreg Clayton    }
8823b8abbe214c252028f6e09f79169529c846409dGreg Clayton    return NULL;
8923b8abbe214c252028f6e09f79169529c846409dGreg Clayton}
9023b8abbe214c252028f6e09f79169529c846409dGreg Clayton
9123b8abbe214c252028f6e09f79169529c846409dGreg Claytonconst char *
92d9b4425303fd48210ab104ca6573c869083a8480Greg ClaytonSBInstruction::GetOperands(SBTarget target)
9323b8abbe214c252028f6e09f79169529c846409dGreg Clayton{
9423b8abbe214c252028f6e09f79169529c846409dGreg Clayton    if (m_opaque_sp)
9523b8abbe214c252028f6e09f79169529c846409dGreg Clayton    {
9623b8abbe214c252028f6e09f79169529c846409dGreg Clayton        Mutex::Locker api_locker;
9723b8abbe214c252028f6e09f79169529c846409dGreg Clayton        ExecutionContext exe_ctx;
98334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton        TargetSP target_sp (target.GetSP());
99334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton        if (target_sp)
10023b8abbe214c252028f6e09f79169529c846409dGreg Clayton        {
1011b584ebc1de8b50fe375cffb5fb33ad13be10046Jim Ingham            api_locker.Lock (target_sp->GetAPIMutex());
102334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton            target_sp->CalculateExecutionContext (exe_ctx);
103334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton            exe_ctx.SetProcessSP(target_sp->GetProcessSP());
10423b8abbe214c252028f6e09f79169529c846409dGreg Clayton        }
1050fef968c843be422d6facc2e8d54d8471eee88edGreg Clayton        return m_opaque_sp->GetOperands(&exe_ctx);
10623b8abbe214c252028f6e09f79169529c846409dGreg Clayton    }
10723b8abbe214c252028f6e09f79169529c846409dGreg Clayton    return NULL;
10823b8abbe214c252028f6e09f79169529c846409dGreg Clayton}
10923b8abbe214c252028f6e09f79169529c846409dGreg Clayton
11023b8abbe214c252028f6e09f79169529c846409dGreg Claytonconst char *
11123b8abbe214c252028f6e09f79169529c846409dGreg ClaytonSBInstruction::GetComment(SBTarget target)
11223b8abbe214c252028f6e09f79169529c846409dGreg Clayton{
11323b8abbe214c252028f6e09f79169529c846409dGreg Clayton    if (m_opaque_sp)
11423b8abbe214c252028f6e09f79169529c846409dGreg Clayton    {
11523b8abbe214c252028f6e09f79169529c846409dGreg Clayton        Mutex::Locker api_locker;
11623b8abbe214c252028f6e09f79169529c846409dGreg Clayton        ExecutionContext exe_ctx;
117334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton        TargetSP target_sp (target.GetSP());
118334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton        if (target_sp)
11923b8abbe214c252028f6e09f79169529c846409dGreg Clayton        {
1201b584ebc1de8b50fe375cffb5fb33ad13be10046Jim Ingham            api_locker.Lock (target_sp->GetAPIMutex());
121334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton            target_sp->CalculateExecutionContext (exe_ctx);
122334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton            exe_ctx.SetProcessSP(target_sp->GetProcessSP());
12323b8abbe214c252028f6e09f79169529c846409dGreg Clayton        }
1240fef968c843be422d6facc2e8d54d8471eee88edGreg Clayton        return m_opaque_sp->GetComment(&exe_ctx);
12523b8abbe214c252028f6e09f79169529c846409dGreg Clayton    }
12623b8abbe214c252028f6e09f79169529c846409dGreg Clayton    return NULL;
12723b8abbe214c252028f6e09f79169529c846409dGreg Clayton}
12823b8abbe214c252028f6e09f79169529c846409dGreg Clayton
1295c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Claytonsize_t
1305c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg ClaytonSBInstruction::GetByteSize ()
1315c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton{
1325c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    if (m_opaque_sp)
133149731c0b267e5b6cd7192cbfac0c7f457ae5cfcGreg Clayton        return m_opaque_sp->GetOpcode().GetByteSize();
1345c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    return 0;
1355c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton}
13624943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner
13723b8abbe214c252028f6e09f79169529c846409dGreg ClaytonSBData
13823b8abbe214c252028f6e09f79169529c846409dGreg ClaytonSBInstruction::GetData (SBTarget target)
13923b8abbe214c252028f6e09f79169529c846409dGreg Clayton{
14023b8abbe214c252028f6e09f79169529c846409dGreg Clayton    lldb::SBData sb_data;
14123b8abbe214c252028f6e09f79169529c846409dGreg Clayton    if (m_opaque_sp)
14223b8abbe214c252028f6e09f79169529c846409dGreg Clayton    {
14350561699a9a14c716d1099ae1d38be2f31534b67Greg Clayton        DataExtractorSP data_extractor_sp (new DataExtractor());
1440fef968c843be422d6facc2e8d54d8471eee88edGreg Clayton        if (m_opaque_sp->GetData (*data_extractor_sp))
14523b8abbe214c252028f6e09f79169529c846409dGreg Clayton        {
14623b8abbe214c252028f6e09f79169529c846409dGreg Clayton            sb_data.SetOpaque (data_extractor_sp);
14723b8abbe214c252028f6e09f79169529c846409dGreg Clayton        }
14823b8abbe214c252028f6e09f79169529c846409dGreg Clayton    }
14923b8abbe214c252028f6e09f79169529c846409dGreg Clayton    return sb_data;
15023b8abbe214c252028f6e09f79169529c846409dGreg Clayton}
15123b8abbe214c252028f6e09f79169529c846409dGreg Clayton
15223b8abbe214c252028f6e09f79169529c846409dGreg Clayton
15323b8abbe214c252028f6e09f79169529c846409dGreg Clayton
1545c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Claytonbool
1555c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg ClaytonSBInstruction::DoesBranch ()
1565c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton{
1575c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    if (m_opaque_sp)
1585c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton        return m_opaque_sp->DoesBranch ();
1595c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    return false;
1605c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton}
16124943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner
1625c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Claytonvoid
1635c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg ClaytonSBInstruction::SetOpaque (const lldb::InstructionSP &inst_sp)
1645c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton{
1655c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    m_opaque_sp = inst_sp;
1665c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton}
16724943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner
1685c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Claytonbool
1695c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg ClaytonSBInstruction::GetDescription (lldb::SBStream &s)
1705c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton{
1715c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    if (m_opaque_sp)
1725c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    {
1735c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton        // Use the "ref()" instead of the "get()" accessor in case the SBStream
1745c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton        // didn't have a stream already created, one will get created...
1750fef968c843be422d6facc2e8d54d8471eee88edGreg Clayton        m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL);
1765c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton        return true;
1775c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    }
1785c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    return false;
1795c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton}
18024943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner
18124943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattnervoid
18224943d2ee8bfaa7cf5893e4709143924157a5c1eChris LattnerSBInstruction::Print (FILE *out)
18324943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner{
18424943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner    if (out == NULL)
18524943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner        return;
18624943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner
1875c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    if (m_opaque_sp)
1885c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    {
1895892856b0cd6591194c669afab5bf9ac19c5b3a0Greg Clayton        StreamFile out_stream (out, false);
1900fef968c843be422d6facc2e8d54d8471eee88edGreg Clayton        m_opaque_sp->Dump (&out_stream, 0, true, false, NULL);
1915c4c746a3a83c1aad411c6cdc5f9525a4fc2d17eGreg Clayton    }
19224943d2ee8bfaa7cf5893e4709143924157a5c1eChris Lattner}
193af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice
194af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Ticebool
195888a7334344778d1a4edbd58b5852ae4d53ffed9Greg ClaytonSBInstruction::EmulateWithFrame (lldb::SBFrame &frame, uint32_t evaluate_options)
196af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice{
197334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton    if (m_opaque_sp)
198af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice    {
199334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton        lldb::StackFrameSP frame_sp (frame.GetFrameSP());
200334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton
201334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton        if (frame_sp)
202334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton        {
203334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton            lldb_private::ExecutionContext exe_ctx;
204334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton            frame_sp->CalculateExecutionContext (exe_ctx);
205334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton            lldb_private::Target *target = exe_ctx.GetTargetPtr();
206334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton            lldb_private::ArchSpec arch = target->GetArchitecture();
207334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton
208334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton            return m_opaque_sp->Emulate (arch,
209334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton                                         evaluate_options,
210334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton                                         (void *) frame_sp.get(),
211334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton                                         &lldb_private::EmulateInstruction::ReadMemoryFrame,
212334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton                                         &lldb_private::EmulateInstruction::WriteMemoryFrame,
213334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton                                         &lldb_private::EmulateInstruction::ReadRegisterFrame,
214334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton                                         &lldb_private::EmulateInstruction::WriteRegisterFrame);
215334d33a19fd28cf41cba74cc61cf149e7101a603Greg Clayton        }
216af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice    }
217af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice    return false;
218af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice}
219af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice
220af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Ticebool
221af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline TiceSBInstruction::DumpEmulation (const char *triple)
222af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice{
223af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice    if (m_opaque_sp && triple)
224af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice    {
225f15996eea072cdaa8a092f22d3a1212b3d95f0ecGreg Clayton        lldb_private::ArchSpec arch (triple, NULL);
226af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice
2270fe5a535b87841a5c422f4a79d55c21bf07b50caCaroline Tice        return m_opaque_sp->DumpEmulation (arch);
2280fe5a535b87841a5c422f4a79d55c21bf07b50caCaroline Tice
229af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice    }
230af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice    return false;
231af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice}
232af59180d46b42665dba3ea581fc501bb9fcb1fb7Caroline Tice
2336b8d3b5e7f0507aca2ee1c0937d7ec80fa2a9c5bCaroline Ticebool
2346b8d3b5e7f0507aca2ee1c0937d7ec80fa2a9c5bCaroline TiceSBInstruction::TestEmulation (lldb::SBStream &output_stream,  const char *test_file)
2356b8d3b5e7f0507aca2ee1c0937d7ec80fa2a9c5bCaroline Tice{
2366b8d3b5e7f0507aca2ee1c0937d7ec80fa2a9c5bCaroline Tice    if (!m_opaque_sp.get())
2376b8d3b5e7f0507aca2ee1c0937d7ec80fa2a9c5bCaroline Tice        m_opaque_sp.reset (new PseudoInstruction());
2386b8d3b5e7f0507aca2ee1c0937d7ec80fa2a9c5bCaroline Tice
23909008d035b798ccae9fc5208567aaf4a01a28b23Johnny Chen    return m_opaque_sp->TestEmulation (output_stream.get(), test_file);
24009008d035b798ccae9fc5208567aaf4a01a28b23Johnny Chen}
2417fb143064009e34dbb7a602924e9807375f72a46Greg Clayton
2427fb143064009e34dbb7a602924e9807375f72a46Greg Claytonlldb::AddressClass
2437fb143064009e34dbb7a602924e9807375f72a46Greg ClaytonSBInstruction::GetAddressClass ()
2447fb143064009e34dbb7a602924e9807375f72a46Greg Clayton{
2457fb143064009e34dbb7a602924e9807375f72a46Greg Clayton    if (m_opaque_sp.get())
2467fb143064009e34dbb7a602924e9807375f72a46Greg Clayton        return m_opaque_sp->GetAddressClass();
2477fb143064009e34dbb7a602924e9807375f72a46Greg Clayton    return eAddressClassInvalid;
2487fb143064009e34dbb7a602924e9807375f72a46Greg Clayton}
249