Commit Graph

5558 Commits

Author SHA1 Message Date
Todd Fiala f105f588b3 Fix a gdbremote bug in _M/_m stub support detection.
When a stub reported $#00 (unsupported) for _M and _m
packets, the unsupported response was not handled and
the client then marked the _M/_m commands as definitely
supported.  However, they would always fail, preventing
lldb's fallback InferiorCallMmap-based allocation strategy
from being used to attempt to allocate memory in the inferior
process space.

llvm-svn: 211425
2014-06-21 00:48:09 +00:00
Greg Clayton 06f09b58f7 Fixed the "log enable gdb-remote packets" to support dumping the binary memory read packet ('x') by printing out the binary data correctly using only printable characters and removing the 0x7d escapes so the memory is readable in the packet output.
llvm-svn: 211400
2014-06-20 20:41:07 +00:00
Greg Clayton 577508df83 Command files that switch input handlers didn't work, now they do.
The issue was when we called Debugger::RunIOHandler(), it would run the current IOHandler by activating it, and running it and then try to pop it and exit regardless of wether it was on top or not.

The new code will push the IOHandler that was passed in, and run the IOHandlers until the one passed in is successfully popped. This allows files for the "command source" to switch input handlers:

% cat /tmp/commands
br s -S alignLeftEdges:
br command add
bt
frame var
po self
DONE
b s -n main
br command add
bt
frame var
DONE

Note above we set a breakpoint, then add commands do it. The "br command add" will push the breakpoint comment gatherer until it sees "DONE" and then pop itself off the stack. The a new breakpoint will be set and it does the same thing again.

Now this file can be sourced from the command line:

% lldb -s /tmp/commands /path/to/a.out

And your breakpoints will be correctly setup!

<rdar://problem/17081650>

llvm-svn: 211329
2014-06-20 00:23:57 +00:00
John Wolfe 6f5cb5f14b Test commit: Correct type in two comments.
llvm-svn: 211296
2014-06-19 19:21:53 +00:00
Jim Ingham e4ce44197c Switch over to using object_getClass to get the class of an object. Previously we were
directly accessing the isa pointer of a class object to get its meta-class, but the isa
pointers are not simple pointers on arm64, so this would cause the stepping to fail.
object_getClass does whatever magic needs doing in this case.

<rdar://problem/17239690>

llvm-svn: 211289
2014-06-19 18:25:51 +00:00
Jim Ingham 2dfa00f6f2 Actually make a real scoped locker rather than constructing one that gets immediately thrown away...
llvm-svn: 211242
2014-06-18 23:40:13 +00:00
Jason Molenda 5cba569c4b Add a lock in the UnwindTable class so two Targets won't try
to modify the same UnwindTable object simultaneously.  Fix
HistoryThread and HistoryUnwind's mutex lock acqusition to
retain the lock for the duration of the operation instead of
releasing the temporary immediately.
<rdar://problem/17055023>

llvm-svn: 211241
2014-06-18 23:32:53 +00:00
Greg Clayton 9e42e92e43 Don't allow multiple line entries with the same address to exist sequentially.
The compiler, when JIT'ing code, can emit illegal DWARF line tables (address is line table sequences must increase). This changes fixes that issue by replacing previous line entries whose start address is the same with the new line entry to avoid having multiple line entries with the same address. Since the address range of lines entries is determined by the delta between the current and next line entry, this shouldn't cause any issues.

llvm-svn: 211212
2014-06-18 19:55:34 +00:00
Jim Ingham 5799e291e1 Add locking around the m_owners collection in the breakpoint site. If we are in the middle of "BreakpointLocation::ShouldStop" we don't
want other commands (like "break disable") to mutate the owners of this breakpoint out from under us.

<rdar://problem/17255589>

llvm-svn: 211136
2014-06-18 01:04:40 +00:00
Ed Maste 2e940a11e7 Avoid crashing on invalid or unreadable ELF core
Issue discovered during the GSoC 2014 project implementing FreeBSD
kernel support.  The existing elf-core Process plugin crashed trying
to read from /dev/mem (the kernel memory device).

Patch by Mike Ma.

