Commit Graph

909 Commits

Author SHA1 Message Date
Greg Clayton 1d4313b261 Stop the lldb_private::RegularExpression class from implicitly
constructing itself and causing unexpected things to happen
in LLDB.

llvm-svn: 134598
2011-07-07 04:49:07 +00:00
Greg Clayton 644247c1dc Added "target variable" command that allows introspection of global
variables prior to running your binary. Zero filled sections now get
section data correctly filled with zeroes when Target::ReadMemory
reads from the object file section data.

Added new option groups and option values for file lists. I still need
to hook up all of the options to "target variable" to allow more complete
introspection by file and shlib.

Added the ability for ValueObjectVariable objects to be created with
only the target as the execution context. This allows them to be read
from the object files through Target::ReadMemory(...). 

Added a "virtual Module * GetModule()" function to the ValueObject
class. By default it will look to the parent variable object and
return its module. The module is needed when we have global variables
that have file addresses (virtual addresses that are specific to
module object files) and in turn allows global variables to be displayed
prior to running.

Removed all of the unused proxy object support that bit rotted in 
lldb_private::Value.

Replaced a lot of places that used "FileSpec::Compare (lhs, rhs) == 0" code
with the more efficient "FileSpec::Equal (lhs, rhs)".

Improved logging in GDB remote plug-in.

llvm-svn: 134579
2011-07-07 01:59:51 +00:00
Greg Clayton 34132754bd Fixed some issues with ARM backtraces by not processing any push/pop
instructions if they are conditional. Also fixed issues where the PC wasn't
getting bit zero stripped for ARM targets when a stack frame was thumb. We
now properly call through the GetOpcodeLoadAddress() functions to make sure
the addresses are properly stripped for any targets that may decorate up
their addresses.

We now don't pass the SIGSTOP signals along. We can revisit this soon, but
currently this was interfering with debugging some older ARM targets that
don't have vCont support in the GDB server.

llvm-svn: 134461
2011-07-06 04:07:21 +00:00
Greg Clayton 0c51ac3295 When we use the "fd://%u" for file descriptors, we need to detect if this is
a file or socket. We now make a getsockopt call to check if the fd is a socket.

Also, the previous logic in the GDB communication needs to watch for success
with an error so we can deal with EAGAIN and other normal "retry" error codes.

llvm-svn: 134359
2011-07-02 23:21:06 +00:00
Greg Clayton 197bacfffa Cleanup errors that come out of commands and make sure they all have newlines
_only_ in the resulting stream, not in the error objects (lldb_private::Error).
lldb_private::Error objects should always just have an error string with no 
terminating newline characters or periods.

Fixed an issue with GDB remote packet detection that could end up deadlocking
if a full packet wasn't received in one chunk. Also modified the packet 
checking function to properly toss one or more bytes when it detects bad
data. 

llvm-svn: 134357
2011-07-02 21:07:54 +00:00
Greg Clayton e305594277 Centralize all of the type name code so that we always strip the leading
"struct ", "class ", and "union " from the start of any type names that are
extracted from clang QualType objects. I had to fix test suite cases that
were expecting the struct/union/class prefix to be there.

llvm-svn: 134132
2011-06-30 02:28:26 +00:00
Greg Clayton a2721476e7 This commit adds broad architectural support for hierarchical
inspection of namespaces in the expression parser.

ClangExpressionDeclMap hitherto reported that namespaces had
been completely imported, even though the namespaces are
returned empty.  To deal with this situation, ClangASTSource
was recently extended with an API to complete incomplete type
definitions, and, for greater efficiency, to complete these
definitions partially, returning only those objects that have
a given name.

This commit supports these APIs on LLDB's side, and uses it
to provide information on types resident in namespaces.
Namespaces are now imported as they were -- that is to say,
empty -- but with minimal import mode on.  This means that
Clang will come back and request their contents by name as
needed.  We now respond with information on the contained
types; this will be followed soon by information on functions
and variables.

llvm-svn: 133852
2011-06-25 00:44:06 +00:00
Greg Clayton f58c269aa1 Removed an member variable "m_local_debugserver" that is no longer needed.
We now check with the platform to see if we are doing local or remote 
debugging and setup the stdio accordingly.

llvm-svn: 133835
2011-06-24 22:32:10 +00:00
Jim Ingham d555bacca3 Add support for looking up ivar offset from the ObjC runtime.
llvm-svn: 133831
2011-06-24 22:03:24 +00:00
Greg Clayton 0c74e78d63 Fixed SBTarget attach calls to properly deal with being connected to a remotely
connected process connection.

Also added support for more kinds of continue packet when multiple threads
need to continue where some want to continue with signals.

llvm-svn: 133785
2011-06-24 03:21:43 +00:00
Peter Collingbourne d155c0b451 Remove duplicate m_monitor field from LaunchArgs
Fixes segfault when launching process on Linux.

llvm-svn: 133484
2011-06-20 23:55:58 +00:00
Jim Ingham f72ce3a216 Use the dyld_mode, image_infos & image_infos_count passed into the shared library notification function
to update libraries rather than reading the whole all_imaage_infos structure every time we get notified.

llvm-svn: 133448
2011-06-20 17:32:44 +00:00
Greg Clayton 5cf21f5f06 Fixed a crasher where we were accessing a symbol with a bad index.
llvm-svn: 133377
2011-06-19 04:26:01 +00:00
Greg Clayton 5861d3e6f0 Make sure we have a valid object file before we try getting the symbol table
so we avoid crashing.

llvm-svn: 133376
2011-06-19 04:02:02 +00:00
Peter Collingbourne ba23ca085f Switch from USEC_PER_SEC/NSEC_PER_SEC/NSEC_PER_USEC to TimeValue constants
Fixes the Linux build.

llvm-svn: 133370
2011-06-18 23:52:14 +00:00
Greg Clayton c662ec8bd3 Fixed variable parsing to not parse block variables over and over due to an
issue in the way block variables are marked as parsed. In the DWARF parser we
always parse all blocks for a function at once, so we can mark all blocks as
having all variables parsed and avoid recursive function calls to try and
reparse things that have already been handled.

Fixed an issue with how variables get scoped into blocks. The DWARF parser can
now handle abtract class definitions that contain concrete static variables.
When the concrete instance of the class functions get instantiated, they will
track down the concrete block for the abtract block and add the variable to
each block.

llvm-svn: 133302
2011-06-17 22:10:16 +00:00
Greg Clayton f3dd93c888 Added the notion of an system root for SDKs. This is a directory where all
libraries and headers exist. This can be specified using the platform select
function:

platform select --sysroot /Volumes/remote-root remote-macosx

Each platform subclass is free to interpret the sysroot as needed.

Expose the new SDK root directory through the SBDebugger class. 

Fixed an issue with the GDB remote protocol where unimplemented packets were
not being handled correctly.

llvm-svn: 133231
2011-06-17 03:31:01 +00:00
Greg Clayton 73bf5dbd16 Improved the packet throughput when debugging with GDB remote by over 3x on
darwin (not sure about other platforms).

Modified the communication and connection classes to not require the
BytesAvailable function. Now the "Read(...)" function has a timeout in
microseconds.

Fixed a lot of assertions that were firing off in certain cases and replaced
them with error output and code that can deal with the assertion case.

llvm-svn: 133224
2011-06-17 01:22:15 +00:00
Johnny Chen 25e68e3c1b Primitive attach support for linux
This patch is a starting point for the attach functionality.

Signed-off-by: Johnny Chen <johnny.chen@apple.com>
llvm-svn: 133006
2011-06-14 19:19:50 +00:00
Peter Collingbourne 6a520222d0 Improve error reporting in ProcessMonitor::Launch
llvm-svn: 132972
2011-06-14 03:55:58 +00:00
Peter Collingbourne 6234320933 Fix mistakes relating to ProcessMonitor::DupDescriptor
llvm-svn: 132971
2011-06-14 03:55:54 +00:00
Peter Collingbourne 4aeb47e23c If ProcessMonitor::Launch fails, post semaphore to notify caller
llvm-svn: 132970
2011-06-14 03:55:49 +00:00
Peter Collingbourne 933f6f617d Add license header to InferiorCallPOSIX.cpp
llvm-svn: 132966
2011-06-14 03:55:34 +00:00
Greg Clayton c0094b1be3 Remove assert() calls that were firing off and crashing the LLDB framework.
llvm-svn: 132960
2011-06-14 01:53:36 +00:00
Greg Clayton b677cb893d Header file cleanup and moved an inline to the implementation file.
llvm-svn: 132828
2011-06-10 01:37:29 +00:00
Greg Clayton a658fd26c3 Created a std::string in the base StopInfo class for the description and
cleaned up all base classes that had their own copy. Added a SetDescription
accessor to the StopInfo class.

llvm-svn: 132615
2011-06-04 01:26:29 +00:00
Peter Collingbourne 10bc01032c Implement RegisterContextLinux_x86_64::{Read,Write}AllRegisterValues
llvm-svn: 132587
2011-06-03 20:41:02 +00:00
Peter Collingbourne 5a6fa540dc Move SaveFrameZeroState and RestoreSaveFrameZero implementations to Thread base class
llvm-svn: 132586
2011-06-03 20:40:54 +00:00
Peter Collingbourne 70969ef102 Implement ProcessLinux::Do{Allocate,Deallocate}Memory using inferior mmap/munmap calls
llvm-svn: 132585
2011-06-03 20:40:44 +00:00
Peter Collingbourne 99f9aa02c2 Move inferior mmap/munmap call code into their own functions in utility lib
llvm-svn: 132584
2011-06-03 20:40:38 +00:00
Peter Collingbourne b4aabeb8d7 Scan dynamic symbol table of ELF object files
llvm-svn: 132582
2011-06-03 20:39:58 +00:00
Johnny Chen b1fa6b466b Bail out if we have an invalid thumb instruction.
llvm-svn: 132511
2011-06-02 23:19:06 +00:00
Johnny Chen 8a71c0b771 Turn the commented-out assert()'s into appropriate bail-out actions.
llvm-svn: 132507
2011-06-02 23:07:03 +00:00
Johnny Chen 6ef2735631 When emulating an ill-formed instruction, we should bail out instead of asserting and bringing down the whole process.
llvm-svn: 132506
2011-06-02 22:50:51 +00:00
Greg Clayton 850cc8998c Remove asserts that will crash LLDB. These should be changed to return
true/false in an extra boolean parameter and not cause the the binary that
us using the LLDB framework to crash.

llvm-svn: 132501
2011-06-02 22:23:35 +00:00
Greg Clayton dd0e5a5258 Make sure we don't lose our stop reply packet in the case where the other
GDB server doesn't support the LLDB specific qThreadStopInfo packet.

llvm-svn: 132499
2011-06-02 22:22:38 +00:00
Johnny Chen 8a742f5f37 EmulateShiftReg() also accepts shifter type of SRType_ROR.
llvm-svn: 132484
2011-06-02 21:00:34 +00:00
Greg Clayton 007d5be653 lldb-59.
llvm-svn: 132304
2011-05-30 00:49:24 +00:00
Greg Clayton 1cbc52cd64 Added some comments.
llvm-svn: 132066
2011-05-25 17:56:20 +00:00
Greg Clayton 9b72eb7101 ABI plug-ins must implement the following pure virtual functions:
virtual bool
ABI::StackUsesFrames () = 0;

Should return true if your ABI uses frames when doing stack backtraces. This
means a frame pointer is used that points to the previous stack frame in some
way or another.

virtual bool
ABI::CallFrameAddressIsValid (lldb::addr_t cfa) = 0;

Should take a look at a call frame address (CFA) which is just the stack
pointer value upon entry to a function. ABIs usually impose alignment
restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed.
This function should return true if "cfa" is valid call frame address for
the ABI, and false otherwise. This is used by the generic stack frame unwinding
code to help determine when a stack ends.

