threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example).
Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.
We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:
(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000)
(lldb) target list
Current targets:
target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
frame #1: 0x0000000100000b64 a.out`start + 52
Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.
llvm-svn: 129695
111 lines
2.8 KiB
C++
111 lines
2.8 KiB
C++
//===-- DisassemblerLLVM.h --------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef liblldb_DisassemblerLLVM_h_
|
|
#define liblldb_DisassemblerLLVM_h_
|
|
|
|
|
|
#include "llvm-c/EnhancedDisassembly.h"
|
|
|
|
#include "lldb/Core/Disassembler.h"
|
|
#include "lldb/Host/Mutex.h"
|
|
|
|
class InstructionLLVM : public lldb_private::Instruction
|
|
{
|
|
public:
|
|
InstructionLLVM (const lldb_private::Address &addr,
|
|
lldb_private::AddressClass addr_class,
|
|
EDDisassemblerRef disassembler,
|
|
bool force_raw);
|
|
|
|
virtual
|
|
~InstructionLLVM();
|
|
|
|
virtual void
|
|
Dump (lldb_private::Stream *s,
|
|
uint32_t max_opcode_byte_size,
|
|
bool show_address,
|
|
bool show_bytes,
|
|
const lldb_private::ExecutionContext* exe_ctx,
|
|
bool raw);
|
|
|
|
virtual bool
|
|
DoesBranch () const;
|
|
|
|
virtual size_t
|
|
Decode (const lldb_private::Disassembler &disassembler,
|
|
const lldb_private::DataExtractor &data,
|
|
uint32_t data_offset);
|
|
|
|
protected:
|
|
EDDisassemblerRef m_disassembler;
|
|
EDInstRef m_inst;
|
|
bool m_force_raw;
|
|
};
|
|
|
|
|
|
class DisassemblerLLVM : public lldb_private::Disassembler
|
|
{
|
|
public:
|
|
//------------------------------------------------------------------
|
|
// Static Functions
|
|
//------------------------------------------------------------------
|
|
static void
|
|
Initialize();
|
|
|
|
static void
|
|
Terminate();
|
|
|
|
static const char *
|
|
GetPluginNameStatic();
|
|
|
|
static const char *
|
|
GetPluginDescriptionStatic();
|
|
|
|
static lldb_private::Disassembler *
|
|
CreateInstance(const lldb_private::ArchSpec &arch);
|
|
|
|
|
|
DisassemblerLLVM(const lldb_private::ArchSpec &arch);
|
|
|
|
virtual
|
|
~DisassemblerLLVM();
|
|
|
|
size_t
|
|
DecodeInstructions (const lldb_private::Address &base_addr,
|
|
const lldb_private::DataExtractor& data,
|
|
uint32_t data_offset,
|
|
uint32_t num_instructions,
|
|
bool append);
|
|
|
|
//------------------------------------------------------------------
|
|
// PluginInterface protocol
|
|
//------------------------------------------------------------------
|
|
virtual const char *
|
|
GetPluginName();
|
|
|
|
virtual const char *
|
|
GetShortPluginName();
|
|
|
|
virtual uint32_t
|
|
GetPluginVersion();
|
|
|
|
protected:
|
|
bool
|
|
IsValid() const
|
|
{
|
|
return m_disassembler != NULL;
|
|
}
|
|
|
|
EDDisassemblerRef m_disassembler;
|
|
EDDisassemblerRef m_disassembler_thumb;
|
|
};
|
|
|
|
#endif // liblldb_DisassemblerLLVM_h_
|