llvm-svn: 211102
2014-06-17 14:14:33 +00:00
Greg Clayton 38f9cc425a Correctly classify code sections as code sections by using the S_ATTR_PURE_INSTRUCTIONS and S_ATTR_SOME_INSTRUCTIONS section flags.
Also correctly set the symbol type of symbols for S_REGULAR and other section types.

<rdar://problem/16896734>

llvm-svn: 211073
2014-06-16 22:53:16 +00:00
Greg Clayton c72f713068 Don't allow two threads to create/use the section list before it has been fully populated.
<rdar://problem/16937203>

llvm-svn: 211043
2014-06-16 19:44:24 +00:00
Todd Fiala 720cd3f689 Move x86-specific struct user code for Linux ProcessMonitor behind #define guards.
See http://reviews.llvm.org/D4092 for details.

Change by Paul Osmialowski.  (Minor tweaks to the comment by Todd.)

llvm-svn: 211026
2014-06-16 14:49:28 +00:00
Todd Fiala be03c36ef3 Properly terminated POSIX register sets with LLDB_INVALID_REGNUM.
RegisterSets are assumed to be terminated by this value.  Loops over
register set values would fail without LLDB_INVALID_REGNUM terminating
the list.  This change adjusts the static check to account for the
size of the register set regnum list being one larger than the expected
valid register set count.

llvm-svn: 210964
2014-06-14 03:13:01 +00:00
Jason Molenda b51d5cd84f Add a check that we found an ABI plugin before calling a method on it.
llvm-svn: 210942
2014-06-13 22:04:15 +00:00
Greg Clayton fc56a0123b Don't dereference target if it is NULL.
Caught by the clang static analyzer by Jason Molenda.

llvm-svn: 210941
2014-06-13 21:57:58 +00:00
Saleem Abdulrasool 6ae82a66ac Interpreter: kill some dead code
Remove commented out code and an unnecessary associated scope.  No functional
change.

llvm-svn: 210882
2014-06-13 03:30:47 +00:00
Saleem Abdulrasool e014729d34 Interpreter: explicitly initialize base class
Initialise base class std::enable_shared_from_this explicitly.  Identified by
GCC.

llvm-svn: 210881
2014-06-13 03:30:45 +00:00
Saleem Abdulrasool e8e4ae9f78 Core: address comparison of signed and unsigned types
Add a cast to ensure that the comparison is done with the same sign type.
Identified by GCC.

llvm-svn: 210880
2014-06-13 03:30:42 +00:00
Saleem Abdulrasool 3924d754e5 Remove unused variables
Address the 'variable set but not used' warning from GCC.  In some cases a few
additional calls were removed where there should be no visible side effects of
the calls (i.e. should not effect any cached state).

llvm-svn: 210879
2014-06-13 03:30:39 +00:00
Jason Molenda 705b180964 Initial merge of some of the iOS 8 / Mac OS X Yosemite specific
lldb support.  I'll be doing more testing & cleanup but I wanted to
get the initial checkin done.

This adds a new SBExpressionOptions::SetLanguage API for selecting a
language of an expression.

I added adds a new SBThread::GetInfoItemByPathString for retriving
information about a thread from that thread's StructuredData.

I added a new StructuredData class for representing
key-value/array/dictionary information (e.g. JSON formatted data).
Helper functions to read JSON and create a StructuredData object,
and to print a StructuredData object in JSON format are included.

A few Cocoa / Cocoa Touch data formatters were updated by Enrico
to track changes in iOS 8 / Yosemite.

Before we query a thread's extended information, the system runtime may 
provide hints to the remote debug stub that it will use to retrieve values
out of runtime structures.  I added a new SystemRuntime method 
AddThreadExtendedInfoPacketHints which allows the SystemRuntime to add 
key-value type data to the initial request that we send to the remote stub.

The thread-format formatter string can now retrieve values out of a thread's
extended info structured data.  The default thread-format string picks up
two of these - thread.info.activity.name and thread.info.trace_messages.

