Commit Graph

5578 Commits

Author SHA1 Message Date
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
Jason Molenda 48cd333b7c When increasing the amount of a file read, read the total of the Mach-O header
plus the size of the load commands in case the LC_UUID load command comes near
the end of the file.
<rdar://problem/16599318> 

llvm-svn: 206865
2014-04-22 04:52:30 +00:00
Jim Ingham 23ef27cd46 Give the clang functions names. This is only for logging.
llvm-svn: 206836
2014-04-22 01:42:22 +00:00
Jim Ingham fd95f8961e Make RunThreadPlan start the timeout clock for each part of the expression evaluation AFTER the
successful resume for that part.  This will make the timeouts more stable when lldb is running
in a busy program.

llvm-svn: 206835
2014-04-22 01:41:52 +00:00
Sylvestre Ledru b96ca6b0c8 Remove useless declaration
llvm-svn: 206764
2014-04-21 17:43:17 +00:00
Ed Maste d4612ad0f3 Switch NULL to C++11 nullptr in source/Symbol and source/Utility
Patch by Robert Matusewicz

llvm-svn: 206713
2014-04-20 13:17:36 +00:00
Ed Maste d78c9576ca Switch NULL to C++11 nullptr in source/Interpreter
Patch by Robert Matusewicz

llvm-svn: 206711
2014-04-20 00:31:37 +00:00
Saleem Abdulrasool 97fb5e128a Utility: fix compilation on Linux
When compiling on Linux with GCC 4.8, compilation would fail due to the use of
the offsetof macro.  This is a standard macro, defined in stddef.h.  Include
this header to ensure that offsetof is declared.

llvm-svn: 206702
2014-04-19 21:18:28 +00:00
Sean Callanan af90cf528c Included <inttypes.h> in a few headers that were
using preprocessor constants for printf() format
specifications.

llvm-svn: 206679
2014-04-19 03:09:28 +00:00
Todd Fiala 3dbe13f6a8 Address hung tests in Linux.
Follow-up patch coming to address test failures exposed by this change.

llvm-svn: 206618
2014-04-18 17:01:01 +00:00
Greg Clayton c71e7bc415 After updating to Xcode.5.1.1 LLDB framework stopped to support partial (only for STDIN) pseudo terminal usage in the debugging process.
Here is the fix resolving this issue.

Patch from Alexey Ushakov.

llvm-svn: 206476
2014-04-17 17:27:28 +00:00
Ed Maste 94ba368946 elf-core: Add FreeBSD signals
Sponsored by: DARPA, AFRL
Differential Revision: http://reviews.llvm.org/D3401

llvm-svn: 206469
2014-04-17 13:09:29 +00:00
Ed Maste 41736e3c0d elf-core: Strip trailing whitespace
llvm-svn: 206468
2014-04-17 13:06:49 +00:00
Ed Maste dbb67c46db Move FreeBSDSignals to Utility
It will shortly be need by FreeBSD elf core support on all hosts.

llvm-svn: 206466
2014-04-17 13:03:10 +00:00
Jim Ingham fe1c34266f Clean up the logic in setting timeouts a bit, and the logging as well.
llvm-svn: 206351
2014-04-16 02:24:48 +00:00
Jim Ingham b8cd5750b4 m_interrupt_sent wasn't being initialized, and wasn't being reset after an
interrupt.  Do both of those.

llvm-svn: 206350
2014-04-16 02:24:17 +00:00
Ed Maste 9b8d847b8f Add FreeBSD-specific SIGTHR and SIGLIBRT signals
llvm-svn: 206319
2014-04-15 20:22:32 +00:00
Sylvestre Ledru a3e4cebd96 Remove trailing spaces
llvm-svn: 206278
2014-04-15 12:08:57 +00:00
Sylvestre Ledru 5ac35ae6f7 Make LLDB builds against the current LLVM sources (modification on createMCDisassembler introduced by r206241)
llvm-svn: 206277
2014-04-15 12:07:25 +00:00
Hafiz Abid Qadeer 224746a400 Remove > 1 check against a boolean.
I saw a complain about this code on the LLVM channel. It looks wrong to me
as has_tag is a boolean. I am committing it as obvious.

llvm-svn: 206270
2014-04-15 10:06:47 +00:00
Jason Molenda c6fa5db747 Add some basic sanity checks to DynamicLoaderDarwinKernel::ReadKextSummaryHeader()
when it is reading the kext table, in case we're reading out of a core file with
corrupt contents in this region.
<rdar://problem/16601915> 

