Commit Graph

2219 Commits

Author SHA1 Message Date
Jim Ingham 2bdbfd50d2 This checkin is the first step in making the lldb thread stepping mechanism more accessible from
the user level.  It adds the ability to invent new stepping modes implemented by python classes,
and to view the current thread plan stack and to some extent alter it.

I haven't gotten to documentation or tests yet.  But this should not cause any behavior changes
if you don't use it, so its safe to check it in now and work on it incrementally.

llvm-svn: 218642
2014-09-29 23:17:18 +00:00
Matthew Gardiner f03e6d84bc Very minimal support 24-bit kalimbas. Vanilla "memory read" for data sections
works, as do breakpoints, run and pause, display zeroth frame.

See
http://reviews.llvm.org/D5503

for a fuller description of the changes in this commit.

llvm-svn: 218596
2014-09-29 08:02:24 +00:00
Todd Fiala cacde7df6d Enable llgs to build against experimental Android AOSP lldb/llvm/clang/compiler-rt repos.
See http://reviews.llvm.org/D5495 for more details.

These are changes that are part of an effort to support building llgs, within the AOSP source tree, using the Android.mk
build system, when using the llvm/clang/lldb git repos from AOSP replaced with the experimental ones currently in
github.com/tfiala/aosp-{llvm,clang,lldb,compiler-rt}.

llvm-svn: 218568
2014-09-27 16:54:22 +00:00
Enrico Granata 5e35cf9dcc Add an explicit cast to silence compiler warning here
llvm-svn: 218410
2014-09-24 20:52:58 +00:00
Enrico Granata a540496e6f These APIs were defined in the .h file, but never actually implemented. Just get rid of them
llvm-svn: 218396
2014-09-24 17:57:11 +00:00
Todd Fiala d5635cdd7f Adjust to LLVM JIT API change
Those wrapper functions seems not used by lldb... Removed

Reference for

replacing JITMemoryManager with SectionMemoryManager
replacing "llvm::JITMemoryManager::CreateDefaultMemManager()" with "new llvm::SectionMemoryManager()"
http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-jitlistener/llvm-jitlistener.cpp?r1=218316&r2=218315&pathrev=218316

Change by Tong Shen.

Tested:
Ubuntu 14.04 x86_64
MacOSX 10.9.5 with Xcode Version 6.1 (6A1030) (Beta)

llvm-svn: 218383
2014-09-24 15:55:47 +00:00
Zachary Turner acee96ae52 Fix up the HostThread interface, making the interface simpler.
Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D5417

llvm-svn: 218325
2014-09-23 18:32:09 +00:00
Zachary Turner 4171da5cfe Make sure to #include <atomic> when using std::atomic.
llvm-svn: 218148
2014-09-19 20:12:32 +00:00
Greg Clayton 615eb7e609 Test suite runs better again after recent fixes that would select a platform if a "file a.out" auto selected a different platform than the selected one.
Changes include:
- fix it so you can select the "host" platform using "platform select host"
- change all callbacks that create platforms to returns shared pointers
- fix TestImageListMultiArchitecture.py to restore the "host" platform by running "platform select host"
- Add a new "PlatformSP Platform::Find(const ConstString &name)" method to get a cached platform
- cache platforms that are created and re-use them instead of always creating a new one

llvm-svn: 218145
2014-09-19 20:11:50 +00:00
Carlo Kok 0fd6fd4fd4 Adds two new functions to SBTarget FindGlobalVariables and FindGlobalFunctions that lets you search by name, by regular expression and by starts with.
llvm-svn: 218140
2014-09-19 19:38:19 +00:00
Enrico Granata 47caf9a956 Extend the member function discovery APIs to also support Objective-C as well as C++
For the Objective-C case, we do not have a "function type" notion, so we actually end up wrapping the clang ObjCMethodDecl in the Impl object, and ask function-y questions of it
In general, you can always ask for return type, number of arguments, and type of each argument using the TypeMemberFunction layer - but in the C++ case, you can also acquire a Type object for the function itself, which instead you can't do in the Objective-C case

