Commit Graph

2960 Commits

Author SHA1 Message Date
Enrico Granata bd5eab8287 Fix a bug where language categories would hold on to their caches even after changes
llvm-svn: 255603
2015-12-15 02:20:48 +00:00
Jason Molenda 25d5b10b22 When constructing an address range to "step" or "next" through,
find the largest address range (possibly combining multiple 
LineEntry's for this line number) that is contiguous.

This allows lldb's fast-step stepping algorithm to potentially
run for a longer address range than if we have to stop at every
LineEntry indicating a subexpression in the source line.

http://reviews.llvm.org/D15407
<rdar://problem/23270882> 

llvm-svn: 255590
2015-12-15 00:40:30 +00:00
Omair Javaid af9a31aff3 Add failure paths to a few JSONNumber members
Differential revision: http://reviews.llvm.org/D15355

llvm-svn: 255499
2015-12-14 14:52:07 +00:00
Dawn Perchik b59257841e Fix scope-based lookup when more than one function is found.
When multiple functions are found by name, lldb removes duplicate entries of
functions with the same type, so the first function in the symbol context list
is chosen, even if it isn't in scope. This patch uses the declaration context
of the execution context to select the function which is in scope.

This fixes cases like the following:

    int func();
    namespace ns {
	int func();
	void here() {
	    // Run to BP here and eval 'p func()';
	    // lldb used to find ::func(), now finds ns::func().
	}
    }

Reviewed by: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D15312

llvm-svn: 255439
2015-12-12 19:31:41 +00:00
Jason Molenda 12f7929177 Add some additional safety checks to the StructuredData access
methods - lldb can still crash pretty easily on corrupt JSON text,
and these will help eliminate a bunch of cases where that would
result in a crash.  Some of the methods would check that e.g.
GetItemAtIndex would actually return an item before dereferencing it,
some would not, that kind of thing.  

<rdar://problem/23768693> 

llvm-svn: 255093
2015-12-09 04:15:47 +00:00
Sean Callanan 77decf5f20 When printing warnings, the repeat_key should be
const void * because the data is never accessed,
the pointer is the only useful piece of data.

llvm-svn: 255090
2015-12-09 01:25:01 +00:00
Greg Clayton dfc0962196 Change DeclContextFindDeclByName to return a vector of CompilerDecl objects. Opaque pointers should only be used for the decl context object. Also made a default implementation so that GoASTContext doesn't need to override DeclContextFindDeclByName.
llvm-svn: 255038
2015-12-08 18:39:50 +00:00
Tamas Berghammer ccd6cffba3 Modify "platform connect" to connect to processes as well
The standard remote debugging workflow with gdb is to start the
application on the remote host under gdbserver (e.g.: gdbserver :5039
a.out) and then connect to it with gdb.

The same workflow is supported by debugserver/lldb-gdbserver with a very
similar syntax but to access all features of lldb we need to be
connected also to an lldb-platform instance running on the target.

Before this change this had to be done manually with starting a separate
lldb-platform on the target machine and then connecting to it with lldb
before connecting to the process.

This change modifies the behavior of "platform connect" with
automatically connecting to the process instance if it was started by
the remote platform. With this command replacing gdbserver in a gdb
based worflow is usually as simple as replacing the command to execute
gdbserver with executing lldb-platform.

Differential revision: http://reviews.llvm.org/D14952

llvm-svn: 255016
2015-12-08 14:08:19 +00:00
Tamas Berghammer 4fbd67ac11 Add a new option to Platform::LoadImage to install the image
This change introduce 3 different working mode for Platform::LoadImage
depending on the file specs specified.
* If only a remote file is specified then the remote file is loaded on
  the target (same behavior as before)
* If only a local file is specified then the local file is installed to
  the current working directory and then loaded from there.
* If both local and remote file is specified then the local file is
  installed to the specified location and then loaded from there.

The same options are exposed on the SB API with a new method LoadImage
method while the old signature presers its meaning.

On the command line the installation of the shared library can be specified
with the "--install" option of "process load".

Differential revision: http://reviews.llvm.org/D15152

llvm-svn: 255014
2015-12-08 13:43:59 +00:00
Greg Clayton e6b36cdd4d Trying to submit 254476 one more time. This implement -gmodule debugging support.
It was previously reverted due to issues that showed up only on linux. I was able to reproduce these issues and fix the underlying cause.

So this is the same patch as 254476 with the following two fixes:
- Fix not trying to complete classes that don't have external sources
- Fix ClangASTSource::CompleteType() to check the decl context of types that it finds by basename to ensure we don't complete a type "S" with a type like "std::S". Before this fix ClangASTSource::CompleteType() would accept _any_ type that had a matching basename and copy it into the other type.

<rdar://problem/22992457>

llvm-svn: 254980
2015-12-08 01:02:08 +00:00
Pavel Labath 19da1f16c2 Recommit "Fix race during process interruption"
This is a resubmit of r254403, see that commit's message for context. This fixes an issue in the
original commit, where we would incorrectly interrupt the process if the interrupt request came
just as we were about to send the stopped event to the public.

llvm-svn: 254902
2015-12-07 12:36:52 +00:00
Jim Ingham 6dd8aa2ed2 Make it clear how you would get the pointee out of an SBValue with
GetType().IsPointerType() returns true.

llvm-svn: 254790
2015-12-04 22:51:19 +00:00
Dawn Perchik f268357514 Fix breakpoint language filtering for other C variants (like C99) and Pascal.
This patch fixes setting breakpoints on symbol for variants of C and
Pascal where the language is "unknown" within the filter-by-language
process added in r252356. It also renames GetLanguageForSymbolByName to
GuessLanguageForSymbolByName and adds comments explaining the pitfalls
of the flawed assumption that the language can be determined solely from
the name and target.

Reviewed by: jingham
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D15175

llvm-svn: 254753
2015-12-04 19:34:00 +00:00
Tamas Berghammer 6d73750b2a Improve the functionality of JSONNumber
* Add support for representing signed integers
* Add new constructors taking any signed or unsigned integer types

Differential revision: http://reviews.llvm.org/D15187

llvm-svn: 254715
2015-12-04 13:23:35 +00:00
Mohit K. Bhakkad 69035c8a5d [Fix] fix build failure due to rL254588
llvm-svn: 254593
2015-12-03 08:44:33 +00:00
Mohit K. Bhakkad 6846bc8de2 [LLDB][MIPS] fix watchpoint searched on client side for same masked variables
Reviewers: clayborg.
Subscribers: jaydeep, bhushan, sagar, nitesh.jain,lldb-commits.
Differential Revision: http://reviews.llvm.org/D15106

llvm-svn: 254522
2015-12-02 17:45:02 +00:00
Tamas Berghammer 3cb132a0f4 Fix "process load/unload" on android
On android the symbols exposed by libdl (dlopen, dlclose, dlerror)
prefixed by "__dl_". This change moves the handling of process
load/unload to the platform object and override it for android to
handle the special prefix.

Differential revision: http://reviews.llvm.org/D11465

llvm-svn: 254504
2015-12-02 11:58:51 +00:00
Tamas Berghammer fcf334b824 Revert "Added support for -gmodule debugging when debug info is left in the .o files on Darwin."
The commit caused a test failure on the linux buildbot in
TestDataFormatterSynthVal.

llvm-svn: 254502
2015-12-02 11:35:54 +00:00
Greg Clayton 5dfc4a4d02 Added support for -gmodule debugging when debug info is left in the .o files on Darwin.
This is done by finding the types that are forward declarations that come from a module, and loading that module's debug info in a separate lldb_private::Module, and copying the type over into the current module using a ClangASTImporter object. ClangASTImporter objects are already used to copy types from on clang::ASTContext to another for expressions so the type copying code has been around for a while.

A new FindTypes variant was added to SymbolVendor and SymbolFile:

size_t
SymbolVendor::FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types);

