Commit Graph

1626 Commits

Author SHA1 Message Date
Abhishek Aggarwal 5bfee5f1c8 Added new API to SBStructuredData class
Summary:
 - Added API to access data types
    -- integer, double, array, string, boolean and dictionary data types
    -- Earlier user had to parse through the string output to get these
       values

 - Added Test cases for API testing

 - Added new StructuredDataType enum in public include file
   -- Replaced locally-defined enum in StructuredData.h with this new
      one       
   -- Modified other internal files using this locally-defined enum

Signed-off-by: Abhishek Aggarwal <abhishek.a.aggarwal@intel.com>

Reviewers: clayborg, lldb-commits

Reviewed By: clayborg

Subscribers: labath

Differential Revision: https://reviews.llvm.org/D33434

llvm-svn: 304138
2017-05-29 08:25:46 +00:00
Pavel Labath 45dde23756 Recommit "RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false"
This is a resubmit of r303732, which was reverted due to a regression.

The original patch caused a regression in TestLoadUnload, which has only showed
up when running the remote test suite. The problem there was that we interrupted
the target just as it has hit the rendezvous breakpoint in the dlopen call. This
meant that the stop reason was set to "breakpoint" even though the event would
not have been broadcast if we had not stopped the process. I fix this by
checking StopInfo->ShouldNotify() before stopping.

I also add a new test for the handling of conditional breakpoints in
expressions, which I noticed to be broken (pr33164)

Differential Revision: https://reviews.llvm.org/D33283

llvm-svn: 303848
2017-05-25 10:50:06 +00:00
Pavel Labath 7417558f59 Revert "RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false"
This reverts commit r303732, as it introduces a regression in
TestLoadUnload on android.

llvm-svn: 303740
2017-05-24 11:57:28 +00:00
Pavel Labath 0dc2ad1b13 RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false
Summary:
The function had logic to handle the case when the expression terminated
while we were trying to halt the process, but it failed to take into
account the possibility that the expression stopped because it hit a
breakpoint. This was caused by the fact that the handling of the stopped
events was duplicated for the "halting" and regular cases (the regular
case handled this situation correctly). I've tried to merge these two
cases into one to make sure they stay in sync.

I should call out that the two cases were checking whether the thread
plan has completed in slightly different ways. I am not sure what is the
difference between them, but I think the check should be the same in
both cases, whatever it is, so I just took the one from the regular
case, as that is probably more tested.

For the test, I modified TestUnwindExpression to run the expression with
a smaller timeout (this is how I found this bug originally). With a 1ms
one thread timeout, the test failed consistently without this patch.

Reviewers: jingham

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D33283

llvm-svn: 303732
2017-05-24 09:46:48 +00:00
Pavel Labath f9d1647657 Remove an expensive lock from Timer
The Timer destructor would grab a global mutex in order to update
execution time. Add a class to define a category once, statically; the
class adds itself to an atomic singly linked list, and thus subsequent
updates only need to use an atomic rather than grab a lock and perform a
hashtable lookup.

Differential Revision: https://reviews.llvm.org/D32823
Patch by Scott Smith <scott.smith@purestorage.com>.

llvm-svn: 303058
2017-05-15 13:02:37 +00:00
Zachary Turner 2833321f09 Update StructuredData::String to return StringRefs.
It was returning const std::string& which was leading to
unnecessary copies all over the place, and preventing people
from doing things like Dict->GetValueForKeyAsString("foo", ref);

llvm-svn: 302875
2017-05-12 05:49:54 +00:00
Zachary Turner 97206d5727 Rename Error -> Status.
This renames the LLDB error class to Status, as discussed
on the lldb-dev mailing list.

A change of this magnitude cannot easily be done without
find and replace, but that has potential to catch unwanted
occurrences of common strings such as "Error".  Every effort
was made to find all the obvious things such as the word "Error"
appearing in a string, etc, but it's possible there are still
some lingering occurences left around.  Hopefully nothing too
serious.

llvm-svn: 302872
2017-05-12 04:51:55 +00:00
Lang Hames 8b38565b2f Add DidStartExecuting/WillFinishExecuting methods to Expression.
These methods can be used by the derived expression types to perform expression
specific and/or language specific actions before and after the expression runs.
(ThreadPlanCallUserExpression is modified to call these methods on the
expression immediately before/after execution of the expression).

The immediate motivation is allowing Swift expressions to notify the swift
runtime that exclusivity enforcement should be suspended while the expression
runs (we want LLDB expressions to be able to access variables even when they're
considered exclusively owned by someone else in the original program).

Reviewed in https://reviews.llvm.org/D32889

