Commit Graph

273 Commits

Author SHA1 Message Date
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
Zachary Turner 573ab909d3 Move StringList from Core -> Utility.
llvm-svn: 298412
2017-03-21 18:25:04 +00:00
Pavel Labath bf37a037d0 BreakpointResolverFileLine: Restrict move-to-nearest-code from moving across function boundaries
Summary:
This fixes the case where a user tries to set a breakpoint on a source
line outside of any function (e.g. because that code is #ifdefed out, or
the compiler did not emit code for the function, etc.) and we would
silently move the breakpoint to the next function.

Now we check whether the line range of the resolved symbol context
function matches the original line number. We reject any breakpoint
locations that appear to move the breakpoint into a new function. This
filtering only happens if we have full debug info available (e.g. in
case of -gline-tables-only compilation, we still set the breakpoint on
the nearest source line).

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 297817
2017-03-15 09:53:10 +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
Chris Bieneman 752f73b680 [CMake] Adding API dependency on Utility
Utility is directly referenced from Breakpoint.

llvm-svn: 294987
2017-02-13 21:19:53 +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
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
Zachary Turner 827d5d74a5 Add methods to enable using formatv syntax in LLDB.
This adds formatv-backed formatting functions in various
places in LLDB such as StreamString, logging, constructing
error messages, etc.  A couple of callsites are changed
from Printf style syntax to formatv style syntax to
illustrate its usage.  Additionally, a FileSpec formatter
is introduced so that FileSpecs can be formatted natively.

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

llvm-svn: 289922
2016-12-16 04:27:00 +00:00
Zachary Turner d6a2475787 Re-add "demonstrate new Args API"
This fixes the build breakage due to the use of C++14.

llvm-svn: 287647
2016-11-22 17:10:15 +00:00
Omair Javaid 99a318e112 Fix build failure on Linux and BSD by reverting r287597
Linux and BSD builds failing after this changes from rev 287597.

llvm-svn: 287631
2016-11-22 09:47:00 +00:00
Zachary Turner 1c55c9b5bf Add the new Args / entry-access API.
The long-term goal here is to get rid of the functions
GetArgumentAtIndex() and GetQuoteCharAtIndex(), instead
replacing them with operator based access and range-based for
enumeration.  There are a lot of callsites, though, so the
changes will be done incrementally, starting with this one.

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

llvm-svn: 287597
2016-11-21 23:18:07 +00:00
Zachary Turner 22a2628f18 Make ValueObjectMemory::Create accept StringRefs.
llvm-svn: 286726
2016-11-12 18:17:36 +00:00
Zachary Turner c5d7df9035 Convert some Expression parser functions to StringRef.
llvm-svn: 286208
2016-11-08 04:52:16 +00:00
Malcolm Parsons 771ef6d4f1 Fix Clang-tidy readability-redundant-string-cstr warnings
Reviewers: zturner, labath

Subscribers: tberghammer, danalbert, lldb-commits
    
Differential Revision: https://reviews.llvm.org/D26233

llvm-svn: 285855
2016-11-02 20:34:10 +00:00
Jim Ingham 209a77d8d9 Fix a race condition between the "ephemeral watchpoint disabling" and commands the continue the process.
This closes https://reviews.llvm.org/D25875.

llvm-svn: 285114
2016-10-25 20:34:32 +00:00
Pavel Labath 2e8fe80447 Revert "Fix a race condition between "ephemeral watchpoint disable/enable" and continue in commands."
This reverts commit r284795, as it breaks watchpoint handling on arm (and
presumable all architectures that report watchpoint hits without executing the
tripping instruction).

There seems to be something fundamentally wrong with this patch: it uses
process_sp->AddPreResumeAction to re-enable the watchpoint, but the whole point
of the step-over-watchpoint logic (which AFAIK is the only user of this class) is
to disable the watchpoint *after* we resume to do the single step.

I have no idea how to fix this except by reverting the offending patch.

llvm-svn: 284817
2016-10-21 10:52:11 +00:00
Jim Ingham 94bd575c73 Fix a race condition between "ephemeral watchpoint disable/enable" and continue in commands.
Also, watchpoint commands, like breakpoint commands, need to run in async mode.

This was causing intermittent failures in TestWatchpointCommandPython.py, which is now solid.

