Commit Graph

2094 Commits

Author SHA1 Message Date
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
Caroline Tice 6258c53e12 Add thread state initialization to the thread where the interactive
interpreter is run (which is separate from the thread where
Py_Initialize is called, where this normally gets set up).

llvm-svn: 127191
2011-03-07 23:24:28 +00:00
Johnny Chen d648135902 Add an extra twist of stopping the inferior in a breakpoint, and then continue till it's done.
We should still see the entire stdout redirected once the process is finished.

llvm-svn: 127184
2011-03-07 22:46:30 +00:00
Johnny Chen 75625aa118 Add test cases for SBTarget.Launch() API with the stdout of the inferior redirected to a file.
llvm-svn: 127179
2011-03-07 22:29:04 +00:00
Johnny Chen 2f6f7ba879 Add TestThreadAPI.py file to house the Python SBThread API test cases.
Currently it has only test cases for SBThread.GetStopDescription() API.

Also modified lldb.swig to add typemap for (char *dst, size_t dst_len)
which occurs for SBThread::GetStopDescription() C++ API.  For Python
scripting:

    # Due to the typemap magic (see lldb.swig), we pass in an (int)length to GetStopDescription
    # and expect to get a Python string as the result object!
    # The 100 is just an arbitrary number specifying the buffer size.
    stop_description = thread.GetStopDescription(100)

llvm-svn: 127173
2011-03-07 21:28:57 +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
Johnny Chen 930e3ad51e Add a test case ProcessAPITestCase.test_remote_launch() which tests SBProcess.RemoteLaunch()
API with a process not in eStateConnected, and checks that the remote launch failed.

Modify SBProcess::RemoteLaunch()/RemoteAttachToProcessWithID()'s log statements to fix a
crasher when logging is turned on.

llvm-svn: 127055
2011-03-05 01:20:11 +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
Johnny Chen 05178f6e54 Add a test case for the lldb command 'process connect'.
We start a fake debugserver listening on localhost:12345 and issue the command
'process connect connect://localhost:12345' to connect to it.

llvm-svn: 127048
2011-03-04 23:40:06 +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
Johnny Chen 3ef86dc7da Add docstrings for unittest framework's test methods.
llvm-svn: 127025
2011-03-04 19:47:52 +00:00
Johnny Chen 5f45f6c014 Change the CFLAGS variable assignment operator to ?= (conditional variable assignment operator).
This allows us to override CFLAGS on the command line:

$ CFLAGS='-arch $(ARCH) -gdwarf-2 -O0' ./dotest.py -C clang -A i386 -v objc-optimized

Session logs for test failures/errors will go into directory '2011-03-04-10_33_57'
Command invoked: python ./dotest.py -C clang -A i386 -v objc-optimized
----------------------------------------------------------------------
Collected 2 tests

1: test_break_with_dsym (TestObjcOptimized.ObjcOptimizedTestCase)
   Test 'expr member' continues to work for optimized build. ... ok
2: test_break_with_dwarf (TestObjcOptimized.ObjcOptimizedTestCase)
   Test 'expr member' continues to work for optimized build. ... ok

----------------------------------------------------------------------
Ran 2 tests in 1.902s

OK
$

llvm-svn: 127011
2011-03-04 18:31:00 +00:00
Johnny Chen 3b83d63a17 Add TestObjcOptimized.py under the objc-optimized directory to
test that objective-c expression parser continues to work for optimized build.

Radar filed:
# rdar://problem/9087739
# test failure: objc_optimized does not work for "-C clang -A i386"

llvm-svn: 127009
2011-03-04 18:17:49 +00:00
Johnny Chen 60a084a24d Add objc source file and Makefile. Test case to follow.
llvm-svn: 126980
2011-03-04 01:54:19 +00:00
Johnny Chen e0ec9ea5ce Add the ability for the test suite to specify a list of compilers and a list of architectures
on the command line.  For example, use '-A x86_64^i386' to launch the inferior use both x86_64
and i386.

This is an example of building the debuggee using both clang and gcc compiers:

[17:30:46] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -C clang^gcc -v -f SourceManagerTestCase.test_modify_source_file_while_debugging

Session logs for test failures/errors will go into directory '2011-03-03-17_31_39'
Command invoked: python ./dotest.py -C clang^gcc -v -f SourceManagerTestCase.test_modify_source_file_while_debugging

