Commit Graph

2105 Commits

Author SHA1 Message Date
Greg Clayton 514487e806 Made lldb_private::ArchSpec contain much more than just an architecture. It
now, in addition to cpu type/subtype and architecture flavor, contains:
- byte order (big endian, little endian)
- address size in bytes
- llvm::Triple for true target triple support and for more powerful plug-in
  selection.

llvm-svn: 125602
2011-02-15 21:59:32 +00:00
Johnny Chen f976896b83 Remove the "Register &reg" parameter from the BXWritePC(), LoadWritePC(), and ALUWritePC()
methods of EmulateInstructionARM class.  The context data structure should provide sufficient
information already.

llvm-svn: 125596
2011-02-15 21:08:58 +00:00
Johnny Chen 6f93f63955 Fix wrong mask and encoding for T2 of ASR (immediate).
llvm-svn: 125593
2011-02-15 20:14:02 +00:00
Johnny Chen a4afff97ad A8.6.14 ASR (immediate)
Add EmulateASRImm() Encodings T1, T2, and A1 to the opcodes tables.

llvm-svn: 125592
2011-02-15 20:10:55 +00:00
Johnny Chen ffb3b51ba8 Refactored the test driver to abstract out the Python sys.path specification for
different build configurations.

llvm-svn: 125584
2011-02-15 18:50:19 +00:00
Caroline Tice 6e12e117d4 Add code to emulate STMIB Arm instruction.
llvm-svn: 125580
2011-02-15 18:42:15 +00:00
Caroline Tice 5e38f35fe3 Add code to emulate STMDB Arm instruction.
Add some bit-mask fixes to code for getting register bits for various LDM and STM instructions.

llvm-svn: 125578
2011-02-15 18:10:01 +00:00
Johnny Chen 7a03c852d0 Add a bunch of utilities and an enum (ARM_ShifterType) for shift and rotate operations pertaining to:
o A2.2.1 Pseudocode details of shift and rotate operations
o A8.4.3 Pseudocode details of instruction-specified shifts and rotates

llvm-svn: 125575
2011-02-15 17:52:22 +00:00
Johnny Chen ef55e4c174 Remove the unnecessary assignment of m_inst_cpsr inside EvaluateInstruction(),
because it's already been done within ReadInstruction().

llvm-svn: 125569
2011-02-15 17:31:33 +00:00
Caroline Tice efb309619a Add code to emulate the STMDA Arm instruction.
llvm-svn: 125542
2011-02-15 00:19:42 +00:00
Greg Clayton e576ab2996 All UnwindPlan objects are now passed around as shared pointers.
ArchDefaultUnwindPlan plug-in interfaces are now cached per architecture 
instead of being leaked for every frame.

Split the ArchDefaultUnwindPlan_x86 into ArchDefaultUnwindPlan_x86_64 and
ArchDefaultUnwindPlan_i386 interfaces.

There were sporadic crashes that were due to something leaking or being 
destroyed when doing stack crawls. This patch should clear up these issues.

llvm-svn: 125541
2011-02-15 00:19:15 +00:00
Johnny Chen 557520b996 Add missing logic (if BadReg(d) then UNPREDICTABLE;) for Encoding T2 of EmulateMovRdImm().
llvm-svn: 125533
2011-02-14 23:33:58 +00:00
Johnny Chen 5623dc3559 Fix build warning (unused variable).
llvm-svn: 125531
2011-02-14 23:21:24 +00:00
Caroline Tice eccad4d005 - Rearrange instruction emulation contexts to use a union for the
various types and numbers of arguments rather than trying to keep a
  constant number of arguments for all the types.

- Also create a Register type within the instructions, to hold
  register type and number.

- Modify EmulateInstructionArm.cpp to use the new register and context
  types in all the instruction emulation functions.

- Add code to emulate the STM Arm instruction.

llvm-svn: 125528
2011-02-14 23:03:21 +00:00
Johnny Chen dacc14c995 Updated README file.
llvm-svn: 125527
2011-02-14 22:25:44 +00:00
Johnny Chen c3ba12d8e8 Add entries for EmulateMovRdImm() -- "MOV (immediate)" -- Encodings T1 & T2 into g_thumb_opcodes
table.  Modify EmulateInstructionARM::EvaluateInstruction() so that if the cpsr has changed
during evaluate instruction, we flush out the change into m_inst_cpsr in preparation for the next
instruction.

llvm-svn: 125524
2011-02-14 22:04:25 +00:00
Greg Clayton c2448f6175 Added support for Xcode 4 build directories.
llvm-svn: 125522
2011-02-14 21:17:06 +00:00
Johnny Chen 86776147ff Add impl for EmulateMvnRdImm() -- "MVN (immediate)". Plus zero out the arg0 field of
the context of eContextImmediate type, since the immediate value is known from the
argument value to WriteRegisterUnsigned() callback already.

llvm-svn: 125518
2011-02-14 20:39:01 +00:00
Johnny Chen ac407594c2 Add comment.
llvm-svn: 125509
2011-02-14 19:09:36 +00:00
Johnny Chen e2b86a3a83 Enhanced the existing ARMExpandImm() and ThumbExpandImm() functions which expand
an imm12 into imm32 for ARM or Thumb so that they now handle carry_in/carry_out.
Funnel ARMExpandImm()/ThumbExpandImm() to the enhanced ARMExpandImm_C()/ThumbExpandImm_C()
functions.

llvm-svn: 125508
2011-02-14 19:08:41 +00:00
Greg Clayton 71fc2a33b5 Added the ability to detect which vCont packets (using the "vCont?") packet
are supported by the remote GDB target. We can also now deal with the lack of
vCont support and send packets that the remote GDB stub can use. We also error
out of the continue if LLDB tries to do something too complex when vCont isn't
supported.

llvm-svn: 125433
2011-02-12 06:28:37 +00:00
Johnny Chen b3b8e0ffc2 Add entries for Encodings T1 and A1 of "MVN (immediate)" to g_arm_opcodes and g_thumb_opcodes
tables.  The corresponding EmulateMvnRdImm() method impl is empty for now.

llvm-svn: 125425
2011-02-12 01:27:26 +00:00
Johnny Chen 61938f795f Changed comments of some functions to be consistent with existing ones.
llvm-svn: 125423
2011-02-12 01:01:40 +00:00
Johnny Chen 1173fbdc4b Add helper methods InITBlock() and LastInITBlock() to EmulateInstructionARM class
instead of calling out to m_it_session.InITBlock()/LastInITBlock(), which simplifies
the coding a bit.

llvm-svn: 125421
2011-02-12 00:50:05 +00:00
Johnny Chen a222c04588 Add EmulateBXRm() ("Branch and Exchange") to both g_arm_opcodes and g_thumb_opcodes table.
llvm-svn: 125418
2011-02-12 00:10:51 +00:00
Johnny Chen 722d4e4aa0 Add a couple of utility functions plus some comments.
llvm-svn: 125416
2011-02-11 23:29:14 +00:00
Caroline Tice 7b37670d56 - Add three more instruction contexts to EmulateInstruction:
eContextAdjustBaseRegister, eContextRegisterStore and
eContextWriteMemoryRandomBits.

- Implement a version of WriteBits32UnknownToMemory for writing to memory.

- Modify EmulateLDM, EmulateLDMDA, EmulateLDMDB and EmulateLDMIB to use the
eContextAdjustBaseRegister context when appropriate.

- Add code to emulate the STM/STMIA/STMEA Arm instruction.

llvm-svn: 125414
2011-02-11 22:49:54 +00:00
Johnny Chen a61541663c Add EmulateCmpRnRm() for Encodings T1 & T2 to the g_thumb_opcodes table to emulate
CMP (register) operations.

llvm-svn: 125413
2011-02-11 21:53:58 +00:00
Johnny Chen c6ca7bb67a Rearraned some emulate instruction entries under the appropriate category.
llvm-svn: 125405
2011-02-11 21:23:32 +00:00
Johnny Chen 259326c821 Instead of self.runCmd(), do a stronger self.expect("process status") which also
checks that the process is stopped due to breakpoint at the specified line no.

