Commit Graph

1046 Commits

Author SHA1 Message Date
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 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 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 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
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 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
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
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 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
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