Configuration:  compiler=clang
----------------------------------------------------------------------
Collected 1 test

1: test_modify_source_file_while_debugging (TestSourceManager.SourceManagerTestCase)
   Modify a source file while debugging the executable. ... Command 'run' failed!

original content: #include <stdio.h>

int main(int argc, char const *argv[]) {
    printf("Hello world.\n"); // Set break point at this line.
    return 0;
}

new content: #include <stdio.h>

int main(int argc, char const *argv[]) {
    printf("Hello lldb.\n"); // Set break point at this line.
    return 0;
}

os.path.getmtime() after writing new content: 1299202305.0
content restored to: #include <stdio.h>

int main(int argc, char const *argv[]) {
    printf("Hello world.\n"); // Set break point at this line.
    return 0;
}

os.path.getmtime() after restore: 1299202307.0
ok

----------------------------------------------------------------------
Ran 1 test in 8.259s

OK

Configuration:  compiler=gcc
----------------------------------------------------------------------
Collected 1 test

1: test_modify_source_file_while_debugging (TestSourceManager.SourceManagerTestCase)
   Modify a source file while debugging the executable. ... original content: #include <stdio.h>

int main(int argc, char const *argv[]) {
    printf("Hello world.\n"); // Set break point at this line.
    return 0;
}

new content: #include <stdio.h>

int main(int argc, char const *argv[]) {
    printf("Hello lldb.\n"); // Set break point at this line.
    return 0;
}

os.path.getmtime() after writing new content: 1299202307.0
content restored to: #include <stdio.h>

int main(int argc, char const *argv[]) {
    printf("Hello world.\n"); // Set break point at this line.
    return 0;
}

os.path.getmtime() after restore: 1299202309.0
ok

----------------------------------------------------------------------
Ran 1 test in 2.301s

OK
[17:31:49] johnny:/Volumes/data/lldb/svn/trunk/test $ 

llvm-svn: 126979
2011-03-04 01:35:22 +00:00
James McIlree 9631aae211 Expose ConnectRemote API through SBTarget and SBProcess.
Patch verified by Greg Clayton prior to checkin.

llvm-svn: 126974
2011-03-04 00:31:13 +00:00
Sean Callanan 54366f12cb Fixed a bug in the expression parser where the 'this'
or 'self' variable was not properly read if the compiler
optimized it into a register.

llvm-svn: 126973
2011-03-04 00:23:47 +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
Johnny Chen ed4019802d Add TestDisasmAPI.py which exercises the newly added SBFunction/SBSymbol.GetStartAddress(),
among other things:

// When stopped on breakppint 1, we can get the line entry using SBFrame API
// SBFrame.GetLineEntry().  We'll get the start address for the the line entry
// with the SBAddress type, resolve the symbol context using the SBTarget API
// SBTarget.ResolveSymbolContextForAddress() in order to get the SBSymbol.
//
// We then stop at breakpoint 2, get the SBFrame, and the the SBFunction object.
//
// The address from calling GetStartAddress() on the symbol and the function
// should point to the same address, and we also verify that.

And add one utility function disassemble(target, function_or_symbol) to lldbutil.py:

    """Disassemble the function or symbol given a target.

    It returns the disassembly content in a string object.
    """

TestDisasm.py uses the disassemble() function to do disassembly on the SBSymbol, and
then the SBFunction object.

llvm-svn: 126955
2011-03-03 19:14:00 +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
Johnny Chen d61816b5b8 Add TestTargetAPI.py:
// When stopped on breakppint 1, and then 2, we can get the line entries using
// SBFrame API SBFrame.GetLineEntry().  We'll get the start addresses for the
// two line entries; with the start address (of SBAddress type), we can then
// resolve the symbol context using the SBTarget API
// SBTarget.ResolveSymbolContextForAddress().
//
// The two symbol context should point to the same symbol, i.e., 'a' function.


Add two utility functions to lldbutil.py:

o get_stopped_threads(process, reason):

  return the list of threads with the specified stop reason or an empty list if not found

o get_stopped_thread(process, reason):

  return the first thread with the given stop reason or None if not found

llvm-svn: 126916
2011-03-03 01:41:57 +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
Greg Clayton 93d00df578 Export the ability to get the start and end addresses for functions
and symbols, and also allow clients to get the prologue size in bytes:

    SBAddress
    SBFunction::GetStartAddress ();
    
    SBAddress
    SBFunction::GetEndAddress ();
    
    uint32_t
    SBFunction::GetPrologueByteSize ();

    SBAddress
    SBSymbol::GetStartAddress ();
    
    SBAddress
    SBSymbol::GetEndAddress ();
    
    uint32_t
    SBSymbol::GetPrologueByteSize ();