llvm-svn: 218132
2014-09-19 18:21:05 +00:00
Enrico Granata 2267ad442a Change the ClangASTMap implementation to use a thread-safe wrapper over llvm::DenseMap. This helps avoid a certain class of spins per <rdar://problem/18160764>
llvm-svn: 217888
2014-09-16 17:28:40 +00:00
David Majnemer 8faf9370fa Clean-up warnings on Linux/GCC
llvm-svn: 217862
2014-09-16 06:34:29 +00:00
Enrico Granata 6c42cb11d6 Change SBType.GetMemberFunctionAtIndex() to return an object describing the member function in more detail. A type was really quite vague. This now has function name, kind, as well as function type
llvm-svn: 217828
2014-09-15 21:30:36 +00:00
Todd Fiala 7b0917a0c5 use std::atomic<> to protect variables being accessed by multiple threads
There are several places where multiple threads are accessing the same variables simultaneously without any kind of protection. I propose using std::atomic<> to make it safer. I did a special build of lldb, using the google tool 'thread sanitizer' which identified many cases of multiple threads accessing the same memory. std::atomic is low overhead and does not use any locks for simple types such as int/bool.

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

Change by Shawn Best.

llvm-svn: 217818
2014-09-15 20:07:33 +00:00
Enrico Granata 735152e3b0 Add a --help (-h) option to "command script add" that enables users to define a one-liner short help for their command
Also, in case they don't define any, change the default from "Run Python function <blah>" into "For more information run help <blah>"

The core issue here is that Python only allows one docstring per function, so we can't really attach both a short and a long help to the same command easily
There are alternatives but this is not a pressing enough concern to go through the motions quite yet

Fixes rdar://18322737

llvm-svn: 217795
2014-09-15 17:52:44 +00:00
Enrico Granata 7506dc06f4 std::function is a better choice than a raw function pointer here. You probably still want to be careful about cleaning up stuff you captured, but it's not like a function pointer wasn't going to let you shoot yourself in the foot given enough dedication.
llvm-svn: 217718
2014-09-12 22:56:52 +00:00
Zachary Turner 44e442b3df Make ProcessLaunchInfo copyable.
llvm-svn: 217714
2014-09-12 22:38:39 +00:00
Enrico Granata 190064ad0d Add logic to LLDB to figure out the types of member functions of C++ classes. Add plumbing for that all the way up to the SB layer
llvm-svn: 217701
2014-09-12 18:45:43 +00:00
Enrico Granata 13460a59fd Add a ProcessStructReader utility class to LLDB
The purpose of a ProcessStructReader is to allow intelligent reading of data from the underlying process
Traditionally, the way this has been handled is to have a load_address and shuffle it around, and use Process::ReadMemory()-kind APIs

With a ProcessStructReader one can define a clang type that matches exactly the definition of the thing they are trying to ingest from the inferior process, and then just point LLDB at where the data is
Since this work is done in terms of clang types, one can honor packed/aligned attributes, sizes of types on the inferior architecture, and similar tricky caveats without having to hardcode them

llvm-svn: 217644
2014-09-11 23:09:55 +00:00
Zachary Turner f5e4f37cb6 Update HostProcess to use the same facade pattern as HostThread.
llvm-svn: 217632
2014-09-11 22:22:16 +00:00
Jim Ingham 77fd738f58 Rework how resetting breakpoints in changed modules works. Try to match up old
locations with new ones if possible.

Next up some test cases...

llvm-svn: 217551
2014-09-10 21:40:47 +00:00
Ed Maste 3b7382da74 Move FreeBSD's thread SetName implementation to ThisThread
SetName is only used in LLDB to set a thead's own name.  Move it there
to match OS X and Windows and slightly reduce the effort in any future
HostThread/ThisThread name refactoring.

llvm-svn: 217521
2014-09-10 17:09:46 +00:00
Ed Maste 3967764b98 Fix FreeBSD build after thread changes
More work on the GetName/SetName arguments (thread_t vs tid_t) is needed
but this change should restore the build and basic operation.

llvm-svn: 217502
2014-09-10 13:38:47 +00:00
Zachary Turner 39de311071 Create a HostThread abstraction.
This patch moves creates a thread abstraction that represents a
thread running inside the LLDB process.  This is a replacement for
otherwise using lldb::thread_t, and provides a platform agnostic
interface to managing these threads.

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

Reviewed by: Jim Ingham

llvm-svn: 217460
2014-09-09 20:54:56 +00:00
Enrico Granata 0f883ffbdb Add a -V <bool> flag to frame variable/expression that enables execution of type validators. The jury is still out on what the user experience of type validators should be, so for now gate it on a specific flag. The mode I am using is prefix variables that fail to validate with a bang, and then emitting the actual validation error on a separate line. Of course, given the total absence of validators, this should never actually happen to you
llvm-svn: 217303
2014-09-06 02:20:19 +00:00
Kuba Brecka a51ea3822a Implement ASan history threads in SB API
Reviewed at
http://reviews.llvm.org/D5219
and
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140901/012809.html