I added a new "jThreadExtendedInfo" packet in debugserver; I will
add documentation to the lldb-gdb-remote.txt doc soon.  It accepts
JSON formatted arguments (most importantly, "thread":threadnum) and
it returns a variety of information regarding the thread to lldb
in JSON format.  This JSON return is scanned into a StructuredData
object that is associated with the thread; UI layers can query the
thread's StructuredData to see if key-values are present, and if
so, show them to the user.  These key-values are likely to be
specific to different targets with some commonality among many
targets.  For instance, many targets will be able to advertise the
pthread_t value for a thread.

I added an initial rough cut of "thread info" command which will print
the information about a thread from the jThreadExtendedInfo result.
I need to do more work to make this format reasonably.

Han Ming added calls into the pmenergy and pmsample libraries if
debugserver is run on Mac OS X Yosemite to get information about the
inferior's power use.

I added support to debugserver for gathering the Genealogy information
about threads, if it exists, and returning it in the jThreadExtendedInfo
JSON result.

llvm-svn: 210874
2014-06-13 02:37:02 +00:00
Greg Clayton a2715cf108 Added the ability to save core files:
(lldb) file /bin/ls
(lldb) b malloc
(lldb) run
(lldb) process save-core /tmp/ls.core

Each ObjectFile plug-in now has the option to save core files by registering a new static callback.

llvm-svn: 210864
2014-06-13 00:54:12 +00:00
Alp Toker 10933d1489 Track clang changes from r210764
llvm-svn: 210765
2014-06-12 11:14:32 +00:00
Greg Clayton bc88d938f7 Multi-line expressions in Xcode now have a space between the line number and the expression text.
<rdar://problem/17238093>

llvm-svn: 210718
2014-06-11 23:10:41 +00:00
Ed Maste a5fd299734 Restore select limitations comment for non-Apple platforms
llvm-svn: 210682
2014-06-11 18:10:41 +00:00
Ed Maste f57dcbb615 Remove duplicated code
We preivously had two copies of ::BytesAvailable with only trivial
differences between them, and fixes have been applied to only one of
them.

Instead of duplicating the whole function, hide the FD_SET differences
behind a macro.  This leaves only one small __APPLE__-specific #if
block, and fixes ^C on non-__APPLE__ platforms.

llvm-svn: 210592
2014-06-10 21:33:43 +00:00
Colin Riley 28e7ed12f5 Windows fix: Disable editline for MSVC. Since r208369 there have been issues, probably related to the editline wrapper. For now, it's more stable and usable disabled.
llvm-svn: 210105
2014-06-03 14:37:35 +00:00
Colin Riley 740ed90626 Windows fix: Condition::Wait returned failure when it actually succeeded (SleepConditionVariableCS returns non-zero for success)
llvm-svn: 210104
2014-06-03 14:33:41 +00:00
Colin Riley b7fd1bd223 Fix windows build: SBTypeEnumMember.cpp added to the separate windows liblldb.dll project.
llvm-svn: 210099
2014-06-03 13:01:18 +00:00
Greg Clayton 4bd024d4e8 Small cleanups for the new enum fixes:
- Fix Xcode project to have source files for SBTypeEnumMember.h/SBTypeEnumMember.cpp in the right place
- Rename a member variable to inluce "_sp" suffix since it is a shared pointer
- Cleanup initialization code for TypeEnumMemberImpl to not warn about out of order initialization

llvm-svn: 210051
2014-06-02 21:58:30 +00:00
Todd Fiala 732215f989 Add support for inspecting enum members.
Change by Russell Harmon.

Xcode project updates (and all errors therein)
by Todd Fiala.

llvm-svn: 210046
2014-06-02 20:55:29 +00:00
Todd Fiala 4dc625281d Fix most of the remaining Windows build warnings.
See http://reviews.llvm.org/D3944 for more details.

Change by Zachary Turner.

llvm-svn: 210035
2014-06-02 17:30:22 +00:00
Greg Clayton 6bc8739e57 Don't use libc's "char *basename(char *)" or "char *dirname(char *)" as they are not thread safe.
I switched the lldb_private::FileSpec code over to use "llvm::StringRef llvm::sys::path::filename(llvm::StringRef)" for basename() and "llvm::StringRef llvm::sys::path::parent_path(llvm::StringRef)" for dirname().

