Commit Graph

2010 Commits

Author SHA1 Message Date
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
Greg Clayton 26783fea37 Added logging for threads that are spawned while we stop. We log their
existence if the "thread" log bit is enabled right before we resume.

llvm-svn: 124110
2011-01-24 06:11:50 +00:00
Greg Clayton abcbc8aca8 Fix a crasher when you have no log.
llvm-svn: 124109
2011-01-24 05:36:47 +00:00
Jim Ingham ce5798394f Some useful logging. Also don't stuff the temporary thread into a shared pointer for no apparent reason.
llvm-svn: 124108
2011-01-24 04:11:25 +00:00
Jim Ingham 9f35921baa Add a method to StreamFile to line buffer the file. Use that in "log enable -f file" to line buffer the log output.
llvm-svn: 124107
2011-01-24 04:09:25 +00:00
Jim Ingham c530be664f Linebuffer the log file.
llvm-svn: 124103
2011-01-24 03:46:59 +00:00
Jim Ingham dfac4ccdb7 A little less noise, please.
llvm-svn: 124086
2011-01-23 21:20:20 +00:00
Jim Ingham 1e7a9ee7d0 Add some more logging of broadcaster and Process. Also, protect the event broadcasting against hijacking in mid-event delivery.
llvm-svn: 124084
2011-01-23 21:14:08 +00:00
Greg Clayton b2daec9b04 Improved process logging for both lldb_private::Process and ProcessGDBRemote.
llvm-svn: 124080
2011-01-23 19:58:49 +00:00
Greg Clayton 6f907e69e9 Deprecated old forms of SBTarget::Launch. There is not just one and no
SWIG renaming done to work around deprecated APIs.

llvm-svn: 124075
2011-01-23 17:46:22 +00:00
Johnny Chen c5826824b5 Let's teach SWIG to rename the overloaded SBTarget::Launch() function which has
provision for specifying a working directory with the name LaunchWithCWD in our
target language (Python) for now.  This fixes the test suite failures due to the
overloading.

llvm-svn: 124069
2011-01-23 08:11:49 +00:00
Greg Clayton 03813a4e0d Restored some missing APIs for the test suite. Now testsuite still has some failures
due to overloaded SBTarget::Launch() calls. 

Bumping Xcode project versions: lldb-42 and debugserver-127.

llvm-svn: 124063
2011-01-23 06:21:25 +00:00
Greg Clayton bd82a5d2cc Added a new variant of SBTarget::Launch() that deprectates the old one that
takes separate file handles for stdin, stdout, and stder and also allows for
the working directory to be specified.

Added support to "process launch" to a new option: --working-dir=PATH. We
can now set the working directory. If this is not set, it defaults to that
of the process that has LLDB loaded. Added the working directory to the
host LaunchInNewTerminal function to allows the current working directory 
to be set in processes that are spawned in their own terminal. Also hooked this
up to the lldb_private::Process and all mac plug-ins. The linux plug-in had its
API changed, but nothing is making use of it yet. Modfied "debugserver" and
"darwin-debug" to also handle the current working directory options and modified
the code in LLDB that spawns these tools to pass the info along.

Fixed ProcessGDBRemote to properly pass along all file handles for stdin, stdout
and stderr. 

After clearing the default values for the stdin/out/err file handles for
process to be NULL, we had a crasher in UserSettingsController::UpdateStringVariable
which is now fixed. Also fixed the setting of boolean values to be able to
be set as "true", "yes", "on", "1" for true (case insensitive) and "false", "no",
"off", or "0" for false.

Fixed debugserver to properly handle files for STDIN, STDOUT and STDERR that are not
already opened. Previous to this fix debugserver would only correctly open and dupe
file handles for the slave side of a pseudo terminal. It now correctly handles
getting STDIN for the inferior from a file, and spitting STDOUT and STDERR out to
files. Also made sure the file handles were correctly opened with the NOCTTY flag
for terminals.