llvm-svn: 302314
2017-05-05 22:42:13 +00:00
Jim Ingham 7fca8c0757 Provide a mechanism to do some pre-loading of symbols up front.
Loading a shared library can require a large amount of work; rather than do that serially for each library,
this patch will allow parallelization of the symbols and debug info name indexes.

From scott.smith@purestorage.com

https://reviews.llvm.org/D32598

llvm-svn: 301609
2017-04-28 00:51:06 +00:00
Jim Ingham bdbdd22937 Teach SBFrame how to guess its language.
<rdar://problem/31411646>

llvm-svn: 300012
2017-04-12 00:19:54 +00:00
Zachary Turner 2f3df6137a iwyu fixes for lldbCore.
This adjusts header file includes for headers and source files
in Core.  In doing so, one dependency cycle is eliminated
because all the includes from Core to that project were dead
includes anyway.  In places where some files in other projects
were only compiling due to a transitive include from another
header, fixups have been made so that those files also include
the header they need.  Tested on Windows and Linux, and plan
to address failures on OSX and FreeBSD after watching the
bots.

llvm-svn: 299714
2017-04-06 21:28:29 +00:00
Jim Ingham 99d1e28aef DisassembleRange can return an empty DisassemblerSP
check for it.

<rdar://problem/31379799>

llvm-svn: 299276
2017-03-31 22:39:55 +00:00
Tamas Berghammer 4c08fe2841 Add support for sythetic operator dereference
Summary:
After this change a sythetic child provider can generate a special child
named "$$dereference$$" what if present is used when "operator*" or
"operator->" used on a ValueObject. The goal of the change is to make
expressions like "up->foo" work inside the "frame variable" command.

Reviewers: labath, jingham

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D31368

llvm-svn: 299251
2017-03-31 20:23:22 +00:00
Zachary Turner 3eb2b44d31 Delete some more dead includes.
This breaks the cycle between Target and PluginLanguageC++, reducing
the overall cycle count from 43 to 42.

llvm-svn: 298561
2017-03-22 23:33:16 +00:00
Zachary Turner 5713a05b5b Move FileSpec from Host -> Utility.
llvm-svn: 298536
2017-03-22 18:40:07 +00:00
Zachary Turner 8d48cd6009 Resubmit "Delete the remainder of platform specific code in FileSpec."
This was causing a test failure in one of LLDB's tests which
specifically dealt with a limitation in LLVM's implementation
of home_directory() that LLDB's own implementation had worked
around.

This limitation has been addressed in r298513 on the LLVM side,
so the failing test (which is now unnecessary as the limitation
no longer exists) was removed in r298519, allowing this patch to
be re-submitted without modification.

llvm-svn: 298526
2017-03-22 17:33:23 +00:00
Pavel Labath ed00beba12 Revert "Delete the remainder of platform specific code in FileSpec."
This reverts commit r298465 as it breaks
TestLLVM.TestHomeDirectory.test_tilde_home_directory.

llvm-svn: 298509
2017-03-22 14:04:43 +00:00
Zachary Turner aaedf89101 Delete the remainder of platform specific code in FileSpec.
Differential Revision: https://reviews.llvm.org/D31129

llvm-svn: 298465
2017-03-22 00:27:24 +00:00
Pavel Labath e3ad2e2e73 Replace std::ofstream with llvm::raw_fd_ostream
Summary:
ofstream does not handle paths with non-ascii characters correctly on
windows, so I am switching these to llvm streams to fix that.

Reviewers: zturner, eugene

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D31079

llvm-svn: 298375
2017-03-21 13:49:50 +00:00
Zachary Turner 07db3f7e3f Resubmit r298334 after fixing OSX build errors.
Hopefully this works, I can't test since I don't have Mac
hardware, however.

llvm-svn: 298340
2017-03-21 05:47:57 +00:00
Jason Molenda 2eb3227f97 Revert r298334 until Zachary has a chance to fix the buildbot failure
on macosx.

llvm-svn: 298338
2017-03-21 04:45:10 +00:00
Zachary Turner bfe8bcbc43 Delete various lldb FileSystem functions.
Use LLVM's equivalent versions instead.

Differential Revision: https://reviews.llvm.org/D31111

llvm-svn: 298334
2017-03-21 04:01:04 +00:00
Zachary Turner 076a259938 Delete LLDB's MD5 code. Use LLVM instead.
Differential Revision: https://reviews.llvm.org/D31108

llvm-svn: 298325
2017-03-20 23:54:54 +00:00
Zachary Turner 6934e0aaa7 Remove FileSystem::Get/SetFilePermissions
Differential Revision: https://reviews.llvm.org/D31089