llvm-svn: 125400
2011-02-11 20:11:06 +00:00
Johnny Chen f1075ce0e6 Handle the case of interworking branch for EmulateLDMDA.
llvm-svn: 125392
2011-02-11 19:37:03 +00:00
Johnny Chen 298251cd9b Add Thumb2 LDR (literal) instruction into the g_thumb_opcodes table.
Change the method name from *LDRRdPCRelative to *LDRRtPCRelative to be compliant
with the ARM Arch Manual which uses Rt for the destination register.

llvm-svn: 125390
2011-02-11 19:12:30 +00:00
Johnny Chen bce7ad6b48 Fix build.
llvm-svn: 125379
2011-02-11 18:11:22 +00:00
Caroline Tice 485b4d8352 Add new instruction context, eContextWriteRegisterRandomBits.
Add new utility function, WriteBits32Unknown

Modify the LDM* instruction emulation functions to call WriteBits32Unknown.
Add missing overview comments to the LDM* instruction emulation functions.

Add code to emulate LDMDA Arm instruction.

llvm-svn: 125377
2011-02-11 17:59:55 +00:00
Johnny Chen c7af6fe3bd Add an entry for CMP (immediate) (Encoding T1) to the g_thumb_opcodes table.
llvm-svn: 125333
2011-02-11 02:02:56 +00:00
Johnny Chen 37c48b02a4 Add a helper method AddWithCarry() to the EmulateInstructionARM class.
llvm-svn: 125329
2011-02-11 01:29:53 +00:00
Johnny Chen 0061ff20d8 Fix another typo.
llvm-svn: 125323
2011-02-11 00:07:26 +00:00
Johnny Chen b18528df84 Fix a typo.
llvm-svn: 125322
2011-02-11 00:06:48 +00:00
Johnny Chen b500ffe071 Add TestConstStrings.py under foundation dir for testing expression parser on objective-c strings
and constant strings.

llvm-svn: 125320
2011-02-10 23:58:37 +00:00
Sean Callanan 229ce2d5b1 Fixes for two bugs:
- Objective-C constant strings were being
  NULL-terminated erroneously.

- Empty Objective-C constant strings were not
  being generated correctly.

Also added the template for a test of these
fixes.

llvm-svn: 125314
2011-02-10 22:17:53 +00:00
Johnny Chen 9524110d98 Cleaned up some parameter types and names.
llvm-svn: 125313
2011-02-10 21:49:16 +00:00
Johnny Chen c843a78efc Namings are important. Renamed Bits32(const uint32_t val, uint32_t bit) to Bit32(val, bit) and
SetBits32(uint32_t &bits, uint32_t bit, uint32_t val) to SetBit32(bits, bit, val).

llvm-svn: 125312
2011-02-10 21:39:01 +00:00
Johnny Chen 101f6efb8a Some refactorings to use the convenience function: Bits32(const uint32_t value, const uint32_t bit).
llvm-svn: 125303
2011-02-10 19:54:05 +00:00
Johnny Chen 992b48c4be Add some comment markers.
llvm-svn: 125302
2011-02-10 19:40:42 +00:00
Johnny Chen 0cfda5bbb5 Add a generic EmulateMovRdRm() method and modify/add entries to the g_thumb_opcodes
table.  Also add some more defines and convenience functions.

llvm-svn: 125300
2011-02-10 19:29:03 +00:00
Johnny Chen 77224a5422 Rearrange the order of g_thumb_opcodes entries.
llvm-svn: 125295
2011-02-10 18:13:23 +00:00
Greg Clayton 1117795eaf Fixed a crasher when enabling logging that is due to the new hijack listener stack changes.
llvm-svn: 125269
2011-02-10 06:51:22 +00:00
Johnny Chen cc13e4c62e Add EmulateLDRRtRnImm() for EncodingT1 of LDR (immediate, Thumb) to the g_thumb_opcodes table,
and a helper method UnalignedSupport().

llvm-svn: 125258
2011-02-10 01:52:38 +00:00
Caroline Tice b44880cadd Add a new function to Debugger for finding the top/current
input reader.

Always make sure the input reader stack is not empty before
trying to get the top element from the stack.

llvm-svn: 125255
2011-02-10 01:15:13 +00:00
Johnny Chen 1cabebe7bc Add a new member variable m_new_inst_cpsr to catch the to-be-updated state
of the CPSR during the course of executing an opcode, and modified SelectInstrSet()
to update this variable instead of the original m_inst_cpsr, which should be
the cached copy of the CPSR at the beginning of executing the opcode.

llvm-svn: 125244
2011-02-09 23:59:17 +00:00
Johnny Chen edf55ae52a Add EmulateAddRdnRm() for EncodingT2 of ADD(register) to the g_thumb_opcodes table,
and a helper method ALUWritePC(Context&, uint32_t).

llvm-svn: 125241
2011-02-09 23:43:29 +00:00
Greg Clayton 7bd65b9fae Modified version of a patch from Warren Paul that takes care of issues with
indirect forms, deals with empty DW_AT_comp_dir attributes, and fixups for
handling other signed integer types.

llvm-svn: 125240
2011-02-09 23:39:34 +00:00
Johnny Chen 0ce4a83c44 Modified existing Emulate* methods to call LoadWritePC(context, data) where appropriate to
effect an interworking branch if the ArchVersion() is ARMv5T and above.

llvm-svn: 125227
2011-02-09 22:02:17 +00:00
Greg Clayton f4dd543d92 Missed part of a patch from Stephen Wilson.
llvm-svn: 125220
2011-02-09 21:12:40 +00:00
Stephen Wilson d4182f4b01 linux: use IS_VALID_LLDB_HOST_THREAD.
Update the linux plugin code to use the new check for a valid host
thread introduced in r125067.

llvm-svn: 125213
2011-02-09 20:10:35 +00:00
Johnny Chen 8bba644bf4 Modified EmulatePop impl to use the helper method LoadWritePC(context, data) since if PC
is in the list of registers to be load and we're in ARMv5T and above, this is an interworking branch.

llvm-svn: 125212
2011-02-09 19:30:49 +00:00
Johnny Chen cc707657f9 If the CPSR is changed due to switching between ARM and Thumb ISETSTATE,
we want to record it and issue a WriteRegister callback so the clients
can track the mode changes accordingly.

llvm-svn: 125209
2011-02-09 19:11:32 +00:00
Greg Clayton 1c9e5acd27 Added the DWARF unique type map such that we only create a type once in the
module's AST context. Prior to this fix, with gcc binaries, we end up with
a full class definition for any used classes in each compile unit due to the
one definition rule. This would result in us making N copies of class T, where
N is the number of compile units that use class T, in the module AST. When
an expression would then try and use any types that were duplicated, it would
quickly confuse clang and make expression evaluation fail due to all of the
duplicate types that got copied over. This is now fixed by making a map of
types in the DWARF that maps type names to a collection of types + declaration
(file + line number) + DIE. Then later when we find a type we look in this
module map and find any already cached types that we can just use.

8935777

llvm-svn: 125207
2011-02-09 19:06:17 +00:00
Greg Clayton 000aeb89ae Patch from Kirk Beitz to make things compile on MinGW minus the putenv part.
llvm-svn: 125199
2011-02-09 17:41:27 +00:00
Greg Clayton 94d086262a File::GetFileSpec() support for linux patch from Stephen Wilson.
llvm-svn: 125181
2011-02-09 07:19:18 +00:00
Greg Clayton 9f5abd8e44 Fix comment text.
llvm-svn: 125162
2011-02-09 03:12:09 +00:00
Greg Clayton 0d0c12ab61 <rdar://problem/8972204> Test failure: ./dotest.py -v -t -f UniversalTestCase.test_process_launch_for_universal
Fix for bad architecture settings that were being used from the qHostInfo.

llvm-svn: 125161
2011-02-09 03:09:55 +00:00
Greg Clayton 925137cf84 Pull support for the shared and exclusive lock since this wasn't available
on linux. And conditionalize the availablility of the fcntl() command 
F_GETPATH.

llvm-svn: 125152
2011-02-09 01:16:43 +00:00
Greg Clayton 51b1e2d271 Use Host::File in lldb_private::StreamFile and other places to cleanup host
layer a bit more.