llvm-svn: 124060
2011-01-23 05:56:20 +00:00
Greg Clayton 1b03cb5d1b Watch out for NULL types in NameSearchContext::AddTypeDecl or we crash.
llvm-svn: 124051
2011-01-23 00:34:52 +00:00
Greg Clayton 61c2e57b09 Fixed a crasher that would happen when we run into malformed DWARF. It is
nice to know about the issue, but we shouldn't crash.

llvm-svn: 124050
2011-01-23 00:09:32 +00:00
Greg Clayton 6779606a7c Fixed an issue in "SBError SBProcess::Destroy ()" where it wasn't properly
checking the validity of the shared pointer prior to using it.

Fixed the GDB remote plug-in to once again watch for a reply from the "k" 
packet, and fixed the logic to make sure the thread requesting the kill
and the async thread play nice (and very quickly) by synchronizing the
packet sending and reply. I also tweaked some of the shut down packet
("k" kill, "D" detach, and the halt packet) to make sure they do the right
thing.

Fixed "StateType Process::WaitForProcessStopPrivate (...)" to correctly pass
the timeout along to WaitForStateChangedEventsPrivate() and made the function
behave correctly with respect to timing out.

Added separate STDIN, STDOUT, and STDERR support to debugserver. Also added
the start of being able to set the working directory for the inferior process.

llvm-svn: 124049
2011-01-22 23:43:18 +00:00
Greg Clayton 7ecb3a040b Avoid the race condition Stephen Wilson was worried about in revision 123465 by making a local copy. We need to be able to have the private state thread let the lldb_private::Process class that it has exited, otherwise we end up with a timeout when the process destructor or DoDestroy is called where the private state thread has already exited and then StopPrivateStateThread() will wait for the thread which has already existed to respond to it.
llvm-svn: 124038
2011-01-22 17:43:17 +00:00
Greg Clayton 6ed95945ed Sped up the shutdown time on MacOSX by quite a bit by making sure any
threads that we spawn let us know when they are going away and that we
don't timeout waiting for a message from threads that have gone away.
We also now don't expect the "k" packet (kill) to send a response. This
greatly speeds up debugger shutdown performance. The test suite now runs
quite a bit faster.

Added a fix to the variable display code that fixes the display of
base classes. We were assuming the virtual or normal base class offsets
were being given in bit sizes, but they were being given as character
sizes, so we needed to multiply the offset by 8. This wasn't affecting
the expression parser, but it was affecting the correct display of C++
class base classes and all of their children.

llvm-svn: 124024
2011-01-22 07:12:45 +00:00
Jim Ingham 1c823b43e5 Added an interface for noticing new thread creation. At this point, I only turn it on when
we are requesting a single thread to run.  May seem like a silly thing to do, but the kernel 
on MacOS X will inject new threads into a program willy-nilly, and I would like to keep them
from running if I can.

llvm-svn: 124018
2011-01-22 01:33:44 +00:00
Jim Ingham e22e88b8a8 Add more logging. Try to handle the case where "Halt" fails. This is kind of a losing game in the end, if we can't halt the target, it is not clear what we can do but keep trying...
llvm-svn: 124017
2011-01-22 01:30:53 +00:00
Jim Ingham e54defe4a3 Centralize the register reporting (might want to move this function to Thread).
llvm-svn: 124016
2011-01-22 01:28:29 +00:00
Jim Ingham 9da3683c43 Centralize the register reporting (might want to move this function to Thread).
Make sure DoTakedown gets called only once by adding a dedicated m_takedown_done bool. 
Add a little more useful logging.

llvm-svn: 124015
2011-01-22 01:27:23 +00:00
Jim Ingham e3be0c55f5 Move some of the more noisy "log enable lldb expression" output to the verbose output.
llvm-svn: 124014
2011-01-22 01:25:40 +00:00
Jim Ingham d8d148e0ee Make "log enable -v" work. We were only checking the log's stream's verbosity, not the log's verbosity...
llvm-svn: 124013
2011-01-22 01:24:30 +00:00
Jim Ingham 50646ab3e1 Add a (currently disabled) bear trap where instead of deallocating pages, we remove all permissions.
llvm-svn: 124012
2011-01-22 01:22:51 +00:00
Caroline Tice e02657b181 Add API and implementation for SBDebugger::Destroy and Debugger::Destroy.
llvm-svn: 124011
2011-01-22 01:02:07 +00:00
Johnny Chen 05a97ecc02 Add more descriptions to the g_arm_opcodes table entries.
llvm-svn: 124010
2011-01-22 00:59:07 +00:00
Johnny Chen 7aeb12b848 Pass along (ARMEncoding)encoding as the callback data, which allows us to abstract
the EmulateCallback routine without too much duplication.  Add an entry for emulating
ARM PUSH with encoding A2.