llvm-svn: 298205
2017-03-19 05:49:43 +00:00
Zachary Turner d3d95fd66a Remove FileSystem::MakeDirectory.
Have callers use llvm::sys::fs::create_directory() instead.

Differential Revision: https://reviews.llvm.org/D31086

llvm-svn: 298203
2017-03-19 05:48:47 +00:00
Zachary Turner d82067f83a Remove LLDB's recursive directory deletion function.
LLVM now has such a function, so we use that instead.

llvm-svn: 297360
2017-03-09 05:12:36 +00:00
Zachary Turner 7d86ee5ab0 Resubmit FileSystem changes.
This was originall reverted due to some test failures in
ModuleCache and TestCompDirSymlink.  These issues have all
been resolved and the code now passes all tests.

Differential Revision: https://reviews.llvm.org/D30698

llvm-svn: 297300
2017-03-08 17:56:08 +00:00
Eugene Zemtsov 7993cc5eed Make LLDB skip server-client roundtrip for signals that don't require any actions
If QPassSignals packaet is supported by lldb-server, lldb-client will
utilize it and ask the server to ignore signals that don't require stops
or notifications.
Such signals will be immediately re-injected into inferior to continue
normal execution.

Differential Revision: https://reviews.llvm.org/D30520

llvm-svn: 297231
2017-03-07 21:34:40 +00:00
Pavel Labath 30e6cbfcfc Revert "Use LLVM for all stat-related functionality."
this reverts r297116 because it breaks the unittests and
TestCompDirSymlink. The ModuleCache unit test is trivially fixable, but
the CompDirSymlink failure is a symptom of a deeper problem: llvm's stat
functionality is not a drop-in replacement for lldb's. The former is
based on stat(2) (which does symlink resolution), while the latter is
based on lstat(2) (which does not).

This also reverts subsequent build fixes (r297128, r297120, 297117) and
r297119 (Remove FileSpec dependency on FileSystem) which builds on top
of this.

llvm-svn: 297139
2017-03-07 13:19:15 +00:00
Zachary Turner 990e3cd8e2 Use LLVM for all stat-related functionality.
This deletes LLDB's FileType enumeration and replaces all
users, and all calls to functions that check whether a file
exists etc with corresponding calls to LLVM.

Differential Revision: https://reviews.llvm.org/D30624

llvm-svn: 297116
2017-03-07 03:43:17 +00:00
Zachary Turner fb1a0a0d2f Move many other files from Core -> Utility.
llvm-svn: 297043
2017-03-06 18:34:25 +00:00
Zachary Turner 777de77956 Truncate thread names if they're too long.
llvm-svn: 296972
2017-03-04 16:42:25 +00:00
Zachary Turner 666cc0b291 Move DataBuffer / DataExtractor and friends from Core -> Utility.
llvm-svn: 296943
2017-03-04 01:30:05 +00:00
Zachary Turner 6f9e690199 Move Log from Core -> Utility.
All references to Host and Core have been removed, so this
class can now safely be lowered into Utility.

Differential Revision: https://reviews.llvm.org/D30559

llvm-svn: 296909
2017-03-03 20:56:28 +00:00
Zachary Turner 3bc714b209 Fix various warnings. NFC
llvm-svn: 296717
2017-03-02 00:05:25 +00:00
Zachary Turner 8b3f2160d5 Fix incorrect logic in StackFrame::Disassemble.
This had broken as the result of some previous cleanup.

llvm-svn: 296495
2017-02-28 17:59:59 +00:00
Greg Clayton 98f9bcc1c9 Fixed errors in AllocatedBlock:
- Allow zero byte size request for memory and ensure it gets a unique address
- Exit the free block loop when we find an appropriate free block

<rdar://problem/30644888>

llvm-svn: 295907
2017-02-22 23:42:55 +00:00
Pavel Labath c4a3395103 Fix a couple of corner cases in NameMatches
Summary:
I originally set out to move the NameMatches closer to the relevant
function and add some unit tests. However, in the process I've found a
couple of bugs in the implementation:
- the early exits where not always correct:
  - (test==pattern) does not mean the match will always suceed because
    of regular expressions
  - pattern.empty() does not mean the match will fail because the "" is
    a valid prefix of any string

So I cleaned up those and added some tests. The only tricky part here
was that regcomp() implementation on darwin did not recognise the empty
string as a regular expression and returned an REG_EMPTY error instead.
The simples fix here seemed to be to replace the empty expression with
an equivalent non-empty one.

Reviewers: clayborg, zturner

Subscribers: mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D30094

