Commit Graph

2109 Commits

Author SHA1 Message Date
Greg Clayton 576d8834fe Split the GDBRemoteCommunication class into three classes:
GDBRemoteCommunication - The base GDB remote communication class
GDBRemoteCommunicationClient - designed to be used for clients the connect to
                               a remote GDB server
GDBRemoteCommunicationServer - designed to be used on the server side of a
                               GDB server implementation.

llvm-svn: 128070
2011-03-22 04:00:09 +00:00
Jim Ingham ffba229d61 Add "up" and "down" aliases.
llvm-svn: 128066
2011-03-22 02:29:32 +00:00
Jim Ingham 0292f4a531 Clean up a few places where SetOptionValue was using the global optarg, rather than the option_arg value that was passed in.
llvm-svn: 128064
2011-03-22 01:53:33 +00:00
Jim Ingham 37023b06bd Add the ability to disassemble "n" instructions from the current PC, or the first "n" instructions in a function.
Also added a "-p" flag that disassembles from the current pc.

llvm-svn: 128063
2011-03-22 01:48:42 +00:00
Jim Ingham 381e25b793 Tidy up the stop hook printing when only one thread matches, and there is only one hook.
llvm-svn: 128062
2011-03-22 01:47:27 +00:00
Greg Clayton b43767aff2 Added missing files.
llvm-svn: 128061
2011-03-22 01:34:44 +00:00
Greg Clayton fc36f79170 Abtracted the innards of lldb-core away from the SB interface. There was some
overlap in the SWIG integration which has now been fixed by introducing
callbacks for initializing SWIG for each language (python only right now).
There was also a breakpoint command callback that called into SWIG which has
been abtracted into a callback to avoid cross over as well.

Added a new binary: lldb-platform

This will be the start of the remote platform that will use as much of the 
Host functionality to do its job so it should just work on all platforms.
It is pretty hollowed out for now, but soon it will implement a platform
using the GDB remote packets as the transport.

llvm-svn: 128053
2011-03-22 01:14:58 +00:00
Johnny Chen 9d46337511 Add options to allow for specifying an option string when spawning gdb and for executing
command(s) right after starting up gdb.  Update the README file to show an example of
using these to pass '-arch armv7' to gdb and to execute gdb command to set shared library
path substitutions before loading iOS4.3 sdk's /usr/lib/libSystem.B.dylib and disassembling
the 'printf' function.

llvm-svn: 128040
2011-03-21 23:44:44 +00:00
Johnny Chen 31d446aa5c Fix a typo in the message string.
llvm-svn: 128034
2011-03-21 23:01:34 +00:00
Greg Clayton 45aea640a0 Added real user/group id, effective user/group id, and parent
process ID to the ProcessInfo.

llvm-svn: 128023
2011-03-21 21:25:07 +00:00
Greg Clayton 0f366ac3af Move the building of llvm/clang and the swig wrappers into the lldb-core
target.

llvm-svn: 128012
2011-03-21 18:46:11 +00:00
Greg Clayton e38a2556da Fixed a warning with gcc 4.2 when the Xcode project falls back to the
system compiler when clang isn't around to do the compiling.

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

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

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

llvm-svn: 127963
2011-03-20 04:57:14 +00:00
Johnny Chen 5c07daaa1d Modify disasm.py to better deal with the objc method name which has ':' in them.
Add a utility similar to disasm.py, but which provides a shell-like environment for invoking llvm-mc.

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

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

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


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

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

llvm-svn: 127934
2011-03-19 01:12:21 +00:00
Johnny Chen d3a4e7eee5 Add cases to test that two template instantiations of std::vector<long> and std::vector<short>
in the same compilation module show up as different types for lldb debugger.

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

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

Fix bug in insn tables.

llvm-svn: 127838
2011-03-17 23:50:16 +00:00
Jim Ingham 8268ccab60 Fix a problem where we were looking up the class pointer in the {class/sel -> implementation} cache for a objc_msgSendSuper call - where we should have looked up the class's super-class.
llvm-svn: 127830
2011-03-17 21:04:33 +00:00
Jim Ingham 35944dda10 Get ObjC stepping working again when the process is not the default host architecture.
llvm-svn: 127825
2011-03-17 20:02:56 +00:00
Johnny Chen 0d825132c6 Tidy up the input file given to 'llvm-mc -disassemble' and also append the gdb
assembler code to the memory dump.