llvm-svn: 124009
2011-01-22 00:47:08 +00:00
Jim Ingham d14777a2f2 Add missing {} so we don't print the Baton address for the brief breakpoint listing.
llvm-svn: 124008
2011-01-22 00:28:04 +00:00
Johnny Chen dfeab068f5 Untabify the file.
llvm-svn: 124003
2011-01-21 22:47:25 +00:00
Sean Callanan f694a55736 Added a safeguard to ensure that the user does not create variables that override persistent result variables.
llvm-svn: 124001
2011-01-21 22:30:25 +00:00
Jim Ingham 8f3432c916 The code to check whether the number of arguments was 0 was not necessary, VerifyBreakpointIDs will turn an empty argument into the last specified breakpoint.
llvm-svn: 124000
2011-01-21 22:13:25 +00:00
Greg Clayton 6da4ca83b0 Added the start of opcode emulation for ARM instructions. This class is designed
to be fed 4 callbacks: read/write memory, and read/write registers. After this,
you can tell the object to read an instruction. This will cause the class to read
the PC, and read and instruction. Then you can emulate the instruction by calling
EvaluateInstruction. This will cause the class to figure out exactly what an opcode
does, and call the read/write mem/regs functions with actual values which allows one
to emulate an instruction without running a process, or it allows one to watch the
context information (the memory write is a pushing register 3 onto the stack at offset
12) so it can be used for generating call frame information. This way, in the future,
we will have one class that can be used to emulate instructions and generate our
unwind info from assembly.

llvm-svn: 123998
2011-01-21 22:02:52 +00:00
Johnny Chen 661ba65dd8 Add test cases for the scenario of selecting a frame index while stopped, and
then doing a thread step-out.  This should lead us to the caller frame of the
frame we just selected.

llvm-svn: 123984
2011-01-21 18:23:16 +00:00
Greg Clayton 481cef25dc Added support for stepping out of a frame. If you have 10 stack frames, and you
select frame #3, you can then do a step out and be able to go directly to the
frame above frame #3! 

Added StepOverUntil and StepOutOfFrame to the SBThread API to allow more powerful
stepping.

llvm-svn: 123970
2011-01-21 06:11:58 +00:00
Greg Clayton e221f82b40 Fixed up the SBValue::GetExpressionPath() to be more correct under more
circumstances.

llvm-svn: 123957
2011-01-21 01:59:00 +00:00
Greg Clayton 6d5e68eaf2 Added the ability to StackFrame::GetValueForVariableExpressionPath(...) to avoid
fragile ivars if requested. This was done by changing the previous second parameter
to an options bitfield that can be populated by logical OR'ing the new 
StackFrame::ExpressionPathOption enum values together:

    typedef enum ExpressionPathOption
    {
        eExpressionPathOptionCheckPtrVsMember   = (1u << 0),
        eExpressionPathOptionsNoFragileObjcIvar = (1u << 1),
    };

So the old function was:
     lldb::ValueObjectSP
     StackFrame::GetValueForVariableExpressionPath (const char *var_expr, bool check_ptr_vs_member, Error &error);

But it is now:

    lldb::ValueObjectSP
    StackFrame::GetValueForVariableExpressionPath (const char *var_expr, uint32_t options, Error &error);

This allows the expression parser in Target::EvaluateExpression(...) to avoid
using simple frame variable expression paths when evaluating something that might
be a fragile ivar.

llvm-svn: 123938
2011-01-20 19:27:18 +00:00
Johnny Chen af5fe69860 Remove the expectedFailure decorators. The bug:
rdar://problem/8875425 Found mySource->isa local variable assertion failed