llvm-svn: 206233
2014-04-15 01:04:00 +00:00
Greg Clayton 3434b578be Fix LLDB to build with top of tree LLVM/Clang.
Patch from Michael Tao.

llvm-svn: 206213
2014-04-14 21:33:38 +00:00
Greg Clayton 8334e14efc Fixed SBThread.GetStopReasonDataAtIndex() to correctly return breakpoint location ID.
Patch from Vyacheslav Karpukhin.

llvm-svn: 206040
2014-04-11 17:27:02 +00:00
Enrico Granata bd4885f129 <rdar://problem/16540961>
The "unexpected value" message only matters to me, but is bound to make the experience more confusing for people when some uninitialized memory looks like an NSNumber and then can't be formatted properly, and that error comes out in the UI

Just drop the error message entirely - nobody but me cares

llvm-svn: 205978
2014-04-10 18:17:30 +00:00
Enrico Granata 1ac6296376 <rdar://problem/12055586>
Enable data formatters to see-through pointers/references to typedefs

For instance, if Foo is a typedef to Bar, and there is a formatter for any/all of Bar*, Bar&, Bar&&, then Foo*, Foo&, and Foo&& should pick these up if Foo-specific formatters don't exist

llvm-svn: 205939
2014-04-10 00:14:07 +00:00
Enrico Granata 699e14f3ce When trying to extract the type info for an r-value reference type, dont' cast to an l-value reference type
llvm-svn: 205932
2014-04-09 21:54:17 +00:00
Enrico Granata a0db6ed44b <rdar://problem/16477472>
Set the correct FormatManager revision before starting to figure out the new formatters
This can avoid entering some corner cases where as part of figuring out formatters we try to figure out dynamic types, and in turn that causes us to go back in trying to fetch new formatters - it is not only a futile exercise, it's also prone to endless recursion

This would only cause a behavior change if getting this chain started would eventually cause something to run and alter the formatters, a very unlikely if at all possible sequence of events

llvm-svn: 205928
2014-04-09 21:06:11 +00:00
Ed Maste 5b031ebc70 Use the default TID format in curses UI
TIDs are conventionally shown as decimal values on FreeBSD and Linux.
Thus, use the ${thread.id%tid} format string to display the thread ID,
instead of a fixed hex format.

llvm.org/pr19380

llvm-svn: 205912
2014-04-09 16:39:30 +00:00
Sean Callanan 131be99d24 Fixed a problem where IRForTarget wasn't ignoring
dbg_value intrinsics appropriately.

<rdar://problem/16504649>

llvm-svn: 205825
2014-04-09 00:59:41 +00:00
Jim Ingham 35878c4752 Fix the behavior when hand-calling a function times out on one thread,
but by the time we go to halt, it has already stopped by hitting the 
function end breakpoint.  That wasn't being shown to the threads so the
Function call thread plan didn't know its job was done.

<rdar://problem/16515785>

llvm-svn: 205803
2014-04-08 21:33:21 +00:00
Jim Ingham 7e9eff664c This function should be const.
llvm-svn: 205790
2014-04-08 20:24:45 +00:00
Enrico Granata 2b8fc66df2 Fix the GetArrayElementType() call so it will not crash when called on a non-array thing
Also, the stride is now a pointer so one can avoid passing it if it's not required

llvm-svn: 205782
2014-04-08 18:36:09 +00:00
Ed Maste 42c549b346 Revert r205769 as it breaks the build on FreeBSD:
error: declaration of constexpr static data member 'spec' requires an
initializer

llvm-svn: 205776
2014-04-08 17:02:25 +00:00
Ed Maste 4a06df95b9 Accept DWARF version 2 and 3 in debug_line tables
Issue reported by Matthew Gardiner.  Further work is necessary to
synchronize LLDB's DWARF classes with the derivatives now in LLVM.

llvm-svn: 205771
2014-04-08 15:12:07 +00:00
Virgile Bello 97a70e4f7e Added i686 architecture (ArchSpec::Core::eCore_x86_32_i686).
llvm-svn: 205770
2014-04-08 14:48:48 +00:00
Virgile Bello 8250ebdd8a Improve demangler to compile with MSVC.
llvm-svn: 205769
2014-04-08 14:46:44 +00:00
Greg Clayton 86e70cb3ac Fixed an issue where if you called:
SBTarget::AddModule(const char *path,
                    const char *triple,
                    const char *uuid_cstr,
                    const char *symfile);
                    