llvm-svn: 284795
2016-10-21 00:06:38 +00:00
Zachary Turner 0d4f23c565 Fix some test failures due to the recent Breakpoint patch.
llvm-svn: 283358
2016-10-05 18:40:51 +00:00
Zachary Turner 0debabb3d0 Try to fix Android build.
Seems it doesn't like the implicit conversion from
StringRef[] to ArrayRef<StringRef>.

llvm-svn: 283351
2016-10-05 17:58:46 +00:00
Zachary Turner 401f55df93 Convert some breakpoint code to use StringRef.
Differential revision: https://reviews.llvm.org/D25158

llvm-svn: 283345
2016-10-05 17:07:47 +00:00
Jim Ingham f7e0725628 Fix serialization of Python breakpoint commands.
CommandData breakpoint commands didn't know whether they were
Python or Command line commands, so they couldn't serialize &
deserialize themselves properly.  Fix that.
I also changed the "breakpoint list" command to note in the output
when the commands are Python commands.  Fortunately only one test
was relying on this explicit bit of text output.

llvm-svn: 282432
2016-09-26 19:47:37 +00:00
Jim Ingham 3acdf38519 Add the ability to deserialize only breakpoints matching a given name.
Also tests for this and the ThreadSpec serialization.

llvm-svn: 282207
2016-09-22 22:20:28 +00:00
Jim Ingham 778ef39294 Serilize the thread options within the breakpoint options.
llvm-svn: 282205
2016-09-22 22:00:59 +00:00
Zachary Turner 95eae4235d Make lldb::Regex use StringRef.
This updates getters and setters to use StringRef instead of
const char *.  I tested the build on Linux, Windows, and OSX
and saw no build or test failures.  I cannot test any BSD
or Android variants, however I expect the required changes
to be minimal or non-existant.

llvm-svn: 282079
2016-09-21 16:01:28 +00:00
Jim Ingham ff9a91ea98 Adds tests for breakpoint names, and a FindBreakpointsByName.
Also if you set a breakpoint with an invalid name, we'll
refuse to set the breakpoint rather than silently ignoring
the name.

llvm-svn: 282043
2016-09-21 01:21:19 +00:00
Jim Ingham 92d1960e3b Add some more tests for breakpoint serialization.
Serialize breakpoint names & the hardware_requested attributes.
Also added a few missing affordances to SBBreakpoint whose absence
writing the tests pointed out.

<rdar://problem/12611863>

llvm-svn: 282036
2016-09-20 22:54:49 +00:00
Zachary Turner ecbb0bb169 Fix more functions in Args to use StringRef.
This patch also marks the const char* versions as =delete to prevent
their use.  This has the potential to cause build breakages on some
platforms which I can't compile.  I have tested on Windows, Linux,
and OSX.  Best practices for fixing broken callsites are outlined in
Args.h in a comment above the deleted function declarations.

Eventually we can remove these =delete declarations, but for now they
are important to make sure that all implicit conversions from
const char * are manually audited to make sure that they do not invoke a
conversion from nullptr.

llvm-svn: 281919
2016-09-19 17:54:06 +00:00
Zachary Turner 0ab39359de Fix boolean logic error in BreakpointID.
llvm-svn: 281804
2016-09-17 02:34:40 +00:00
Zachary Turner 6fa7681bb6 Convert many functions to use StringRefs.
Where possible, remove the const char* version.  To keep the
risk and impact here minimal, I've only done the simplest
functions.

In the process, I found a few opportunities for adding some
unit tests, so I added those as well.

Tested on Windows, Linux, and OSX.

llvm-svn: 281799
2016-09-17 02:00:02 +00:00
Jim Ingham 6d1e4696a2 First tests for serializing breakpoints.
Plus a few bug fixes I found along the way.

llvm-svn: 281690
2016-09-16 01:41:27 +00:00
Jim Ingham 75f0f5830b Make the keys enumerations for options and resolvers enum classes.
This keeps them from conflicting with other symbols names, so it's
worth their being less convenient to use for indexing.

llvm-svn: 281569
2016-09-15 01:47:22 +00:00
Jim Ingham db30877477 Fix some const-ness issues with BreakpointID & BreakpointIDList.
llvm-svn: 281519
2016-09-14 19:05:27 +00:00
Zachary Turner 4e4fbe8211 Some more pointer safety in Breakpoint.
Plumb unique_ptrs<> all the way through the baton interface.
NFC, this is a minor improvement to remove the possibility of an
accidental pointer ownership issue.