has been fixed.

llvm-svn: 123924
2011-01-20 17:40:51 +00:00
Greg Clayton 4dc72284b2 Fixed the async packets (packets that need to be sent to the GDB server
while the inferior is running) to be fast. The previous code would always
cause the sender to timeout, yet still return success due to the way we
were waiting for a value (incorrect value) to change. Now the ProcessGDBRemote
plug-in has a public and private "is running" predicate. This allows things
that need to send async packets to interrupt and wait for the private "is running"
state to be flipped to false, and then resume quickly with no timeout. 

llvm-svn: 123903
2011-01-20 07:53:45 +00:00
Greg Clayton 16b2d2bf19 Made the DWARF + debug map symbol file parser be much more efficient when it isn't
going to actually be used as the symbol file plug-in by looking only for suitable
N_OSO symbols and avoiding sorting function (N_FUN) and global/static (N_GSYM/N_STSYM)
symbols when there are no suitable N_OSO objects.

llvm-svn: 123889
2011-01-20 06:08:59 +00:00
Greg Clayton c432c1967b Fixed the auto completion of objective C types with the new ExternalASTSource
changes that recently happened.

llvm-svn: 123881
2011-01-20 04:18:48 +00:00
Jim Ingham 77787033b9 Back up both the register AND the stop state when calling functions.
Set the thread state to "bland" before calling functions so they don't 
  inherit the pending signals and die.

llvm-svn: 123869
2011-01-20 02:03:18 +00:00
Greg Clayton 22a939a782 Make expressions clean up their JIT'ed code allocation.
llvm-svn: 123855
2011-01-19 23:00:49 +00:00
Johnny Chen 2a67aa721f Add the cmdline to invoke the Python profile reporting module.
llvm-svn: 123844
2011-01-19 19:48:29 +00:00
Johnny Chen f249090d7b Print out the command line used to invoke the test suite so I don't get confused
since different options can affect the run time.

llvm-svn: 123843
2011-01-19 19:31:46 +00:00
Johnny Chen d2047fa6af Fix a typo in the comment.
llvm-svn: 123840
2011-01-19 18:18:47 +00:00
Jim Ingham e8231f41aa ThreadPlanCallUserExpression's WillPop needs to call it's parent's WillPop.
llvm-svn: 123816
2011-01-19 09:45:44 +00:00
Greg Clayton e2d4f0d7ce Took the timeout for a ClangUserExpression down from a 10 second timeout to
500 ms.

Make MachThreadList more threadsafe.

Added code to make sure the thread register state was properly flushed for x86_64.

Fixed an missing return code for the current thread in the new thread suffix code.

Improved debugserver logging.

llvm-svn: 123815
2011-01-19 07:54:15 +00:00
Johnny Chen 30775d0107 Added special logic to faciliate profiling the test suite run with the cProfile.py
module.

On my MBP running SnowLeopard:

$ DOTEST_PROFILE=YES DOTEST_SCRIPT_DIR=/Volumes/data/lldb/svn/trunk/test /System/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/cProfile.py -o my.profile ./dotest.py -v -w 2> ~/Developer/Log/lldbtest.log

After that, I used the pstats.py module to browse the statistics recorded in the my.profile file. 

llvm-svn: 123807
2011-01-19 02:10:40 +00:00
Johnny Chen cf7f74e31c The test suite was unnecessarily doing a time.sleep() after performing the
"process launch" or "run" interpreter command.  Let's do the sleep only if
the process launch failed.  This saves about 135 seconds from the whole test
suite run time.

llvm-svn: 123806
2011-01-19 02:02:08 +00:00
Stephen Wilson 570243b5d9 Delay sync with the parent thread in ProcessLinux/ProcessMonitor.
This patch removes a potential race condition between a process monitor thread
and its parent waiting to interrogate the success/failure of the launch.