If "symfile" was filled in, it would cause us to not correctly add the module. Same goes for:

SBTarget::AddModule(SBModuleSpec ...)

Where you filled in the symfile.

<rdar://problem/16529799>

llvm-svn: 205750
2014-04-07 23:50:17 +00:00
Greg Clayton c7797accb8 Fixed a case where we could spin indefinitely if we got an error from fgets that isn't EINTR.
<rdar://problem/16535437>

llvm-svn: 205740
2014-04-07 21:37:59 +00:00
Greg Clayton 78d1019703 Cleanup the code a bit.
llvm-svn: 205739
2014-04-07 21:37:03 +00:00
Greg Clayton 521c2278ab Disable JITLoaderGDB on "vendor == apple" for now due to performance slowdowns for every first run process as a global name lookup in all shared libraries if performed.
<rdar://problem/16542894>

llvm-svn: 205734
2014-04-07 20:13:57 +00:00
Greg Clayton d20deac32d Xcode 5 crashes if lldb stops at breakpoint if long c++ template lists are present.
This fix reduces the stack size of SymbolFileDWARF::ParseType(). It seems that clang is not very good at sharing locations on the stack with local variables in large functions that have many blocks and each variable gets unique locations. The reduction in size was done by:
1 - removing some large locals that were default constructed by not used
2 - Placing some larger local variables into std::unique_ptr<> to make them on the heap
3 - removing local variables there were large and being populated but not being used
4 - reducing the size of some typedefs to llvm::SmallVector<T, N> so that N wasn’t excessively large


<rdar://problem/16431645>

llvm-svn: 205640
2014-04-04 18:15:18 +00:00
Greg Clayton c9cf579837 Don’t exit the command interpreter if we get interrupted by an EINTR when calling fgets().
llvm-svn: 205638
2014-04-04 18:11:31 +00:00
Jim Ingham 2e3881c0f5 Remember to clear the cached data for the OptionValueFileSpec in SetValueFromCString.
<rdar://problem/16179718> target.expr-prefix contents appear to be cached for an entire session

llvm-svn: 205636
2014-04-04 18:06:54 +00:00
Greg Clayton 7ec287cda3 Don’t crash when we get an invalid .debug_aranges set, just ignore it. Also print out warning messages if LLDB_CONFIGURATION_DEBUG is defined.
<rdar://problem/16516343>

llvm-svn: 205634
2014-04-04 17:53:30 +00:00
Saleem Abdulrasool 324a103619 sweep up -Wformat warnings from gcc
This is a purely mechanical change explicitly casting any parameters for printf
style conversion.  This cleans up the warnings emitted by gcc 4.8 on Linux.

llvm-svn: 205607
2014-04-04 04:06:10 +00:00
Ed Maste 0fdeb7158e Avoid crash if symbol returns a null name
llvm-svn: 205555
2014-04-03 19:27:39 +00:00
Jim Ingham 2f4693aa77 Get "dis -c -s" working again.
pr19324

llvm-svn: 205544
2014-04-03 17:16:17 +00:00
Jim Ingham 6c9ed91cca Make the fail messages
llvm-svn: 205497
2014-04-03 01:26:14 +00:00
Jason Molenda 987cbaa09b Add a missing arm64 idef.
llvm-svn: 205488
2014-04-02 23:52:55 +00:00
Jim Ingham 46d005dbc4 Workaround for collision between enum members in LLVM's MachO.h and system headers
on Mac OS X (in particular mach/machine.h).

<rdar://problem/16494607>

llvm-svn: 205480
2014-04-02 22:53:21 +00:00
Greg Clayton 711861fec5 Don’t #include "llvm/Support/MachO.h” as it isn’t needed here.
llvm-svn: 205462
2014-04-02 20:39:20 +00:00
Greg Clayton 3657e9c592 Don’t include “llvm/Support/MachO.h” as it isn’t needed here.
llvm-svn: 205461
2014-04-02 20:38:03 +00:00
Greg Clayton eadcca97cb Don’t #include “llvm/Support/MachO.h” in a header file if we can avoid it.
llvm-svn: 205460
2014-04-02 20:36:22 +00:00
Andrew MacPherson 82aae0d835 Use getpgid() with waitpid() in case the process pgid is not equal to its pid, as is the case with a forked subprocess. Also a couple of fixes for unit test failures from Todd Fiala.
llvm-svn: 205405
2014-04-02 06:57:45 +00:00
Saleem Abdulrasool 3985c8c646 sanitise sign comparisons
This is a mechanical change addressing the various sign comparison warnings that
are identified by both clang and gcc.  This helps cleanup some of the warning
spew that occurs during builds.