size_t
SymbolVendor::FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types);

The CompilerContext is a way to represent the exact context of a type and pass it through an agnostic API boundary so that we can find that exact context elsewhere in another file. This was required here because we can have a module that has submodules, both of which have a "foo" type.

I am not able to add tests for this yet as we currently don't build our C/C++/ObjC binaries with the clang binary that we build. There are some driver issues where it can't find the header files for the C and C++ standard library which makes compiling these tests hard. We can't also guarantee that if we are building with clang that it supporst the exact format of -gmodule debugging that we are trying to test. We have had other versions of clang that had a different implementation of -gmodule debugging that we are no longer supporting, so we can't enable tests if we are building with clang without compiling something and looking at the structure of the DWARF that was generated to ensure that it is the format we can actually use.

llvm-svn: 254476
2015-12-02 00:43:32 +00:00
Pavel Labath 00fea63627 Revert "Fix race during process interruption"
The android buildbot gets quite flaky after this change. I'm reverting it while I investigate.

llvm-svn: 254430
2015-12-01 17:59:56 +00:00
Pavel Labath df55f522bd Fix race during process interruption
Summary:
The following situation was occuring in TestAttachResume:
- we did a "continue" from a breakpoint (which involves a private start-stop to step over the
  breakpoint)
- after receiving the stop-reply from the step-over, we issue a "detach" (which requires a
  process interrupt)