llvm-svn: 217300
2014-09-06 01:33:13 +00:00
Enrico Granata edc4414094 Expose the ability to retrieve the result of a type validator via the SB API. To keep it simple, do not expose the pair, but just return a NULL string for success, and a non-NULL string for error; If we were to decide to expose the pair, we would need an SBTypeValidatorResult, which is fine, but it should come as part of exposing type validators through the SB API rather than as a one-off thing. So, KISS for now
llvm-svn: 217299
2014-09-06 01:30:04 +00:00
Kuba Brecka a5ea1e2b6c Expose ThreadCollection in SB API
Reviewed at
http://reviews.llvm.org/D5218
and
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140901/012828.html

llvm-svn: 217296
2014-09-06 01:21:19 +00:00
Enrico Granata 744794aa96 Start plumbing the type validator logic through to the ValueObjects; allow a ValueObject to have a validator, to update it from the FormatManager, and to retrieve (and cache) the result of the validation
llvm-svn: 217282
2014-09-05 21:46:22 +00:00
Enrico Granata c582713ce6 Introduce the notion of a "type validator" formatter
Type Validators have the purpose of looking at a ValueObject, and making sure that there is nothing semantically wrong about the object's contents
For instance, if you have a class that represents a speed, the validator might trigger if the speed value is greater than the speed of light

This first patch hooks up the moving parts in the formatters subsystem, but does not link ValueObjects to TypeValidators, nor lets the SB API be exposed to validators
It also lacks the notion of Python validators

llvm-svn: 217277
2014-09-05 20:45:07 +00:00
Kuba Brecka e4d4801c3a [lldb] Abstract a superclass for a generic thread container.
Reviewed at
http://reviews.llvm.org/D5200
and
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140901/012799.html

llvm-svn: 217269
2014-09-05 19:13:15 +00:00
Kuba Brecka beed821ffb ASan malloc/free history threads
Reviewed at http://reviews.llvm.org/D4596

llvm-svn: 217116
2014-09-04 01:03:18 +00:00
Jason Molenda f0340c9ab5 Add a new target.process.memory-cache-line-size to change the size of
lldb's internal memory cache chunks that are read from the remote
system.  For a remote connection that is especially slow, a user may
need to reduce it; reading a 512 byte chunk of memory whenever a
4-byte region is requested may not be the right decision in these
kinds of environments.
<rdar://problem/18175117> 

llvm-svn: 217083
2014-09-03 22:30:54 +00:00
Jason Molenda 5de2e7cafb RegisterContextLLDB::InitializeNonZerothFrame had a bit of code to
detct unwind loops but there was a code path through there (using
architecture default unwind plans) that didn't do the check, and
could end up with an infinite loop unwind.  Move that code into a
separate method and call it from both places where it is needed.

Also remove the use of ABI::FunctionCallsChangeCFA in that check.
I thought about it a lot and none of the architecutres that we're
supporting today can have a looping CFA.

Since the unwinder isn't using ABI::FunctionCallsChangeCFA() and
ABI::StackUsesFrames(), and the unwinder was the only reason
those methods exists, I removed them from the ABI and all its
plugins.

<rdar://problem/17364005> 

llvm-svn: 216992
2014-09-02 23:04:01 +00:00
Matthew Gardiner e77b2948b4 Add an interface on ArchSpec to provide lldb client code
with a mechanism to query if the current target architecture
has non 8-bit bytes.

llvm-svn: 216867
2014-09-01 09:06:03 +00:00
Todd Fiala 4ceced3f59 Consolidate UnixSignals setting/getting in Process.
See http://reviews.llvm.org/D5108 for details.

This change does the following:

* eliminates the Process::GetUnixSignals() virtual method and replaces with a fixed getter.
* replaces the Process UnixSignals storage with a shared pointer.
* adds a Process constructor variant that can be passed the UnixSignalsSP. When the constructor without the UnixSignalsSP is specified, the Host's default UnixSignals is used.
* adds a host-specific version of GetUnixSignals() that is used when we need the host's appropriate UnixSignals variant.
* replaces GetUnixSignals() overrides in PlatformElfCore, ProcessGDBRemote, ProcessFreeBSD and ProcessLinux with code that appropriately sets the Process::UnixSignals for the process.

This change also enables some future patches that will enable llgs to be used for local Linux debugging.

llvm-svn: 216748
2014-08-29 17:35:57 +00:00
Jim Ingham b5796cb40e Allow "breakpoint command add" to add commands to more than one breakpoint at a time.
<rdar://problem/13314462>