Reviewed By: jingham
Differential Revision: https://reviews.llvm.org/D24495

llvm-svn: 281360
2016-09-13 17:53:38 +00:00
Jim Ingham 1a81b27378 Add a few const's (thanks Zachary) and return shared or unique pointers
in places where they help prevent leaks.

llvm-svn: 281288
2016-09-13 01:58:08 +00:00
Jim Ingham e14dc26857 This is the main part of a change to add breakpoint save and restore to lldb.
Still to come:
1) SB API's
2) Testcases
3) Loose ends:
   a) serialize Thread options
   b) serialize Exception resolvers
4) "break list --file" should list breakpoints contained in a file and
   "break read -f 1 3 5" should then read in only those breakpoints.

<rdar://problem/12611863>

llvm-svn: 281273
2016-09-12 23:10:56 +00:00
Kate Stone b9c1b51e45 *** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style.  This kind of mass change has
*** two obvious implications:

Firstly, merging this particular commit into a downstream fork may be a huge
effort.  Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit.  The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):

    find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
    find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;

The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.

Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit.  There are alternatives available that will attempt
to look through this change and find the appropriate prior commit.  YMMV.

llvm-svn: 280751
2016-09-06 20:57:50 +00:00
Jim Ingham 298de8f6a3 Errors compiling breakpoint conditions will cause the breakpoint not to be hit
This was a shadowed variable error from the big Expression Parser plugin-ification.  I also 
added a test case for this.

<rdar://problem/27682376>

llvm-svn: 277662
2016-08-03 22:46:11 +00:00
Greg Clayton 6234a5c863 Centralize the way symbol and functions are looked up by making a Module::LookupInfo class that does all of the heavy lifting.
Background: symbols and functions can be looked up by full mangled name and by basename. SymbolFile and ObjectFile are expected to be able to do the lookups based on full mangled name or by basename, so when the user types something that is incomplete, we must be able to look it up efficiently. For example the user types "a:🅱️:c" as a symbol to set a breakpoint on, we will break this down into a 'lookup "c"' and then weed out N matches down to just the ones that match "a:🅱️:c". Previously this was done manaully in many functions by calling Module::PrepareForFunctionNameLookup(...) and then doing the lookup and manually pruning the results down afterward with duplicated code. Now all places use Module::LookupInfo to do the work in one place.

This allowed me to fix the name lookups to look for "func" with eFunctionNameTypeFull as the "name_type_mask", and correctly weed the results:

"func", "func()", "func(int)", "a::func()", "b::func()", and "a:🅱️:func()" down to just "func", "func()", "func(int)". Previously we would have set 6 breakpoints, now we correctly set just 3. This also extends to the expression parser when it looks up names for functions it needs to not get multiple results so we can call the correct function.

<rdar://problem/24599697> 

llvm-svn: 275281
2016-07-13 17:12:24 +00:00
Jim Ingham 1cf8f5937a Lock the access to the BreakpointLocationCollection.
I was investigating an odd crash in lldb when the breakpoint site
goes to bump the hit counts of the locations it implements.  I noticed
that the BreakpointLocationCollection wasn't locking itself for access and
modification.  I don't see how that can cause the crash I'm seeing, but still
this is the right thing to do...

<rdar://problem/25178205>

llvm-svn: 270939
2016-05-26 23:55:04 +00:00
Saleem Abdulrasool bb19a13c0b second pass over removal of Mutex and Condition
llvm-svn: 270024
2016-05-19 05:13:57 +00:00
Saleem Abdulrasool 16ff860469 remove use of Mutex in favour of std::{,recursive_}mutex
This is a pretty straightforward first pass over removing a number of uses of
Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there
are interfaces which take Mutex::Locker & to lock internal locks. This patch
cleans up most of the easy cases. The only non-trivial change is in
CommandObjectTarget.cpp where a Mutex::Locker was split into two.

llvm-svn: 269877
2016-05-18 01:59:10 +00:00
Ted Woodward 911d57840a Keep original source path and mapped path in LineEntry
Summary:
The "file" variable in a LineEntry was mapped using target.source-map, except when stepping through inlined code. This patch adds a new variable to LineEntry, "original_file", that contains the original file from the debug info. "file" will continue to (possibly) be mapped.

