Commit Graph

1474 Commits

Author SHA1 Message Date
Charles Davis 51be6b5dfa Add the LanguageRuntime plugins to the makefile build, and remove the
Mac OS X Process plugin from the build.

I'm surprised no one caught this earlier. Am I the only one who builds with
the makefiles on Mac?

llvm-svn: 131704
2011-05-19 23:44:09 +00:00
Charles Davis 8c444c407e Use a SmallVector here instead of a VLA.
llvm-svn: 131698
2011-05-19 23:33:46 +00:00
Johnny Chen c25433f3d2 A bit of clean up.
Removed ifdeffed out functions and added the implementation of
WriteRegister for x86_64 architecture.

Signed-off-by: Johnny Chen <johnny.chen@apple.com>
llvm-svn: 131696
2011-05-19 23:08:41 +00:00
Johnny Chen c18a538646 API fix and missing headers.
Host.cpp was missing Error.h and the implementation of
LaunchProcess. Once againg I have added a "fake" implementation
waiting for a real one.

Fixed the call GetAddressRange to reflect the new interface in
DynamicLoaderLinuxDYLD.cpp.

Added string.h to ARM_DWARF_Registers.cpp that is needed for ::memset.

Signed-off-by: Johnny Chen <johnny.chen@apple.com>
llvm-svn: 131695
2011-05-19 23:07:19 +00:00
Charles Davis c9c24af6f2 Fix trailing commas at the end of enumerator lists.
Seriously, I have no idea how you guys managed to build LLDB before.

llvm-svn: 131684
2011-05-19 21:59:12 +00:00
Peter Collingbourne 1b27dac253 Build and initialise the Darwin ABI plugins on all platforms
llvm-svn: 131661
2011-05-19 18:32:34 +00:00
Greg Clayton 92bb12ca3e Moved a lot of simple functions from StoppointLocation.cpp to be inlined in
StoppointLocation.h.

Added a new lldb_private::Address function:

addr_t
Address::GetOpcodeLoadAddress (Target *target) const;

This will strip any special bits from an address to make sure it is suitable
for use in addressing an opcode. Often ARM addresses have an extra bit zero 
that can be set to indicate ARM vs Thumb addresses (gotten from return address
registers, or symbol addresses that may be marked up specially). We need to 
strip these bits off prior to setting breakpoints, so we can centralized the
place to do this inside the Address class.

llvm-svn: 131658
2011-05-19 18:17:41 +00:00
Peter Collingbourne 5e494f4fe9 Add UnwindAssembly plugins to makefile build
llvm-svn: 131650
2011-05-19 17:34:58 +00:00
Peter Collingbourne 6a94e50448 #include <string.h> for memset
llvm-svn: 131648
2011-05-19 17:34:51 +00:00
Peter Collingbourne ea384b4f85 Remove some old files which should have been removed in r131193
llvm-svn: 131647
2011-05-19 17:34:48 +00:00
Peter Collingbourne 1cbedd3ee0 Use the portable memchr function instead of the BSD-only strnstr
llvm-svn: 131646
2011-05-19 17:34:44 +00:00
Peter Collingbourne a09bfcaed4 Initialise the Darwin ABI plugins only on Darwin
llvm-svn: 131645
2011-05-19 17:34:40 +00:00
Greg Clayton af247d7b98 Fixed a crasher that was happened when a log shared pointer wasn't valid.
Fixed ThreadPlanCallFunction::ReportRegisterState(...) to only dump when
verbose logging is enabled and fixed the function to use the new
RegisterValue method of reading registers.

Fixed the GDB remote client to not send a continue packet after receiving
stdout or stderr from the inferior process.

llvm-svn: 131628
2011-05-19 03:54:16 +00:00
Johnny Chen d746478404 Make InstructionLLVM::Dump() more robust for edis in cases when all the
EDOperandIndexForToken(token) calls fail to return a meaningful operand index,
resulting in both operands and comment being empty.  We will use the raw disassembly
string as output in these cases.

There is still a known bug where llvm:tB (A8.6.16 B Encoding T2) is not being processed
as a branch instruction and therefore the symbolic information is not being dumped for
non-raw mode.