virtual bool
ABI::CodeAddressIsValid (lldb::addr_t pc) = 0;    

Validates a possible PC value and returns true if an opcode can be at "pc".
Some ABIs or architectures have fixed width instructions and must be aligned
to a 2 or 4 byte boundary. "pc" can be an opcode or a callable address which
means the load address might be decorated with extra bits (such as bit zero
to indicate a thumb function call for ARM targets), so take this into account
when returning true or false. The address should also be validated to ensure
it is a valid address for the address size of the inferior process. 32 bit
targets should make sure the address is less than UINT32_MAX.

Modified UnwindLLDB to use the new ABI functions to help it properly terminate
stacks.


Modified the mach-o function that extracts dependent files to not resolve the
path as the paths inside a binary might not match those on the current
host system.

llvm-svn: 132021
2011-05-24 23:06:02 +00:00
Johnny Chen c731848a05 Add comment.
llvm-svn: 131998
2011-05-24 20:36:40 +00:00
Jim Ingham 0a042ced97 Fix a thinko in converting to ReadCStringFromMemory.
llvm-svn: 131984
2011-05-24 19:08:00 +00:00
Johnny Chen 0084527b82 Refactor InstructionLLVM::Dump() a little bit to reduce the entropy by introducing
a new file static utility function AddSymbolicInfo() which is called from places
within InstructionLLVM::Dump().

llvm-svn: 131937
2011-05-23 23:29:23 +00:00
Greg Clayton 49c0fe24d6 Don't resolve the path when we extract the path from the dyld info or we
can end up with an invalid path if the path resolves to something different
on the local machine. It is very important not to since remote debugging will
mention paths that might exist on the current machine (like 
"/System/Library/Frameworks/CoreFoundation/CoreFoundation" which on the desktop
systems is a symlink to "/System/Library/Frameworks/CoreFoundation/Versions/A/CoreFoundation").

We will let the platform plug-ins resolve the paths in a later stage.

llvm-svn: 131934
2011-05-23 23:14:34 +00:00
Greg Clayton cdbf866727 Calculate the dyld slide from all in memory info without having to use the
lldb module.

llvm-svn: 131914
2011-05-23 20:06:52 +00:00
Johnny Chen 54dc300653 Add more workarounds for "bl #..." and "blx #..." where the ARMAsmParser fails to parse/recognize
the (PC-relative) immediate operand.

llvm-svn: 131913
2011-05-23 19:41:31 +00:00
Greg Clayton 8d400e1750 Fixed an issue in the EmulateInstructionARM there the IT opcode was trying to
parse NOP instructions. I added the new table entries for the NOP for the
plain NOP, Yield, WFE, WFI, and SEV variants. Modified the opcode emulation
function EmulateInstructionARM::EmulateMOVRdSP(...) to notify us when it is
creating a frame. Also added an abtract way to detect the frame pointer 
register for both the standard ARM ABI and for Darwin.

Fixed GDBRemoteRegisterContext::WriteAllRegisterValues(...) to correctly be
able to individually write register values back if case the 'G' packet is
not implemented or returns an error.

Modified the StopInfoMachException to "trace" stop reasons. On ARM we currently
use the BVR/BCR register pairs to say "stop when the PC is not equal to the 
current PC value", and this results in a EXC_BREAKPOINT mach exception that
has 0x102 in the code.

Modified debugserver to create the short option string from long option
definitions to make sure it doesn't get out of date. The short option string
was missing many of the newer short option values due to a modification of
the long options defs, and not modifying the short option string.

llvm-svn: 131911
2011-05-23 18:04:09 +00:00
Johnny Chen feb961b86a Fix the Align() utility which tries to align the raw disassembly with the edis'ed disassembly
so that both the opcode and the operands are aligned with the rest of output.

Comment out the code related to force_raw mode when disassembling arm or thumb for now.
It testing goes ok, we will remove the section of code related to force_raw.

llvm-svn: 131910
2011-05-23 18:00:40 +00:00
Greg Clayton f3ef3d2af9 Added new lldb_private::Process memory read/write functions to stop a bunch
of duplicated code from appearing all over LLDB:

lldb::addr_t
Process::ReadPointerFromMemory (lldb::addr_t vm_addr, Error &error);

bool
Process::WritePointerToMemory (lldb::addr_t vm_addr, lldb::addr_t ptr_value, Error &error);

size_t
Process::ReadScalarIntegerFromMemory (lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Error &error);

size_t
Process::WriteScalarToMemory (lldb::addr_t vm_addr, const Scalar &scalar, uint32_t size, Error &error);

in lldb_private::Process the following functions were renamed:

From:
uint64_t
Process::ReadUnsignedInteger (lldb::addr_t load_addr, 
                              size_t byte_size,
                              Error &error);

To:
uint64_t
Process::ReadUnsignedIntegerFromMemory (lldb::addr_t load_addr, 
                                        size_t byte_size,
                                        uint64_t fail_value, 
                                        Error &error);

Cleaned up a lot of code that was manually doing what the above functions do
to use the functions listed above.

Added the ability to get a scalar value as a buffer that can be written down
to a process (byte swapping the Scalar value if needed):

uint32_t 
Scalar::GetAsMemoryData (void *dst,
                        uint32_t dst_len, 
                        lldb::ByteOrder dst_byte_order,
                        Error &error) const;

The "dst_len" can be smaller that the size of the scalar and the least 
significant bytes will be written. "dst_len" can also be larger and the
most significant bytes will be padded with zeroes. 

Centralized the code that adds or removes address bits for callable and opcode
addresses into lldb_private::Target:

lldb::addr_t
Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;

lldb::addr_t
Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;

All necessary lldb_private::Address functions now use the target versions so
changes should only need to happen in one place if anything needs updating.

Fixed up a lot of places that were calling :

addr_t
Address::GetLoadAddress(Target*);

to call the Address::GetCallableLoadAddress() or Address::GetOpcodeLoadAddress()
as needed. There were many places in the breakpoint code where things could
go wrong for ARM if these weren't used.

llvm-svn: 131878
2011-05-22 22:46:53 +00:00
Greg Clayton cff851ab33 Added functions to lldb_private::Address to set an address from a load address
and set the address as an opcode address or as a callable address. This is
needed in various places in the thread plans to make sure that addresses that
might be found in symbols or runtime might already have extra bits set (ARM/Thumb).
The new functions are:

bool
Address::SetCallableLoadAddress (lldb::addr_t load_addr, Target *target);

bool
Address::SetOpcodeLoadAddress (lldb::addr_t load_addr, Target *target);

SetCallableLoadAddress will initialize a section offset address if it can,
and if so it might possibly set some bits in the address to make the address
callable (bit zero might get set for ARM for Thumb functions).

SetOpcodeLoadAddress will initialize a section offset address using the
specified target and it will strip any special address bits if needed 
depending on the target.

Fixed the ABIMacOSX_arm::GetArgumentValues() function to require arguments
1-4 to be in the needed registers (previously this would incorrectly fallback
to the stack) and return false if unable to get the register values. The
function was also modified to first look for the generic argument registers
and then fall back to finding the registers by name.

Fixed the objective trampoline handler to use the new Address::SetOpcodeLoadAddress
function when needed to avoid address mismatches when trying to complete 
steps into objective C methods. Make similar fixes inside the
AppleThreadPlanStepThroughObjCTrampoline::ShouldStop() function.

Modified ProcessGDBRemote::BuildDynamicRegisterInfo(...) to be able to deal with
the new generic argument registers.

Modified RNBRemote::HandlePacket_qRegisterInfo() to handle the new generic
argument registers on the debugserver side.

Modified DNBArchMachARM::NumSupportedHardwareBreakpoints() to be able to 
detect how many hardware breakpoint registers there are using a darwin sysctl.
Did the same for hardware watchpoints in 
DNBArchMachARM::NumSupportedHardwareWatchpoints().

llvm-svn: 131834
2011-05-22 04:32:55 +00:00
Johnny Chen 1c464d4961 A little refactoring.
llvm-svn: 131779
2011-05-21 00:55:57 +00:00
Johnny Chen e7faaa6688 When in non-raw mode and edis fails to parse the tokens of the instruction, output
the raw disassembly so that the opcode aligns with the edis'ed disassembly.

llvm-svn: 131773
2011-05-21 00:44:42 +00:00
Greg Clayton adc00cb2ba Centralize the code that gathers the thread ID list from the remote GDB
server so that it happens in command sequence where no other packets can
sneak between.

llvm-svn: 131769
2011-05-20 23:38:13 +00:00
Peter Collingbourne f5c22943eb Fix build error - strstr returns a const char *
llvm-svn: 131766
2011-05-20 22:42:59 +00:00
Johnny Chen 02cefc2c23 Workaround the issue of llvm:tB (A8.6.16 B Encoding T2) not being processed as
a branch instruction and therefore the symbolic information is not being dumped for
non-raw mode.

The problem is that the ARMAsmParser is not recognizing the "#274" in "b	#274"
as a valid operand when doing disassembly in non-raw mode.

llvm-svn: 131738
2011-05-20 17:27:37 +00:00
Stephen Wilson 8063a4a47a Do not parse DIE's outside a compilation units range.
In DWARFCompileUnit::ExtractDIEsIfNeeded we are relying on a compilation units
DIEs to be terminated by a null entry.  I think the standard is fairly clear
that all sibling chains are to be terminated by null, but at least gcc 4.5.2
disagrees -- the top level chain drops the final entry.  This results in us
interpreting the next compilation unit header as a DIE.

Regardless of whether gcc is right or wrong, we should not overstep a
compilation units extent.  This patch ensures that we do not attempt to extract
a DIE beyond the length specified for a given DWARFCompileUnit by ensuring our
current offset is strictly less than the start of the next CU.

llvm-svn: 131721
2011-05-20 04:27:12 +00:00
Greg Clayton 5fe15d2d52 Fixed an issue in GDBRemoteCommunicationClient where we weren't listening to
the "payload_length" argument for the "payload" packet data. This meant we 
could end up sending random extra data with a packet depending on how the 
packet was constructed.

Fixed GDBRemoteRegisterContext to properly save and restore all registers. 
Previous fixes had been added to work around the "payload_length" issues fixed
above and aren't needed anymore.

Fix logging in GDBRemoteCommunication to make sure we log the correct packet
data being sent by using the packet length when dumping the packet contents.

Added register definitions for 'arm-lldb' in the "disasm-gdb-remote.pl" script
so if you have a register dump from the GDB remote that doesn't include the
qRegisterInfo packets, you can manually tell the script which registers are
which.

llvm-svn: 131715
2011-05-20 03:15:54 +00:00
Charles Davis 51be6b5dfa Add the LanguageRuntime plugins to the makefile build, and remove the
Mac OS X Process plugin from the build.

I'm surprised no one caught this earlier. Am I the only one who builds with
the makefiles on Mac?

llvm-svn: 131704
2011-05-19 23:44:09 +00:00
Johnny Chen c25433f3d2 A bit of clean up.
Removed ifdeffed out functions and added the implementation of
WriteRegister for x86_64 architecture.

Signed-off-by: Johnny Chen <johnny.chen@apple.com>
llvm-svn: 131696
2011-05-19 23:08:41 +00:00
Johnny Chen c18a538646 API fix and missing headers.
Host.cpp was missing Error.h and the implementation of
LaunchProcess. Once againg I have added a "fake" implementation
waiting for a real one.

Fixed the call GetAddressRange to reflect the new interface in
DynamicLoaderLinuxDYLD.cpp.

Added string.h to ARM_DWARF_Registers.cpp that is needed for ::memset.