llvm-svn: 295651
2017-02-20 11:35:33 +00:00
Boris Ulasevich 86aaa8a28d Bug 30863 - Step doesn't stop with conditional breakpoint on the next line
Differential Revisions:
  https://reviews.llvm.org/D26497 (committed r290168, temporary reverted r290197)
  https://reviews.llvm.org/D28945 (fix for Ubuntu tests fail)
  https://reviews.llvm.org/D29909 (fix for TestCallThatThrows test fail)

llvm-svn: 295168
2017-02-15 11:42:47 +00:00
Zachary Turner 01c3243fc1 Remove dependencies from Utility to Core and Target.
With this patch, the only dependency left is from Utility
to Host.  After this is broken, Utility will finally be
standalone.

Differential Revision: https://reviews.llvm.org/D29909

llvm-svn: 295088
2017-02-14 19:06:07 +00:00
Pavel Labath d02b1c83df Add a format_provider for the Timeout class
and use it in the appropriate log statements.

Formatting of chrono types in log messages was very clunky. This should
make it much nicer to use and give better output. For details of the
formatting options see the chrono formatter in llvm.

llvm-svn: 294738
2017-02-10 11:49:33 +00:00
Greg Clayton 29eeea00e1 Make sure we only load the OS plug-in once.
<rdar://problem/27580297> 

llvm-svn: 294611
2017-02-09 18:55:41 +00:00
Greg Clayton 21b4b2ea94 Fix build bots.
llvm-svn: 294603
2017-02-09 18:21:04 +00:00
Greg Clayton ac7c2ef580 Fixed an issue where AllocatedBlock::ReserveRange does a linear search through reserved ranges.
After many expressions are evaluated we were spending time looking for open blocks on memory in the one or more AllocatedBlock objects and it would slow down expression evaluation.

I implemented a fixed size blocks implementation that maintains a sorted free list to fix the issue.

<rdar://problem/17962974> 

llvm-svn: 294600
2017-02-09 17:56:55 +00:00
Kamil Rytarowski c5f28e2a05 Switch std::call_once to llvm::call_once
Summary:
The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms.

This change is required in the NetBSD LLDB port. std::call_once with libstdc++ results with crashing the debugger.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg, emaste, mehdi_amini, clayborg

Reviewed By: labath, clayborg

Subscribers: #lldb

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D29288

llvm-svn: 294202
2017-02-06 17:55:02 +00:00
Pavel Labath 3b7e1981b2 Remove LIBLLDB_LOG_VERBOSE category
Summary:
Per discussion in D28616, having two ways two request logging (log
enable lldb XXX verbose && log enable -v lldb XXX) is confusing. This
removes the first option and standardizes all code to use the second
one.

I've added a LLDB_LOGV macro as a shorthand for if(log &&
log->GetVerbose()) and switched most of the affected log statements to
use that (I've only left a couple of cases that were doing complex
computations in an if(log) block).

Reviewers: jingham, zturner

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D29510

llvm-svn: 294113
2017-02-05 00:44:54 +00:00
Pavel Labath 05d382c5f7 Fix incorrect logging in ThreadPlan::ShouldReportStop
it used printf with formatv style specifications. Also, switch to
LLDB_LOG.

llvm-svn: 294024
2017-02-03 18:50:45 +00:00
Zachary Turner bf9a77305f Move classes from Core -> Utility.
This moves the following classes from Core -> Utility.

ConstString
Error
RegularExpression
Stream
StreamString

The goal here is to get lldbUtility into a state where it has
no dependendencies except on itself and LLVM, so it can be the
starting point at which to start untangling LLDB's dependencies.
These are all low level and very widely used classes, and
previously lldbUtility had dependencies up to lldbCore in order
to use these classes.  So moving then down to lldbUtility makes
sense from both the short term and long term perspective in
solving this problem.

Differential Revision: https://reviews.llvm.org/D29427

llvm-svn: 293941
2017-02-02 21:39:50 +00:00
Zachary Turner df44988b87 Break some dependencies in lldbUtility.
Differential Revision: https://reviews.llvm.org/D29359

llvm-svn: 293806
2017-02-01 19:45:14 +00:00
Chris Bieneman 494f277af5 [CMake] Add accurate dependency specifications
Summary:
This patch adds accurate dependency specifications to the mail LLDB libraries and tools.

In all cases except lldb-server, these dependencies are added in addition to existing dependencies (making this low risk), and I performed some code cleanup along the way.

For lldb-server I've cleaned up the LLVM dependencies down to just the minimum actually required. This is more than lldb-server actually directly references, and I've left a todo in the code to clean that up.

Reviewers: labath, zturner

Subscribers: lldb-commits, danalbert, srhines, ki.stfu, mgorny, jgosnell

Differential Revision: https://reviews.llvm.org/D29333

llvm-svn: 293686
2017-01-31 20:43:05 +00:00