llvm-svn: 127823
2011-03-17 19:05:34 +00:00
Johnny Chen 6f6fb3e515 Add a Python script to take an executable, run gdb to disassemble a function,
read the memory contents of the function, and then feed the bytes to the
'llvm-mc -disassemble' command.

It uses the pexpect module located under ToT/test/pexpect-2.4 directory to
automate the interaction with gdb.  This is used initially to test the low
level ARM disassembler of llvm.

llvm-svn: 127785
2011-03-17 00:59:57 +00:00
Johnny Chen dbfc256eec As a simple measure, output the lldb version and the svn info for
which the testsuite is run against.

llvm-svn: 127782
2011-03-17 00:38:22 +00:00
Caroline Tice aaf5ddcf82 Add code to emulate STRH (Register) Arm instruction.
Remove inaccurate comments from EmulateInstruction::Context definition.

Fix contexts in a few arm instruction emulation routines.

llvm-svn: 127770
2011-03-16 22:46:55 +00:00
Caroline Tice fe28f1bff9 Fix various small bugs found in the instruction emulation functions.
llvm-svn: 127712
2011-03-16 00:06:12 +00:00
Sean Callanan e6935b6bdf Updated LLVM/Clang to the latest release, to pick
up AVX disassembly support.

llvm-svn: 127695
2011-03-15 20:57:04 +00:00
Greg Clayton 1a37ae40e1 Now that we have the debug map issues fixed, change the Xcode project to
build lldb, LLDB.framework and debugserver all with just DWARF (no dSYM).

llvm-svn: 127686
2011-03-15 18:51:42 +00:00
Greg Clayton 3690964ca1 Added a fix that should help incorrect type uniquing. There was an issue
for templatized types that could cause parts of a std::vector (and I am sure
other STL types) to be incorrectly uniqued to each other wreaking havoc on 
variable display for types within the same executable module.

llvm-svn: 127662
2011-03-15 04:38:20 +00:00
Greg Clayton 3ad0572d2e Make the first vector of "long" instead of "int" so we can tell the difference
easier since "short" ends up with "short int" in the template allocators.

llvm-svn: 127661
2011-03-15 04:29:42 +00:00
Greg Clayton 8f67fd10e9 Added a test case for unique types. In the test case there are two std::vector
types that have different contents. Currently LLDB is incorrectly uniquing,
on MacOSX, the std::vector _VectorImpl class from the two different vector
templates. The DWARF looks like:

0x0000008e:         DW_TAG_structure_type [7] *
                     DW_AT_name( "_Vector_base<int,std::allocator<int> >" )
                     DW_AT_declaration( 0x01 )
                     DW_AT_sibling( {0x00000103} )

0x00000098:             DW_TAG_structure_type [8] *
                         DW_AT_name( "_Vector_impl" )
                         DW_AT_byte_size( 0x18 )
                         DW_AT_decl_file( "/usr/include/c++/4.2.1/bits/stl_vector.h" )
                         DW_AT_decl_line( 83 )

0x000000a0:                 DW_TAG_inheritance [9]  
                             DW_AT_type( {0x000006fa} ( allocator<int> ) )
                             DW_AT_data_member_location( +0 )
                             DW_AT_accessibility( DW_ACCESS_public )



0x0000011b:         DW_TAG_structure_type [7] *
                     DW_AT_name( "_Vector_base<short int,std::allocator<short int> >" )
                     DW_AT_declaration( 0x01 )
                     DW_AT_sibling( {0x00000190} )

0x00000125:             DW_TAG_structure_type [8] *
                         DW_AT_name( "_Vector_impl" )
                         DW_AT_byte_size( 0x18 )
                         DW_AT_decl_file( "/usr/include/c++/4.2.1/bits/stl_vector.h" )
                         DW_AT_decl_line( 83 )

0x0000012d:                 DW_TAG_inheritance [9]  
                             DW_AT_type( {0x00000f75} ( allocator<short int> ) )
                             DW_AT_data_member_location( +0 )
                             DW_AT_accessibility( DW_ACCESS_public )


In this case it using DIE 0x00000098 for both 0x00000098 and 0x00000125.