llvm-svn: 131615
2011-05-19 01:05:37 +00:00
Greg Clayton 316b460309 Fixed an issue with the sign extend code so it uses the correct m_data member.
llvm-svn: 131613
2011-05-19 00:55:50 +00:00
Greg Clayton e376938e93 Added the ability to sign extend a Scalar at any bit position for integer
types.

Added the abilty to set a RegisterValue type via accessor and enum.

Added the ability to read arguments for a function for ARM if you are on the
first instruction in ABIMacOSX_arm.

Fixed an issue where a file descriptor becoming invalid could cause an 
inifnite loop spin in the libedit thread.

llvm-svn: 131610
2011-05-19 00:17:26 +00:00
Johnny Chen 30243c74c0 Some refactorings with respect to setting of the 'printTokenized' flag.
Add some comments.

llvm-svn: 131594
2011-05-18 22:48:41 +00:00
Johnny Chen a5aab9ad58 Remove dead code which tests for boolan flag 'raw' and restore one indentation level.
llvm-svn: 131589
2011-05-18 22:08:52 +00:00
Greg Clayton 3f5c08f5c2 Added a function to lldb_private::Address:
addr_t
        Address::GetCallableLoadAddress (Target *target) const;
        
This will resolve the load address in the Address object and optionally
decorate the address up to be able to be called. For all non ARM targets, this
just essentially returns the result of "Address::GetLoadAddress (target)". But
for ARM targets, it checks if the address is Thumb, and if so, it returns
an address with bit zero set to indicate a mode switch to Thumb. This is how
we need function pointers to be for return addresses and when resolving 
function addresses for the JIT. It is also nice to centralize this in one spot
to avoid having multiple copies of this code.

llvm-svn: 131588
2011-05-18 22:01:49 +00:00
Greg Clayton 1c870d6e9f One more fix to:
bool SectionLoadList::ResolveLoadAddress (addr_t load_addr, Address &so_addr) const;

Where if the address is in the last map entry, we need to look it up correctly.
My previous fix was incorrect where it looked in the first if there were
no addresses in the map that were > load_addr. Now we correctly look in the
last entry if our std::map::lower_bound search returns the end of the 
collection.

llvm-svn: 131550
2011-05-18 18:22:47 +00:00
Johnny Chen 5bee94ecab If the use_thumb is set, pass llvm::Triple::thumb to the InstructionLLVM.ctor() unconditionally.
Otherwise, pass m_arch.GetMachine().

Followup patch for rdar://problem/9170971.

llvm-svn: 131549
2011-05-18 18:22:16 +00:00
Jim Ingham 8c0ee21517 Symbol may not have a demangled name, use GetName to get the best name available in this case.
llvm-svn: 131527
2011-05-18 05:04:36 +00:00
Jim Ingham 832332d724 FindFunctions was skipping the include_symbols section if it found a SymbolVendor.
llvm-svn: 131526
2011-05-18 05:02:10 +00:00
Greg Clayton cd482e359e Added a way to resolve an load address from a target:
bool
Address::SetLoadAddress (lldb::addr_t load_addr, Target *target);

Added an == and != operator to RegisterValue.

Modified the ThreadPlanTracer to use RegisterValue objects to store the
register values when single stepping. Also modified the output to be a bit
less wide.

Fixed the ABIMacOSX_arm to not overwrite stuff on the stack. Also made the
trivial function call be able to set the ARM/Thumbness of the target 
correctly, and also sets the return value ARM/Thumbness.

Fixed the encoding on the arm s0-s31 and d16 - d31 registers when the default
register set from a standard GDB server register sets.

llvm-svn: 131517
2011-05-18 01:58:14 +00:00
Jim Ingham 17e5c4e261 RunThreadPlan should set the plan to "not private" since it needs that,
and then reset it to the original value when done.

llvm-svn: 131498
2011-05-17 22:24:54 +00:00
Greg Clayton dc968d1665 Fixed an assert that could cause a crash when there was an
unrecognized DW_TAG_base_type. Now it is a error printed to
stderr.

llvm-svn: 131473
2011-05-17 18:15:05 +00:00
Greg Clayton c5e9a7dc2b Fixed an issue where addresses would not get resolved for the last
loaded section in the section load list.

llvm-svn: 131472
2011-05-17 18:13:59 +00:00
Greg Clayton 7a9ef8f11b Removed some assertions that could crash the controlling program
and turned them into warnings to stderr.

