2010-11-12 03:26:09 +08:00
|
|
|
//===-- ThreadPlan.cpp ------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Target/ThreadPlan.h"
|
|
|
|
|
|
|
|
// C Includes
|
2010-11-12 11:22:21 +08:00
|
|
|
#include <string.h>
|
2010-11-12 03:26:09 +08:00
|
|
|
// C++ Includes
|
|
|
|
// Other libraries and framework includes
|
|
|
|
// Project includes
|
2010-11-12 11:22:21 +08:00
|
|
|
#include "lldb/Core/ArchSpec.h"
|
|
|
|
#include "lldb/Core/DataBufferHeap.h"
|
2010-11-12 03:26:09 +08:00
|
|
|
#include "lldb/Core/Debugger.h"
|
2010-11-12 11:22:21 +08:00
|
|
|
#include "lldb/Core/Disassembler.h"
|
2010-11-12 03:26:09 +08:00
|
|
|
#include "lldb/Core/Log.h"
|
|
|
|
#include "lldb/Core/State.h"
|
2010-11-12 11:22:21 +08:00
|
|
|
#include "lldb/Core/Value.h"
|
|
|
|
#include "lldb/Symbol/TypeList.h"
|
2010-11-12 03:26:09 +08:00
|
|
|
#include "lldb/Target/RegisterContext.h"
|
|
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
#include "lldb/Target/Target.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2010-11-12 11:22:21 +08:00
|
|
|
#pragma mark ThreadPlanTracer
|
|
|
|
|
2010-11-12 03:26:09 +08:00
|
|
|
ThreadPlanTracer::ThreadPlanTracer (Thread &thread, lldb::StreamSP &stream_sp) :
|
2011-04-12 03:41:40 +08:00
|
|
|
m_thread (thread),
|
2010-11-12 03:26:09 +08:00
|
|
|
m_single_step(true),
|
|
|
|
m_enabled (false),
|
|
|
|
m_stream_sp (stream_sp)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ThreadPlanTracer::ThreadPlanTracer (Thread &thread) :
|
2011-04-12 03:41:40 +08:00
|
|
|
m_thread (thread),
|
2010-11-12 03:26:09 +08:00
|
|
|
m_single_step(true),
|
|
|
|
m_enabled (false),
|
|
|
|
m_stream_sp ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Stream *
|
|
|
|
ThreadPlanTracer::GetLogStream ()
|
|
|
|
{
|
|
|
|
|
|
|
|
if (m_stream_sp.get())
|
|
|
|
return m_stream_sp.get();
|
|
|
|
else
|
|
|
|
return &(m_thread.GetProcess().GetTarget().GetDebugger().GetOutputStream());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ThreadPlanTracer::Log()
|
|
|
|
{
|
|
|
|
SymbolContext sc;
|
|
|
|
bool show_frame_index = false;
|
|
|
|
bool show_fullpaths = false;
|
|
|
|
|
|
|
|
m_thread.GetStackFrameAtIndex(0)->Dump (GetLogStream(), show_frame_index, show_fullpaths);
|
|
|
|
GetLogStream()->Printf("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ThreadPlanTracer::TracerExplainsStop ()
|
|
|
|
{
|
|
|
|
if (m_enabled && m_single_step)
|
|
|
|
{
|
|
|
|
lldb::StopInfoSP stop_info = m_thread.GetStopInfo();
|
|
|
|
if (stop_info->GetStopReason() == eStopReasonTrace)
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
2010-11-12 11:22:21 +08:00
|
|
|
|
|
|
|
#pragma mark ThreadPlanAssemblyTracer
|
|
|
|
|
|
|
|
ThreadPlanAssemblyTracer::ThreadPlanAssemblyTracer (Thread &thread, lldb::StreamSP &stream_sp) :
|
|
|
|
ThreadPlanTracer (thread, stream_sp),
|
|
|
|
m_process(thread.GetProcess()),
|
|
|
|
m_target(thread.GetProcess().GetTarget())
|
|
|
|
{
|
2010-11-18 04:19:50 +08:00
|
|
|
InitializeTracer ();
|
|
|
|
}
|
|
|
|
|
|
|
|
ThreadPlanAssemblyTracer::ThreadPlanAssemblyTracer (Thread &thread) :
|
|
|
|
ThreadPlanTracer (thread),
|
|
|
|
m_process(thread.GetProcess()),
|
|
|
|
m_target(thread.GetProcess().GetTarget())
|
|
|
|
{
|
|
|
|
InitializeTracer ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ThreadPlanAssemblyTracer::InitializeTracer()
|
|
|
|
{
|
|
|
|
Process &process = m_thread.GetProcess();
|
2010-11-12 11:22:21 +08:00
|
|
|
Target &target = process.GetTarget();
|
|
|
|
|
|
|
|
ArchSpec arch(target.GetArchitecture());
|
|
|
|
|
2011-03-26 02:03:16 +08:00
|
|
|
m_disassembler = Disassembler::FindPlugin(arch, NULL);
|
2010-11-12 11:22:21 +08:00
|
|
|
|
2011-05-12 02:39:18 +08:00
|
|
|
m_abi = process.GetABI().get();
|
2010-11-12 11:22:21 +08:00
|
|
|
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
ModuleSP exe_module_sp (target.GetExecutableModule());
|
2010-11-12 11:22:21 +08:00
|
|
|
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
if (exe_module_sp)
|
2010-11-12 11:22:21 +08:00
|
|
|
{
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
m_intptr_type = TypeFromUser(exe_module_sp->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, arch.GetAddressByteSize() * 8),
|
|
|
|
exe_module_sp->GetClangASTContext().getASTContext());
|
2010-11-12 11:22:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const unsigned int buf_size = 32;
|
|
|
|
|
|
|
|
m_buffer_sp.reset(new DataBufferHeap(buf_size, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
ThreadPlanAssemblyTracer::~ThreadPlanAssemblyTracer()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-07 06:15:06 +08:00
|
|
|
void
|
|
|
|
ThreadPlanAssemblyTracer::TracingStarted ()
|
2010-11-12 11:22:21 +08:00
|
|
|
{
|
2011-01-07 06:15:06 +08:00
|
|
|
RegisterContext *reg_ctx = m_thread.GetRegisterContext().get();
|
2010-11-12 11:22:21 +08:00
|
|
|
|
|
|
|
if (m_register_values.size() == 0)
|
2011-05-18 09:58:14 +08:00
|
|
|
m_register_values.resize (reg_ctx->GetRegisterCount());
|
2010-11-12 11:22:21 +08:00
|
|
|
}
|
|
|
|
|
2011-01-07 06:15:06 +08:00
|
|
|
void
|
|
|
|
ThreadPlanAssemblyTracer::TracingEnded ()
|
2010-11-12 11:22:21 +08:00
|
|
|
{
|
2011-05-18 09:58:14 +08:00
|
|
|
m_register_values.clear();
|
2010-11-12 11:22:21 +08:00
|
|
|
}
|
|
|
|
|
2011-01-07 06:15:06 +08:00
|
|
|
static void
|
|
|
|
PadOutTo (StreamString &stream, int target)
|
2010-11-12 11:22:21 +08:00
|
|
|
{
|
|
|
|
stream.Flush();
|
|
|
|
|
|
|
|
int length = stream.GetString().length();
|
|
|
|
|
|
|
|
if (length + 1 < target)
|
2011-01-07 06:15:06 +08:00
|
|
|
stream.Printf("%*s", target - (length + 1) + 1, "");
|
2010-11-12 11:22:21 +08:00
|
|
|
}
|
|
|
|
|
2011-01-07 06:15:06 +08:00
|
|
|
void
|
|
|
|
ThreadPlanAssemblyTracer::Log ()
|
2010-11-12 11:22:21 +08:00
|
|
|
{
|
|
|
|
Stream *stream = GetLogStream ();
|
|
|
|
|
|
|
|
if (!stream)
|
|
|
|
return;
|
|
|
|
|
2011-01-07 06:15:06 +08:00
|
|
|
RegisterContext *reg_ctx = m_thread.GetRegisterContext().get();
|
2010-11-12 11:22:21 +08:00
|
|
|
|
|
|
|
lldb::addr_t pc = reg_ctx->GetPC();
|
|
|
|
Address pc_addr;
|
|
|
|
bool addr_valid = false;
|
2011-05-18 09:58:14 +08:00
|
|
|
|
2010-11-12 11:22:21 +08:00
|
|
|
addr_valid = m_process.GetTarget().GetSectionLoadList().ResolveLoadAddress (pc, pc_addr);
|
|
|
|
|
2011-05-18 09:58:14 +08:00
|
|
|
pc_addr.Dump(stream, &m_thread, Address::DumpStyleResolvedDescription, Address::DumpStyleModuleWithFileAddress);
|
2010-11-12 11:22:21 +08:00
|
|
|
|
|
|
|
if (m_disassembler)
|
|
|
|
{
|
2011-02-05 05:13:05 +08:00
|
|
|
::memset(m_buffer_sp->GetBytes(), 0, m_buffer_sp->GetByteSize());
|
2010-11-12 11:22:21 +08:00
|
|
|
|
|
|
|
Error err;
|
|
|
|
m_process.ReadMemory(pc, m_buffer_sp->GetBytes(), m_buffer_sp->GetByteSize(), err);
|
|
|
|
|
|
|
|
if (err.Success())
|
|
|
|
{
|
|
|
|
DataExtractor extractor(m_buffer_sp,
|
|
|
|
m_process.GetByteOrder(),
|
|
|
|
m_process.GetAddressByteSize());
|
|
|
|
|
|
|
|
if (addr_valid)
|
2011-03-22 09:48:42 +08:00
|
|
|
m_disassembler->DecodeInstructions (pc_addr, extractor, 0, 1, false);
|
2010-11-12 11:22:21 +08:00
|
|
|
else
|
2011-03-22 09:48:42 +08:00
|
|
|
m_disassembler->DecodeInstructions (Address (NULL, pc), extractor, 0, 1, false);
|
2010-11-12 11:22:21 +08:00
|
|
|
|
|
|
|
InstructionList &instruction_list = m_disassembler->GetInstructionList();
|
Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:
uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;
uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;
Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than
once.
Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.
Changed:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc);
To:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.
Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").
Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump
them and show the opcode bytes, we can format the output more
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.
Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported
architecture. I also added the ability to specify "thumb" as an
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:
(lldb) disassemble --arch thumb --name main
You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080: 0xb580 push {r7, lr}
0x100001082: 0xaf00 add r7, sp, #0
Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.
llvm-svn: 128347
2011-03-27 03:14:58 +08:00
|
|
|
const uint32_t max_opcode_byte_size = instruction_list.GetMaxOpcocdeByteSize();
|
|
|
|
|
2010-11-12 11:22:21 +08:00
|
|
|
if (instruction_list.GetSize())
|
|
|
|
{
|
2011-05-18 09:58:14 +08:00
|
|
|
const bool show_bytes = true;
|
|
|
|
const bool show_address = true;
|
2010-11-12 11:22:21 +08:00
|
|
|
Instruction *instruction = instruction_list.GetInstructionAtIndex(0).get();
|
2011-05-18 09:58:14 +08:00
|
|
|
instruction->Dump (stream,
|
Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:
uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;
uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;
Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than
once.
Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.
Changed:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc);
To:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.
Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").
Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump
them and show the opcode bytes, we can format the output more
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.
Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported
architecture. I also added the ability to specify "thumb" as an
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:
(lldb) disassemble --arch thumb --name main
You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080: 0xb580 push {r7, lr}
0x100001082: 0xaf00 add r7, sp, #0
Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.
llvm-svn: 128347
2011-03-27 03:14:58 +08:00
|
|
|
max_opcode_byte_size,
|
2011-05-18 09:58:14 +08:00
|
|
|
show_address,
|
|
|
|
show_bytes,
|
2010-11-12 11:22:21 +08:00
|
|
|
NULL,
|
|
|
|
true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_abi && m_intptr_type.GetOpaqueQualType())
|
|
|
|
{
|
|
|
|
ValueList value_list;
|
|
|
|
const int num_args = 1;
|
|
|
|
|
|
|
|
for (int arg_index = 0; arg_index < num_args; ++arg_index)
|
|
|
|
{
|
|
|
|
Value value;
|
|
|
|
value.SetValueType (Value::eValueTypeScalar);
|
2010-11-13 11:52:47 +08:00
|
|
|
value.SetContext (Value::eContextTypeClangType, m_intptr_type.GetOpaqueQualType());
|
2010-11-12 11:22:21 +08:00
|
|
|
value_list.PushValue (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_abi->GetArgumentValues (m_thread, value_list))
|
|
|
|
{
|
|
|
|
for (int arg_index = 0; arg_index < num_args; ++arg_index)
|
|
|
|
{
|
2011-05-18 09:58:14 +08:00
|
|
|
stream->Printf("\n\targ[%d]=%llx", arg_index, value_list.GetValueAtIndex(arg_index)->GetScalar().ULongLong());
|
2010-11-12 11:22:21 +08:00
|
|
|
|
|
|
|
if (arg_index + 1 < num_args)
|
2011-05-18 09:58:14 +08:00
|
|
|
stream->PutCString (", ");
|
2010-11-12 11:22:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-18 09:58:14 +08:00
|
|
|
RegisterValue reg_value;
|
|
|
|
for (uint32_t reg_num = 0, num_registers = reg_ctx->GetRegisterCount();
|
|
|
|
reg_num < num_registers;
|
|
|
|
++reg_num)
|
2010-11-12 11:22:21 +08:00
|
|
|
{
|
2011-05-18 09:58:14 +08:00
|
|
|
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex(reg_num);
|
|
|
|
if (reg_ctx->ReadRegister (reg_info, reg_value))
|
2010-11-12 11:22:21 +08:00
|
|
|
{
|
2011-05-18 09:58:14 +08:00
|
|
|
assert (reg_num < m_register_values.size());
|
|
|
|
if (m_register_values[reg_num].GetType() == RegisterValue::eTypeInvalid ||
|
|
|
|
reg_value != m_register_values[reg_num])
|
|
|
|
{
|
|
|
|
if (reg_value.GetType() != RegisterValue::eTypeInvalid)
|
|
|
|
{
|
|
|
|
stream->PutCString ("\n\t");
|
|
|
|
reg_value.Dump(stream, reg_info, true, false, eFormatDefault);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_register_values[reg_num] = reg_value;
|
2010-11-12 11:22:21 +08:00
|
|
|
}
|
|
|
|
}
|
2011-05-18 09:58:14 +08:00
|
|
|
stream->EOL();
|
2010-11-12 11:22:21 +08:00
|
|
|
}
|