Signed-off-by: Johnny Chen <johnny.chen@apple.com>
llvm-svn: 131695
2011-05-19 23:07:19 +00:00
Charles Davis c9c24af6f2 Fix trailing commas at the end of enumerator lists.
Seriously, I have no idea how you guys managed to build LLDB before.

llvm-svn: 131684
2011-05-19 21:59:12 +00:00
Peter Collingbourne 1b27dac253 Build and initialise the Darwin ABI plugins on all platforms
llvm-svn: 131661
2011-05-19 18:32:34 +00:00
Peter Collingbourne 5e494f4fe9 Add UnwindAssembly plugins to makefile build
llvm-svn: 131650
2011-05-19 17:34:58 +00:00
Peter Collingbourne 1cbedd3ee0 Use the portable memchr function instead of the BSD-only strnstr
llvm-svn: 131646
2011-05-19 17:34:44 +00:00
Greg Clayton af247d7b98 Fixed a crasher that was happened when a log shared pointer wasn't valid.
Fixed ThreadPlanCallFunction::ReportRegisterState(...) to only dump when
verbose logging is enabled and fixed the function to use the new
RegisterValue method of reading registers.

Fixed the GDB remote client to not send a continue packet after receiving
stdout or stderr from the inferior process.

llvm-svn: 131628
2011-05-19 03:54:16 +00:00
Johnny Chen d746478404 Make InstructionLLVM::Dump() more robust for edis in cases when all the
EDOperandIndexForToken(token) calls fail to return a meaningful operand index,
resulting in both operands and comment being empty.  We will use the raw disassembly
string as output in these cases.

There is still a known bug where llvm:tB (A8.6.16 B Encoding T2) is not being processed
as a branch instruction and therefore the symbolic information is not being dumped for
non-raw mode.

llvm-svn: 131615
2011-05-19 01:05:37 +00:00
Greg Clayton e376938e93 Added the ability to sign extend a Scalar at any bit position for integer
types.

Added the abilty to set a RegisterValue type via accessor and enum.

Added the ability to read arguments for a function for ARM if you are on the
first instruction in ABIMacOSX_arm.

Fixed an issue where a file descriptor becoming invalid could cause an 
inifnite loop spin in the libedit thread.

llvm-svn: 131610
2011-05-19 00:17:26 +00:00
Johnny Chen 30243c74c0 Some refactorings with respect to setting of the 'printTokenized' flag.
Add some comments.

llvm-svn: 131594
2011-05-18 22:48:41 +00:00
Johnny Chen a5aab9ad58 Remove dead code which tests for boolan flag 'raw' and restore one indentation level.
llvm-svn: 131589
2011-05-18 22:08:52 +00:00
Greg Clayton 3f5c08f5c2 Added a function to lldb_private::Address:
addr_t
        Address::GetCallableLoadAddress (Target *target) const;
        
This will resolve the load address in the Address object and optionally
decorate the address up to be able to be called. For all non ARM targets, this
just essentially returns the result of "Address::GetLoadAddress (target)". But
for ARM targets, it checks if the address is Thumb, and if so, it returns
an address with bit zero set to indicate a mode switch to Thumb. This is how
we need function pointers to be for return addresses and when resolving 
function addresses for the JIT. It is also nice to centralize this in one spot
to avoid having multiple copies of this code.

llvm-svn: 131588
2011-05-18 22:01:49 +00:00
Johnny Chen 5bee94ecab If the use_thumb is set, pass llvm::Triple::thumb to the InstructionLLVM.ctor() unconditionally.
Otherwise, pass m_arch.GetMachine().

Followup patch for rdar://problem/9170971.

llvm-svn: 131549
2011-05-18 18:22:16 +00:00
Greg Clayton cd482e359e Added a way to resolve an load address from a target:
bool
Address::SetLoadAddress (lldb::addr_t load_addr, Target *target);

Added an == and != operator to RegisterValue.

Modified the ThreadPlanTracer to use RegisterValue objects to store the
register values when single stepping. Also modified the output to be a bit
less wide.

Fixed the ABIMacOSX_arm to not overwrite stuff on the stack. Also made the
trivial function call be able to set the ARM/Thumbness of the target 
correctly, and also sets the return value ARM/Thumbness.

Fixed the encoding on the arm s0-s31 and d16 - d31 registers when the default
register set from a standard GDB server register sets.

llvm-svn: 131517
2011-05-18 01:58:14 +00:00
Greg Clayton 7a9ef8f11b Removed some assertions that could crash the controlling program
and turned them into warnings to stderr.

llvm-svn: 131470
2011-05-17 17:37:43 +00:00
Greg Clayton 5f5b2cad48 Fixed an issue that broke expression parsing related to backing up
all register values. There is some junk that was appearing at the end
of the result the 'g' packet (read all register values). This function
was being called in:

bool
GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp)

Then the packet data for the 'G' packet (write all registers) was being 
placed into "data_sp" so the:

bool
GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data_sp)

could restore it. In attempting to clean up the extra junk at the end of this
packet data, the packet was getting truncated.

llvm-svn: 131468
2011-05-17 16:50:15 +00:00
Greg Clayton e6a9e439d4 Fixed the "mmap" to work on MacOSX/darwin by supplying the correct arguemnts.
Modified ClangUserExpression and ClangUtilityFunction to display the actual
error (if one is available) that made the JIT fail instead of a canned 
response.

Fixed the restoring of all register values when the 'G' packet doesn't work
to use the correct data.

llvm-svn: 131454
2011-05-17 03:51:29 +00:00
Greg Clayton d495c5340d Added an allocated memory cache to avoid having to allocate memory over and
over when running JITed expressions. The allocated memory cache will cache 
allocate memory a page at a time for each permission combination and divvy up
the memory and hand it out in 16 byte increments. 

llvm-svn: 131453
2011-05-17 03:37:42 +00:00
Greg Clayton 93ecc368c1 Add support for the 'G' packet not being implemented or returning an error.
If we are asked to restore all register values, we need to fall back to 
restoring each register one by one.

llvm-svn: 131398
2011-05-16 03:02:32 +00:00
Greg Clayton b4aaf2e78d Fixed an issue where large memory writes might not get chunked up into smaller
packets in GDB remote.

Also fixed a compiler warning for an unhandled case for a switch.

llvm-svn: 131397
2011-05-16 02:35:02 +00:00
Greg Clayton 1cfca1dc09 Dump JIT memory requirements when "log enable lldb expr" logging is enabled.
Correctly handle invalid 32-bit mmap fail return value in ProcessGDBRemote.

llvm-svn: 131394
2011-05-15 23:56:52 +00:00
Greg Clayton 17a0cb68c9 Properly handle when commands are not unsupported in the GDB remote clients.
Prior to this fix we would often call SendPacketAndWaitForResponse() which
returns the number of bytes in the response. The UNSUPPORTED response in the
GDB remote protocol is zero bytes and we were checking for it inside an if
statement:

if (SendPacketAndWaitForResponse(...))
{
    if (response.IsUnsupportedResponse())
    {
        // UNSUPPORTED...
        // This will never happen...
    }
}

We now handle is properly as:

if (SendPacketAndWaitForResponse(...))
{
}
else
{
    // UNSUPPORTED...
}

llvm-svn: 131393
2011-05-15 23:46:54 +00:00
Greg Clayton 5d353156d0 Added the ability to get a 32 or 64 bit simple return value from the
ABIMacOSX_arm plugin.

Modified darwin-debug to print out the exectuable, working directory and
arguments a bit differently.

llvm-svn: 131392
2011-05-15 22:49:24 +00:00
Greg Clayton 3f71643cc9 Fixed the default ARM registers to have the generic argument
definitions and names.

llvm-svn: 131387
2011-05-15 17:52:30 +00:00
Greg Clayton 9a8fa9161f Added generic register numbers for simple ABI argument registers and defined
the appropriate registers for arm and x86_64. The register names for the
arguments that are the size of a pointer or less are all named "arg1", "arg2",
etc. This allows you to read these registers by name:

(lldb) register read arg1 arg2 arg3
...

You can also now specify you want to see alternate register names when executing
the read register command:

(lldb) register read --alternate
(lldb) register read -A

llvm-svn: 131376
2011-05-15 04:12:07 +00:00
Greg Clayton 70b5765740 Added the ability to get the return value from a ThreadPlanCallFunction
thread plan. In order to get the return value, you can call:

        void
        ThreadPlanCallFunction::RequestReturnValue (lldb::ValueSP &return_value_sp);
        
This registers a shared pointer to a return value that will get filled in if
everything goes well. After the thread plan is run the return value will be
extracted for you.

Added an ifdef to be able to switch between the LLVM MCJIT and the standand JIT.
We currently have the standard JIT selected because we have some work to do to
get the MCJIT fuctioning properly.

Added the ability to call functions with 6 argument in the x86_64 ABI.

Added the ability for GDBRemoteCommunicationClient to detect if the allocate
and deallocate memory packets are supported and to not call allocate memory 
("_M") or deallocate ("_m") if we find they aren't supported.

Modified the ProcessGDBRemote::DoAllocateMemory(...) and ProcessGDBRemote::DoDeallocateMemory(...) 
to be able to deal with the allocate and deallocate memory packets not being 
supported. If they are not supported, ProcessGDBRemote will switch to calling
"mmap" and "munmap" to allocate and deallocate memory instead using our 
trivial function call support.

Modified the "void ProcessGDBRemote::DidLaunchOrAttach()" to correctly ignore 
the qHostInfo triple information if any was specified in the target. Currently 
if the target only specifies an architecture when creating the target:

(lldb) target create --arch i386 a.out

Then the vendor, os and environemnt will be adopted by the target.

If the target was created with any triple that specifies more than the arch:

(lldb) target create --arch i386-unknown-unknown a.out

Then the target will maintain its triple and not adopt any new values. This
can be used to help force bare board debugging where the dynamic loader for
static files will get used and users can then use "target modules load ..."
to set addressses for any files that are desired.

Added back some convenience functions to the lldb_private::RegisterContext class
for writing registers with unsigned values. Also made all RegisterContext
constructors explicit to make sure we know when an integer is being converted
to a RegisterValue. 

llvm-svn: 131370
2011-05-15 01:25:55 +00:00
Greg Clayton 2a48f525cd Expand the ABI prepare trivial function call to allow 6 simple args.
llvm-svn: 131334
2011-05-14 01:50:35 +00:00
Jim Ingham 67eb68d260 For the purposes of setting breakpoints treat methods defined in the class and methods defined in a category on the class as the same.
llvm-svn: 131331
2011-05-14 00:40:37 +00:00
Johnny Chen 13e8e1c37d This patch add a "fake" attach waiting for a real implementation and
solve the build break due to the lack of this method.

It also propose a solution to the API changes in RegisterContext.

I upgraded also the the python version in the makefile. My linux
installation has python2.7 and AFAIK also the latest ubuntu
has this version of python so maybe is worth upgrading.

Patch by Marco Minutoli <mminutoli@gmail.com>

[Note: I had to hand merge in the diffs since patch thinks it is a corrupt patch.]

llvm-svn: 131313
2011-05-13 21:29:50 +00:00
Johnny Chen a566355482 PATH_MAX is in limits.h on Linux.
Patch by Marco Minutoli <mminutoli@gmail.com>

llvm-svn: 131304
2011-05-13 20:07:25 +00:00
Johnny Chen 4b95aa4c6f Fix the InstructionLLVM::Dump() so that for Triple::arm, PC reads as the address
of the current instruction plus 8.  And for Triple::thumb, it is plus 4.

rdar://problem/9170971
lldb disassembly's symbol information not correct (off by 2?)