Some code has been changed to use "original_file". This is code dealing with symbols. Code dealing with source files will still use "file". Reviewers, please confirm that these particular changes are correct.

Tests run on Ubuntu 12.04 show no regression.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 269250
2016-05-11 22:46:53 +00:00
Jim Ingham 76bb8d6719 Add the ability to limit "source regexp" breakpoints to a particular function
within a source file.

This isn't done, I need to make the name match smarter (right now it requires an
exact match which is annoying for methods of a class in a namespace.

Also, though we use it in tests all over the place, it doesn't look like we have
a test for Source Regexp breakpoints by themselves, I'll add that in a follow-on patch.

llvm-svn: 267834
2016-04-28 01:40:57 +00:00
Jim Ingham ff7ac6a7b9 Breakpoint conditions were making result variables, which they should not do.
The result variables aren't useful, and if you have a breakpoint on a
common function you can generate a lot of these.  So I changed the
code that checks the condition to set ResultVariableIsInternal in the
EvaluateExpressionOptions that we pass to the execution.
Unfortunately, the check for this variable was done in the wrong place
(the static UserExpression::Evaluate) which is not how breakpoint
conditions execute expressions (UserExpression::Execute).  So I moved
the check to UserExpression::Execute (which Evaluate also calls) and made the
overridden method DoExecute.

llvm-svn: 266093
2016-04-12 17:17:35 +00:00
Sean Callanan 579e70c9b0 Add a DiagnosticManager replace error streams in the expression parser.
We want to do a better job presenting errors that occur when evaluating
expressions. Key to this effort is getting away from a model where all
errors are spat out onto a stream where the client has to take or leave
all of them.

To this end, this patch adds a new class, DiagnosticManager, which
contains errors produced by the compiler or by LLDB as an expression
is created. The DiagnosticManager can dump itself to a log as well as
to a string. Clients will (in the future) be able to filter out the
errors they're interested in by ID or present subsets of these errors
to the user.

This patch is not intended to change the *users* of errors - only to
thread DiagnosticManagers to all the places where streams are used. I
also attempt to standardize our use of errors a bit, removing trailing
newlines and making clients omit 'error:', 'warning:' etc. and instead
pass the Severity flag.

The patch is testsuite-neutral, with modifications to one part of the
MI tests because it relied on "error: error:" being erroneously
printed. This patch fixes the MI variable handling and the testcase.

<rdar://problem/22864976>

llvm-svn: 263859
2016-03-19 00:03:59 +00:00
Jim Ingham 2411167fb5 Add an "offset" option to "break set -n" and "break set -f -l".
That way you can set offset breakpoints that will move as the function they are 
contained in moves (which address breakpoints can't do...)

I don't align the new address to instruction boundaries yet, so you have to get
this right yourself for now.

<rdar://problem/13365575>

llvm-svn: 263049
2016-03-09 18:59:13 +00:00
Eugene Zelenko c33088f41e Remove autoconf support from source directories.
Differential revision: http://reviews.llvm.org/D16662

llvm-svn: 259098
2016-01-28 22:05:24 +00:00
Jim Ingham a202357197 Make the Language print the description of the Exception Breakpoint resolver. Also
have the breakpoint description print the precondition description if one exists.
No behavior change.

<rdar://problem/22885189>

llvm-svn: 255972
2015-12-18 02:14:04 +00:00
Dawn Perchik bfd96183ef Rework breakpoint language filtering to use the symbol context's language.
This patch reworks the breakpoint filter-by-language patch to use the
symbol context instead of trying to guess the language solely from the
symbol's name. This has the advantage that symbols compiled with debug
info will have their actual language known. Symbols without debug info
will still do the same "guess"ing because Symbol::GetLanguage() is
implemented using Mangled::GuessLanguage(). The recognition of ObjC
names was merged into Mangled::GuessLanguage.

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

llvm-svn: 255808
2015-12-16 19:40:00 +00:00
Ted Woodward 65a47b31b3 Fix watchpoint check to use watchpoint ranges
Summary: Watchpoints, unlike breakpoints, have an address range. This patch changes WatchpointList::FindByAddress() to match on any address in the watchpoint range, instead of only matching on the watchpoint's base address.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 254931
2015-12-07 19:38:58 +00:00