llvm-svn: 205390
2014-04-02 03:51:35 +00:00
Jim Ingham d80102e420 Add the ability to set python breakpoint commands from the SBBreakpoint & SBBreakpointLocation API's.
You can either provide the function name, or function body text.
Also propagate the compilation error up from where it is checked so we can report compilation errors.

<rdar://problem/9898371>

llvm-svn: 205380
2014-04-02 01:04:55 +00:00
Ed Maste 4e0999bc22 Implement ProcessMonitor::Kill for Linux
On FreeBSD ptrace(PT_KILL) is used to terminate the traced process
(as if PT_CONTINUE had been used with SIGKILL as the signal to be
delivered), and is the desired behaviour for ProcessPOSIX::DoDestroy.

On Linux, after ptrace(PTRACE_KILL) the traced process still exists
and can be interrogated.  It is only upon resume that it exits as though
it received SIGKILL.

As the Linux PTRACE_KILL behaviour is not used by LLDB, rename
BringProcessIntoLimbo to Kill, and change the implementation to simply
call kill() instead of using ptrace.

Thanks to Todd F for testing (Ubuntu 12.04, gcc 4.8.2).

Sponsored by: DARPA, AFRL
Differential Revision: http://llvm-reviews.chandlerc.com/D3159

llvm-svn: 205337
2014-04-01 18:14:06 +00:00
Ed Maste a837576a2a Add mips64 to the list of 64-bit Host architectures
llvm-svn: 205333
2014-04-01 18:06:45 +00:00
Ed Maste af58e02d1c mips64: clean up register context storage
Store the gpr data in a DataBufferHeap and use a DataExtractor to
extract register values with appropriate endianness.  This avoids hard-
coding the register count, and with some further work would allow this
class to provide generic register context storage for any CPU.

llvm-svn: 205329
2014-04-01 17:27:25 +00:00
Ed Maste 70882939f1 Implement ProcessMonitor::Kill for FreeBSD
On FreeBSD ptrace(PT_KILL) is used to terminate the traced process
(as if PT_CONTINUE had been used with SIGKILL as the signal to be
delivered), and is the desired behaviour for ProcessPOSIX::DoDestroy.

On Linux, after ptrace(PTRACE_KILL) the traced process still exists
and can be interrogated.  It is only upon resume that it exits as though
it received SIGKILL.

For now I'm committing only the FreeBSD change, until the Linux change
(review D3159) is successfully tested.

http://llvm.org/pr18894

llvm-svn: 205315
2014-04-01 14:30:56 +00:00
Enrico Granata 7ca1c76520 <rdar://problem/16424592>
For some reason, the libc++ vector<bool> data formatter was essentially a costly no-up, doing everything required of it, except actually generating the child values!

This restores its functionality

llvm-svn: 205259
2014-03-31 23:02:25 +00:00
Ed Maste 801335cc64 Fix one thread timeout logic
This should fix the seemingly-random failures observed on the FreeBSD
buildbot.

llvm-svn: 205241
2014-03-31 19:28:14 +00:00
Jason Molenda f8310d40c8 Include string.h for memset() prototype. Thanks Dmitri.
llvm-svn: 205115
2014-03-29 19:29:04 +00:00
Jason Molenda a332978b2a lldb arm64 import.
These changes were written by Greg Clayton, Jim Ingham, Jason Molenda.

It builds cleanly against TOT llvm with xcodebuild.  I updated the
cmake files by visual inspection but did not try a build.  I haven't
built these sources on any non-Mac platforms - I don't think this
patch adds any code that requires darwin, but please let me know if
I missed something.

In debugserver, MachProcess.cpp and MachTask.cpp were renamed to
MachProcess.mm and MachTask.mm as they picked up some new Objective-C
code needed to launch processes when running on iOS.

llvm-svn: 205113
2014-03-29 18:54:20 +00:00
Jim Ingham 914f4e7092 Add the ability from the SB API's to set the "one thread" timeout
for expression evaluations that try one and then all threads.