<rdar://problem/16870083>

llvm-svn: 209917
2014-05-30 21:06:57 +00:00
Greg Clayton 7ab7f89ae0 iOS simulator cleanup to make sure we use "*-apple-ios" for iOS simulator apps and binaries.
Changes include:
- ObjectFileMachO can now determine if a binary is "*-apple-ios" or "*-apple-macosx" by checking the min OS and SDK load commands
- ArchSpec now says "<arch>-apple-macosx" is equivalent to "<arch>-apple-ios" since the simulator mixes and matches binaries (some from the system and most from the iOS SDK).
- Getting process inforamtion on MacOSX now correctly classifies iOS simulator processes so they have "*-apple-ios" architectures in the ProcessInstanceInfo
- PlatformiOSSimulator can now list iOS simulator processes correctly instead of showing nothing by using:
    (lldb) platform select ios-simulator
    (lldb) platform process list
- debugserver can now properly return "*-apple-ios" for the triple in the process info packets for iOS simulator executables
- GDBRemoteCommunicationClient now correctly passes along the triples it gets for process info by setting the OS in the llvm::Triple correctly

<rdar://problem/17060217>

llvm-svn: 209852
2014-05-29 21:33:45 +00:00
Greg Clayton 36d7c89497 Fixed the Module::Module(ModuleSpec) constructor to properly copy the file offset and object file mod time from the actual module specifications so we will always be able to directly load the image we care about when calling Module::GetObjectFile().
llvm-svn: 209833
2014-05-29 17:52:46 +00:00
Arnaud A. de Grandmaison 53ae251a17 Fix r209807 which inadvertently removed things
llvm-svn: 209809
2014-05-29 13:42:17 +00:00
Nikola Smiljanic 2882a12337 Fix build. Method was renamed in r209800.
llvm-svn: 209807
2014-05-29 12:38:17 +00:00
Todd Fiala 0a70a84534 Fix Windows warnings.
This fixes a number of trivial warnings in the Windows build. This is part of a larger effort to make the Windows build warning-free.

See http://reviews.llvm.org/D3914 for more details.

Change by Zachary Turner

llvm-svn: 209749
2014-05-28 16:43:26 +00:00
Ed Maste 4aeb3c0a4c Avoid passing null signal name for Log %s argument
llvm-svn: 209739
2014-05-28 14:11:20 +00:00
Ed Maste f886ac0b85 Fix whitespace / formatting
llvm-svn: 209737
2014-05-28 14:05:43 +00:00
Greg Clayton 23377e9fe6 Remove unused variable.
llvm-svn: 209703
2014-05-28 00:23:43 +00:00
Jason Molenda 4da8706e5d Add a lock ivar to the Platform so that multiple Targets
trying to populate the list of trap handler names at
the same time don't conflict with one another.
<rdar://problem/17011969> 

llvm-svn: 209563
2014-05-23 23:11:27 +00:00
Sean Callanan 25ea6a1b8e Fixed the Symbol code to resolve the callable address
of the symbol itself rather than forcing clients to do
it.  This simplifies the logic for the expression
parser a great deal.

<rdar://problem/16935324>

llvm-svn: 209494
2014-05-23 02:30:48 +00:00
Jason Molenda ab35aa92da Instead of having an UnwindTable own a single assembly profiler,
and sharing it with all of its FuncUnwinders, have each FuncUnwinder
create an AssemblyProfiler on demand as needed.  I was worried that
the cost of creating the llvm disassemblers would be high for this
approach but it's not supposed to be an expensive operation, and it
means we don't need to add locks around this section of code.
<rdar://problem/16992332> 

llvm-svn: 209493
2014-05-23 01:48:10 +00:00
Jason Molenda 23a285d2d6 Revert r209488; Greg suggests a different approach.
llvm-svn: 209492
2014-05-23 01:42:56 +00:00
Jason Molenda f5e8a14bd6 The UnwindTable (one per module) used to hand out shared pointers
to its unwind assembly profiler to all of the FuncUnwinders (one
per symbol) under it.  If lldb is running multiple targets, you
could get two different FuncUnwinders in the same Module trying
to use the same llvm disassembler simultaneously and that may be
a re-entrancy problem.  