llvm-svn: 131470
2011-05-17 17:37:43 +00:00
Greg Clayton 5f5b2cad48 Fixed an issue that broke expression parsing related to backing up
all register values. There is some junk that was appearing at the end
of the result the 'g' packet (read all register values). This function
was being called in:

bool
GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp)

Then the packet data for the 'G' packet (write all registers) was being 
placed into "data_sp" so the:

bool
GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data_sp)

could restore it. In attempting to clean up the extra junk at the end of this
packet data, the packet was getting truncated.

llvm-svn: 131468
2011-05-17 16:50:15 +00:00
Greg Clayton e6a9e439d4 Fixed the "mmap" to work on MacOSX/darwin by supplying the correct arguemnts.
Modified ClangUserExpression and ClangUtilityFunction to display the actual
error (if one is available) that made the JIT fail instead of a canned 
response.

Fixed the restoring of all register values when the 'G' packet doesn't work
to use the correct data.

llvm-svn: 131454
2011-05-17 03:51:29 +00:00
Greg Clayton d495c5340d Added an allocated memory cache to avoid having to allocate memory over and
over when running JITed expressions. The allocated memory cache will cache 
allocate memory a page at a time for each permission combination and divvy up
the memory and hand it out in 16 byte increments. 

llvm-svn: 131453
2011-05-17 03:37:42 +00:00
Jim Ingham d915e16f70 Set the default "break list" level back to full.
llvm-svn: 131449
2011-05-17 01:21:41 +00:00
Jim Ingham 160f78c584 Fix the error message when an expression evaluation is interrupted by a crash/breakpoint hit to
give the reason for the interrupt. Also make sure it we don't want to unwind from the evaluation
we print something if it is interrupted.

llvm-svn: 131448
2011-05-17 01:10:11 +00:00
Caroline Tice b5059acc5f Fix places that were writing directly to the debugger's output
handles to go through the appropriate channels instead.

llvm-svn: 131415
2011-05-16 19:20:50 +00:00
Greg Clayton 93ecc368c1 Add support for the 'G' packet not being implemented or returning an error.
If we are asked to restore all register values, we need to fall back to 
restoring each register one by one.

llvm-svn: 131398
2011-05-16 03:02:32 +00:00
Greg Clayton b4aaf2e78d Fixed an issue where large memory writes might not get chunked up into smaller
packets in GDB remote.

Also fixed a compiler warning for an unhandled case for a switch.

llvm-svn: 131397
2011-05-16 02:35:02 +00:00
Greg Clayton 1cfca1dc09 Dump JIT memory requirements when "log enable lldb expr" logging is enabled.
Correctly handle invalid 32-bit mmap fail return value in ProcessGDBRemote.

llvm-svn: 131394
2011-05-15 23:56:52 +00:00
Greg Clayton 17a0cb68c9 Properly handle when commands are not unsupported in the GDB remote clients.
Prior to this fix we would often call SendPacketAndWaitForResponse() which
returns the number of bytes in the response. The UNSUPPORTED response in the
GDB remote protocol is zero bytes and we were checking for it inside an if
statement:

if (SendPacketAndWaitForResponse(...))
{
    if (response.IsUnsupportedResponse())
    {
        // UNSUPPORTED...
        // This will never happen...
    }
}

We now handle is properly as:

if (SendPacketAndWaitForResponse(...))
{
}
else
{
    // UNSUPPORTED...
}

llvm-svn: 131393
2011-05-15 23:46:54 +00:00
Greg Clayton 5d353156d0 Added the ability to get a 32 or 64 bit simple return value from the
ABIMacOSX_arm plugin.

Modified darwin-debug to print out the exectuable, working directory and
arguments a bit differently.

llvm-svn: 131392
2011-05-15 22:49:24 +00:00
Sean Callanan d12cf8bbc9 Updated to use the latest LLVM/Clang, to pick up JIT
changes.

llvm-svn: 131391
2011-05-15 22:34:38 +00:00
Greg Clayton 3f71643cc9 Fixed the default ARM registers to have the generic argument
definitions and names.

llvm-svn: 131387
2011-05-15 17:52:30 +00:00
Greg Clayton 9a8fa9161f Added generic register numbers for simple ABI argument registers and defined
the appropriate registers for arm and x86_64. The register names for the
arguments that are the size of a pointer or less are all named "arg1", "arg2",
etc. This allows you to read these registers by name:

(lldb) register read arg1 arg2 arg3
...

You can also now specify you want to see alternate register names when executing
the read register command:

(lldb) register read --alternate
(lldb) register read -A

llvm-svn: 131376
2011-05-15 04:12:07 +00:00
Greg Clayton 70b5765740 Added the ability to get the return value from a ThreadPlanCallFunction
thread plan. In order to get the return value, you can call:

        void
        ThreadPlanCallFunction::RequestReturnValue (lldb::ValueSP &return_value_sp);
        
This registers a shared pointer to a return value that will get filled in if
everything goes well. After the thread plan is run the return value will be
extracted for you.

Added an ifdef to be able to switch between the LLVM MCJIT and the standand JIT.
We currently have the standard JIT selected because we have some work to do to
get the MCJIT fuctioning properly.

Added the ability to call functions with 6 argument in the x86_64 ABI.

Added the ability for GDBRemoteCommunicationClient to detect if the allocate
and deallocate memory packets are supported and to not call allocate memory 
("_M") or deallocate ("_m") if we find they aren't supported.

Modified the ProcessGDBRemote::DoAllocateMemory(...) and ProcessGDBRemote::DoDeallocateMemory(...) 
to be able to deal with the allocate and deallocate memory packets not being 
supported. If they are not supported, ProcessGDBRemote will switch to calling
"mmap" and "munmap" to allocate and deallocate memory instead using our 
trivial function call support.

Modified the "void ProcessGDBRemote::DidLaunchOrAttach()" to correctly ignore 
the qHostInfo triple information if any was specified in the target. Currently 
if the target only specifies an architecture when creating the target:

(lldb) target create --arch i386 a.out

Then the vendor, os and environemnt will be adopted by the target.

If the target was created with any triple that specifies more than the arch:

(lldb) target create --arch i386-unknown-unknown a.out

Then the target will maintain its triple and not adopt any new values. This
can be used to help force bare board debugging where the dynamic loader for
static files will get used and users can then use "target modules load ..."
to set addressses for any files that are desired.

Added back some convenience functions to the lldb_private::RegisterContext class
for writing registers with unsigned values. Also made all RegisterContext
constructors explicit to make sure we know when an integer is being converted
to a RegisterValue. 

llvm-svn: 131370
2011-05-15 01:25:55 +00:00
Greg Clayton 2a48f525cd Expand the ABI prepare trivial function call to allow 6 simple args.
llvm-svn: 131334
2011-05-14 01:50:35 +00:00
Jim Ingham a16b5be727 Breakpoint::Description with eDescriptionLevelBrief should just print the number of locations, printing the list of locations is pointless.
llvm-svn: 131333
2011-05-14 01:11:02 +00:00
Jim Ingham 67eb68d260 For the purposes of setting breakpoints treat methods defined in the class and methods defined in a category on the class as the same.
llvm-svn: 131331
2011-05-14 00:40:37 +00:00
Johnny Chen 13e8e1c37d This patch add a "fake" attach waiting for a real implementation and
solve the build break due to the lack of this method.

It also propose a solution to the API changes in RegisterContext.

I upgraded also the the python version in the makefile. My linux
installation has python2.7 and AFAIK also the latest ubuntu
has this version of python so maybe is worth upgrading.

Patch by Marco Minutoli <mminutoli@gmail.com>

[Note: I had to hand merge in the diffs since patch thinks it is a corrupt patch.]

llvm-svn: 131313
2011-05-13 21:29:50 +00:00
Johnny Chen 4bee32e53a Headers have been moved to /includes/lldb/Interpreter. This patch
reflects this change.

Marco Minutoli <mminutoli@gmail.com>

llvm-svn: 131306
2011-05-13 20:21:08 +00:00
Johnny Chen a566355482 PATH_MAX is in limits.h on Linux.
Patch by Marco Minutoli <mminutoli@gmail.com>

llvm-svn: 131304
2011-05-13 20:07:25 +00:00
Johnny Chen 709a060411 This method has been removed from the API. This fix the compilation
breakage due to its presence.

Patch by Marco Minutoli <mminutoli@gmail.com>

llvm-svn: 131303
2011-05-13 19:57:45 +00:00