<rdar://problem/15598528>

llvm-svn: 205060
2014-03-28 21:58:28 +00:00
Jim Ingham 6c8824d216 Wait for the reply from the 'D' detach packet before tearing down the debugger. Avoids a race
condition where we could end up killing debugserver (and thus the target) before it had a chance
to detach.
Also fix debugserver to send the OK AFTER it detaches to avoid the same race condition.

<rdar://problem/16202713>

llvm-svn: 205043
2014-03-28 20:00:07 +00:00
Greg Clayton 241de26bdf Add the "lldb_complete" .editrc command back in case veteran users of LLDB had .editrc key mappings in their ~/.editrc.
<rdar://problem/16279283>

llvm-svn: 204870
2014-03-26 22:48:57 +00:00
Greg Clayton bc711e0575 Fixed a crasher when using 1 character type names in “type summary”, “type synthetic” and “type filter”.
Also fixed a missing return when making python summary functions on the fly.

<rdar://problem/16265491>

llvm-svn: 204867
2014-03-26 22:35:52 +00:00
Sean Callanan c4ca2c1d60 Made the Materializer not write back variables
if they didn't change, just like it does for
registers.  This makes life easier for kernel
debugging and any other situation where values
are read-only.

<rdar://problem/16367795>

llvm-svn: 204764
2014-03-25 22:30:19 +00:00
Enrico Granata 894f735953 <rdar://problem/14862302>
For small structs, the frame format now prints them as one-liners
This follows the same definition that frame variable does for deciding what a "small struct" is, and as such should be fairly consistent with the variable display in general

llvm-svn: 204762
2014-03-25 22:03:52 +00:00
Andrew MacPherson 6ef17b96aa Make ProcessLinux return true for DetachRequiresHalt() because PTRACE_DETACH requires this.
llvm-svn: 204759
2014-03-25 21:40:04 +00:00
Enrico Granata afcbdb1570 <rdar://problem/14515139>
Add a GetFoundationVersion() to AppleObjCRuntime
This API is used to return and cache the major version of Foundation.framework, which is potentially a useful piece of data to key off of to enable or disable certain ObjC related behaviors (especially in data formatters)

llvm-svn: 204756
2014-03-25 20:53:33 +00:00
Andrew MacPherson c3826b5ba6 Move calls to DisableAllBreakpointSites() and m_thread_list.DiscardThreadPlans() into base Process::Destroy() instead of in subclass DoDestroy() methods.
llvm-svn: 204752
2014-03-25 19:59:36 +00:00
Sean Callanan 9287289d66 Added a missing "break" to avoid falling through
when other cases get added.

llvm-svn: 204751
2014-03-25 19:47:07 +00:00
Sean Callanan 576a4374b7 Fixed the IRInterpreter to ignore call instructions
that call debug-information intrinsics.

llvm-svn: 204750
2014-03-25 19:33:15 +00:00
Todd Fiala 4339f3a434 Improve Elf object file UUID calculation performance.
This change makes significant improvements in the performance of
calculating a UUID within ObjectFileELF, and handles both running
processes and core files correctly. This does lazy evaluation of
UUID generation and caches the result when calculated.

Change by Piotr Rak.

llvm-svn: 204749
2014-03-25 19:29:09 +00:00
Greg Clayton fc03f8fcb6 A fix for: http://llvm.org/bugs/show_bug.cgi?id=19241
When there was no process, the expression options were set to not ignore breakpoints. This causes debug info to be generated and causes errors when evaluating simple expressions.

llvm-svn: 204745
2014-03-25 18:47:07 +00:00
Ed Maste b9fe0dd781 Add ObjectFileJIT library
llvm-svn: 204698
2014-03-25 02:03:28 +00:00
Jim Ingham 2f2c876e4f Make "disassemble -a" work when the target is not running yet. It will dump all the functions matching that address, just like "disassemble -n" does before running.
<rdar://problem/16406570>

llvm-svn: 204689
2014-03-25 00:15:47 +00:00
Greg Clayton 6f228bf965 Add ObjectFile/JIT to the makefile.
llvm-svn: 204685
2014-03-24 23:30:43 +00:00
Greg Clayton 8541258b4e Make cmake build the new ObjectFileJIT.
llvm-svn: 204683
2014-03-24 23:11:37 +00:00