Instead, the UnwindTable has the unwind assembly profiler and when
the FuncUnwinders want to use it, they get exclusive access to
the assembly profiler until they're done using it.
<rdar://problem/16992332> 

llvm-svn: 209488
2014-05-23 00:08:09 +00:00
Greg Clayton e756aa3571 Make sure SectionLoadHistory::GetCurrentSectionLoadList () is thread safe.
<rdar://problem/15818525>

llvm-svn: 209485
2014-05-22 23:54:17 +00:00
Jason Molenda 8eb3281731 Change ProcessKDP::DoReadMemory() to break up large memory
read requests into smaller chunks; some remote kdp stubs
cannot handle memory reads larger than a KB or two & will
error out.
<rdar://problem/16983125> 

llvm-svn: 209341
2014-05-21 23:44:02 +00:00
Ed Maste a45c1600dc Implement Host::GetThreadName for FreeBSD
llvm-svn: 209312
2014-05-21 18:09:55 +00:00
Rafael Espindola 9cb97b630d Update for llvm api change in r209266.
llvm-svn: 209303
2014-05-21 15:08:27 +00:00
Ed Maste cc913d1453 Correct comment for thread name log option
llvm-svn: 209299
2014-05-21 13:46:46 +00:00
Jim Ingham fbe0b9abf9 ReExported symbols can point to a library that doesn't actually
contain the symbol, but just reexports wholesale from another
library.  Handle this case.

<rdar://problem/16977589>

llvm-svn: 209270
2014-05-21 03:58:03 +00:00
Greg Clayton cb172b104a Don't allow two threads to both be in SBDebugger::Create() due to threading issues in FormatManager.
<rdar://problem/16937126>

llvm-svn: 209160
2014-05-19 20:42:14 +00:00
Todd Fiala ff6131a958 Add support for gdb remote $X stop notification.
debugserver now returns $X09 as the immediate response to
a $k kill process request rather than $W09.

ProcessGDBRemote now properly handles X as indication of
a process exit state.

The @debugserver_test and @lldb_test for $k now properly expects
an X notification (signal-caused exit) after killing a just-attached
inferior that was still in the stopped state.

llvm-svn: 209108
2014-05-19 04:57:23 +00:00
Enrico Granata e8daa2f843 Introduce the concept of a "display name" for types
Rationale:
Pretty simply, the idea is that sometimes type names are way too long and contain way too many details for the average developer to care about. For instance, a plain ol' vector of int might be shown as
std::__1::vector<int, std::__1::allocator<....
rather than the much simpler std::vector<int> form, which is what most developers would actually type in their code

Proposed solution:
Introduce a notion of "display name" and a corresponding API GetDisplayTypeName() to return such a crafted for visual representation type name
Obviously, the display name and the fully qualified (or "true") name are not necessarily the same - that's the whole point
LLDB could choose to pick the "display name" as its one true notion of a type name, and if somebody really needs the fully qualified version of it, let them deal with the problem
Or, LLDB could rename what it currently calls the "type name" to be the "display name", and add new APIs for the fully qualified name, making the display name the default choice

The choice that I am making here is that the type name will keep meaning the same, and people who want a type name suited for display will explicitly ask for one
It is the less risky/disruptive choice - and it should eventually make it fairly obvious when someone is asking for the wrong type

Caveats:
- for now, GetDisplayTypeName() == GetTypeName(), there is no logic to produce customized display type names yet.
- while the fully-qualified type name is still the main key to the kingdom of data formatters, if we start showing custom names to people, those should match formatters

llvm-svn: 209072
2014-05-17 19:14:17 +00:00
Jason Molenda 64a68d6157 Update how we create our MCSymbolizer to keep working correctly
on arm64 binaries after the llvm r206063 changes.  
Patch written by Jim Ingham and Lang Hames.
<rdar://problem/16935671> 

llvm-svn: 209051
2014-05-17 00:27:44 +00:00
Greg Clayton 5c6a2cd920 Fix the copy constructor and assignement operator for the lldb_private::Value class to "do the right thing".
llvm-svn: 209036
2014-05-16 21:49:19 +00:00
Todd Fiala 4fc3cdd054 Refactored RegisterInfoInterface into its own header.
Also moved it into the lldb_private namespace.