llvm-svn: 131256
2011-05-12 22:25:53 +00:00
Johnny Chen 3f125fe2ea Construction of the RegisterReaderArg instance should happen after we have a valid base_addr, not before.
llvm-svn: 131236
2011-05-12 18:48:11 +00:00
Greg Clayton fdeb15635b Cleaned up the ABI::PrepareTrivialCall() function to take three argument
pointers:

        virtual bool
        PrepareTrivialCall (Thread &thread, 
                            lldb::addr_t sp,
                            lldb::addr_t functionAddress,
                            lldb::addr_t returnAddress, 
                            lldb::addr_t *arg1_ptr,
                            lldb::addr_t *arg2_ptr,
                            lldb::addr_t *arg3_ptr) const = 0;

Prior to this it was:

        virtual bool
        PrepareTrivialCall (Thread &thread, 
                            lldb::addr_t sp,
                            lldb::addr_t functionAddress,
                            lldb::addr_t returnAddress, 
                            lldb::addr_t arg,
                            lldb::addr_t *this_arg,
                            lldb::addr_t *cmd_arg) const = 0;

This was because the function that called this slowly added more features to
be able to call a C++ member function that might have a "this" pointer, and 
then later added "self + cmd" support for objective C. Cleaning this code up
and the code that calls it makes it easier to implement the functions for
new targets.

The MacOSX_arm::PrepareTrivialCall() is now filled in and ready for testing.

llvm-svn: 131221
2011-05-12 02:14:56 +00:00
Greg Clayton 31f1d2f535 Moved all code from ArchDefaultUnwindPlan and ArchVolatileRegs into their
respective ABI plugins as they were plug-ins that supplied ABI specfic info.

Also hookep up the UnwindAssemblyInstEmulation so that it can generate the
unwind plans for ARM.

Changed the way ABI plug-ins are handed out when you get an instance from
the plug-in manager. They used to return pointers that would be mananged
individually by each client that requested them, but now they are handed out
as shared pointers since there is no state in the ABI objects, they can be
shared.

llvm-svn: 131193
2011-05-11 18:39:18 +00:00
Greg Clayton 7349bd9078 While implementing unwind information using UnwindAssemblyInstEmulation I ran
into some cleanup I have been wanting to do when reading/writing registers.
Previously all RegisterContext subclasses would need to implement:

virtual bool
ReadRegisterBytes (uint32_t reg, DataExtractor &data);

virtual bool
WriteRegisterBytes (uint32_t reg, DataExtractor &data, uint32_t data_offset = 0);

There is now a new class specifically designed to hold register values: 
        lldb_private::RegisterValue
        
The new register context calls that subclasses must implement are:

virtual bool
ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) = 0;

virtual bool
WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) = 0;

The RegisterValue class must be big enough to handle any register value. The
class contains an enumeration for the value type, and then a union for the 
data value. Any integer/float values are stored directly in an appropriate
host integer/float. Anything bigger is stored in a byte buffer that has a length
and byte order. The RegisterValue class also knows how to copy register value
bytes into in a buffer with a specified byte order which can be used to write
the register value down into memory, and this does the right thing when not
all bytes from the register values are needed (getting a uint8 from a uint32
register value..). 

All RegiterContext and other sources have been switched over to using the new
regiter value class.

llvm-svn: 131096
2011-05-09 20:18:18 +00:00
Greg Clayton 0e4851641f Fixed an issue with the MacOSX backchain register context where the pc was
being returned for both the PC and FP.

llvm-svn: 131081
2011-05-09 03:39:34 +00:00
Greg Clayton c4103b3c2f Fixed not being able to launch the i386 slice of a universal binary by adding
a new "QLaunchArch:<arch-name>" where <arch-name> is the architecture name.
This allows us to remotely launch a debugserver and then set the architecture
for the binary we will launch.

llvm-svn: 131064
2011-05-08 04:53:50 +00:00
Jim Ingham 2837b766f5 Change "frame var" over to using OptionGroups (and thus the OptionGroupVariableObjectDisplay).
Change the boolean "use_dynamic" over to a tri-state, no-dynamic, dynamic-w/o running target,
and dynamic with running target.

llvm-svn: 130832
2011-05-04 03:43:18 +00:00
Jim Ingham 61be0903e5 Adding support for fetching the Dynamic Value for ObjC Objects.
llvm-svn: 130701
2011-05-02 18:13:59 +00:00
Greg Clayton 2289fa4820 Added the ability to set the Platform path for a module through the SBModule
interface.

Added a quick way to set the platform though the SBDebugger interface. I will
actually an a SBPlatform support soon, but for now this will do.

ConnectionFileDescriptor can be passed a url formatted as: "fd://<fd>" where
<fd> is a file descriptor in the current process. This is handy if you have
services, deamons, or other tools that can spawn processes and give you a
file handle.

llvm-svn: 130565
2011-04-30 01:09:13 +00:00
Greg Clayton e5b3498eef Added the start of the CFI row production using the
emulate instruction classes.

llvm-svn: 130556
2011-04-29 22:50:31 +00:00
Greg Clayton 84c39663a9 Added a new OptionValue subclass for lldb::Format: OptionValueFormat. Added
new OptionGroup subclasses for:
- output file for use with options: 
        long opts: --outfile <path> --append--output
        short opts: -o <path> -A
        
- format for use with options:
        long opts: --format <format>

- variable object display controls for depth, pointer depth, wether to show
  types, show summary, show location, flat output, use objc "po" style summary.
  
Modified ValueObjectMemory to be able to be created either with a TypeSP or
a ClangASTType.

Switched "memory read" over to use OptionGroup subclasses: one for the outfile
options, one for the command specific options, and one for the format.

llvm-svn: 130334
2011-04-27 22:04:39 +00:00
Greg Clayton 79ea878bf9 Got the EmulateInstruction CFI code a lot closer to producing CFI data.
Switch the EmulateInstruction to use the standard RegisterInfo structure
that is defined in the lldb private types intead of passing the reg kind and
reg num everywhere. EmulateInstruction subclasses also need to provide
RegisterInfo structs given a reg kind and reg num. This eliminates the need
for the GetRegisterName() virtual function and allows more complete information
to be passed around in the read/write register callbacks. Subclasses should
always provide RegiterInfo structs with the generic register info filled in as
well as at least one kind of register number in the RegisterInfo.kinds[] array.

llvm-svn: 130256
2011-04-26 23:48:45 +00:00
Johnny Chen a85bf380ba Modify EmulateInstructionARM::SetArchitecture() to treat "arm" and "thumb" as wild card architectures
for now, in order to fix the test failure for the 'arm_emulation' directory.
There might be a better way.

llvm-svn: 130227
2011-04-26 18:51:57 +00:00
Greg Clayton 2ed751bd47 Changed the emulate instruction function to take emulate options which
are defined as enumerations. Current bits include:

        eEmulateInstructionOptionAutoAdvancePC
        eEmulateInstructionOptionIgnoreConditions

Modified the EmulateInstruction class to have a few more pure virtuals that
can help clients understand how many instructions the emulator can handle:

        virtual bool
        SupportsEmulatingIntructionsOfType (InstructionType inst_type) = 0;


Where instruction types are defined as:

//------------------------------------------------------------------
/// Instruction types
//------------------------------------------------------------------    
typedef enum InstructionType
{
    eInstructionTypeAny,                // Support for any instructions at all (at least one)
    eInstructionTypePrologueEpilogue,   // All prologue and epilogue instructons that push and pop register values and modify sp/fp
    eInstructionTypePCModifying,        // Any instruction that modifies the program counter/instruction pointer
    eInstructionTypeAll                 // All instructions of any kind

}  InstructionType;


This allows use to tell what an emulator can do and also allows us to request
these abilities when we are finding the plug-in interface.

Added the ability for an EmulateInstruction class to get the register names
for any registers that are part of the emulation. This helps with being able
to dump and log effectively.

The UnwindAssembly class now stores the architecture it was created with in
case it is needed later in the unwinding process.

Added a function that can tell us DWARF register names for ARM that goes
along with the source/Utility/ARM_DWARF_Registers.h file: 

        source/Utility/ARM_DWARF_Registers.c
        
Took some of plug-ins out of the lldb_private namespace.

llvm-svn: 130189
2011-04-26 04:39:08 +00:00
Greg Clayton 7be2542fc9 Renamed UnwindAssemblyProfiler to UnwindAssembly along with its source files.
llvm-svn: 130156
2011-04-25 21:14:26 +00:00
Greg Clayton 078daac55d Even more renaming.
llvm-svn: 130155
2011-04-25 21:07:40 +00:00
Greg Clayton ffc922e389 More moving things around for the unwind plan and assembly unwind plug-ins.
llvm-svn: 130154
2011-04-25 21:05:07 +00:00
Greg Clayton dc5eb693bd Put plug-ins into the correct directories as they were incorrectly located
in a Utility directory.

llvm-svn: 130135
2011-04-25 18:36:36 +00:00
Greg Clayton 7e14f91dbd Fixed the SymbolContext::DumpStopContext() to correctly indent and dump
inline contexts when the deepest most block is not inlined.

Added source path remappings to the lldb_private::Target class that allow it
to remap paths found in debug info so we can find source files that are elsewhere
on the current system.

Fixed disassembly by function name to disassemble inline functions that are
inside other functions much better and to show enough context before the
disassembly output so you can tell where things came from.

Added the ability to get more than one address range from a SymbolContext 
class for the case where a block or function has discontiguous address ranges.

llvm-svn: 130044
2011-04-23 02:04:55 +00:00
Caroline Tice de2fb9cf76 Change code for reading emulation data files to read the new file
format.  (The newly formatted files will go in as a separate commit in a
few minutes).

llvm-svn: 129981
2011-04-22 05:08:45 +00:00
Greg Clayton 2048ea5eba Fixed a case where if a function, inlined function, or global with a mangled
name had a DW_AT_name that was the same string as the DW_AT_MIPS_linkage_name,
then it would get added twice to the DWARF index.

llvm-svn: 129942
2011-04-21 21:41:13 +00:00
Caroline Tice 3ac6711aec Add the infrastructure to test instruction emulations automatically.
The idea is that the instruction to be emulated is actually executed
on the hardware to be emulated, with the before and after state of the
hardware being captured and 'freeze-dried' into .dat files.  The
emulation testing code then loads the before & after state from the
.dat file, emulates the instruction using the before state, and
compares the resulting state to the 'after' state.  If they match, the
emulation is accurate, otherwise there is a problem.

The final format of the .dat files needs a bit more work; the plan is
to generalize them a bit and to convert the plain values to key-value pairs. 
But I wanted to get this first pass committed.

This commit adds arm instruction emulation testing to the testsuite, along with
many initial .dat files.

It also fixes a bug in the llvm disassembler, where 32-bit thumb opcodes
were getting their upper & lower 16-bits reversed.

There is a new Instruction sub-class, that is intended to be loaded
from a .dat file rather than read from an executable.  There is also a
new EmulationStateARM class, for handling the before & after states.
EmulationStates for other architetures can be added later when we
emulate their instructions.

llvm-svn: 129832
2011-04-19 23:30:03 +00:00
Johnny Chen a6ca9fb407 Rename some variables, no functionality change.
llvm-svn: 129724
2011-04-18 22:11:31 +00:00
Greg Clayton 7260f6206f Centralized a lot of the status information for processes,
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
2011-04-18 08:33:37 +00:00
Jim Ingham 78a685aa2d Add support for "dynamic values" for C++ classes. This currently only works for "frame var" and for the
expressions that are simple enough to get passed to the "frame var" underpinnings.  The parser code will
have to be changed to also query for the dynamic types & offsets as it is looking up variables.

The behavior of "frame var" is controlled in two ways.  You can pass "-d {true/false} to the frame var
command to get the dynamic or static value of the variables you are printing.

There's also a general setting:

target.prefer-dynamic-value (boolean) = 'true'

which is consulted if you call "frame var" without supplying a value for the -d option.