This test will help detect this issue once I have a fix for it. I have a fix
that I am testing.

llvm-svn: 127660
2011-03-15 04:25:12 +00:00
Greg Clayton 616f490777 Added a fix to not re-use object files when doing DWARF with debug map.
llvm-svn: 127659
2011-03-15 03:56:33 +00:00
Sean Callanan fb0b7583a7 Updated to LLVM/Clang revision 127600.
llvm-svn: 127634
2011-03-15 00:17:19 +00:00
Stephen Wilson d7b15bd6b7 Fix makefile builds when llvm is configured with -enable-shared.
We were dropping the expansion of -rpath=$(LibDir) on linux, which resulted in
the build not being able to resolve libLLVM.so.  Bring in the definition before
expanding the values hanging off LD.Flags.

Thanks to Jason E. Aten for reporting this!

llvm-svn: 127570
2011-03-13 18:17:16 +00:00
Benjamin Kramer 489ac96fcd Turn labels into actual switch cases.
llvm-svn: 127558
2011-03-13 00:14:32 +00:00
Stephen Wilson 28c16d9a7e Add a missing include.
This change is needed to fix the build on Linux. 

llvm-svn: 127557
2011-03-13 00:00:32 +00:00
Johnny Chen b877f1efe9 Add a test directory stop-hook to test the newly added "target stop-hook" command.
This uses pexpect module to spawn a 'lldb' program and uses pseudo-TTY to talk to
the child application.

The test cases test setting breakpoints, adding a stop-hook with line range, and
verifies that when the inferior stops, the stop-hook will fire off when it is
within range and will not fire off when it is out of range.

llvm-svn: 127519
2011-03-12 01:18:19 +00:00
Johnny Chen b7cfba4cb1 Add pexpect-2.4 (a pure Python module for controlling and automating other programs) to the test directory.
http://pypi.python.org/pypi/pexpect/

llvm-svn: 127484
2011-03-11 20:13:06 +00:00
Johnny Chen 7fdf1d13f0 Discover the 'lldb' executable in the setUp() hook of the base test class.
llvm-svn: 127481
2011-03-11 19:55:31 +00:00
Johnny Chen cd29b050b7 Add a mechanism to discover the full path of the 'lldb' program into the test driver.
This provides a way to potentially provide conversational interactions with 'lldb' in the test suite.

llvm-svn: 127479
2011-03-11 19:47:23 +00:00
Jim Ingham 9575d8446c Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.

llvm-svn: 127457
2011-03-11 03:53:59 +00:00
Jim Ingham bad87feca2 CommandInterpreter::HandleCommands should take its commands as a "const StringList &" since it doesn't modify it...
Also, don't turn on the immediate output in the temporary result, or you'll get doubled output.

llvm-svn: 127452
2011-03-11 01:51:49 +00:00
Jim Ingham e1e96027a6 Fix a few things in the CommandArguments table.
llvm-svn: 127451
2011-03-11 01:50:30 +00:00
Jim Ingham b2605bc96d Declare some const functions as const.
llvm-svn: 127450
2011-03-11 01:48:52 +00:00
Jim Ingham 17de754181 Fix a typo in a comment.
llvm-svn: 127449
2011-03-11 01:48:09 +00:00
Johnny Chen fdc94ff97e Add test cases to exercise the SBThread.GetProcess() API. We launch the process using the
SBTarget.Launch() API, stop at a breakpoint, get the stopped thread, and verify that the
pid of the stopped thread's process is equal to the pid of the process returned by
SBTarget.Launch().

llvm-svn: 127444
2011-03-11 01:16:03 +00:00
Johnny Chen 24e99aa833 Minor typo fix and TAB removals.
llvm-svn: 127439
2011-03-11 00:28:50 +00:00
Caroline Tice c288e8ca0c Add some explanatory comments.
llvm-svn: 127438
2011-03-11 00:21:55 +00:00
Johnny Chen 2d799cca03 Add a test case test_run_to_address() to exercise the SBThread.RunToAddress(lldb::addr_t addr) API.
The test itself is not working yet.

llvm-svn: 127436
2011-03-11 00:00:15 +00:00
Sean Callanan b3396b226e Fixed the -r parameter to the disassemble command
so that it actually triggers raw output.

llvm-svn: 127433
2011-03-10 23:35:12 +00:00