The llgs branch is making use of this interface and its use is not
strictly limited to POSIX.

llvm-svn: 209016
2014-05-16 20:43:19 +00:00
Greg Clayton 24feaf70aa Fixed SectionLoadHistory::GetSectionLoadListForStopID() to always return a valid "SectionLoadList *".
<rdar://problem/15818525>

llvm-svn: 208796
2014-05-14 17:25:00 +00:00
Todd Fiala fd8ae3a140 Replace SIZE_T_MAX with std::numeric_limits value in Section.cpp.
SIZE_T_MAX is not available on Linux.

llvm-svn: 208789
2014-05-14 16:15:43 +00:00
Greg Clayton 3698a715ee Don't assert and crash when sections are malformed.
<rdar://problem/16833247>

llvm-svn: 208749
2014-05-14 01:12:09 +00:00
Todd Fiala e24614f74e lldb: gdb remote support always falls back to $qC when no $qProcessInfo.
See thread here:
http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-May/003992.html

This is meant to address case 3 that I recently broke with an earlier
change to rectify usage of the $qC message for thread ids, specifically:

3. TOT lldb <=> gdbserver (without $qProcessInfo support and not Apple/iOS).

llvm-svn: 208741
2014-05-14 00:15:32 +00:00
Jason Molenda b4892cd266 Add a new SBThread::SafeToCallFunctions API; this calls over to
the SystemRuntime to check if a thread will have any problems 
performing an inferior function call so the driver can skip
making that function call on that thread.  Often the function
call can be executed on another thread instead.
<rdar://problem/16777874> 

llvm-svn: 208732
2014-05-13 22:02:48 +00:00
Jason Molenda 2fc43a3821 Args::StringToGenericRegister will now accept "lr" as
another way to indicate that this register is a generic
Return Address register (in addition to "ra") - this is
used primarily by OperatingSystem plugins.

Correctly annotate the UnwindPlan created by EmulateInstructionARM64
to indicate that it was not sourced from a compiler and it
is valid at every instruction.
<rdar://problem/16639754> 

llvm-svn: 208390
2014-05-09 04:09:48 +00:00
Greg Clayton b89b7496ca "process kill" and "process detach" were causing double prompts or prompts that would overwrite each other. Fixed now.
<rdar://problem/16547729>

llvm-svn: 208369
2014-05-08 23:04:39 +00:00
Greg Clayton 1fd43846a1 Revert bad checkin that use incorrect member field.
llvm-svn: 208339
2014-05-08 17:10:54 +00:00
Greg Clayton 153e7c7207 Set the current line to invalid when done getting multiple lines.
llvm-svn: 208338
2014-05-08 17:06:33 +00:00
Greg Clayton c3d874a584 lldb TOT is dropping the last entry for multi-line IOHandlers that use the IOHandlerDelegateMultiline.
<rdar://problem/16844164>

llvm-svn: 208336
2014-05-08 16:59:00 +00:00
Jason Molenda 8cb27bb911 Change ProcessElfCore::CreateInstance() to check if the ELF magic bytes
appear in the file before it assumes the file is ELF.  It was incorrectly
activating for Mach-O core files.
<rdar://problem/16836816> 

llvm-svn: 208265
2014-05-07 23:14:04 +00:00
Greg Clayton 3e32ad65fb Allow clients to control the exact path that is used to launch processes by adding new calls to SBLaunchInfo.
The new calls are:

SBFileSpec
SBLaunchInfo::GetExecutableFile ();

void
SBLaunchInfo::SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg);

<rdar://problem/16833939>

llvm-svn: 208245
2014-05-07 20:16:06 +00:00
Todd Fiala 9f72b3a1ce Modify debugserver to follow gdb remote $qC protocol definition.
$qC from debugserver now returns the current thread's thread-id (and, like $?, will set a current thread if one is not already selected).  Previously it was returning the current process id.

lldb will now query $qProcessInfo to retrieve the process id.  The process id is now cached lazily and reset like other cached values.  Retrieval of the process id will fall back to the old $qC method for vendor==Apple and os==iOS if the qProcessInfo retrieval fails.