llvm-svn: 125149
2011-02-09 01:08:52 +00:00
Johnny Chen 7eaacc517b Add some helper methods to the EmulateInstructionARM class as a first step in the
refactorings of EmulateInstructionARM.cpp file, which will be modified later to
take advantage of these helper methods.

llvm-svn: 125148
2011-02-09 01:00:31 +00:00
Caroline Tice 123b89b67f Add code to emulate the LDMIB Arm instruction.
Modify code for LDM and LDMDB instructions to only
create one context and to reuse it, rather than 
creating multiple contexts.

llvm-svn: 125139
2011-02-08 23:56:10 +00:00
Johnny Chen 108a363318 Fix typos.
llvm-svn: 125138
2011-02-08 23:49:37 +00:00
Jim Ingham 843630781a Add FileSpec::ResolvePartialUsername, and use it in CommandCompletions to isolate pwd.h in the Host layer.
llvm-svn: 125135
2011-02-08 23:24:09 +00:00
Johnny Chen 03feace9d0 Add EmulateCB() entry to the g_thumb_opcodes table to represent "Compare and Branch
on NonZero and Compare and Branch on Zero" operations.

llvm-svn: 125134
2011-02-08 23:21:57 +00:00
Caroline Tice cdb58e1236 Add code to emulate LDMDB Arm instruction.
llvm-svn: 125133
2011-02-08 23:16:02 +00:00
Caroline Tice 7aa01cfd64 Add code to emulate the LDM ARM instruction.
llvm-svn: 125118
2011-02-08 22:24:38 +00:00
Johnny Chen 181376f29f Add missing implementation for "BL, BLX (immediate)" Encoding T1 and an entry for "bl <label>"
into g_thumb_opcodes table.

llvm-svn: 125112
2011-02-08 20:36:34 +00:00
Greg Clayton 846b64bf83 Updated a few more Host::File functions and added documentation.
llvm-svn: 125110
2011-02-08 19:54:44 +00:00
Greg Clayton 968fa38e0a Added a few more calls to the File abtract class for seeking, syncing and
getting the file spec from the file descriptor.

llvm-svn: 125106
2011-02-08 19:10:53 +00:00
Johnny Chen 86e48b6940 Add missing implementation for "BL, BLX (immediate)" Encoding A1.
llvm-svn: 125103
2011-02-08 18:58:31 +00:00
Johnny Chen 933fefdd6a Add new radar info for failed test.
llvm-svn: 125100
2011-02-08 18:37:49 +00:00
Johnny Chen 78bb926f9b Make the assertion message about 32-bit process address byte size more clear.
llvm-svn: 125099
2011-02-08 18:31:06 +00:00
Greg Clayton 504f89a7e8 Added a file abtraction layer into the Host section of LLDB.
llvm-svn: 125093
2011-02-08 17:49:02 +00:00
Greg Clayton f9399453c3 A patch from Stephen Wilson that fixes some issues with my previous dynamic
loader changes.

llvm-svn: 125084
2011-02-08 05:24:57 +00:00
Jim Ingham 0f16e73a76 Rework the RunThreadPlan event handling to use Event Hijacking not stopping the event thread. Also clarify the logic of the function.
llvm-svn: 125083
2011-02-08 05:20:59 +00:00
Greg Clayton 87e5ff02a1 A bit more cleanup with respect to using LLDB_CONFIG_XXX defines outside of
the lldb/source/Host/*.cpp and lldb/source/Host/*/*.cpp directories. The only
offenders are the command completion and the StreamFile.cpp. 

I will soon modify StreamFile.cpp to use a lldb/source/Host/File.cpp so that
all file open, close, read, write, seek, are abstracted into the host layer
as well, then this will be gone.

llvm-svn: 125082
2011-02-08 05:19:06 +00:00
Jim Ingham 0e97cbcbc9 Add _pthread_wqthread to the list of thread stop points, and change the logging a bit.
llvm-svn: 125081
2011-02-08 05:19:01 +00:00
Jim Ingham c4f4f72137 Change the Hijacking interposer to a stack of interposers.
llvm-svn: 125080
2011-02-08 05:16:50 +00:00
Jim Ingham cedb5820ff Add a GetName interface to the Listener for logging purposes.
llvm-svn: 125079
2011-02-08 05:15:05 +00:00
Greg Clayton 53239f00b5 Moved FileSpec into the Host layer since it will vary from host to host.
We have a common unix implementation in lldb/source/Host/common/FileSpec.cpp.

llvm-svn: 125078
2011-02-08 05:05:52 +00:00
Jim Ingham 242e0ad729 Formatting.
llvm-svn: 125076
2011-02-08 04:27:50 +00:00
Johnny Chen 9b0b60c946 Forgot to check in this file with r125059.
llvm-svn: 125075
2011-02-08 04:21:13 +00:00
Greg Clayton 7012049c7f Fixed a crasher that could happen when trying to look at N_GSYM entries
in the DWARF + debug map symbol file parser.

Also cleaned up the "image lookup --address ADDR" output when we it results
in something that is in an inlined function. Now we correctly dump out the
full inlined call stack.

llvm-svn: 125072
2011-02-08 02:40:32 +00:00
Greg Clayton 2da6d49523 Patch that allows for thread_t to be something more complex than an
integer. Modified patch from Kirk Beitz.

llvm-svn: 125067
2011-02-08 01:34:25 +00:00
Greg Clayton 453194664d Cleaned up the dynamic library open/getsymbol/close code to use abstracted
flags such that symbols can be searched for within a shared library if desired.
Platforms that support the RTLD_FIRST flag can still take advantage of their
quicker lookups, and other platforms can still get the same fucntionality
with a little extra work.

Also changed LLDB_CONFIG flags over to either being defined, or not being
defined to stay in line with current open source practices and to prepare for
using autoconf or cmake to configure LLDB builds.

llvm-svn: 125064
2011-02-08 00:35:34 +00:00
Johnny Chen a3990398a3 Add implementation for EmulateInstructionARM::EmulateB() and fixed two typos in g_thumb_opcodes
as pointed out By Caroline.  Refactored a little bit by adding two new helper methods to the
EmulateInstructionARM class:

o BranchWritePC()
o BXWritePC()

llvm-svn: 125059
2011-02-08 00:06:35 +00:00
Greg Clayton a3406614e0 Abtract terminal stuff into a new lldb_private::Terminal class
where the implementation is hidden in the host layer. This avoids
a slew of "#if LLDB_CONFIG_TERMIOS_SUPPORTED" statements in the
code and keeps things cleaner.

llvm-svn: 125057
2011-02-07 23:24:47 +00:00
Johnny Chen 05a975d777 Add EmulateInstructionARM::EmulateB entries to the g_arm_opcodes and g_thumb_opcodes
tables.  EmulateB() has empty impl. and needs to be filled in later.

llvm-svn: 125048
2011-02-07 20:11:47 +00:00
Jim Ingham 9035e7c26d Include Config.h so we can get "~" resolved.
llvm-svn: 125031
2011-02-07 19:42:39 +00:00
Greg Clayton 6c3e431e9b More termios fixes. We need to currently make sure to include:
#include "lldb/Host/Config.h"

Or the LLDB_CONFIG_TERMIOS_SUPPORTED defined won't be set. I will fix all
of this Termios stuff later today by moving lldb/Core/TTYState.* into the 
host layer and then we conditionalize all of this inside TTYState.cpp and
then we get rid of LLDB_CONFIG_TERMIOS_SUPPORTED all together.

Typically, when we start to see too many "#if LLDB_CONFIG_XXXX" preprocessor
directives, this is a good indicator that something needs to be moved over to
the host layer. TTYState can be modified to do all of the things that many
areas of the code are currently doing, and it will avoid all of the 
preprocessor noise.