llvm-svn: 123803
2011-01-19 01:37:06 +00:00
Stephen Wilson 771ec8006c Make LinuxThread use the LLDB unwinder.
llvm-svn: 123801
2011-01-19 01:36:10 +00:00
Stephen Wilson 02e8f8fdc9 Do not enable hardware stepping when resuming a step-enabled thread.
The previous implementation of HardwareSingleStep wrongly resumed the thread and
single-stepped over the next instruction.  Use the proper call to ProcessMonitor.

llvm-svn: 123800
2011-01-19 01:35:00 +00:00
Stephen Wilson cd69a9ab16 Fix implementation of LinuxThread::HardwareSingleStep.
Previous version simply resumed the associated thread to single step over a
single instruction which is not the intended semantics for this method.  Set the
appropriate bit in the rflags register instead.

llvm-svn: 123799
2011-01-19 01:33:33 +00:00
Stephen Wilson 273c93b625 Implement RegisterContextLinux_x86_64::ReadRegisterBytes.
Also, this patch adds a few delimiters to the register enumeration to enable
efficient testing of register set inclusion.

llvm-svn: 123798
2011-01-19 01:32:28 +00:00
Stephen Wilson ade1aea00c Support the reading of registers en masse via the linux ProcessMonitor.
llvm-svn: 123797
2011-01-19 01:31:38 +00:00
Stephen Wilson e329630873 Timeout if we fail to receive a state change event when destroying an inferior.
llvm-svn: 123796
2011-01-19 01:30:44 +00:00
Stephen Wilson 9f71f0cb66 Only enqueue valid ProcessLinux messages.
llvm-svn: 123795
2011-01-19 01:29:39 +00:00
Stephen Wilson 88eb6d5725 Load dependent modules in the Linux dynamic loader.
This fixes a bug where the dynamic loader rendezvous was not updating its
internal state when first initialized.

llvm-svn: 123794
2011-01-19 01:28:39 +00:00
Johnny Chen d077e4595c Decorated two new expected failures:
rdar://problem/8875425 Found mySource->isa local variable assertion failed

llvm-svn: 123792
2011-01-19 00:31:52 +00:00
Sean Callanan 2c777c4afb Updated to revision 123723 of LLVM, to bring in
support for minimal type import functionality.

llvm-svn: 123787
2011-01-18 23:32:05 +00:00
Jim Ingham b086ff7e3f Make a few log messages come out in "log enable lldb step" as well as "log enable lldb expression".
llvm-svn: 123784
2011-01-18 22:20:08 +00:00
Greg Clayton 6f535b98e9 Remove trailing commas from lldb enumerations (patch from Stephen Wilson).
llvm-svn: 123782
2011-01-18 21:49:11 +00:00
Greg Clayton 8368b4b2a2 Use generic CPU types instead of hard coding to mach-o when getting default byte order (patch from Stephen Wilson).
llvm-svn: 123781
2011-01-18 21:47:52 +00:00
Greg Clayton 411c0ce87c Fixed incorrect logging printf (patch from Stephen Wilson).
llvm-svn: 123780
2011-01-18 21:44:45 +00:00
Greg Clayton 9566143f7d Fixed missing return value (patch from Stephen Wilson).
llvm-svn: 123779
2011-01-18 21:43:22 +00:00
Greg Clayton c4e411ffc0 Thread safety changes in debugserver and also in the process GDB remote plugin.
I added support for asking if the GDB remote server supports thread suffixes
for packets that should be thread specific (register read/write packets) because
the way the GDB remote protocol does it right now is to have a notion of a
current thread for register and memory reads/writes (set via the "$Hg%x" packet)
and a current thread for running ("$Hc%x"). Now we ask the remote GDB server
if it supports adding the thread ID to the register packets and we enable
that feature in LLDB if supported. This stops us from having to send a bunch
of packets that update the current thread ID to some value which is prone to
error, or extra packets.

llvm-svn: 123762
2011-01-18 19:36:39 +00:00
Jim Ingham bda4e5eb33 In ThreadPlanCallFunction, do the Takedown right when the thread plan gets popped. When the function call is discarded (e.g. when it crashes and discard_on_error is true) the plan gets discarded. You need to make sure that the stack gets restored right then, and not wait till you start again and the thread plan stack is cleared.
llvm-svn: 123716
2011-01-18 01:58:06 +00:00
Sean Callanan 2652ad251a Quick fixes to set access specifiers for Typedefs
and Enums inside classes.