Added a gdb remote protocol-level test to verify that $qProcessInfo reports a valid process id after launching a process, while the process is in the initial stopped state.  Verifies the given process id is a currently valid process on host OSes for which we know how to check (MacOSX, Linux, {Free/Net}BSD).  Ignores the live process check for OSes where we don't know how to do this.  (I saw no portable way to do this in stock Python without pulling in other libs).

llvm-svn: 208241
2014-05-07 19:28:21 +00:00
Greg Clayton c62338e89d control-D on empty line to quit lldb stopped working in Release builds on MacOSX.
<rdar://problem/16822217>

llvm-svn: 208117
2014-05-06 18:54:53 +00:00
Jason Molenda 6076bf4edb Change ProcessGDBRemote::DoReadMemory to use the x packet to read
data if it is available.

Change ProcessGDBRemote's maximum read/write packet size from a
fixed 512 byte value to asking the remote gdb stub what its maximum
is, using up to 128kbyte sizes if that's allowed, and falling back
to 512 if the remote gdb stub doesn't advertise a max packet size.

Add a new "process plugin packet xfer-size" command that can be used
to override the maximum packet size (although not exceeding any packet
size maximum published by the remote gdb stub).
<rdar://problem/16032150> 

llvm-svn: 208058
2014-05-06 04:34:52 +00:00
Jason Molenda bdc4f12f19 Add GetxPacketSupported to test if the 'x' packet is supported.
<rdar://problem/16032150> 

llvm-svn: 208052
2014-05-06 02:59:39 +00:00
Jim Ingham 8646d3c164 Rename eExecution*** to eExpression*** to be consistent with the result type.
llvm-svn: 207945
2014-05-05 02:47:44 +00:00
Jim Ingham 1624a2d3c8 Make the Expression Execution result enum available to the SB API layer.
Add a callback that will allow an expression to be cancelled between the
expression evaluation stages (for the ClangUserExpressions.)

<rdar://problem/16790467>, <rdar://problem/16573440>

llvm-svn: 207944
2014-05-05 02:26:40 +00:00
Alp Toker cf55e88a11 Track recent changes in clang internals
llvm-svn: 207913
2014-05-03 15:05:45 +00:00
Greg Clayton 745b6688b4 LLDB could segfault if it got a .a file that had extra padding bytes at the end of the file.
<rdar://problem/16732178>

llvm-svn: 207877
2014-05-02 22:25:51 +00:00
Joerg Sonnenberger a53b3593f0 Use posix_spawn on NetBSD as well.
llvm-svn: 207864
2014-05-02 19:09:40 +00:00
Joerg Sonnenberger 420708a374 Fix format string for 32bit systems.
llvm-svn: 207862
2014-05-02 19:00:27 +00:00
Joerg Sonnenberger ff9620f975 LLDB_INVALID_ADDRESS may not be too large for a uintptr_t, so cast
first.

llvm-svn: 207860
2014-05-02 18:58:51 +00:00
Joerg Sonnenberger 6764b3e82a EOF is outside the value range of char on architectures with unsigned
char like ARM. Check for EOF explicitly.

llvm-svn: 207859
2014-05-02 18:53:53 +00:00
Joerg Sonnenberger 4f51a0740a LLDB_INVALID_OFFSET can be large than a size_t on ILP32 systems, so use
SIZE_MAX here.

llvm-svn: 207855
2014-05-02 18:26:40 +00:00
Greg Clayton f29bf9a169 "DONE" is being left in multi-line results when it shouldn't for non terminal input.
<rdar://problem/16790579>

llvm-svn: 207818
2014-05-02 01:03:07 +00:00
Greg Clayton f0066ad07f Fixed CTRL+C related issues:
- CTRL+C wasn't clearing the command in lldb
- CTRL+C doesn't work in python macros in lldb
- Ctrl+C no longer interrupts the running process that you attach to

<rdar://problem/15949205> 
<rdar://problem/16778652> 
<rdar://problem/16774411>