- at this moment, the public state is "running", private state is "about-to-be-stopped" (the
  stopped event was broadcast, but it was not received yet)
- StopForDestroyOrDetach (public thread) notes the public state is running, sends an interrupt
  request to the private thread
- private thread gets the eBroadcastBitInterrupt (before the eStateStopped message), and asks the
  process plugin to stop (via Halt())
- process plugin says it has nothing to do as the process is already stopped
- private thread shrugs and carries on. receives the stop event, restores the breakpoint and
  resumes the process.
- after a while, the public thread times out and says it failed to stop the process

This patch does the following:
- splits Halt() into two functions, private and public, their usage depends on the context
  - public Halt(): sends eBroadcastBitInterrupt to the private thread and waits for the Stop
    event
  - HaltPrivate(): asks the plugin to stop and makes a note that the halt was requested. When the
    next stop event comes it sets the interrupt flag on it.
- removes HijackPrivateProcessEvents(), as the only user (old Halt()) has gone away
- removes the m_currently_handling_event hack, as the new Halt() does not need it
- adds a use_run_lock parameter to public Halt() and WaitForProcessToStop(). This was needed
  because RunThreadPlan uses Halt() while holding the run lock and we don't want Halt() to take
  it away from him.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 254403
2015-12-01 11:28:47 +00:00
Adrian McCarthy f7d1893f5b Enable saving of mini dumps with lldb process save-core.
Also adds SB API to save a core and tests that use it.

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

llvm-svn: 253734
2015-11-20 23:09:11 +00:00
Adrian McCarthy f9a2697e13 Revert "FOO"
Accidentally commited before I was done.

This reverts commit 2ec2da4ee52780582d5e9c88b2e982a688fbdbe1.

llvm-svn: 253685
2015-11-20 18:18:21 +00:00
Adrian McCarthy af75dab383 FOO
llvm-svn: 253684
2015-11-20 18:15:14 +00:00
Greg Clayton 9d47212194 Fix a crasher in SymbolContext::SortTypeList() where something that was iterating over a std::multimap was actually mutating the list.
<rdar://problem/23605600>

llvm-svn: 253618
2015-11-19 23:10:45 +00:00
Enrico Granata 46252398f0 Fix up LLDB for a change in the way clang represents anonymous unions such that the 'frame variable' command can still find the members of such union as if they were top-level variables in the current scope
llvm-svn: 253613
2015-11-19 22:28:58 +00:00
Enrico Granata 293207dd57 Pass the ExecutionContext as well, since it is actually useful
llvm-svn: 253537
2015-11-19 02:50:27 +00:00
Enrico Granata d4129b47d0 Allow the language plugins a say in how the function name is rendered as part of frame formatting
llvm-svn: 253531
2015-11-19 01:11:53 +00:00
Enrico Granata 3de08c5f0c Reapply r253423 and r253424 (which cleanup the data formatters iteration model, as well as the type X list commands), along with a change by Zachary Turner to bypass a MSVC bug with SFINAE
llvm-svn: 253493
2015-11-18 19:42:44 +00:00
Tamas Berghammer 68aa90a11e Revert 2 commits breaking the MSVC build
Revert "Remove a few vestigial typedefs from the old world"
This reverts commit 05872cda2a00fbd988c4fc761b1f87fe9edce224.

Revert "Cleanup the type X list commands to use the new ForEach goodness"
This reverts commit 85b1d83819a22cdc9ef12f58fd4fa92b473a4f81.

llvm-svn: 253455
2015-11-18 12:11:34 +00:00
Enrico Granata 0481df6af4 Remove a few vestigial typedefs from the old world
llvm-svn: 253424
2015-11-18 01:44:36 +00:00
Enrico Granata a76e894bd5 Cleanup the type X list commands to use the new ForEach goodness
llvm-svn: 253423
2015-11-18 01:37:49 +00:00
Jim Ingham 055a08a488 Add the ability (through the SB API & command line) to specify an address
breakpoint as "file address" so that the address breakpoint will track that
module even if it gets loaded in a different place.  Also fixed the Address
breakpoint resolver so that it handles this tracking correctly.

llvm-svn: 253308
2015-11-17 03:39:13 +00:00
Enrico Granata b56d01033e The existing logic to loop over formatters is very pre-C++11, using void* batons, and function pointers, and raw memory allocations instead of safer more modern constructs
This is a first pass at a cleanup of that code, modernizing the "type X clear" commands, and providing the basic infrastructure I plan to use all over
More cleanup will come over the next few days