llvm-svn: 129623
2011-04-16 00:01:13 +00:00
Jim Ingham 337030f556 Work around a llvm gcc bug where the name of a reference doesn't include the "&".
llvm-svn: 129620
2011-04-15 23:41:23 +00:00
Johnny Chen b57edcab3b Get rid the of set membership test (log(m)) and, instead, use an index variable 'i'
which advances when src collides with a purged slot.
Hi Stephen, you're welcome to overwrite/or improve upon this version.  Thanks.

llvm-svn: 129611
2011-04-15 21:45:12 +00:00
Johnny Chen fec280e750 Update both the src and dst pointers at the end of the loop.
Stephen Wilson is working on a better performing patch in the meantime.

llvm-svn: 129605
2011-04-15 20:59:46 +00:00
Johnny Chen d2ddabac20 Optimize address range coalescing.
DWARFDebugAranges::Sort() calls std::stable_sort() over a set of address ranges
and then proceeds to collapse neighboring ranges together.

One problem with the current implementation is that it does an incomplete job.
When a pair of ranges are merged the next pair considered does not include the
just-merged range.  IOW, three consecutive ranges are never collapsed into one.

Another problem is that for each range merged we are calling
std::vector::erase() which "shifts" all remaining elements of the vector by one
position on every merge.  The end result (in the worst case) is a quadratic
algorithm -- not good when the input vector is large.

The following patch merges all consecutive ranges and removes the quadratic
behavior.  The implementation uses an auxiliary vector of indices in order to
remember all ranges that can be dropped, then performs the coalescing of ranges
in a single pass.

Patch from Stephen Wilson with some minor modification by me.

llvm-svn: 129595
2011-04-15 19:56:24 +00:00
Greg Clayton ab65b34fdc Added auto completion for architecture names and for platforms.
Modified the OptionGroupOptions to be able to specify only some of the options
that should be appended by using the usage_mask in the group defintions and
also provided a way to remap them to a new usage mask after the copy. This 
allows options to be re-used and also targetted for specific option groups.

Modfied the CommandArgumentType to have a new eArgTypePlatform enumeration.
Taught the option parser to be able to automatically use the appropriate
auto completion for a given options if nothing is explicitly specified
in the option definition. So you don't have to specify it in the option
definition tables.

Renamed the default host platform name to "host", and the default platform
hostname to be "localhost".

Modified the "file" and "platform select" commands to make sure all options
and args are good prior to creating a new platform. Also defer the computation
of the architecture in the file command until all options are parsed and the
platform has either not been specified or reset to a new value to avoid
computing the arch more than once.

Switch the PluginManager code over to using llvm::StringRef for string
comparisons and got rid of all the AccessorXXX functions in lieu of the newer
mutex + collection singleton accessors.

llvm-svn: 129483
2011-04-13 22:47:15 +00:00
Caroline Tice 17f5fa2b1c Fix bug where source & target registers were swapped in an
emulation function.

llvm-svn: 129474
2011-04-13 21:49:04 +00:00
Caroline Tice 69955f6cdc Fix various minor bugs in the ARM instruction emulation code.
llvm-svn: 129422
2011-04-13 00:42:12 +00:00
Greg Clayton 8b82f087a0 Moved the execution context that was in the Debugger into
the CommandInterpreter where it was always being used.

Make sure that Modules can track their object file offsets correctly to
allow opening of sub object files (like the "__commpage" on darwin).

Modified the Platforms to be able to launch processes. The first part of this
move is the platform soon will become the entity that launches your program
and when it does, it uses a new ProcessLaunchInfo class which encapsulates
all process launching settings. This simplifies the internal APIs needed for
launching. I want to slowly phase out process launching from the process
classes, so for now we can still launch just as we used to, but eventually
the platform is the object that should do the launching.

Modified the Host::LaunchProcess in the MacOSX Host.mm to correctly be able
to launch processes with all of the new eLaunchFlag settings. Modified any
code that was manually launching processes to use the Host::LaunchProcess
functions.

Fixed an issue where lldb_private::Args had implicitly defined copy 
constructors that could do the wrong thing. This has now been fixed by adding
an appropriate copy constructor and assignment operator.

Make sure we don't add empty ModuleSP entries to a module list.

Fixed the commpage module creation on MacOSX, but we still need to train
the MacOSX dynamic loader to not get rid of it when it doesn't have an entry
in the all image infos.

Abstracted many more calls from in ProcessGDBRemote down into the 
GDBRemoteCommunicationClient subclass to make the classes cleaner and more
efficient.

Fixed the default iOS ARM register context to be correct and also added support
for targets that don't support the qThreadStopInfo packet by selecting the
current thread (only if needed) and then sending a stop reply packet.

Debugserver can now start up with a --unix-socket (-u for short) and can 
then bind to port zero and send the port it bound to to a listening process
on the other end. This allows the GDB remote platform to spawn new GDB server
instances (debugserver) to allow platform debugging.

llvm-svn: 129351
2011-04-12 05:54:46 +00:00
Stephen Wilson 71c21d18c3 Order of initialization lists.
This patch fixes all of the warnings due to unordered initialization lists.

Patch by Marco Minutoli.

llvm-svn: 129290
2011-04-11 19:41:40 +00:00
Caroline Tice 88544c5f2c Implement ARM emulation function to handle "SUBS PC, LR and related instructions".
llvm-svn: 129279
2011-04-11 15:51:10 +00:00
Caroline Tice 25d61ac2ed Fix various things in the instruction emulation code:
- Add ability to control whether or not the emulator advances the
    PC register (in the emulation state), if the instruction itself
    does not change the pc value..

    - Fix a few typos in asm description strings.

    - Fix bug in the carry flag calculation.

llvm-svn: 129168
2011-04-08 23:33:06 +00:00
Stephen Wilson 8acdbb8a75 Add missing headers.
Something changed in commit r129112 where a few standard headers vanished from
the include chain when building on Linux.  Fix up by including limits.h for
INT_MAX and PATH_MAX where needed, and stdio.h for printf().

llvm-svn: 129130
2011-04-08 13:36:44 +00:00
Stephen Wilson 05459c8269 Add the ARM instruction emulation makefile.
I forgot to 'svn add' this file in r129119.

llvm-svn: 129120
2011-04-08 02:11:29 +00:00
Stephen Wilson d5adc9185c Add makefile support for the ARM instruction emulation plugin.
llvm-svn: 129119
2011-04-08 02:01:35 +00:00
Stephen Wilson 3f588d3f50 linux: add missing arguments to FindFirstModuleForFileSpec
Specifying the new arguments as NULL is appropriate for now as this is
backwards-compatible with the old invocation. 

llvm-svn: 129118
2011-04-08 02:00:23 +00:00
Greg Clayton eb0103f2d0 Modified the ArchSpec to take an optional "Platform *" when setting the triple.
This allows you to have a platform selected, then specify a triple using
"i386" and have the remaining triple items (vendor, os, and environment) set
automatically.

Many interpreter commands take the "--arch" option to specify an architecture
triple, so now the command options needed to be able to get to the current
platform, so the Options class now take a reference to the interpreter on
construction.

Modified the build LLVM building in the Xcode project to use the new
Xcode project level user definitions:

LLVM_BUILD_DIR - a path to the llvm build directory
LLVM_SOURCE_DIR - a path to the llvm sources for the llvm that will be used to build lldb
LLVM_CONFIGURATION - the configuration that lldb is built for (Release, 
Release+Asserts, Debug, Debug+Asserts).

I also changed the LLVM build to not check if "lldb/llvm" is a symlink and
then assume it is a real llvm build directory versus the unzipped llvm.zip
package, so now you can actually have a "lldb/llvm" directory in your lldb
sources.

llvm-svn: 129112
2011-04-07 22:46:35 +00:00
Stephen Wilson f6e259049d Removed use of NSEC_PER_SEC.
NSEC_PER_SEC is not defined in sys/time.h on Linux. Replaced that macro with a
static constant inside TimeValue.

Patch by Marco Minutoli.

llvm-svn: 129071
2011-04-07 10:27:22 +00:00
Stephen Wilson 0682ba2f2e linux: remove ProcessLinux::FindProcesses
This method only needs to be overridden in the remote debugging case,  the
base class handles the host case.  Since we do not do remote debugging on
Linux yet and there is a typo that causes a build issue, just remove this
method for now.
 

llvm-svn: 129069
2011-04-07 10:16:53 +00:00
Greg Clayton 15eb2558ef Update the linux platform to use the new Host::FindProcesses functionality.
llvm-svn: 129018
2011-04-06 18:50:36 +00:00
Caroline Tice 7c9dd3ce3c Add Emulate and DumpEmulation to Instruction class.
Move InstructionLLVM out of DisassemblerLLVM class.

Add instruction emulation function calls to SBInstruction and SBInstructionList APIs.

llvm-svn: 128956
2011-04-05 23:22:54 +00:00
Caroline Tice ad379efc86 Add the rest of the mechanisms to make ARM instruction emulation usable/possible.
llvm-svn: 128907
2011-04-05 18:46:00 +00:00
Greg Clayton 9b1e1cdf23 Added a speed test to the GDBRemoteCommunicationClient and
GDBRemoteCommunicationServer classes. This involved adding a new packet
named "qSpeedTest" which can test the speed of a packet send/response pairs
using a wide variety of send/recv packet sizes.

Added a few new connection classes: one for shared memory, and one for using
mach messages (Apple only). The mach message stuff is experimental and not 
working yet, but added so I don't lose the code. The shared memory stuff
uses pretty standard calls to setup shared memory.

llvm-svn: 128837
2011-04-04 18:18:57 +00:00
Greg Clayton 95bf0fd3ab Added the ability to get a broadcaster event name for a given broadcaster
event.

Modified the ProcessInfo structure to contain all process arguments. Using the
new function calls on MacOSX allows us to see the full process name, not just
the first 16 characters. 

Added a new platform command: "platform process info <pid> [<pid> <pid> ...]"
that can be used to get detailed information for a process including all 
arguments, user and group info and more.

llvm-svn: 128694
2011-04-01 00:29:43 +00:00
Jim Ingham 8d543de400 Remove unneeded ExecutionContextScope variables.
llvm-svn: 128685
2011-03-31 23:01:21 +00:00
Caroline Tice d20c8d1a17 Fix a few typos in the previous commit.
llvm-svn: 128671
2011-03-31 21:31:50 +00:00
Caroline Tice 028b8b7bb7 Add code to emulate VLD1 (single element to all lanes) ARM instruction.
llvm-svn: 128669
2011-03-31 21:15:29 +00:00
Caroline Tice 5901ea7e67 Add code to emulate VST1 (single element from one lane) ARM
instruction (more floating point stores).

llvm-svn: 128661
2011-03-31 19:17:12 +00:00
Caroline Tice d64a08144c Add code to emulate VST1 (multiple single elements) ARM
instruction (floating point store).

llvm-svn: 128656
2011-03-31 18:44:04 +00:00
Caroline Tice bc2b96b699 Add code to emulate VLD1 (single element to one lane) floating point
register load instruction (ARM) .

llvm-svn: 128646
2011-03-31 17:58:23 +00:00
Caroline Tice 31d8498f6f Add code to emulate VLD1 (multiple single elements) ARM instruction.
llvm-svn: 128637
2011-03-31 16:41:19 +00:00
Caroline Tice 8e4ed85520 Add code to emulate VSTR ARM instruction (store a floating point register).
llvm-svn: 128614
2011-03-31 05:38:36 +00:00
Caroline Tice df6dec754b Add code to emulate the VLDR Arm instruction (load a floating poitn register).
llvm-svn: 128613
2011-03-31 05:05:30 +00:00
Caroline Tice b5c6a3e50a Add "Bits64" utility function.
Add code to emulate VSTM ARM instruction (store multiple floating point registers).