llvm-svn: 123710
2011-01-18 01:03:44 +00:00
Sean Callanan c3a160062d Added support for the fragile ivars provided by
Apple's Objective-C 2.0 runtime.  They are enabled
if the Objective-C runtime has the proper version.

llvm-svn: 123694
2011-01-17 23:42:46 +00:00
Jim Ingham 5caed4e8a8 Add a method on the ObjC Language Runtime that returns the runtime version.
llvm-svn: 123693
2011-01-17 23:06:54 +00:00
Johnny Chen 07b289221f Terminate the current process being debugged.
The test framework was relying on detecting either "run" or
"process launch" command to automatically kill the inferior.

llvm-svn: 123683
2011-01-17 22:35:39 +00:00
Caroline Tice 6760a51739 Replace Mutex guarding python interpreter access with Predicate,
allowing timeouts & informing the user when the lock is unavailable.


Fixed problem where Debugger::Terminate was clearing the debugger list
even when the global ref count was greater than zero.

llvm-svn: 123674
2011-01-17 21:55:19 +00:00
Greg Clayton fc75303acb Avoid infinite loops in stack backtraces and renamed:
bool RegisterContextLLDB::GetPC (addr_t& pc);

to:
    bool RegisterContextLLDB::ReadPC (addr_t& pc);
    
To avoid confusion with the GetPC() function that is part of the 
lldb_private::RegisterContext:

    uint64_t RegisterContext::GetPC (uint64_t fail_value);
    
Bad things could happen if the two got intermixed and the wrong one got
called.

Fixed inifinite loop detection by watching for two frames where the
RegisterContextLLDB::CursorSP contains the same start_pc and cfa.

    

llvm-svn: 123673
2011-01-17 21:03:33 +00:00
Greg Clayton b2a844bfe1 Removed commented out code since it was incorrect code to begin with and we don't want anyone thinking they should put it back in.
llvm-svn: 123672
2011-01-17 20:59:07 +00:00
Sean Callanan 865267f9d4 Fixed a bug which would trigger an assert() in LLDB;
we were setting a forward-declared Objective-C class
type as being completed using an ExternalSemaSource,
but this is neither legal nor necessary.

llvm-svn: 123671
2011-01-17 20:50:38 +00:00
Greg Clayton 388b33b5cd Another fix for the objective C runtime object checker to not use NULL when it isn't defined.
llvm-svn: 123617
2011-01-17 06:17:42 +00:00
Greg Clayton 23af0d896d Fixed the C string summary formatter to not get into an infinite loop for
long strings in "char *" (with any combo if qualifiers).

llvm-svn: 123616
2011-01-17 05:51:02 +00:00
Greg Clayton 7d87b92d2e Fix the objective C object validator that I broke. When we have ObjC runtime
V2 and we only have gdb_class_getClass, then make sure the isa isn't NULL 
before trying to call gdb_class_getClass otherwise we end up deadlocking the
objective C runtime.

llvm-svn: 123615
2011-01-17 04:34:26 +00:00
Greg Clayton 47a15b7c0b Added missing source files.
llvm-svn: 123614
2011-01-17 04:19:51 +00:00
Greg Clayton 6beaaa680a A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a 
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.

A few months ago I worked with the llvm/clang folks to have the 
ExternalASTSource class be able to complete classes if there weren't completed
yet:

class ExternalASTSource {
....

    virtual void
    CompleteType (clang::TagDecl *Tag);
    
    virtual void 
    CompleteType (clang::ObjCInterfaceDecl *Class);
};

This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.

This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
  objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
  types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
  ClangASTType, and more) can now be iterating through children of any type,
  and if a class/union/struct type (clang::RecordType or ObjC interface) 
  is found that is incomplete, we can ask the AST to get the definition. 
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
  all child SymbolFileDWARF classes will share (much like what happens when
  we have a complete linked DWARF for an executable).
  