llvm-svn: 125027
2011-02-07 19:22:32 +00:00
Greg Clayton cdd074fbc7 More termios fixes from Kirk Beitz.
llvm-svn: 125024
2011-02-07 19:04:58 +00:00
Greg Clayton 425260bd33 Namespace patch for linux builds from Jai Menon.
llvm-svn: 125016
2011-02-07 17:44:33 +00:00
Greg Clayton 75852f56ae Added a "ArchSpec::SetElfArch()" that was removed by a previous patch and
avoid using RTLD_FIRST with dlopen to keep things compatible with other *NIX
variants. Patch from Jai Menon.

llvm-svn: 125015
2011-02-07 17:43:47 +00:00
Greg Clayton e0f3c020fc Posix compatability patch from Jai Menon to avoid uses dirent struct members
that aren't always available (sometimes d_namlen or d_reclen). Now strlen is
used to avoid such issues.

llvm-svn: 125008
2011-02-07 17:41:11 +00:00
Greg Clayton 068d16b4df Fixup on setlinebuf() patch to make it work.
llvm-svn: 124944
2011-02-05 06:41:57 +00:00
Greg Clayton edd5192d13 Configuration support for setlinebuf support from Kirk Beitz.
llvm-svn: 124943
2011-02-05 06:37:53 +00:00
Greg Clayton 8442fba3b4 Apple specific fix for Host.cpp from Kirk Beitz.
llvm-svn: 124942
2011-02-05 06:36:35 +00:00
Greg Clayton 4c2c0fcb9f Apple specific change from Kirk Beitz.
llvm-svn: 124941
2011-02-05 06:35:06 +00:00
Greg Clayton 0360eac4df A tool for examining a mach process and its threads.
llvm-svn: 124937
2011-02-05 05:27:30 +00:00
Greg Clayton 95e314260e Header patch, virtual dtor patch and missed UUID patch from Kirk Beitz.
llvm-svn: 124931
2011-02-05 02:56:16 +00:00
Greg Clayton 8a9ef34039 Python override patch from Jai Menon.
llvm-svn: 124929
2011-02-05 02:32:19 +00:00
Greg Clayton 9c139319f8 Fixed an excessive ctor issue. Patch from Kirk Beitz / Jai Menon.
llvm-svn: 124928
2011-02-05 02:28:58 +00:00
Greg Clayton fd18426e55 Added support for targets that don't support expanding "~/" or "~USERNAME".
Patch from Kirk Beitz.

llvm-svn: 124927
2011-02-05 02:27:52 +00:00
Greg Clayton 6d0934519d Added a quicker lookup in the SectionLoadList when looking things up by
section by using a DenseMap.

Fixed some logging calls to get the log shared pointer.

llvm-svn: 124926
2011-02-05 02:25:06 +00:00
Johnny Chen 56902044a7 Handle the thumb branch instructions which have their cond bits embedded in the instruction stream.
llvm-svn: 124925
2011-02-05 01:39:52 +00:00
Johnny Chen 6e2acff0be Add EmulateInstructionARM::EmulateIT() to the g_thumb_opcodes table,
to represent the the 'If Then' instruction which makes up to four following
instructions (the IT block)conditional.

Hook up ITSession utility class as a member variable of EmulateInstructionARM.

llvm-svn: 124915
2011-02-05 00:46:10 +00:00
Greg Clayton c0d3446516 Fixed the BreakpointLocationList to be able to do O(1) lookups on breakpoint
locations by ID. It used to be, worst case, O(N).

llvm-svn: 124914
2011-02-05 00:38:04 +00:00
Johnny Chen ea745e86c8 Add a utility class ITSession to maintain the ITState for the Thumb ISA.
llvm-svn: 124906
2011-02-04 23:02:47 +00:00
Caroline Tice 79042b3e93 Change "breakpoint list" command to default to brief output rather than full output.
Modify test cases in test suite to either expect brief output or to pass -f for full
output as appropriate.

llvm-svn: 124905
2011-02-04 22:59:41 +00:00
Johnny Chen 2246ff143b Add some comments and a little utility to convert ARM conditions to strings.
llvm-svn: 124898
2011-02-04 21:27:54 +00:00
Greg Clayton 72b77ebc8a Remove bzero use and replace with memset (patch from Kirk Beitz).
llvm-svn: 124897
2011-02-04 21:13:05 +00:00
Greg Clayton 768f2809f2 Added the start of platform configuration designed for internal LLDB use.
Internal use means for compiling the LLDB debug engine and plug-ins, but it
should never make it into the public API.

Since we don't currently have a configuration script that detects avaiable
functionality in the LLDB build system, we are hard coding #define values
in the host specific "Config.h" files. 

#define values in these Config.h header files should set the value to zero or
one:

#define LLDB_CONFIG_TERMIOS_SUPPORTED 1

#define LLDB_CONFIG_OTHER 0

Then any code in the LLDB engine should check the availability using:

#if LLDB_CONFIG_TERMIOS_SUPPORTED
....
#endif

Eventually the contents of the host specific Config.h files will be auto
generated, but for now they will be hard coded. Any LLDB_CONFIG_XXXX items
that are added should be added to all Config.h files and set to either zero
or one.

llvm-svn: 124892
2011-02-04 19:17:57 +00:00
Greg Clayton 05c32e27c6 Patch to remove uses of non-standard strcasestr and replace then with
strncasecmp equivalents from Kirk Beitz.

llvm-svn: 124889
2011-02-04 18:55:41 +00:00
Greg Clayton 6083026822 Applied a fix to qualify "UUID" with the lldb_private namespace to fix
build issues on MinGW.

llvm-svn: 124888
2011-02-04 18:53:10 +00:00
Greg Clayton 806d42783a MinGW patch from Kirk Beitz.
llvm-svn: 124879
2011-02-04 18:09:50 +00:00
Johnny Chen b0616a6f32 Patches from Jean-Daniel:
One (stepout.patch) to fix a problem in ThreadPlanStepOut.cpp. There is an erroneous semi colon at end of an if statement that make the condition useless (if body is empty).

And the second patch is to remove to useless typedef on enum, and so avoid a lot of warnings with clang++.

llvm-svn: 124874
2011-02-04 17:21:08 +00:00
Greg Clayton b766a73dfc Added support for attaching to a remote debug server with the new command:
(lldb) process connect <remote-url>

Currently when you specify a file with the file command it helps us to find
a process plug-in that is suitable for debugging. If you specify a file you
can rely upon this to find the correct debugger plug-in:

% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) process connect connect://localhost:2345
...

If you don't specify a file, you will need to specify the plug-in name that
you wish to use:

% lldb
(lldb) process connect --plugin process.gdb-remote connect://localhost:2345

Other connection URL examples:

(lldb) process connect connect://localhost:2345
(lldb) process connect tcp://127.0.0.1
(lldb) process connect file:///dev/ttyS1

We are currently treating the "connect://host:port" as a way to do raw socket
connections. If there is a URL for this already, please let me know and we
will adopt it.

So now you can connect to a remote debug server with the ProcessGDBRemote
plug-in. After connection, it will ask for the pid info using the "qC" packet
and if it responds with a valid process ID, it will be equivalent to attaching.
If it response with an error or invalid process ID, the LLDB process will be
in a new state: eStateConnected. This allows us to then download a program or
specify the program to run (using the 'A' packet), or specify a process to
attach to (using the "vAttach" packets), or query info about the processes
that might be available.

llvm-svn: 124846
2011-02-04 01:58:07 +00:00
Johnny Chen 7fa6c95b05 Add test_apropos_should_also_search_settings_description() to make sure that:
apropos 'environment variable'

searches all settings description and returns a topic related to:

    target.process.env-vars

llvm-svn: 124841
2011-02-04 00:50:49 +00:00
Johnny Chen b52193787d Add EmulateInstructionARM::EmulateSVC() to the g_arm_opcodes and g_thumb_opcodes tables,
to represent the supervisor call instruction (previosuly software interrupt).

llvm-svn: 124840
2011-02-04 00:40:18 +00:00
Caroline Tice 73fd2728b9 Modify 'apropos' command to search settings variable descriptions as well.
llvm-svn: 124836
2011-02-04 00:16:49 +00:00
Johnny Chen d762ff1faa Modify test scripts to accomodate SBTarget.Launch() API change.
llvm-svn: 124828
2011-02-03 23:15:53 +00:00
Greg Clayton 4b0456211c Added a SBListener parameter to Launch and attach calls to avoid a race
condition that could occur when launching or attaching. What could happen is
you would launch/attach to a process, then you would need to tell a listener
to watch for process state changed events. In this case, if you waited too
long to listen for events, you could miss the initial stop event, requiring
clients to listen, then check the process state. 