llvm-svn: 207816
2014-05-02 00:45:31 +00:00
Greg Clayton 4cc3ba56bf Fixed whitespace issues.
llvm-svn: 207778
2014-05-01 18:13:08 +00:00
Greg Clayton 40286e0b6d Sometimes when launching through a shell, we can run into cases where the /bin/sh or /usr/bin/arch can crash the process due to security measures. Now we correctly report when a process exited in the process of launching so we can show the reason why it crashed instead of just showing “initial process state wasn't stopped: exited”.
llvm-svn: 207700
2014-04-30 20:29:09 +00:00
Ed Maste e61c7b06c9 Typo: forever is one word
llvm-svn: 207564
2014-04-29 17:48:06 +00:00
Ed Maste abb813275f Address warnings in EmulateInstructionARM64
- Remove default for switch which covers all enumeration values

- Remove unused functions
  LSL_C is left in the source under #if 0, as it may be needed in the
  future for emulating other instructions.

Differential Revision: http://reviews.llvm.org/D3528

llvm-svn: 207449
2014-04-28 21:34:04 +00:00
Greg Clayton 28432c24e9 Since one or more Editline instances of the same kind (lldb commands, expressions, etc) can exist at once, they should all shared a ref counted history object.
Now they do.

llvm-svn: 207293
2014-04-25 23:55:26 +00:00
Greg Clayton ed6499fe64 Free the strong reference to a lldb::SBDebugger that the script interpreter was holding onto in the "lldb.debugger" global variable.
llvm-svn: 207292
2014-04-25 23:55:12 +00:00
Greg Clayton 0c4129f2f7 Make sure that the CommandInterpreter::m_command_io_handler_sp gets reset when we quit.
Currently if you run _any_ python, python has the "lldb.debugger" global variable and it has a strong reference to a lldb_private::Debugger since it is a lldb::SBDebugger object with a shared pointer.

This makes sure that your LLDB command interpreter history is saved each time you quit command line LLDB.

llvm-svn: 207164
2014-04-25 00:35:14 +00:00
Jason Molenda a0560152cb Only allow on thread to run when calling libBacktraceRecording.
Make sure the timeout is set to 0.5s for these.
<rdar://problem/16719510> 

llvm-svn: 207163
2014-04-25 00:06:26 +00:00
Jason Molenda 2dd5deb1e6 Missed this file with the r207160 commit.
llvm-svn: 207161
2014-04-25 00:02:11 +00:00
Jason Molenda b9ffa98cab Add a new SBThread::GetQueue() method to get the queue that is
currently associated with a given thread, on relevant targets.

Change the queue detection code to verify that the queues 
associated with all live threads are included in the list.
<rdar://problem/16411314> 

llvm-svn: 207160
2014-04-25 00:01:15 +00:00
Sean Callanan 4640a01c1c Fixed a flipped conditional when writing back the
values of variables in the Materializer.

The Materializer should not write the variable
back if its new value is the *same* as the old
value, not if the new value is *different*.

<rdar://problem/16712205>

llvm-svn: 207148
2014-04-24 21:43:04 +00:00
Enrico Granata 8a068e6c43 Allow summary formatters to take ValueObjects into account when deciding whether values/children should be printed and if child names should be shown
This decision has always been statically-bound to the individual formatter. With this patch, the idea is that this decision could potentially be dynamic depending on the ValueObject itself

llvm-svn: 207046
2014-04-23 23:16:25 +00:00
Greg Clayton 885a33a0a3 Remove the using namespace directives to make it clear where code is scoped.
llvm-svn: 207041
2014-04-23 22:20:25 +00:00
Greg Clayton cc3594d6ee Change the default key bindings for multi-line mode:
Up/down arrows select next/prev line in multi-line mode
CTRL+N and CTRL+P do next/prev history

llvm-svn: 207033
2014-04-23 21:42:31 +00:00
Greg Clayton 90e9692d05 Fixed a case where if someone added a "bind -v" to their ~/.editrc file, key mappings would get messed up.
I fixed this by only doing el_set(e, EL_BIND, ...) calls before sourcing the .editrc files.

<rdar://problem/16614095>

llvm-svn: 207005
2014-04-23 17:57:26 +00:00