We will need to modify some of the ClangUserExpression code to take more 
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.

llvm-svn: 123613
2011-01-17 03:46:26 +00:00
Stephen Wilson 2103e25e19 Initial support for a DynamicLoader plugin on Linux.
This patch is enough to have shared objects recognized by LLDB.  We can handle
position independent executables.  We can handle dynamically loaded modules
brought in via dlopen.

The DYLDRendezvous class provides an interface to a structure present in the
address space of ELF-based processes.  This structure provides the address of a
function which is called by the linker each time a shared object is loaded and
unloaded (thus a breakpoint at that address will let LLDB intercept such
events), a list of entries describing the currently loaded shared objects, plus
a few other things.

On Linux, processes are brought up with an auxiliary vector on the stack.  One
element in this vector contains the (possibly dynamic) entry address of the
process.  One does not need to walk the stack to find this information as it is
also available under /proc/<pid>/auxv.  The new AuxVector class provides a
convenient read-only view of this auxiliary vector information.  We use the
dynamic entry address and the address as specified in the object file to compute
the actual load address of the inferior image.  This strategy works for both
normal executables and PIE's.

llvm-svn: 123592
2011-01-16 19:45:39 +00:00
Stephen Wilson 811975d59e Make a mandatory call to DestroyThread() in ~LinuxThread().
llvm-svn: 123583
2011-01-16 16:56:16 +00:00
Greg Clayton 45eacff2ad lldb-41 and debugserver-126 are set in the Xcode projects.
llvm-svn: 123513
2011-01-15 03:06:23 +00:00
Greg Clayton 49462ea7e4 Added complete complex support for displaying and parsing complex types.
llvm-svn: 123509
2011-01-15 02:52:14 +00:00
Greg Clayton f83f32d3ef Enabled ObjC 2 abilities for expressions. We will enable the fragile ivar
stuff soon when we get a fix for looking up the "OBJC_IVAR_$_Class.ivar"
style symbols into IRForTarget::ResolveExternals() next week.

llvm-svn: 123507
2011-01-15 01:32:14 +00:00
Stephen Wilson fda49a0540 Add empty implementation of pure virtual RegisterContext::InvalidateAllRegisters.
This patch simply allows the tree to build.  A proper implementation still needs
to be provided.

llvm-svn: 123504
2011-01-15 00:15:12 +00:00
Stephen Wilson 2f8e0f24dd Set the ID of a ProcessLinux instance to the PID of the inferior on launch.
llvm-svn: 123503
2011-01-15 00:13:27 +00:00
Stephen Wilson 57740ecedb Miscellaneous cleanups in ProcessMonitor.
Propagate the environment if one is not provided.  Also, do not allocate the
monitor threads launch arguments on the stack.

llvm-svn: 123502
2011-01-15 00:12:41 +00:00
Stephen Wilson f62308c9b0 Use the correct type for thread handle.
llvm-svn: 123500
2011-01-15 00:11:28 +00:00
Stephen Wilson c4391cb11e Implement ProcessLinux::GetImageInfoAddress().
llvm-svn: 123499
2011-01-15 00:10:37 +00:00
Stephen Wilson 7f3b57ca35 Test if an ELF object is executable by checking if an entry point is defined.
The previous check on header type ET_EXEC is not general enough.  Position
independent executables have type ET_DYN.

llvm-svn: 123498
2011-01-15 00:09:50 +00:00
Stephen Wilson 2ab0a5858f Implement GetEntryPoint, GetImageInfoAddress and GetArchitecture for ObjectFileELF.
llvm-svn: 123496
2011-01-15 00:08:44 +00:00
Stephen Wilson 5a75c91eeb Have LinuxThread cache it's current StopInfo object.
llvm-svn: 123495
2011-01-15 00:07:36 +00:00
Greg Clayton 714ab86491 Added the ability to wait for a predicate value, and set it to a new value all in a thread safe fashion.
llvm-svn: 123492
2011-01-14 23:37:51 +00:00
Johnny Chen ded0a2c05a Converted to use Makefile.rules.
llvm-svn: 123471
2011-01-14 21:55:29 +00:00