llvm-svn: 124818
2011-02-03 21:28:34 +00:00
Caroline Tice eb5cfe4f2b Fix exit instructions for interactive interpreter, now that ctrl-D works.
llvm-svn: 124811
2011-02-03 20:08:40 +00:00
Caroline Tice 9fd5850fbc Fix the ctr-D and end-of-file stuff.
llvm-svn: 124810
2011-02-03 20:02:43 +00:00
Johnny Chen ff885ce667 Add teardown hook to clear image-search-paths after the test.
llvm-svn: 124806
2011-02-03 18:03:54 +00:00
Greg Clayton 25c98707da Removed unneeded header file.
llvm-svn: 124804
2011-02-03 17:48:50 +00:00
Greg Clayton c3f381be87 Removed a memory map loading of a file where the mmap contents were just
being read directly into a string. The use of memory mapping here was useless.

llvm-svn: 124803
2011-02-03 17:47:47 +00:00
Greg Clayton aae6e9a6fd Fixed the SendInterrupt logic to return the true if the target was halted
(regardless if the interrupt was sent), and false of not.

llvm-svn: 124766
2011-02-03 01:07:45 +00:00
Johnny Chen 769302a97f Parametrize make variable CC to also test with clang.
llvm-svn: 124764
2011-02-03 00:44:32 +00:00
Johnny Chen 32679314fe Parametrize make variable CC to also test with clang.
llvm-svn: 124763
2011-02-03 00:38:18 +00:00
Johnny Chen 7791b3320b Add a test case test_image_search_paths() to test lldb's ability to do image search paths
substitutions in order to achieve file mappings.

Modify CommandObjectTarget.cpp to properly set the status of the return object to make
scripting like this:

    self.runCmd("target image-search-paths add %s %s" % (os.getcwd(), new_dir))

works.

llvm-svn: 124762
2011-02-03 00:30:19 +00:00
Caroline Tice 2bf67986ef Fix breakpoint id test to work with clang as well as gcc; added a few
more test cases

Fixed minor bug in the breakpoint id range translation code.

llvm-svn: 124729
2011-02-02 17:48:16 +00:00
Greg Clayton 4272cc7d4c Modified the PluginManager to be ready for loading plug-ins from a system
LLDB plugin directory and a user LLDB plugin directory. We currently still
need to work out at what layer the plug-ins will be, but at least we are 
prepared for plug-ins. Plug-ins will attempt to be loaded from the 
"/Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Plugins" 
folder, and from the "~/Library/Application Support/LLDB/Plugins" folder on
MacOSX. Each plugin will be scanned for:

extern "C" bool LLDBPluginInitialize(void);
extern "C" void LLDBPluginTerminate(void);

If at least LLDBPluginInitialize is found, the plug-in will be loaded. The
LLDBPluginInitialize function returns a bool that indicates if the plug-in
should stay loaded or not (plug-ins might check the current OS, current
hardware, or anything else and determine they don't want to run on the current
host). The plug-in is uniqued by path and added to a static loaded plug-in
map. The plug-in scanning happens during "lldb_private::Initialize()" which
calls to the PluginManager::Initialize() function. Likewise with termination
lldb_private::Terminate() calls PluginManager::Terminate(). The paths for the
plug-in directories is fetched through new Host calls:

    bool Host::GetLLDBPath (ePathTypeLLDBSystemPlugins, dir_spec);
    bool Host::GetLLDBPath (ePathTypeLLDBUserPlugins, dir_spec);

This way linux and other systems can define their own appropriate locations
for plug-ins to be loaded.

To allow dynamic shared library loading, the Host layer has also been modified
to include shared library open, close and get symbol:

    static void *
    Host::DynamicLibraryOpen (const FileSpec &file_spec, 
                              Error &error);

    static Error
    Host::DynamicLibraryClose (void *dynamic_library_handle);

    static void *
    Host::DynamicLibraryGetSymbol (void *dynamic_library_handle, 
                                  const char *symbol_name, 
                                  Error &error);

lldb_private::FileSpec also has been modified to support directory enumeration
in an attempt to abstract the directory enumeration into one spot in the code.
The directory enumertion function is static and takes a callback:


    typedef enum EnumerateDirectoryResult
    {
        eEnumerateDirectoryResultNext,  // Enumerate next entry in the current directory
        eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is a directory or symlink, or next if not
        eEnumerateDirectoryResultExit,  // Exit from the current directory at the current level.
        eEnumerateDirectoryResultQuit   // Stop directory enumerations at any level
    };

    typedef FileSpec::EnumerateDirectoryResult (*EnumerateDirectoryCallbackType) (void *baton,
                                                                                  FileSpec::FileType file_type,
                                                                                  const FileSpec &spec);

    static FileSpec::EnumerateDirectoryResult
    FileSpec::EnumerateDirectory (const char *dir_path,
                                  bool find_directories,
                                  bool find_files,
                                  bool find_other,
                                  EnumerateDirectoryCallbackType callback,
                                  void *callback_baton);

This allow clients to specify the directory to search, and specifies if only
files, directories or other (pipe, symlink, fifo, etc) files will cause the
callback to be called. The callback also gets to return with the action that
should be performed after this directory entry. eEnumerateDirectoryResultNext
specifies to continue enumerating through a directory with the next entry.
eEnumerateDirectoryResultEnter specifies to recurse down into a directory
entry, or if the file is not a directory or symlink/alias to a directory, then
just iterate to the next entry. eEnumerateDirectoryResultExit specifies to 
exit the current directory and skip any entries that might be remaining, yet
continue enumerating to the next entry in the parent directory. And finally
eEnumerateDirectoryResultQuit means to abort all directory enumerations at 
all levels.

Modified the Declaration class to not include column information currently
since we don't have any compilers that currently support column based 
declaration information. Columns support can be re-enabled with the
additions of a #define.

Added the ability to find an EmulateInstruction plug-in given a target triple
and optional plug-in name in the plug-in manager.

Fixed a few cases where opendir/readdir was being used, but yet not closedir
was being used. Soon these will be deprecated in favor of the new directory
enumeration call that was added to the FileSpec class.