llvm-svn: 216747
2014-08-29 17:34:17 +00:00
Todd Fiala 02e7181508 lldb - towards AArch64 being recognised as platform architecture
See http://reviews.llvm.org/D4381.

Change by Paul Osmialowski.

llvm-svn: 216668
2014-08-28 14:32:43 +00:00
Todd Fiala 76e0fc9884 Add some logging around Process attaching and inferior exec handling.
llvm-svn: 216630
2014-08-27 22:58:26 +00:00
Zachary Turner 4e82ec9caa Create a HostProcess class.
This is a lightweight wrapper around a pid.  It is intended to be
lightweight enough to serve as a replacement anywhere we currently
store a pid.  It provides convenience methods and common process
operations.

This patch does not yet make use of HostProcess anywhere.

llvm-svn: 216607
2014-08-27 20:15:30 +00:00
Zachary Turner 58a559c07e Update LLDB to use LLVM's DynamicLibrary.
LLDB had implemented its own DynamicLibrary class for plugin
support.  LLVM has an equivalent mechanism, so this patch deletes
the duplicated code in LLDB and updates LLDB to reference the
mechanism provided by LLVM.

llvm-svn: 216606
2014-08-27 20:15:09 +00:00
Matthew Gardiner 5f67579f69 Add support for kalimba architecture variants 3, 4 and 5.
Add entries to core_definitions and elf_arch_entries for
those variants. Select the subtype for the variant by parsing
the e_flags field of the elf header.

llvm-svn: 216541
2014-08-27 12:09:39 +00:00
Enrico Granata 59953f0dbe It was pointed out to me that an offset of 0 makes sense for ObjC, but not always for C++, and this API claims to be general enough that it should not drop C++ usability on the floor for no good reason. Fix it with an explicit offset argument
llvm-svn: 216487
2014-08-26 21:35:30 +00:00
Bruce Mitchener ca7b0aaa36 [dwarf] Add new language enumerations.
This updates the DWARF language identifiers to include recent additions to
the DWARF 5 specification (draft).

llvm-svn: 216486
2014-08-26 21:22:49 +00:00
Enrico Granata 32556cda18 Add an API on ValueObject to generate a 'synthetic child' of base class type. Note that in this commit, the term synthetic child is not meant to refer to data formatters, but to the programmatically-generated children stored inside a ValueObject itself
llvm-svn: 216483
2014-08-26 20:54:04 +00:00
Todd Fiala 0562524b45 On x86 & x86_64, try to use eh_frame for frame 0.
We decided to use assmbly profiler instead of eh_frame for frame 0 because for compiler generated code, eh_frame is usually synchronous(a.k.a. only valid at call site); and we have no way to tell if it's asynchronous or not.
But for x86 & x86_64 compiler generated code:
1. clang & GCC describes all prologue instructions in eh_frame;
2. mid-function stack pointer altering instructions can be easily detected.
So we can grab eh_frame, and use assembly profiler to augment it into asynchronous unwind table.
This change also benefits hand-written assembly; eh_frame for hand-written assembly is often asynchronous,so we have a much better chance to successfully unwind through them.

Change by Tong Shen.

llvm-svn: 216406
2014-08-25 20:29:09 +00:00
Jason Molenda 8cd95a3b2c Add a little documentation for the register kinds
and the method to convert between them.

llvm-svn: 216372
2014-08-25 08:03:10 +00:00
Jason Molenda 05a09c67da When adding a dSYM to an existing ObjectFile, we can have a situation
with binaries in the dyld shared cache (esp on iOS) where the file
address for the executable binary (maybe from memory, maybe from
an expanded copy of the dyld shared cache) is different from the
file address in the dSYM.  In that case, ObjectFileMachO replaces
the file addresses from the original binary with the dSYM file
addresses (usually 0-based) -- lldb doesn't have a notion of two
file addresses for a given module so they need to agree.

There was a cache of file addresses over in the Symtab so I added
a method to the Module and the objects within to clear any file address
caches if they exist, and added an implementation in the Symtab
module to do that.
<rdar://problem/16929569> 

llvm-svn: 216258
2014-08-22 02:46:46 +00:00
Zachary Turner a21fee0ee4 Move the rest of the HostInfo functions over.
This should bring HostInfo up to 99% completion.  The remainder
of code in Host will be split into instantiatable classes
representing host processes, threads, dynamic libraries, and
process launching strategies.

llvm-svn: 216230
2014-08-21 21:49:24 +00:00