llvm-svn: 126892
2011-03-02 23:01:18 +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
Johnny Chen 43e587c1f6 Clarified the docstrings for int_to_bytearray() and bytearray_to_int().
llvm-svn: 126877
2011-03-02 20:54:22 +00:00
Jim Ingham 843d20aa7a Add some function docs.
llvm-svn: 126868
2011-03-02 19:58:15 +00:00
Johnny Chen 4e90a7e503 Add some comments.
llvm-svn: 126867
2011-03-02 19:49:27 +00:00
Caroline Tice 1cd4459b21 Add code to emulate LDRSH (literal) Arm instruction.
llvm-svn: 126866
2011-03-02 19:45:34 +00:00
Johnny Chen 43766d6f12 Add two utility functions to lldbutil.py:
o int_to_bytearray()
o bytearray_to_int()

They return/interpret the bytearray in the little endian format.
For big endian, simply perform ba.reverse() on the bytearray object.

And modify TestProcessAPI.py to take advantage of the functions.

llvm-svn: 126813
2011-03-02 01:36:45 +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
Johnny Chen cf386e24ab Add an API SBProcess::GetByteOrder() and add test cases which utilizes GetByteOrder(),
among other SBProcess APIs, to write (int)256 into a memory location of a global variable
(int)my_int and reads/checks the variable afterwards.

llvm-svn: 126792
2011-03-01 22:56:31 +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
Johnny Chen 0dd049204c Fix wrong placement of skipUnless() decorator.
llvm-svn: 126774
2011-03-01 19:53:43 +00:00
Johnny Chen 90aa594c5e Add test methods for SBProcess.WriteMemory() API to the TestProcessAPI.py file.
This makes the number of total tests equal to 201.

llvm-svn: 126769
2011-03-01 18:51:47 +00:00
Caroline Tice 4f0e5f8852 Add code to emulate LDRH (register) Arm instruction.
llvm-svn: 126758
2011-03-01 18:00:42 +00:00
Johnny Chen 37f99fdb73 Add TestProcessAPI.py which exercises some Python SBProcess API. In particular, this tests
the SBProcess.ReadMemory() API, which, due to SWIG typemap'ing, expects 3 arguments (the location
to read from, the size in bytes to read, and an SBError object), and returns the result as a
Python string object.

On SnowLeopard where this has been tested, the SWIG script needs to be pampered (use the exact
same parameter names as in SBProcess.h) in order for this to work.

llvm-svn: 126736
2011-03-01 02:20:14 +00:00
Jim Ingham 6b90ba414a Look for swig in /usr/bin and /usr/local/bin.
llvm-svn: 126732
2011-03-01 01:39:04 +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 725269a0b4 If the user sets a working directory path using "process launch -w <path>", honor that dir path;
otherwise, use the thing the debugserver is started with.

Fixed rdar://problem/9056462
The process launch flag '-w' for setting the current working directory not working?

llvm-svn: 126537
2011-02-26 01:36:13 +00:00
Johnny Chen 4899420f17 Simplify the dictionary setting for test_set_working_dir_* methods.
llvm-svn: 126531
2011-02-25 23:24:25 +00:00
Johnny Chen d08df5b016 Call self.setTearDownCleanup() and pass a proper dictionay to properly cleanup
the intermediate files built with the same dictionary during test execution.

llvm-svn: 126530
2011-02-25 23:22:59 +00:00
Johnny Chen 90eb2cbaee Add a test case to exercise the process launch flag of '-w <path>' which sets the
current working directory when running the inferior.  Radar filed:

    # rdar://problem/9056462
    # The process launch flag '-w' for setting the current working directory not working?

llvm-svn: 126529
2011-02-25 23:15:09 +00:00
Johnny Chen 51433bf688 Renamed the Python test file to be TestProcessLaunch.py.
llvm-svn: 126517
2011-02-25 21:37:56 +00:00
Johnny Chen 80180e1257 Renamed the test class to be ProcessLaunchTestCase.
llvm-svn: 126516
2011-02-25 21:36:35 +00:00
Johnny Chen 40b328ca48 Simplified the code a little bit.
llvm-svn: 126515
2011-02-25 21:32:36 +00:00
Johnny Chen f85c0eb65d Renamed test/process_io directory to test/process_launch, in preparation to add additional tests
related to 'process launch' command.