llvm-svn: 124716
2011-02-02 02:24:04 +00:00
Caroline Tice 31f7d460fa Make sure the confirmation input reader calls fflush after writing its output.
(<rdar://problem/8946573>)

llvm-svn: 124711
2011-02-02 01:17:56 +00:00
Johnny Chen d07a57f222 Add EmulateBLXImmediate() and EmulateBLXRm() to the g_arm_opcodes and g_thumb_opcodes tables,
which represent "bl <label>", "blx <label>", and "blx <Rm>" instructions.

llvm-svn: 124710
2011-02-02 01:13:56 +00:00
Johnny Chen ab62873b63 Fix test function breakpoint_command_script_parameters()'s expect-pattern so that
it passes when using clang as the compiler to build the inferior.

llvm-svn: 124707
2011-02-02 00:56:40 +00:00
Greg Clayton 03dbf2e2a5 Added missing return statement (patch from Kirk Beitz).
llvm-svn: 124706
2011-02-02 00:52:14 +00:00
Sean Callanan 0917d6e5d5 Added a new class, ASTDumper, that provides verbose
diagnostics of Clang AST classes for the purpose of
debugging the types LLDB produces for DWARF objects.

The ASTDumper is currently only used in log output
if you enable verbose mode in the expression log:

log enable -v lldb expr

Its output then appears in the log for external
variables used by the expr command.

llvm-svn: 124703
2011-02-01 23:43:26 +00:00
Johnny Chen 2684ccccda Remove the 'lldb_private::' namespace resolution operator.
llvm-svn: 124671
2011-02-01 18:51:48 +00:00
Johnny Chen 3d9011d6dd Add EmulateVPOP() to the g_arm_opcodes and g_thumb_opcodes tables, which represents
an operation to load multiple extension registers from the stack.

llvm-svn: 124670
2011-02-01 18:35:28 +00:00
Greg Clayton 69c6bc7a9f A missed endian fix for the linux register context for x86_64.
llvm-svn: 124658
2011-02-01 09:20:26 +00:00
Greg Clayton 9b62fd2fda Added a cleanup helper object to make sure the directory that was opened with "DIR *opendir(const char *)" is closed if it is valid with a call to "int closedir (DIR *)".
llvm-svn: 124649
2011-02-01 05:15:22 +00:00
Greg Clayton 293d593294 Added a cleanup helper object to make sure the directory that was opened with "DIR *opendir(const char *)" is closed if it is valid with a call to "int closedir (DIR *)".
llvm-svn: 124648
2011-02-01 05:15:02 +00:00
Greg Clayton f03bbe2661 Added EmulateIntruction plug-in manager support.
llvm-svn: 124644
2011-02-01 01:37:45 +00:00
Greg Clayton 7fb56d0a1a Endian patch from Kirk Beitz that allows better cross platform building.
llvm-svn: 124643
2011-02-01 01:31:41 +00:00
Johnny Chen a1c833769e Add TestVirtual.py to go with test/cpp/virtual/main.cpp file, which tests
C++ virtual function and virtual inheritance.

llvm-svn: 124642
2011-02-01 01:23:34 +00:00
Greg Clayton c4a99bc416 Patch from Kirk Beitz that removes an unneeded include of "sys/errno.h".
llvm-svn: 124638
2011-02-01 01:13:32 +00:00
Greg Clayton c46f94d490 Cleaned up the EmulateInstructionARM to have the evaluate instruction
callbacks use member functions.

llvm-svn: 124636
2011-02-01 00:49:32 +00:00
Greg Clayton c1dfd93e1e Made the EmulateInstruction class into a plug-in interface and moved the
source files around into the places they need to go.

llvm-svn: 124631
2011-02-01 00:04:43 +00:00
Greg Clayton c30c39982d Added a virtual C++ test case that catches some interesting cases
that you run into with inheritance.

llvm-svn: 124619
2011-01-31 23:14:35 +00:00
Johnny Chen 2a183f836c Add emulate_pop (loads multiple registers from the stack) entries to both the
g_arm_opcodes and g_thumb_opcodes tables.

Plus a minor comment fix for EmulateInstruction.h.

llvm-svn: 124617
2011-01-31 23:07:40 +00:00
Caroline Tice 4dd2a3bb97 Test warning for pending breakpoints.
llvm-svn: 124600
2011-01-31 20:27:28 +00:00
Caroline Tice 1196d48842 Add test for breakpoint id ranges.
llvm-svn: 124598
2011-01-31 20:21:32 +00:00
Johnny Chen 413e6520da Add emulate_add_sp_imm entry to the g_thumb_opcodes table, which represents an operation
to adjust the stack pointer by adding an imm7-scaled value to the SP.

llvm-svn: 124596
2011-01-31 20:09:28 +00:00
Johnny Chen 9eb77456e6 Align comment.
llvm-svn: 124595
2011-01-31 20:01:01 +00:00
Caroline Tice 5126986ffc Add test for help on aliased commands.
llvm-svn: 124594
2011-01-31 19:34:56 +00:00
Caroline Tice c9c235e796 Add a few more settings tests.
llvm-svn: 124589
2011-01-31 18:18:54 +00:00
Johnny Chen 072c35866a Add some comments to the emulate_* functions.
llvm-svn: 124588
2011-01-31 18:02:28 +00:00
Johnny Chen 1475d4fa36 Minor comment fix.
llvm-svn: 124586
2011-01-31 17:37:39 +00:00
Greg Clayton b30438aa2b Added the start of the plug-in interface to EmulateInstruction
and implemented it for the EmulateInstructionARM class.

llvm-svn: 124563
2011-01-30 20:03:56 +00:00
Greg Clayton 7d478e0851 Added some documentation that describes the purpose and the goals
of the EmulateInstruction class.

llvm-svn: 124562
2011-01-30 19:42:40 +00:00
Greg Clayton e1af156bdf Bumped Xcode project versions to lldb-46 and debugserver-131.
llvm-svn: 124531
2011-01-29 07:14:26 +00:00
Greg Clayton 513c26ce9d Finished up the async attach support. This allows us to request to attach
by name or by pid (with or without waiting for a process to launch) and
catch the response asynchronously.

llvm-svn: 124530
2011-01-29 07:10:55 +00:00
Jim Ingham 754ab98fae The m_next_action is simpler if it is an auto_pointer.
llvm-svn: 124525
2011-01-29 04:05:41 +00:00
Jim Ingham 2a5fdd4729 Handle the case where the "NextEventAction" wants to kill us on some event other than eStateExited.
llvm-svn: 124521
2011-01-29 01:57:31 +00:00
Jim Ingham bb3a283b3e Added a completion action class to the Process events so that we can make things like Attach and later Launch start their job, and then return to the event loop while waiting for the work to be done.
llvm-svn: 124520
2011-01-29 01:49:25 +00:00
Johnny Chen 74d53758c5 Added comment.
llvm-svn: 124517
2011-01-29 01:21:04 +00:00
Johnny Chen 6573818e38 Add a "-D" option to the test driver which dumps the Python sys.path variable
to be used for the test run.  Could be useful for debugging the setup of the
test environment.

llvm-svn: 124516
2011-01-29 01:16:52 +00:00
Johnny Chen ec1ccca61a Use different log files for the two test cases in order not to confuse the logging subsystem.
llvm-svn: 124513
2011-01-29 00:52:54 +00:00
Caroline Tice 836e3aba16 Add a test case to verify that the frame and breakpoint location
are being properly passed down to script breakpoint commands.

llvm-svn: 124511
2011-01-29 00:20:56 +00:00
Caroline Tice 8607f03af1 Add a test case to check logging of command processing.
Currently this test case works fine run by itself, but fails when
run in the entire test suite; Johnny requested that I check it in
so that he can look at it.

llvm-svn: 124510
2011-01-29 00:19:53 +00:00
Johnny Chen 8960ffd902 Add emulate_mov_low_high() entry to the g_thumb_opcodes table to capture moving
of high registers to low registers in the prologue so they can be saved.

llvm-svn: 124509
2011-01-29 00:11:15 +00:00
Johnny Chen 6bcb81a773 Add "import sys" for sys.stdout.
llvm-svn: 124504
2011-01-28 20:59:39 +00:00
Johnny Chen a1a00b19b5 Add emulate_mov_rd_sp() entries to the g_arm_opcodes and g_thumb_opcodes tables.
For prolog instructions which set r7 or ip to the stack pointer.

llvm-svn: 124501
2011-01-28 19:57:25 +00:00
Johnny Chen 49c2245354 The restoring of sys.stdout should happen right after:
self.runCmd("script my.date()")

In case the self.expect() fails, the restore would not be executed.

llvm-svn: 124500
2011-01-28 19:39:06 +00:00
Johnny Chen c03a362b16 Hardened the test_command_source() test case by actually capturing the output
from running the "script my.date()" lldb command and comparing it against our
expected result.

llvm-svn: 124499
2011-01-28 19:30:12 +00:00
Caroline Tice 163ae0986b Add comment.
llvm-svn: 124495
2011-01-28 18:31:34 +00:00
Caroline Tice c3cc59c119 Remove comments I accidentally left in before.
llvm-svn: 124490
2011-01-28 17:34:54 +00:00
Caroline Tice 29329ada20 Add tests for 'process launch' I/O flags.
llvm-svn: 124489
2011-01-28 17:31:28 +00:00
Johnny Chen 8b2c3217fd Minor comment change.
llvm-svn: 124488
2011-01-28 17:22:29 +00:00
Johnny Chen 121e448e19 Add emulate_sub_r7_ip_imm() (set frame pointer to some ip offset) and emulate_sub_ip_sp_imm() (
set ip to some stack offset) entries to the g_arm_opcodes table.

llvm-svn: 124466
2011-01-28 02:26:08 +00:00
Jim Ingham dd2fe7adb5 Fix a little thinko in sending down the thread name to SetName.
llvm-svn: 124464
2011-01-28 02:23:12 +00:00
Jim Ingham f2c6ccf043 The thread_info changes over the life of the thread, so you can't get it once and cache it, you have to fetch it every time you want to use it.
llvm-svn: 124463
2011-01-28 02:21:37 +00:00
Johnny Chen e5b28a9e6a Should provide more useful context info for the emulate_ldr_rd_pc_rel() impl.
The context being that it's a PC relative load.

llvm-svn: 124460
2011-01-28 00:32:27 +00:00
Caroline Tice ba8df270e6 If the user specfies one of stdin, stdout or stderr, don't
automatically set the non-specified ones to /dev/null.

llvm-svn: 124459
2011-01-28 00:19:58 +00:00
Johnny Chen 3086022a3c Add emulate_ldr_rd_pc_rel entry to the g_thumb_opcodes table, which represents a
PC relative immediate load into register, possibly followed by an add operation
to adjust the SP.

llvm-svn: 124448
2011-01-27 22:52:23 +00:00
Jim Ingham a462f5cc07 Adding a Xcode workspace for lldb.
llvm-svn: 124416
2011-01-27 20:15:39 +00:00
Greg Clayton 2a06ad25d7 Removed the "lldb" folder reference from the Xcode project.
llvm-svn: 124401
2011-01-27 19:37:17 +00:00
Johnny Chen 8286868c84 Add emulate_add_sp_rm entry to the g_thumb_opcodes table, which represents an operation
to adjust the stack pointer by adding a register value in Rm to the SP.

llvm-svn: 124400
2011-01-27 19:34:30 +00:00
Greg Clayton 539848dd25 Updated Xcode project versions: lldb-45 and debugserver-130
llvm-svn: 124372
2011-01-27 09:20:08 +00:00
Greg Clayton 5732f242ee Improved support for GCC complex integers.
llvm-svn: 124371
2011-01-27 09:15:11 +00:00
Greg Clayton 7ec3d40ec0 Finally tracked down the racy condition that would hose up our debug
sessions: When continue packet has been sent and an interrupt packet was
quickly sent, it would get read at the same time:

$c#00\x03

There was an error where the packet end index was always being computed 
incorrectly by debugserver, but it wouldn't matter if there weren't extra
bytes on the end (the hex \x03 interrupt byte in this case). The first
'$' last 3 bytes of the data in the packet buffer were being trimmed
(trying to trim the '#' + checksum (#XX)) which made:

c#

And this would then be passed to the handle routine for the 'c' packet which
would see an extra character at the end and assume it was going to be in the
form c[addr] where "[addr]" was a hex address to resume at and this would
result in a malformed packet response. This is now fixed and everything works
great.

Another issue was issuing async packets correctly by doing correct handshakes
between the thread that wants to send the async packet, and the thread that
is tracking the current run.

Added a write lock to the communication class as well to make sure you never
get two threads trying to write data at the same time. This wasn't happening,
but it is a good idea to make sure it doesn't.

llvm-svn: 124369
2011-01-27 09:02:32 +00:00
Greg Clayton 931180e644 Changed the SymbolFile::FindFunction() function calls to only return
lldb_private::Function objects. Previously the SymbolFileSymtab subclass
would return lldb_private::Symbol objects when it was asked to find functions.

The Module::FindFunctions (...) now take a boolean "bool include_symbols" so
that the module can track down functions and symbols, yet functions are found
by the SymbolFile plug-ins (through the SymbolVendor class), and symbols are
gotten through the ObjectFile plug-ins.

Fixed and issue where the DWARF parser might run into incomplete class member
function defintions which would make clang mad when we tried to make certain
member functions with invalid number of parameters (such as an operator=
operator that had no parameters). Now we just avoid and don't complete these
incomplete functions.

llvm-svn: 124359
2011-01-27 06:44:37 +00:00
Sean Callanan 78e3760fde Updated Clang to a version that supports propagating
the "virtual" flag when importing a C++ function
declaration.  Made changes to LLDB to support other
changes in Clang.

llvm-svn: 124355
2011-01-27 04:42:51 +00:00
Johnny Chen 3ff8e96cf7 Some cleanup to plugins/darwin.py after the recent additions of '-A arch' and '-C compiler'
command line options to the test driver.  Replace TestBase.getRunSpec() with TestBase.getRunOptions().

llvm-svn: 124353
2011-01-27 02:58:54 +00:00
Johnny Chen 9864b5ec5f Add emulate_add_rd_sp_imm (SP plus immediate) to the g_arm_opcodes and g_thumb_opcodes tables.
Change the data type of Context.arg2 to int64_t due to possible negative values.

llvm-svn: 124343
2011-01-27 01:26:19 +00:00
Sean Callanan 3989fb9211 Added error reporting to IRForTarget so that the
user doesn't have to enable logging to see where
something went wrong.

llvm-svn: 124342
2011-01-27 01:07:04 +00:00
Greg Clayton 645bf5420d Added support for some new environment variables within LLDB to enable some
extra launch options:

LLDB_LAUNCH_FLAG_DISABLE_ASLR disables ASLR for all launched processes

LLDB_LAUNCH_FLAG_DISABLE_STDIO will disable STDIO (reroute to "/dev/null")
for all launched processes

LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY will force all launched processes to be
launched in new terminal windows.

Also, don't init python if we never create a script interpreter.

llvm-svn: 124341
2011-01-27 01:01:10 +00:00
Greg Clayton 385d603825 Fixed a crasher when there is no log in Process::SetExitStatus (...).
llvm-svn: 124338
2011-01-26 23:47:29 +00:00
Johnny Chen 9c40302b3b Add emulate_vpush (stores multiple consecutive extension registers to the stack) entries
to both the g_arm_opcodes and g_thumb_opcodes tables.

llvm-svn: 124333
2011-01-26 23:14:33 +00:00
Jim Ingham 2c36439cb0 Make sure that if a CallFunction thread plan crashes while running in the "run to address" mode, and it
is an auto-discard thread plan, the plan stack unwinds properly.

llvm-svn: 124306
2011-01-26 19:13:09 +00:00
Jim Ingham 4bf570d618 Typo in looking up the stored address breakpoints, could cause us to look too far for breakpoints.
llvm-svn: 124305
2011-01-26 19:10:34 +00:00
Jim Ingham 9b23df5903 Initialize an uninitialized variable. I don't think this is ever used, but just to be sure...
llvm-svn: 124304
2011-01-26 19:09:39 +00:00
Johnny Chen 4f7370f7ae Add "-A arch_spec" and "-C compiler_spec" options to the test driver. Example:
$ ./dotest.py -A i386 -C clang -v -w -t -p TestObjCMethods.py
$ ./dotest.py -A x86_64 -C gcc -v -w types

llvm-svn: 124303
2011-01-26 19:07:42 +00:00
Johnny Chen f6aaf31103 Remove duplicated comments.
llvm-svn: 124262
2011-01-26 01:24:45 +00:00
Johnny Chen 832d3137df Move #define's out of ARMUtils.h and into a newly created file ARMDefines.h.
llvm-svn: 124261
2011-01-26 01:18:52 +00:00
Johnny Chen 74889b29a8 Move the generic instruction bits manipulation routines into a newly created file
named InstructionUtils.h and modify some existing code to use them.

llvm-svn: 124259
2011-01-26 01:00:55 +00:00
Johnny Chen 3fde51b820 Add Encoding T1 entry of emulate_sub_sp_imm to the g_thumb_opcodes table.
Update emulate_sub_sp_imm to handle Encoding T1.

llvm-svn: 124253
2011-01-26 00:08:59 +00:00
Greg Clayton 1a65ae11bd Enabled extra warnings and fixed a bunch of small issues.
llvm-svn: 124250
2011-01-25 23:55:37 +00:00
Johnny Chen d5cd645c74 Add Encoding T2 & T3 entries of emulate_sub_sp_imm to the g_thumb_opcodes table.
Update emulate_sub_sp_imm to handle Encoding T2 & T3.

llvm-svn: 124248
2011-01-25 23:49:39 +00:00
Stephen Wilson f3e78a3040 Simple makefile fixups.
With the current target revision of Clang libclangChecker no longer exists and
is not needed.  Update the include path so we can get at ARM_DWARF_Registers.h
and friends.

llvm-svn: 124240
2011-01-25 23:03:42 +00:00
Johnny Chen ccc9963e34 Add an entry to the g_arm_opcodes table named emulate_sub_sp_imm which corresponds
to an operation to adjust the stack pointer (allocate space for local storage).

llvm-svn: 124237
2011-01-25 22:45:28 +00:00
Greg Clayton 1ea20bf6ed http://llvm.org/bugs/show_bug.cgi?id=8260
Removed incorrect enumeration from switch.

llvm-svn: 124232
2011-01-25 21:39:46 +00:00
Greg Clayton 58f417180b http://llvm.org/bugs/show_bug.cgi?id=9053
Fixed bug reported by Ken Ryall.

llvm-svn: 124231
2011-01-25 21:32:01 +00:00
Johnny Chen 54355f7440 Variable renaming for better readability.
llvm-svn: 124208
2011-01-25 19:07:04 +00:00
Johnny Chen 93b0c8b2aa Remove the expectedFailure decorator for the fixed bug:
rdar://problem/8435794
    settings set target.process.output-path does not seem to work

Also change the test case from test_set_output_path to test_set_error_output_path
as it now exercises both setting target.process.error-path and target.process.output-path.

llvm-svn: 124198
2011-01-25 17:39:43 +00:00
Johnny Chen 109941b078 Fix wrong order of "import lldbutil" statement and its usage in the failure case.
llvm-svn: 124196
2011-01-25 17:17:45 +00:00
Johnny Chen a343545229 Trivial comment fix.
llvm-svn: 124195
2011-01-25 16:56:01 +00:00
Greg Clayton ad25145255 Bumped Xcode project versions to lldb-44 and debugserver-129.
llvm-svn: 124181
2011-01-25 07:01:26 +00:00
Greg Clayton cdc7322bb1 Reverting recent thread resume changes as it was causing testing issues.
We will need to try again soon, but this change was causing instability.

llvm-svn: 124180
2011-01-25 06:55:13 +00:00
Greg Clayton 4cd178020c Fixed an issue that was stopping LLDB from finding complete definitions for
types. What was happening was the DWARF parser was almost ignoring definitions
(DIEs with the DW_AT_declaration set to 1). It wasn't ignoring declarations
that had _some_ children. When this happened, we would treat the declaration
as a complete type. Often we would have a declaration of a type with just
some enum definitions inside and nothing else. Now we correctly ignore these
definitions, and also I added some changes to allow us to figure out what
decl context these special declarations actually point to.

llvm-svn: 124179
2011-01-25 06:17:32 +00:00
Jim Ingham b1e1112124 When we are stepping a thread, force it to resume ALL the way to 0. And of course, when we stop
if we undid some user provided suspends, we need to re-do the suspends.

llvm-svn: 124178
2011-01-25 05:26:48 +00:00
Greg Clayton 99d686d728 One more fix to ProcessGDBRemote::DoDestroy(). This one will make sure we
parse the exit status in case we send this packet while stopped.

llvm-svn: 124177
2011-01-25 04:57:42 +00:00
Jason Molenda f28ce687ac Revert one unintended change checked in to DWARFCallFrameInfo.cpp
with my last commit.

The change should be correct but it's not fixing anything important
and right now unneeded changes are not a good idea.

llvm-svn: 124173
2011-01-25 03:12:34 +00:00
Jason Molenda 8fe0c8c6c5 Use new Section::IsEncrypted() method to check if the eh_frame
section is encrypted before trying to read it.  Fixes assert / crash
when trying to unwind an executable w/ encrypted eh_frame sect.

llvm-svn: 124172
2011-01-25 03:05:13 +00:00
Greg Clayton 414f5d3fe8 Fixed ProcessGDBRemote to kill the process correctly when it is either running
or stopped. 

Added support for sections to be able to state if they are encrypted or not.

llvm-svn: 124171
2011-01-25 02:58:48 +00:00
Jim Ingham 0c2706823e Check for a NULL saved stop info shared pointer.
llvm-svn: 124170
2011-01-25 02:47:23 +00:00
Johnny Chen 86b84c25d1 Add an emulate-callback function emulate_str_rt_sp() to the g_arm_opcodes table.
llvm-svn: 124165
2011-01-25 01:13:00 +00:00
Johnny Chen 175de8a1c6 Use two opcode tables g_arm_opcodes and g_thumb_opcodes, instead of lumping arm and thumb opcodes together.
llvm-svn: 124156
2011-01-24 23:40:59 +00:00
Greg Clayton aa1c587a69 Fixed a crasher due to not checking if a shared pointer (m_last_created_breakpoint)
contained a valid object pointer.

llvm-svn: 124155
2011-01-24 23:35:47 +00:00
Johnny Chen b66cdadd4a Fix typo of encoding T2 (push) in the original ARM Architecture Reference Manual,
which has been corrected in the subsequent errata.

llvm-svn: 124152
2011-01-24 22:50:16 +00:00
Johnny Chen 9397fba093 Add comment about using Encoding A1 push instruction to emulate the "stmfd sp!, reg" case,
i.e., pushing one register onto the full descending stacks.

llvm-svn: 124149
2011-01-24 22:25:48 +00:00
Johnny Chen 65b58eafbe Make the assembler mnemonic lowercase.
llvm-svn: 124147
2011-01-24 22:02:46 +00:00
Johnny Chen e74e60cd50 Add Encoding T1 of the PUSH instructions to the g_arm_opcodes table.
llvm-svn: 124144
2011-01-24 20:38:45 +00:00
Johnny Chen c053cdd03d Fix typo in the instruction descriptions for Encoding T2 and T3 of PUSH.
llvm-svn: 124143
2011-01-24 20:21:01 +00:00
Johnny Chen 44a408424f Move some #define's to the ARMUtils.h header file.
llvm-svn: 124141
2011-01-24 19:50:30 +00:00
Johnny Chen d8c2a48298 Add Encoding T2 & T3 of the PUSH instructions to the g_arm_opcodes table.
Plus add an extra field ARMInstrSize to the table entry type 'ARMOpcode'.

llvm-svn: 124140
2011-01-24 19:46:32 +00:00
Johnny Chen 91027008f1 Add an ARMUtils.h file to house utility functions for the ARM/Thumb Instruction Set Architecture.
llvm-svn: 124131
2011-01-24 18:24:53 +00:00
Sean Callanan 9d2127ad3c Fixed a bug in the expression code which caused
it to interpret a "this" variable that was merely
a pointer -- that is, not a class pointer -- as
meaning that the current context was inside a C++
method.  This bug would prevent expressions from
evaluating correctly in regular C code if there
was a pointer variable named "this" in scope.

llvm-svn: 124117
2011-01-24 08:11:45 +00:00
Greg Clayton d58ac45c92 Bumped Xcode project versions: lldb-43 and debugserver-128.
llvm-svn: 124116
2011-01-24 07:16:06 +00:00
Greg Clayton 692538db26 One more thing... Resume any threads that we discover were created while we stop as
they may be in sensitive areas and we set breakpoints on the thread creation routines
if we are running expressions, so the threads should quickly get to a safe spot.

llvm-svn: 124115
2011-01-24 07:10:48 +00:00
Jim Ingham b3413c8a82 Remember to turn off the debugserver.txt hard-coded emission.
llvm-svn: 124114
2011-01-24 06:35:54 +00:00
Jim Ingham 444586b5d2 More useful STEP logging.
Be sure to clear out the base plan's m_report_run and m_report_stop each time we resume so we don't use stale values.

llvm-svn: 124113
2011-01-24 06:34:17 +00:00
Greg Clayton 2ad6670ef1 Make the logging come out all lined up and such.
llvm-svn: 124112
2011-01-24 06:30:45 +00:00
Greg Clayton 050f33cee8 Discover new threads right before we continue a process since libdispatch has
been known to make threads for us while our process/task is suspended.

llvm-svn: 124111
2011-01-24 06:22:23 +00:00