llvm-svn: 128609
2011-03-31 03:26:23 +00:00
Greg Clayton 05d2b7f741 Added some functions to our API related to classifying symbols as code, data,
const data, etc, and also for SBAddress objects to classify their type of
section they are in and also getting the module for a section offset address.

    lldb::SymbolType SBSymbol::GetType();
    
    lldb::SectionType SBAddress::GetSectionType ();
    lldb::SBModule SBAddress::GetModule ();

llvm-svn: 128602
2011-03-31 01:08:07 +00:00
Caroline Tice 920c6c9855 Modify ARM instruction tables to allow for specifying floating point variants.
Add code to emulate VLDM ARM instruction (loading multiplt floating point registers).

Add function declarations for other floating point instructions to emulate.

llvm-svn: 128589
2011-03-31 00:02:51 +00:00
Caroline Tice 55bff33b50 Fill in code for EmulateSTRDImm and EmulateSTRDReg, to emulate the
STRD (immediate) and STRD (register) instructions.

llvm-svn: 128570
2011-03-30 19:02:56 +00:00
Greg Clayton 32e0a7509c Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make 
sense by default so that subclasses can check:

int
PlatformSubclass::Foo ()
{
    if (IsHost())
        return Platform::Foo (); // Let the platform base class do the host specific stuff
    
    // Platform subclass specific code...
    int result = ...
    return result;
}

Added new functions to the platform:

    virtual const char *Platform::GetUserName (uint32_t uid);
    virtual const char *Platform::GetGroupName (uint32_t gid);

The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.

Added the parent process ID to the ProcessInfo class. 

Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value, 
    euid == value, egid == value, arch == value, parent == value.
    
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class 
implements the process lookup routines, you can now lists processes on 
your local machine:

machine1.foo.com % lldb
(lldb) platform process list 
PID    PARENT USER       GROUP      EFF USER   EFF GROUP  TRIPLE                   NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538  1      username   usergroup  username   usergroup  x86_64-apple-darwin      FileMerge
94943  1      username   usergroup  username   usergroup  x86_64-apple-darwin      mdworker
94852  244    username   usergroup  username   usergroup  x86_64-apple-darwin      Safari
94727  244    username   usergroup  username   usergroup  x86_64-apple-darwin      Xcode
92742  92710  username   usergroup  username   usergroup  i386-apple-darwin        debugserver


This of course also works remotely with the lldb-platform:

machine1.foo.com % lldb-platform --listen 1234

machine2.foo.com % lldb
(lldb) platform create remote-macosx
  Platform: remote-macosx
 Connected: no
(lldb) platform connect connect://localhost:1444
  Platform: remote-macosx
    Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
    Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
  Hostname: machine1.foo.com
 Connected: yes
(lldb) platform process list 
PID    PARENT USER       GROUP      EFF USER   EFF GROUP  TRIPLE                   NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556  244    username   usergroup  username   usergroup  x86_64-apple-darwin      trustevaluation
99548  65539  username   usergroup  username   usergroup  x86_64-apple-darwin      lldb
99538  1      username   usergroup  username   usergroup  x86_64-apple-darwin      FileMerge
94943  1      username   usergroup  username   usergroup  x86_64-apple-darwin      mdworker
94852  244    username   usergroup  username   usergroup  x86_64-apple-darwin      Safari

The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.

Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:

% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out

Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.

Modified the disassembly to show the current PC value. Example output:

(lldb) disassemble --frame
a.out`main:
   0x1eb7:  pushl  %ebp
   0x1eb8:  movl   %esp, %ebp
   0x1eba:  pushl  %ebx
   0x1ebb:  subl   $20, %esp
   0x1ebe:  calll  0x1ec3                   ; main + 12 at test.c:18
   0x1ec3:  popl   %ebx
-> 0x1ec4:  calll  0x1f12                   ; getpid
   0x1ec9:  movl   %eax, 4(%esp)
   0x1ecd:  leal   199(%ebx), %eax
   0x1ed3:  movl   %eax, (%esp)
   0x1ed6:  calll  0x1f18                   ; printf
   0x1edb:  leal   213(%ebx), %eax
   0x1ee1:  movl   %eax, (%esp)
   0x1ee4:  calll  0x1f1e                   ; puts
   0x1ee9:  calll  0x1f0c                   ; getchar
   0x1eee:  movl   $20, (%esp)
   0x1ef5:  calll  0x1e6a                   ; sleep_loop at test.c:6
   0x1efa:  movl   $12, %eax
   0x1eff:  addl   $20, %esp
   0x1f02:  popl   %ebx
   0x1f03:  leave
   0x1f04:  ret
   
This can be handy when dealing with the new --line options that was recently
added:

(lldb) disassemble --line
a.out`main + 13 at test.c:19
   18  	{
-> 19  		printf("Process: %i\n\n", getpid());
   20  	    puts("Press any key to continue..."); getchar();
-> 0x1ec4:  calll  0x1f12                   ; getpid
   0x1ec9:  movl   %eax, 4(%esp)
   0x1ecd:  leal   199(%ebx), %eax
   0x1ed3:  movl   %eax, (%esp)
   0x1ed6:  calll  0x1f18                   ; printf

Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.

Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two 
following functions to retrieve both paths:

const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;

llvm-svn: 128563
2011-03-30 18:16:51 +00:00
Caroline Tice 23443245e7 Fill in EmulateLDRDRegister to emulate LDRD (register) instruction.
Remove stubs for functions not-to-be-implemented at the moment.

llvm-svn: 128559
2011-03-30 17:54:52 +00:00
Caroline Tice f0901227e3 Fill in EmulateLDRLImmediate to emulate the LDRD (immediate) ARM instruction.
llvm-svn: 128556
2011-03-30 17:11:45 +00:00
Stephen Wilson 464280542b linux: create thread plans for stepping thru PLT entries
Using the new synthetic symbols generated by ObjectFileELF, have the Linux
dynamic loader plugin generate a thread plan that will take us thru a PLT entry
to the corresponding target function.

llvm-svn: 128552
2011-03-30 16:11:36 +00:00
Stephen Wilson 499b40e8a7 elf: synthesize symbols for PLT entries
When populating symbol tables ObjectFileELF now generates a set of synthetic
trampoline symbols.  These new symbols correspond to entries in the program
linkage table and have a (possibly mangled) name identifying the corresponding
symbol in some DSO.  These symbols will be used by the DynamicLoader loader
plugin on Linux to provide thread plans when execution flows from one DSO to
another.

llvm-svn: 128550
2011-03-30 16:07:05 +00:00
Caroline Tice e746dbf83b Fix typo in previous check-in.
llvm-svn: 128549
2011-03-30 16:05:23 +00:00
Stephen Wilson 43fe645b62 elf: add support for ELF relocation entries
llvm-svn: 128548
2011-03-30 15:59:12 +00:00
Stephen Wilson 84ffe7033c linux: initial support for 'real' signal handling
This patch upgrades the Linux process plugin to handle a larger range of signal
events.  For example, we can detect when the inferior has "crashed" and why,
interrupt a running process, deliver an arbitrary signal, and so on.

llvm-svn: 128547
2011-03-30 15:55:52 +00:00
Caroline Tice 527637d64a Fill in EmulateSTRImmARM to emulate the STR (immediate,ARM) instruction.
llvm-svn: 128528
2011-03-30 06:03:24 +00:00
Caroline Tice a0e8cd5e89 Fill in EmulateSTRBImmARM to emulate the STRB (immediate, ARM) instruction.
llvm-svn: 128527
2011-03-30 05:40:56 +00:00
Caroline Tice 4cee4bd9f4 Fill in EmulateSTREX to emulate the STREX ARM instruction.
llvm-svn: 128525
2011-03-30 05:15:46 +00:00
Stephen Wilson dc91686f48 Unfortunately, sranddev() is not available on all platforms so seed using the
current time instead.

llvm-svn: 128514
2011-03-30 00:12:40 +00:00
Caroline Tice 799e203894 Fill in code in EmulateSUBReg to emulate the SUB (register) ARM instruction.
llvm-svn: 128508
2011-03-29 23:44:20 +00:00
Caroline Tice c5bcda4619 Fill in code in EmulateADDRegShift, to emulate the ADD
(register-shifted register) ARM instruction.

llvm-svn: 128500
2011-03-29 23:03:16 +00:00
Jim Ingham 7572fa75cf Can't just call "rand" to get a random port, 'cause then you'll get the same sequence in two lldb's. This makes running lldb on lldb not work very well.
llvm-svn: 128493
2011-03-29 21:45:47 +00:00
Caroline Tice eba8f83479 Add subtraction context.
Add code to emulate SUB (SP minus register) ARM instruction.

Add stubs for other ARM emulation functions that need to be written.

llvm-svn: 128491
2011-03-29 21:24:06 +00:00
Caroline Tice 3f0bfdacc1 Add missing encodings for EmulateMOVRdImm (MOV register) function.
llvm-svn: 128479
2011-03-29 19:53:44 +00:00
Caroline Tice 87c19f61d4 Fix single quote characters throughout the ARM emulation stuff.
Fix bugs in various ARM istruction emulation functions:

EmulateVPUSH
   - Fix context.
   - Fix bug calculating register numbers.

EmulateVPOP
   - Fix context.
   - Fix bug calculating register numbers.

EmulateShiftIMM
   - Fix bug in assert statement.

EmulateLDMDA
   - Fix context.

EmulateLDMDB
   - Fix context.

EmulateLDMIB
   - Fix context.     

EmulateSTM
   - Fix bug calculating lowest_set_bit.     

EmulateSTMDA
   - Fix context.
   - Fix bug calculating lowest_set_bit.

EmulateSTMDB
   - Fix context.
   - Fix bug calculating lowest_set_bit.

EmulateSTMIB
   - FIx context     

EmulateLDRSBImmed
   - Fix test to match correction in corrected manual 

llvm-svn: 128409
2011-03-28 16:10:45 +00:00
Greg Clayton 357132eb9a 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-26 19:14:58 +00:00
Stephen Wilson 78decfd025 linux: minor updates to account for recent namespace changes
llvm-svn: 128313
2011-03-26 00:34:57 +00:00
Stephen Wilson 63f37bba1a Add PlatformGDBServer and ProcessGDBRemote to the build system.
llvm-svn: 128312
2011-03-26 00:32:59 +00:00
Stephen Wilson a78867b899 Simple fixes for the gdb remote process plugin on Linux.
llvm-svn: 128291
2011-03-25 18:16:28 +00:00
Greg Clayton 1080edbcdd Cleaned up the Disassembler code a bit more. You can now request a disassembler
plugin by name on the command line for when there is more than one disassembler
plugin.

Taught the Opcode class to dump itself so that "disassembler -b" will dump
the bytes correctly for each opcode type. Modified all places that were passing
the opcode bytes buffer in so that the bytes could be displayed to just pass
in a bool that indicates if we should dump the opcode bytes since the opcode
now lives inside llvm_private::Instruction.

llvm-svn: 128290
2011-03-25 18:03:16 +00:00
Greg Clayton 0ae962735f Made the lldb_private::Opcode struct into a real boy... I mean class.
Modified the Disassembler::Instruction base class to contain an Opcode 
instance so that we can know the bytes for an instruction without needing
to keep the data around.

Modified the DisassemblerLLVM's instruction class to correctly extract the
opcode bytes if all goes well.

llvm-svn: 128248
2011-03-24 23:53:38 +00:00
Greg Clayton e0d378b334 Fixed the LLDB build so that we can have private types, private enums and
public types and public enums. This was done to keep the SWIG stuff from
parsing all sorts of enums and types that weren't needed, and allows us to
abstract our API better.

llvm-svn: 128239
2011-03-24 21:19:54 +00:00
Caroline Tice 466327d604 Fix small bug in ThumbExpandImm_C; arguments to a call to 'bits' were
in the wrong order.

llvm-svn: 128237
2011-03-24 21:11:26 +00:00
Caroline Tice 9b281e2214 Add missing encodings for EmulateLDRRtRnImm (ARM insn emulation funciton).
llvm-svn: 128229
2011-03-24 19:23:45 +00:00
Greg Clayton 1cb6496eb0 Did a lot more work on abtracting and organizing the platforms.
On Mac OS X we now have 3 platforms:
PlatformDarwin - must be subclassed to fill in the missing pure virtual funcs
                 but this implements all the common functionality between
                 remote-macosx and remote-ios. It also allows for another
                 platform to be used (remote-gdb-server for now) when doing
                 remote connections. Keeping this pluggable will allow for
                 flexibility.
PlatformMacOSX - Now implements both local and remote macosx desktop platforms.
PlatformRemoteiOS - Remote only iOS that knows how to locate SDK files in the
                    cached SDK locations on the host.

A new agnostic platform has been created:
PlatformRemoteGDBServer - this implements the platform using the GDB remote 
                          protocol and uses the built in lldb_private::Host
                          static functions to implement many queries.

llvm-svn: 128193
2011-03-24 04:28:38 +00:00
Stephen Wilson 26977167bc linux: simple support for process input and output
llvm-svn: 128137
2011-03-23 02:14:42 +00:00
Stephen Wilson ecc114745e linux: PlatformLinux improvements
Add a few missing virtual methods to PlatformLinux and have it register itself
with PluginManager.

llvm-svn: 128128
2011-03-23 00:57:47 +00:00
Greg Clayton d314e810a7 Added new platform commands:
platform connect <args>
platform disconnect

Each platform can decide the args they want to use for "platform connect". I 
will need to add a function that gets the connect options for the current
platform as each one can have different options and argument counts.

Hooked up more functionality in the PlatformMacOSX and PlatformRemoteiOS.
Also started an platform agnostic PlatformRemoteGDBServer.cpp which can end
up being used by one or more actual platforms. It can also be specialized and
allow for platform specific commands.

llvm-svn: 128123
2011-03-23 00:09:55 +00:00
Caroline Tice 3e1fa1ad09 More fixes for ARM instruction emulation code:
- Remove duplicate write from EmulateLDRRtPCRelative.
  - Add a missing encoding to EmulateADDSPImm.
  - Fix minor problems in Thumb instruction tables.

llvm-svn: 128115
2011-03-22 22:38:28 +00:00
Greg Clayton 576d8834fe Split the GDBRemoteCommunication class into three classes:
GDBRemoteCommunication - The base GDB remote communication class
GDBRemoteCommunicationClient - designed to be used for clients the connect to
                               a remote GDB server
GDBRemoteCommunicationServer - designed to be used on the server side of a
                               GDB server implementation.

llvm-svn: 128070
2011-03-22 04:00:09 +00:00
Jim Ingham 37023b06bd Add the ability to disassemble "n" instructions from the current PC, or the first "n" instructions in a function.
Also added a "-p" flag that disassembles from the current pc.

llvm-svn: 128063
2011-03-22 01:48:42 +00:00
Greg Clayton 7a5388bf75 Split all of the core of LLDB.framework/lldb.so into a
static archive that can be linked against. LLDB.framework/lldb.so
exports a very controlled API. Splitting the API into a static
library allows other tools (debugserver for now) to use the power
of the LLDB debugger core, yet not export it as its API is not
portable or maintainable. The Host layer and many of the other
internal only APIs can now be statically linked against.

Now LLDB.framework/lldb.so links against "liblldb-core.a" instead
of compiling the .o files only for the shared library. This fix
is only for compiling with Xcode as the Makefile based build already
does this.

The Xcode projecdt compiler has been changed to LLVM. Anyone using
Xcode 3 will need to manually change the compiler back to GCC 4.2,
or update to Xcode 4.

llvm-svn: 127963
2011-03-20 04:57:14 +00:00
Greg Clayton ded470d31a Added more platform support. There are now some new commands:
platform status -- gets status information for the selected platform
platform create <platform-name> -- creates a new instance of a remote platform
platform list -- list all available platforms
platform select -- select a platform instance as the current platform (not working yet)

When using "platform create" it will create a remote platform and make it the
selected platform. For instances for iPhone OS debugging on Mac OS X one can 
do:

(lldb) platform create remote-ios --sdk-version=4.0
Remote platform: iOS platform
SDK version: 4.0
SDK path: "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0"
Not connected to a remote device.
(lldb) file ~/Documents/a.out
Current executable set to '~/Documents/a.out' (armv6).
(lldb) image list
[  0] /Volumes/work/gclayton/Documents/devb/attach/a.out
[  1] /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/dyld
[  2] /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/libSystem.B.dylib


Note that this is all happening prior to running _or_ connecting to a remote
platform. Once connected to a remote platform the OS version might change which
means we will need to update our dependecies. Also once we run, we will need
to match up the actualy binaries with the actualy UUID's to files in the
SDK, or download and cache them locally.

This is just the start of the remote platforms, but this modification is the
first iteration in getting the platforms really doing something.

llvm-svn: 127934
2011-03-19 01:12:21 +00:00
Caroline Tice 77c13fe304 Fix various small problems with EmulateInstructionARM::EmulateSTRRtSP.
llvm-svn: 127898
2011-03-18 19:41:00 +00:00
Jim Ingham b7603bb48d Relax the constraint on the types of ValueObjects that we'll by default try the
ObjC runtime for print object to Pointer AND Integer (from just pointer.)

llvm-svn: 127841
2011-03-18 00:05:18 +00:00
Caroline Tice 4c753376cb Make all the codee that attempts to read the PC consistently use
ReadCoreReg (which 'does the right thing', adding to pc when needed);
fixed places in code where extra addition was being passed along.

Fix bug in insn tables.

llvm-svn: 127838
2011-03-17 23:50:16 +00:00
Jim Ingham 8268ccab60 Fix a problem where we were looking up the class pointer in the {class/sel -> implementation} cache for a objc_msgSendSuper call - where we should have looked up the class's super-class.
llvm-svn: 127830
2011-03-17 21:04:33 +00:00
Jim Ingham 35944dda10 Get ObjC stepping working again when the process is not the default host architecture.
llvm-svn: 127825
2011-03-17 20:02:56 +00:00
Caroline Tice aaf5ddcf82 Add code to emulate STRH (Register) Arm instruction.
Remove inaccurate comments from EmulateInstruction::Context definition.

Fix contexts in a few arm instruction emulation routines.

llvm-svn: 127770
2011-03-16 22:46:55 +00:00
Caroline Tice fe28f1bff9 Fix various small bugs found in the instruction emulation functions.
llvm-svn: 127712
2011-03-16 00:06:12 +00:00
Greg Clayton 3690964ca1 Added a fix that should help incorrect type uniquing. There was an issue
for templatized types that could cause parts of a std::vector (and I am sure
other STL types) to be incorrectly uniqued to each other wreaking havoc on 
variable display for types within the same executable module.

llvm-svn: 127662
2011-03-15 04:38:20 +00:00
Greg Clayton 616f490777 Added a fix to not re-use object files when doing DWARF with debug map.
llvm-svn: 127659
2011-03-15 03:56:33 +00:00
Sean Callanan fb0b7583a7 Updated to LLVM/Clang revision 127600.
llvm-svn: 127634
2011-03-15 00:17:19 +00:00
Stephen Wilson 1636265248 Add Makefile support for the Platform plugins.
This patch supports building the Linux platform plugin, and should also support
the MacOSX plugin as well (the MacOSX side has not been tested, unfortunately).
A small typo was corrected in lldb.cpp to initialize the new platform code on
Linux.

llvm-svn: 127393
2011-03-10 03:08:28 +00:00
Greg Clayton c574ede632 Centralize the GDB remote timeout value into the GDBRemoteCommunication as a
member variable (m_packet_timeout which is a value in seconds). This value is
then used for all packets sent to/from the remote GDB server.

llvm-svn: 127392
2011-03-10 02:26:48 +00:00
Sean Callanan b8205b1588 Fixed a bug where the disassembly syntax specified for the
ARM disassembler was wrong, causing the disassembler to fail
to initialize.

llvm-svn: 127302
2011-03-09 01:02:51 +00:00
Greg Clayton e996fd30be LLDB now has "Platform" plug-ins. Platform plug-ins are plug-ins that provide
an interface to a local or remote debugging platform. By default each host OS
that supports LLDB should be registering a "default" platform that will be
used unless a new platform is selected. Platforms are responsible for things
such as:
- getting process information by name or by processs ID
- finding platform files. This is useful for remote debugging where there is 
  an SDK with files that might already or need to be cached for debug access.
- getting a list of platform supported architectures in the exact order they
  should be selected. This helps the native x86 platform on MacOSX select the
  correct x86_64/i386 slice from universal binaries.
- Connect to remote platforms for remote debugging
- Resolving an executable including finding an executable inside platform
  specific bundles (macosx uses .app bundles that contain files) and also
  selecting the appropriate slice of universal files for a given platform.

So by default there is always a local platform, but remote platforms can be
connected to. I will soon be adding a new "platform" command that will support
the following commands:
(lldb) platform connect --name machine1 macosx connect://host:port
Connected to "machine1" platform.
(lldb) platform disconnect macosx

This allows LLDB to be well setup to do remote debugging and also once 
connected process listing and finding for things like:
(lldb) process attach --name x<TAB>

The currently selected platform plug-in can now auto complete any available
processes that start with "x". The responsibilities for the platform plug-in
will soon grow and expand.

llvm-svn: 127286
2011-03-08 22:40:15 +00:00
Stephen Wilson d126c8cc5a Fix ObjectFileElf::GetEntryPointAddress()
ELF object files do not implicitly have a symbol named "start" as an entry
point.  For example, on Linux it is often named "_start", but can be trivially
set to any symbol by passing an --entry argument to the linker.

Use the ELF header to determine the entry point and resolve the associated
section based on that address.

Also, update the linux dynamic loader to call GetEntryPointAddress instead of
GetEntryPoint.

llvm-svn: 127218
2011-03-08 04:12:15 +00:00
Stephen Wilson 8f0daa28d4 Add Makefile support for the new DynamicLoaderStatic plugin.
llvm-svn: 127215
2011-03-08 03:57:00 +00:00
Jim Ingham bd3f260698 I didn't notice there was already an ObjectFile::GetEntryPoint. Move that over to GetEntryPointAddress 'cause that's more consistent with other functions in ObjectFile, do the mutatis mutandi and also in the ELF case I return a section offset address rather than a bare load address.
llvm-svn: 127205
2011-03-08 01:54:01 +00:00
Jim Ingham 5ca40258ea Reverting the part of the debug-in-ofile patch from earlier today that removes them from the shared module list. That was causing a bunch of asserts. Greg is working on a better fix.
llvm-svn: 127201
2011-03-08 01:49:10 +00:00
Jim Ingham 672e6f59c5 Add a method "GetEntryPoint" to the ObjectFile class, and implement it on MachO & ELF - though the ELF implementation is probably a little weak. Then use this method in place of directly looking for "start" in the ThreadPlanCallFunction constructor to find the stopping point for our function evaluation.
llvm-svn: 127194
2011-03-07 23:44:08 +00:00
Greg Clayton 0bb165a7a7 Don't cache .o files in the debug map + DWARF in .o files. If we cache them
then we end up using older .o files with out of date section remappings if
we debug, compile + fix, and debug again.

llvm-svn: 127166
2011-03-07 18:51:54 +00:00
Greg Clayton fc7117ae93 Added a DynamicLoaderStatic plug-in that will act as a static dynamic loader.
It will just load all files exactly where the files state they are (file
addresses == load addresses). This is used when the llvm::Triple::OSType is
set to llvm::Triple::UnknownOS or llvm::Triple::NoOS.

llvm-svn: 127053
2011-03-05 01:04:56 +00:00
Greg Clayton 874472584d Allow the macosx frame backchain to use 32/64 bit as the selector when
chosing which FP back-chain methods to use since we can rely upon generic 
register numbers after that.

llvm-svn: 127044
2011-03-04 22:59:14 +00:00
Caroline Tice 94f87e37c8 Add code to emulate RFE Arm instruction.
Add new instruction context for RFE instruction.

Add several new helper functions to help emulate RFE instruction
(including CurrentModeIsPrivileged, BadMode, and CPSRWriteByInstr).

llvm-svn: 126965
2011-03-03 22:37:46 +00:00
Caroline Tice c8d0d3ae0b Add code to emulate UXTH Arm instruction.
llvm-svn: 126954
2011-03-03 18:48:58 +00:00
Caroline Tice 9c35f321c6 Add code to emulate UXTB Arm instruction.
llvm-svn: 126953
2011-03-03 18:27:17 +00:00
Caroline Tice 8678f2a192 Add code to emulate SXTH Arm instruction.
llvm-svn: 126951
2011-03-03 18:04:49 +00:00
Caroline Tice 67735bf069 Add code to emulate SXTB Arm instruction.
llvm-svn: 126949
2011-03-03 17:42:58 +00:00
Caroline Tice edc103e253 Fix bug where bitwise-AND was being used and it should have been bitwise-OR.
llvm-svn: 126904
2011-03-03 00:07:02 +00:00
Caroline Tice 30f40c6850 Add code to emulate ADD (immediate, Thumb) Arm instruction.
Add addition context to EmulateInstruction contexts.

llvm-svn: 126903
2011-03-02 23:57:02 +00:00
Caroline Tice 1a234ff46f Add code to emulate MUL Arm instruction.
Add new context type & info structure for  mul instruction.

llvm-svn: 126891
2011-03-02 22:43:54 +00:00
Greg Clayton 5f2a4f999d Added a missing API call in SBTarget that enables one to get
anything in a SBSymbolContext filled in given an SBAddress:

SBSymbolContext
SBTarget::ResolveSymbolContextForAddress (const SBAddress& addr, uint32_t resolve_scope);

Also did a little cleanup on the ProcessGDBRemote stdio file handle
code.

llvm-svn: 126885
2011-03-02 21:34:46 +00:00
Caroline Tice a0d3b67572 Add code to emulate LDRSH (register) Arm instruction.
llvm-svn: 126881
2011-03-02 21:13:44 +00:00
Caroline Tice 1cd4459b21 Add code to emulate LDRSH (literal) Arm instruction.
llvm-svn: 126866
2011-03-02 19:45:34 +00:00
Caroline Tice d3e57ee4fc Add code to emulate LDRSH (immediate) Arm instruction.
llvm-svn: 126807
2011-03-02 00:39:42 +00:00
Caroline Tice 4776fbbd72 Add code to emulate LDRSB (register) Arm instruction.
llvm-svn: 126802
2011-03-01 23:55:59 +00:00
Caroline Tice 4947ffc80d Add code to emulate LDRSB (literal) Arm instruction.
llvm-svn: 126789
2011-03-01 22:25:17 +00:00
Caroline Tice 28c3fcccb2 Add code to emulate LDRSB (immediate) Arm instruction.
llvm-svn: 126783
2011-03-01 21:53:03 +00:00
Caroline Tice 4f0e5f8852 Add code to emulate LDRH (register) Arm instruction.
llvm-svn: 126758
2011-03-01 18:00:42 +00:00
Caroline Tice 6261d240e1 Add code to emulate LDRH (literal) Arm instruction.
llvm-svn: 126709
2011-02-28 23:15:24 +00:00
Stephen Wilson bbb7e06ad3 Add register context for i386 on Linux.
Patch by Marco Minutoli!

llvm-svn: 126696
2011-02-28 22:52:38 +00:00
Caroline Tice adef8fb003 Add code to emulate LDRH (immediate, Thumb) arm instruction.
llvm-svn: 126692
2011-02-28 22:39:58 +00:00
Johnny Chen 699ac0e967 Add emulation for Encoding A1 of A8.6.97 MOV (register).
llvm-svn: 126456
2011-02-25 00:23:25 +00:00
Greg Clayton 7133762232 Fixed CommandReturnObject::SetImmediateErrorFile() to set the correct stream.
Modifed lldb_private::Process to be able to handle connecting to a remote 
target that isn't running a process. This leaves lldb_private::Process in the
eStateConnected state from which we can then do an attach or launch.

Modified ProcessGDBRemote to be able to set stdin, stdout, stderr, working
dir, disable ASLR and a few other settings down by using new GDB remote 
packets. This allows us to keep all of our current launch flags and settings
intact and still be able to communicate them over to the remote GDB server.
Previously these were being sent as arguments to the debugserver binary that
we were spawning. Also modified ProcessGDBRemote to handle losing connection
to the remote GDB server and always exit immediately. We do this by watching
the lldb_private::Communication event bit for the read thread exiting in the
ProcessGDBRemote async thread.

Added support for many of the new 'Q' packets for setting stdin, stdout,
stderr, working dir and disable ASLR to the GDBRemoteCommunication class for
easy accesss.

Modified debugserver for all of the new 'Q' packets and also made it so that
debugserver always exists if it loses connection with the remote debugger.

llvm-svn: 126444
2011-02-24 22:24:29 +00:00
Johnny Chen a517bae73c Fix typos in the opcode entries for branch instructions.
llvm-svn: 126442
2011-02-24 21:54:22 +00:00
Johnny Chen 3c970dc50d Add emulation for BXJ (Branch and Exchange Jazelle), assuming that the attempt to
switch to Jazelle state fails, thus treating BXJ as a BX operation.

llvm-svn: 126423
2011-02-24 21:01:20 +00:00
Stephen Wilson 17e3d193e1 linux: Use ArchSpec::GetCore and the ArchSpec::Core enums.
llvm-svn: 126406
2011-02-24 19:17:09 +00:00
Stephen Wilson 3f4200fd9d linux: Remove a local ObjectFileELF version of GetArchitecture.
Also fix a bug where we were not lazily parsing the ELF header and thus
returning an ArchSpec with invalid cpu type components.  Initialize the cpu
subtype as LLDB_INVALID_CPUTYPE for compatibility with the new ArchSpec
implementation.

llvm-svn: 126405
2011-02-24 19:16:15 +00:00
Johnny Chen bf4afa8796 Add emulation methods for Bitwise Bit Clear (immediate and register) operations.
llvm-svn: 126355
2011-02-24 01:15:17 +00:00
Johnny Chen 132548df62 Add emulation methods for "SUB (immediate, Thumb)" and "SUB (immediate, ARM)" operations.
llvm-svn: 126343
2011-02-23 23:47:56 +00:00
Johnny Chen d88d96cac9 Add emulation for "ADR" operations. Add a ThumbImm8Scaled() convenience function
and rename the original ThumbImmScaled() function to ThumbImm7Scaled().

llvm-svn: 126335
2011-02-23 21:24:25 +00:00
Johnny Chen 5278cd11ba Modify EmulateSUBSPImm() to handle the cases with generic Rd value instead of
Rd == 13.  Add opcode entries for the generic "sub (sp minus immediate)" operations.

llvm-svn: 126293
2011-02-23 01:55:07 +00:00
Johnny Chen 187b0e37c1 Add emulation methods for "SBC (immediate)" and "SBC (register)" operations.
llvm-svn: 126283
2011-02-23 01:01:21 +00:00
Greg Clayton 64195a2c8b Abtracted all mach-o and ELF out of ArchSpec. This patch is a modified form
of Stephen Wilson's idea (thanks for the input Stephen!). What I ended up
doing was:
- Got rid of ArchSpec::CPU (which was a generic CPU enumeration that mimics
  the contents of llvm::Triple::ArchType). We now rely upon the llvm::Triple 
  to give us the machine type from llvm::Triple::ArchType.
- There is a new ArchSpec::Core definition which further qualifies the CPU
  core we are dealing with into a single enumeration. If you need support for
  a new Core and want to debug it in LLDB, it must be added to this list. In
  the future we can allow for dynamic core registration, but for now it is
  hard coded.
- The ArchSpec can now be initialized with a llvm::Triple or with a C string
  that represents the triple (it can just be an arch still like "i386").
- The ArchSpec can still initialize itself with a architecture type -- mach-o
  with cpu type and subtype, or ELF with e_machine + e_flags -- and this will
  then get translated into the internal llvm::Triple::ArchSpec + ArchSpec::Core.
  The mach-o cpu type and subtype can be accessed using the getter functions:
  
  uint32_t
  ArchSpec::GetMachOCPUType () const;

  uint32_t
  ArchSpec::GetMachOCPUSubType () const;
  
  But these functions are just converting out internal llvm::Triple::ArchSpec 
  + ArchSpec::Core back into mach-o. Same goes for ELF.

All code has been updated to deal with the changes.

This should abstract us until later when the llvm::TargetSpec stuff gets
finalized and we can then adopt it.

llvm-svn: 126278
2011-02-23 00:35:02 +00:00
Johnny Chen 673badf292 Renamed macro definition of CPSR_C to be CPSR_C_POS to avoid confusions and subtle bugs.
llvm-svn: 126271
2011-02-23 00:15:56 +00:00
Johnny Chen 7deb7422bc Add emulation methods for "RSC (immediate)" and "RSC (register)" operations.
llvm-svn: 126267
2011-02-23 00:07:09 +00:00
Johnny Chen 447c001048 Add emulation methods for "RSB (immediate)" and "RSB (register)".
Plus add missing break stmts for "case" blocks.

llvm-svn: 126265
2011-02-22 23:42:58 +00:00
Johnny Chen 5f88bcc16a Add two convenience functions: DecodeImmShiftThumb() and DecodeImmShiftARM() to ARMUtils.h.
Use them within EmulateInstructionARM.cpp to save repetitive typing.

llvm-svn: 126247
2011-02-22 21:17:52 +00:00
Johnny Chen 83a4ddd0cb Add "cmp<c>.w <Rn>, #<const>" emulation to EmulateCMPImm() method,
and implement EmulateCMNImm() and EMulateCMNReg() methods.

llvm-svn: 126236
2011-02-22 19:48:22 +00:00
Greg Clayton 681254c830 Remove an assertion that was causing a crash.
llvm-svn: 126235
2011-02-22 19:32:07 +00:00
Johnny Chen aebcfc86df Fix the 'variants' field of "CMN (immediate)" Encoding T1 entry, it should be ARMV6T2_ABOVE, not ARMvAll.
llvm-svn: 126234
2011-02-22 19:01:11 +00:00
Johnny Chen 01ceff367a Add ARM encoding entries for "CMN (immediate)" and "CMN (register)" operations.
llvm-svn: 126179
2011-02-22 02:00:12 +00:00
Johnny Chen 5ea119468a Add ARM encoding entries for "CMP (immediate)" and "CMP (register)" operations.
Add ARM/Thumb encoding entries for "CMN (immediate)" and "CMN (register)" operations,
with the EmulateCMNImm()/Reg() methods not implemented yet for now.

llvm-svn: 126178
2011-02-22 01:56:31 +00:00
Johnny Chen c2fa8fafde Add emulation methods for "MVN (immediate)" and "MVN (register)".
llvm-svn: 126172
2011-02-22 01:01:03 +00:00
Johnny Chen e69108a78f Add emulation methods for "EOR (Immediate)", "EOR (register)",
"TEQ (immediate)", and "TEQ (register)" operations.

llvm-svn: 126160
2011-02-21 23:42:44 +00:00