llvm-svn: 126514
2011-02-25 21:21:21 +00:00
Johnny Chen 0e65ce3de8 Add readme on the version of emacs that works with lldb-enhanced gud.el,
for Stuart Hastings. :-)

llvm-svn: 126469
2011-02-25 01:51:25 +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
Johnny Chen e1e020dc29 The lldb-enhanced gud.el does not work on emacs 22.1.1 (dumb terminal).
This is the error I got:

Debugger entered--Lisp error: (void-function split-string-and-unquote)
  (split-string-and-unquote command-line)
  (let* ((words ...) (program ...) (dir default-directory) (file-word ...) (file-subst ...) (args ...) (file ...) (filepart ...) (existing-buffer ...)) (pop-to$
  gud-common-init("/Volumes/data/lldb/svn/trunk/build/Debug/lldb" nil gud-lldb-marker-filter)
  lldb("/Volumes/data/lldb/svn/trunk/build/Debug/lldb")
  call-interactively(lldb)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)

The gud-common-init elisp function references split-string-and-unquote function
which is not defined there.

llvm-svn: 126449
2011-02-24 23:13:28 +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
Jim Ingham f6ea93fbab When making a DataExtractor from a Value that's got a ClangType, set the AddressByteSize from the AST Context.
llvm-svn: 126433
2011-02-24 21:23:14 +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
Stephen Wilson bd58871d96 Host: linux: Use llvm::sys::getHostTriple for the default host ArchSpec.
Previously we were using a set of preprocessor defines and returning an ArchSpec
without any OS/Vendor information.  This fixes an issue with plugin resolution
on Linux where a valid OS component is needed.

llvm-svn: 126404
2011-02-24 19:15:09 +00:00
Stephen Wilson facebfc354 ArchSpec: Do not depend on Host::GetArchitecture.
The major issue this patch solves is that ArchSpec::SetTriple no longer depends
on the implementation of Host::GetArchitecture.  On linux, Host::GetArchitecture
calls ArchSpec::SetTriple, thus blowing the stack.

A second smaller point is that SetTriple now defaults to Host defined components
iff all OS, vendor and environment fields are not set.

llvm-svn: 126403
2011-02-24 19:13:58 +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
Greg Clayton 1971900fdc Don't enable thread safe logging as it currently deadlocks logging.
llvm-svn: 126260
2011-02-22 23:08:31 +00:00
Greg Clayton 76b436e21d Make logs threadsafe (add the -t option) when logging API stuff.
llvm-svn: 126257
2011-02-22 22:59:30 +00:00
Sean Callanan 2d1f4be47a Fixed a hang in the expression parser's result synthesizer that occurs when the function generated for the expression is completely empty except for a NULL_STMT. This happens sometimes when the parser returns errors.
llvm-svn: 126251
2011-02-22 21:52:56 +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
Johnny Chen 28c5882cb5 Add emulation methods for "TST (immediate)" and "TST (register)".
Plus modified EmulateANDImm/Reg to delegate to TSTImm/Reg for Thumb2
32-bit instructions when Rd == '1111' and setflags is true.

llvm-svn: 126144
2011-02-21 21:24:49 +00:00
Greg Clayton 9d0402b1eb Don't limit StreamTee to just two streams. It now can contain
N streams by making the stream a vector of stream shared pointers
that is protected by a mutex. Streams can be get/set by index which
allows indexes to be defined as stream indentifiers. If a stream is
set at index 3 and there are now streams in the collection, then
empty stream objects are inserted to ensure that stream at index 3
has a valid stream. There is also an append method that allows a stream
to be pushed onto the stack. This will allow our streams to be very
flexible in where the output goes.

Modified the CommandReturnObject to use the new StreamTee functionality.
This class now defines two StreamTee indexes: 0 for the stream string
stream, and 1 for the immediate stream. This is used both on the output
and error streams.

Added the ability to get argument types as strings or as descriptions.
This is exported through the SBCommandInterpreter API to allow external
access.

Modified the Driver class to use the newly exported argument names from
SBCommandInterpreter::GetArgumentTypeAsCString().

llvm-svn: 126067
2011-02-20 02:15:07 +00:00
Jim Ingham 85e8b81492 - Changed all the places where CommandObjectReturn was exporting a StreamString to just exporting
a Stream, and then added GetOutputData & GetErrorData to get the accumulated data.
- Added a StreamTee that will tee output to two provided lldb::StreamSP's.
- Made the CommandObjectReturn use this so you can Tee the results immediately to
the debuggers output file, as well as saving up the results to return when the command
is done executing.
- HandleCommands now uses this so that if you have a set of commands that continue the target
you will see the commands come out as they are processed.
- The Driver now uses this to output the command results as you go, which makes the interface
more reactive seeming.

llvm-svn: 126015
2011-02-19 02:53:09 +00:00
Johnny Chen ce0dec7597 Make the helper method ReadCoreReg(uint32_t reg, bool *success) more generic
which now handles R0-R12, SP, LR, as well as PC.  And refactored a lot of
calls to ReadRegisterUnsigned() to now funnel through ReadCoreReg(), instead.

llvm-svn: 126010
2011-02-19 01:36:13 +00:00
Caroline Tice 55532be31f Add code to emulate LDRB (register) Arm instruction.
llvm-svn: 125994
2011-02-18 23:52:21 +00:00
Johnny Chen ce4e629fdf Add emulation methods for "ORR (immediate)" and "ORR (register)".
Add Encoding T3 of "MOV (register)" to EmulateMOVRdRm() method and fixed
some bugs in EmulateMOVRdImm() and EmulateMOVRdRm() methods.

llvm-svn: 125992
2011-02-18 23:41:11 +00:00
Caroline Tice 27d1032b60 Add code to emulate LDRB (literal) Arm instruction.
llvm-svn: 125975
2011-02-18 22:24:22 +00:00
Johnny Chen d1fd6963f5 Add emulation methods for "ADC (immediate)" and "ADC (register)".
Plus add a helper method ReadCoreReg(uint32_t regnum, bool *success) to simplify
coding a bit.

llvm-svn: 125961
2011-02-18 21:13:05 +00:00
Caroline Tice 489517c4a4 Add code to emulate LDRB (immediate, Thumb) instruction.
llvm-svn: 125959
2011-02-18 21:06:04 +00:00
Johnny Chen faba5dd4ae Add emulation methods for "AND (immediate)" and "AND (register)".
Plus add macro definitions for APSR_C and APSR_V to simplify code.

llvm-svn: 125947
2011-02-18 19:32:20 +00:00
Caroline Tice a1bf8db478 Add code to emulate LDR (register) Arm instruction.
llvm-svn: 125945
2011-02-18 18:52:37 +00:00
Greg Clayton bfe5f3bf06 Added new target instance settings for execution settings:
Targets can now specify some additional parameters for when we debug 
executables that can help with plug-in selection:

target.execution-level = auto | user | kernel
target.execution-mode  = auto | dynamic | static
target.execution-os-type = auto | none | halted | live

On some systems, the binaries that are created are the same wether you use
them to debug a kernel, or a user space program. Many times inspecting an 
object file can reveal what an executable should be. For these cases we can
now be a little more complete by specifying wether to detect all of these
things automatically (inspect the main executable file and select a plug-in
accordingly), or manually to force the selection of certain plug-ins.

To do this we now allow the specficifation of wether one is debugging a user
space program (target.execution-level = user) or a kernel program 
(target.execution-level = kernel).

We can also specify if we want to debug a program where shared libraries
are dynamically loaded using a DynamicLoader plug-in 
(target.execution-mode = dynamic), or wether we will treat all symbol files
as already linked at the correct address (target.execution-mode = static).

We can also specify if the inferior we are debugging is being debugged on 
a bare board (target.execution-os-type = none), or debugging an OS where
we have a JTAG or other direct connection to the inferior stops the entire
OS (target.execution-os-type = halted), or if we are debugging a program on
something that has live debug services (target.execution-os-type = live).

For the "target.execution-os-type = halted" mode, we will need to create 
ProcessHelper plug-ins that allow us to extract the process/thread and other
OS information by reading/writing memory.

This should allow LLDB to be used for a wide variety of debugging tasks and
handle them all correctly.

llvm-svn: 125815
2011-02-18 01:44:25 +00:00
Johnny Chen f401d69c85 Fix typo.
llvm-svn: 125812
2011-02-18 01:26:39 +00:00