llvm-svn: 253125
2015-11-14 05:44:23 +00:00
Sean Callanan 92655f58bc Always initialize expression variables' flags field.
llvm-svn: 253112
2015-11-14 01:05:33 +00:00
Enrico Granata e86e425945 Add a few useful accessors on the data formatters containers
llvm-svn: 253111
2015-11-14 00:58:37 +00:00
Enrico Granata 920c587e64 Fix indentation
llvm-svn: 253087
2015-11-13 21:34:39 +00:00
Sean Callanan a3444ffcdd Made the ClangASTImporter into a shared pointer, eliminating a race condition.
It used to be a unique pointer, and there could be a case where ClangASTSource
held onto a copy of the pointer but Target::Destroy destroyed the unique pointer
in the mean time.

I also ensured that there is a validity check on the target (which confirms that
a ClangASTImporter can be generated) before the target's shared pointer is
copied into ClangASTSource.

This race condition caused a crash if Target::Destroy was called and then later
the target objecct was deleted.

llvm-svn: 252665
2015-11-10 22:54:42 +00:00
Enrico Granata 608d67c152 Introduce a way for Languages to specify whether values of "reference types" are "nil" (not pointing to anything) or uninitialized (never made to point at anything)
This latter determination may or may not be possible on a per-language basis; and neither is mandatory to implement for any language

Use this knowledge in the ValueObjectPrinter to generalize the notion of IsObjCNil() and the respective printout

llvm-svn: 252663
2015-11-10 22:39:15 +00:00
Enrico Granata 8cf44d9684 Upstream changes to the ValueObjectPrinter; nfc
llvm-svn: 252638
2015-11-10 19:07:58 +00:00
Greg Clayton fe68904fa6 Fixed TypeMemberFunctionImpl to not use clang types directly but use the new CompilerDecl class to do the job in an abstract way.
Fixed a crash that would happen if you tried to get the name of a constructor or destructor by calling "getDeclName()" instead of calling getName() (which would assert and crash).

Added the ability to get function arguments names from SBFunction.

llvm-svn: 252622
2015-11-10 17:47:04 +00:00
Jason Molenda 649a607e11 Add support for tvos and watchos to ObjectFileMachO.
Add support for the new dyld shared cache format on
ios etc devices.
Small changes for classifying ObjC metadata symbols.

llvm-svn: 252588
2015-11-10 05:21:54 +00:00
Enrico Granata 97e31cdeed Code cleanup
llvm-svn: 252560
2015-11-10 00:21:10 +00:00
Enrico Granata 99448c6367 Rework the way in which ValueObjectChild decides how to update itself; this is a slight refactoring that I need as part of a larger master plan. As such, should be NFC
llvm-svn: 252529
2015-11-09 23:07:55 +00:00
Enrico Granata 6500061e92 Extend the TypeSystem's ShouldPrintAsOneLiner implementation so that the ValueObject itself also gets a say in the process; NFC
llvm-svn: 252516
2015-11-09 21:28:55 +00:00
Enrico Granata dc62ffd37b Add a way for source languages to "mark" ValueObjects with language-specific flags
In this way, when a language needs to tell itself things that are not bound to a type but to a value (imagine a base-class relation, this is not about the type, but about the ValueObject), it can do so in a clean and general fashion

The interpretation of the values of the flags is, of course, up to the language that owns the value (the value object's runtime language, that is)

llvm-svn: 252503
2015-11-09 19:27:34 +00:00
Bruce Mitchener 9ccb970f23 Make lldb::endian::InlHostByteOrder() private.
Summary:
Since this is within the lldb namespace, the compiler tries to
export a symbol for it. Unfortunately, since it is inlined, the
symbol is hidden and this results in a mess of warnings when
building on OS X with cmake.

Moving it to the lldb_private namespace eliminates that problem.

Reviewers: clayborg

Subscribers: emaste, lldb-commits

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

llvm-svn: 252396
2015-11-07 04:40:13 +00:00
Enrico Granata 7123e2b5d7 Add SBType::IsAnonymousType() and relative plumbing in the debugger internals
For language that support such a thing, this API allows to ask whether a type is anonymous (i.e. has been given no name)

Comes with test case

llvm-svn: 252390
2015-11-07 02:06:57 +00:00
Jim Ingham 0fcdac363c Make the language specifier to "break set" actually filter the names by their language. So for
instance:

break set -l c++ -r Name

will only break on C++ symbols that match Name, not ObjC or plain C symbols.  This also works
for "break set -n" and there are SB API's to pass this as well.

llvm-svn: 252356
2015-11-06 22:48:59 +00:00
Jim Ingham 569aaf9e1a Another optimization to keep down gdb-remote traffic. If we have suspended a thread while
running, don't request the thread status when deciding why we stopped.

llvm-svn: 252355
2015-11-06 22:45:57 +00:00