Commit Graph

15107 Commits

Author SHA1 Message Date
Ilia K a3174853b7 Fix parsing expressions to evaluate with spaces and optional args (MI)
Summary:
When extracting options for long options (starting with `--`), the use of
`MIUtilString::SplitConsiderQuotes` to split all the arguments was being
conditioned on the option type to be expected. This was wrong as this caused
other options to be parsed incorrectly since it was not taking into account the
presence of quotes.

Patch by Ed Munoz <edmunoz@microsoft.com>

Reviewers: edmunoz, ki.stfu

Subscribers: ki.stfu, lldb-commits

Projects: #lldb

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

llvm-svn: 282135
2016-09-22 05:08:41 +00:00
Todd Fiala 150aa321f7 fix Args function broken in r281942
The method was hard-coded to check only the 0th element of the array.
This manifested as NSLog messages behaving incorrectly on macOS.
(This is independent of the broken DarwinLog feature).

llvm-svn: 282128
2016-09-22 00:59:23 +00:00
Ed Maste 2ce823d0d8 Fix typo in lldb --help
Patch by Yacine Belkadi

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

llvm-svn: 282123
2016-09-21 23:30:36 +00:00
Ed Maste 0509203952 Fix for loop sign fix in r282112 for column = 0
llvm-svn: 282119
2016-09-21 22:36:51 +00:00
Zachary Turner 4037780485 Fix an incorrect nullptr conversion.
llvm-svn: 282117
2016-09-21 22:33:30 +00:00
Ed Maste ac77fe3b55 Fix integer sign warning from r282105
llvm-svn: 282112
2016-09-21 21:14:31 +00:00
Ed Maste 228e4abb63 Fix -Wcovered-switch-default warning in StackFrame.cpp
The switch coveres all possible values. If a new one is added in the
future the compiler will start warning, providing a notification that
the switch needs updating.

llvm-svn: 282111
2016-09-21 21:08:30 +00:00
Chris Bieneman d3199f5ed2 [CMake] Initial support for LLDB.framework
Summary:
This patch adds a CMake option LLDB_BUILD_FRAMEWORK, which builds libLLDB as a macOS framework instead of as a *nix shared library.

With this patch any LLDB executable that has the INCLUDE_IN_FRAMEWORK option set will be built into the Framework's resources directory, and a symlink to the exeuctable will be placed under the build directory's bin folder. Creating the symlinks allows users to run commands from the build directory without altering the workflow.

The framework generated by this patch passes the LLDB test suite, but has not been tested beyond that. It is not expected to be fully ready to ship, but it is a first step.

With this patch binaries that are placed inside the framework aren't being properly installed. Fixing that would increase the patch size significantly, so I'd like to do that in a follow-up.

Reviewers: zturner, tfiala

Subscribers: beanz, lldb-commits, mgorny

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

llvm-svn: 282110
2016-09-21 21:02:16 +00:00
Todd Fiala 9666ba7526 add stop column highlighting support
This change introduces optional marking of the column within a source
line where a thread is stopped.  This marking will show up when the
source code for a thread stop is displayed, when the debug info
knows the column information, and if the optional column marking is
enabled.

There are two separate methods for handling the marking of the stop
column:

* via ANSI terminal codes, which are added inline to the source line
  display.  The default ANSI mark-up is to underline the column.

* via a pure text-based caret that is added in the appropriate column
  in a newly-inserted blank line underneath the source line in
  question.

There are some new options that control how this all works.

* settings set stop-show-column

  This takes one of 4 values:

  * ansi-or-caret: use the ANSI terminal code mechanism if LLDB
    is running with color enabled; if not, use the caret-based,
    pure text method (see the "caret" mode below).

  * ansi: only use the ANSI terminal code mechanism to highlight
    the stop line.  If LLDB is running with color disabled, no
    stop column marking will occur.

  * caret: only use the pure text caret method, which introduces
    a newly-inserted line underneath the current line, where
    the only character in the new line is a caret that highlights
    the stop column in question.

  * none: no stop column marking will be attempted.

* settings set stop-show-column-ansi-prefix

  This is a text format that indicates the ANSI formatting
  code to insert into the stream immediately preceding the
  column where the stop column character will be marked up.
  It defaults to ${ansi.underline}; however, it can contain
  any valid LLDB format codes, e.g.

      ${ansi.fg.red}${ansi.bold}${ansi.underline}

* settings set stop-show-column-ansi-suffix

  This is the text format that specifies the ANSI terminal
  codes to end the markup that was started with the prefix
  described above.  It defaults to: ${ansi.normal}.  This
  should be sufficient for the common cases.

Significant leg-work was done by Adrian Prantl.  (Thanks, Adrian!)

differential review: https://reviews.llvm.org/D20835

reviewers: clayborg, jingham
llvm-svn: 282105
2016-09-21 20:13:14 +00:00
Jim Ingham 1ac2f2c4d3 Probably should add the breakpoint names test directory as well...
llvm-svn: 282103
2016-09-21 19:21:38 +00:00
Zachary Turner 2552acd945 Fix failing regex tests.
r282079 converted the regular expression interface to accept
and return StringRefs instead of char pointers.  In one case
a null pointer check was converted to an empty string check,
but this was an incorrect conversion because an empty string
is a valid regular expression.  Removing this check should
fix the test failures.

llvm-svn: 282090
2016-09-21 17:13:51 +00:00
Zachary Turner 9a4e30117f Fix an inefficient StringRef conversion.
Since the original object was already an llvm::SmallString<>
there's no point calling c_str() first.

llvm-svn: 282080
2016-09-21 16:01:43 +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
Valentina Giusti 58db5bb20e Refactor NativeRegisterContextLinux_x86_64 code.
This patch refactors the way the XState type is checked and, in order to
simplify the code, it removes the usage of the 'cpuid' instruction: just checking
if the ptrace calls done throuhg ReadFPR is enough to verify both if there is
HW support and if there is kernel support. Also the XCR0 bits are enough to check if
there is both HW and kernel support for AVX and MPX.

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

llvm-svn: 282072
2016-09-21 13:33:01 +00:00
Luke Drummond 451dd080ed Remove an invalid doxygen `@return` docstring on a void function
`ClangASTSource::FindExternalVisibleDecls` has void return type, so the
previous docstring was misleading.

llvm-svn: 282066
2016-09-21 11:12:50 +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
Eugene Zelenko 3eb83b4a0d Fix Clang initialization and Clang-tidy modernize-use-nullptr warnings in source/Plugins/Process/Utility.
Differential revision: https://reviews.llvm.org/D24694

llvm-svn: 282041
2016-09-21 00:59:22 +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
Kamil Rytarowski d4487347e3 Unbreak the NetBSD build after recent changes
Similar to r281922 "Try to fix freebsd and android builds."

Replace .AppendArgument(cstr) with .AppendArgument(llvm::StringRef(cstr))

llvm-svn: 282032
2016-09-20 22:26:29 +00:00
Zachary Turner 4c5506a64d Enable clang attributes when using clang-cl.
llvm-svn: 282029
2016-09-20 22:15:07 +00:00
Zachary Turner fb3b3bd111 [PECOFF] Use the COFF subsystem field when determining the Triple.
Patch by walter erquinigo
Differential revision: https://reviews.llvm.org/D24284

llvm-svn: 282013
2016-09-20 20:44:50 +00:00
Enrico Granata 9800539f19 Make it so that one can register prefix matches as well as identical matches as extra cases for NSDictionary data formatting
llvm-svn: 281993
2016-09-20 18:26:30 +00:00
Sean Callanan 1355f4735d Fixed the build by changing a couple of const char *s to StringRefs.
llvm-svn: 281943
2016-09-19 22:06:12 +00:00
Zachary Turner 5c725f3a06 Convert 3 more functions to use a StringRef.
This converts Args::Unshift, Args::AddOrReplaceEnvironmentVariable,
and Args::ContainsEnvironmentVariable to use StringRefs.  The code
is also simplified somewhat as a result.

llvm-svn: 281942
2016-09-19 21:56:59 +00:00
Zachary Turner 552d012b7e Fix compilation of unit tests.
llvm-svn: 281926
2016-09-19 18:32:23 +00:00
Zachary Turner 92b146e5fa Try to fix freebsd and android builds.
llvm-svn: 281922
2016-09-19 18:03:54 +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
Todd Fiala ba8a82dbe4 Xcode: support gtests that use the Inputs dir
This change adds support for the gtests that require input data
in the Inputs files.  This is done through a new Xcode script
phase that runs the scripts/Xcode/prepare-gtest-run-dir.sh script.
That script simply copies the contents of all unittests/**/Inputs
dirs into ${TARGET_BUILD_DIR}/Inputs before running the test.

This change also renames the Xcode 'gtest-for-debugging' to
'gtest-build', and makes the gtest "build and run" target
depend on gtest-build.  This reduces replication within the
targets.  gtest .c/.cpp files now should only be added to
the gtest-build target.

llvm-svn: 281913
2016-09-19 16:42:41 +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
Greg Clayton 8e0d63112b Fix compiler warnings where two values weren't being initialized.
llvm-svn: 281770
2016-09-16 20:10:02 +00:00
Zachary Turner e04c274e35 Set the correct triple when creating an ArchSpec for Windows.
Patch by Walter Erquinigo
Differential Revision: https://reviews.llvm.org/D24283

llvm-svn: 281765
2016-09-16 19:09:19 +00:00
Zachary Turner 7b2e5a36e4 Add unit tests for a few string conversion functions in Args.
Also provided a StringRef overload for these functions and have
the const char* overloads delegate to the StringRef overload.

llvm-svn: 281764
2016-09-16 19:09:12 +00:00
Luke Drummond 7f193d6903 [RenderScript] Support tracking and dumping reduction kernels
Initial implementation of support for tracking
[RenderScript Reductions](https://developer.android.com/guide/topics/renderscript/compute.html#reduction-in-depth)

With this patch, `language renderscript module dump` properly lists reductions
that are part of loaded RenderScript modules as well the the consituent
functions and their roles, within the reduction.

This support required new tracking mechanisms for the `#pragma(reduce)`
mechanism, and extension of `RSModuleDescriptor::ParseRSInfo` to support
the metadata output by `bcc`. This work was also an opportunity to
refactor/improve parse code:

- `RSModuleDescriptor::ParseExportReduceCount` now has a complete
  implementation and the debugger can correctly track reductions on
  receipt of a module hook.
- `RSModuleDescriptor::Dump` now dumps Reductions as well as `ForEach`
  kernels. Also, fixed indentation of the output, and made indentation
  groupings in the source clearer.
- `RSModuleDescriptor::ParseRSInfo` now returns true if the `".rs.info"`
  packet has nonzero linecount, rather than rejecting RenderScripts that
  don't contain kernels (an unlikely situation, but possibly valid). This
  was changed because scripts that only contained reductions were not
  being tracked in `RenderScriptRuntime::LoadModule`.
- Refactor `RSModuleInfo::ParseRSInfo` and add reduction spec parser stub
 - Prepared ParseRSInfo to more easily be able to add new parser types
 - Use llvm::StringRef and llvm::StringMap helpers to make the parsing code cleaner
 - factor out forEachCount, globalVarCount, and pragmaCount parsing block to their own methods
 - Add ExportReduceCount Parser
 - Use `llvm::StringRef` in `RSKernelDescriptor` constructor
 - removed now superfluous `MAXLINE` macros as we've switched from `const
   char *` to `llvm::StringRef`

llvm-svn: 281717
2016-09-16 11:28:12 +00:00
Todd Fiala d15aa24a7e add availability check to DarwinLog event tests
The pexpect-based tests properly checked for the stub reporting
DarwinLog support.  The event-based ones did not.  This is fixed
here.  Swift CI bots are not currently building debugserver on
macOS, so they don't have the DarwinLog support even when they
pass the macOS 10.12 check.

llvm-svn: 281696
2016-09-16 03:07:14 +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
Zachary Turner aa9f1c59d2 Allow ArchSpec to take a StringRef.
llvm-svn: 281662
2016-09-15 21:32:57 +00:00
Zachary Turner e13ffee009 [cmake] Don't depend on lldb-server unless it's built.
llvm-svn: 281661
2016-09-15 21:32:51 +00:00
Chris Bieneman 3045d703f6 Fixing bot failures
Need to only add debugserver as a test dependency on Darwin.

llvm-svn: 281652
2016-09-15 20:23:31 +00:00
Chris Bieneman 4851558f55 [LIT] First pass of LLDB LIT support
Summary:
This patch supplies basic infrastructure for LLDB to use LIT, and ports a few basic test cases from the LLDB test suite into LIT.

With this patch the LLDB lit system is not capable or intended to fully replace the existing LLDB test suite, but this first patch enables people to write lit tests for LLDB.

The lit substitution for %cc and %cxx default to the host compiler unless the CMake option LLDB_TEST_CLANG is On, in which case the in-tree clang will be used.

The target check-lldb-lit will run all lit tests including the lit-based executor for the unit tests. Alternatively there is a target generated for each subdirectory under the lit directory, so check-lldb-unit and check-lldb-expr will run just the tests under their respective directories.

The ported tests are not removed from the existing suite, and should not be until such a time when the lit runner is mature and in use by bots and workflows.

Reviewers: zturner, labath, jingham, tfiala

Subscribers: beanz, mgorny, lldb-commits

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

llvm-svn: 281651
2016-09-15 20:13:55 +00:00
Zachary Turner f6607454d4 Convert ArchSpec::ParseMachOCPUDashSubtypeTriple to use StringRef.
This makes the code easier to grok, and since this is a very low
level function it also is very helpful to have this take a StringRef
since it means anyone higher up the chain who has a StringRef would
have to first convert it to a null-terminated string.  This way it
can work equally well with StringRefs or const char*'s, which will
enable the conversion of higher up functions to StringRef.

Tested on Windows, Linux, and OSX and saw no regressions.

llvm-svn: 281642
2016-09-15 18:41:48 +00:00
Todd Fiala ab7ccf0ecb added LLDB_PYTHON_TESTSUITE_ARCH Xcode variable
This Xcode build variable defaults to x86_64.  It can be set to i386
to cause the lldb-python-test-suite target run the tests in the
specified architecture.

This flag is being added for the zorg build script so that Green Dragon
can run the test suite against both x86_64 and i386 macOS targets.

llvm-svn: 281639
2016-09-15 18:28:03 +00:00
Dimitar Vlahovski 6d78a1a417 Reformat x86_64 register infos defines table
Fix the table format of the register defines after clang-format.
Added guards to prevent future reformatting again from clang-format.

llvm-svn: 281606
2016-09-15 12:58:27 +00:00
Tamas Berghammer b293fc783b Fix TestSymbolContextTwoFiles on Android after rL281595
llvm-svn: 281601
2016-09-15 10:49:55 +00:00
Tamas Berghammer 2540a553e5 Add support for DW_AT_ranges_base attribute
It is a new attribute emitted by clang as a GNU extension and will
be part of Dwarf5. The purpose of the attribute is to specify a compile
unit level base value for all DW_AT_ranges to reduce the number of
relocations have to be done by the linker.

Fixes (at least partially): https://llvm.org/pr28826

Differential revision: https://reviews.llvm.org/D24514

llvm-svn: 281595
2016-09-15 08:53:33 +00:00
Tamas Berghammer 2cc4e3e04e Try to fix windows build after rL281569
llvm-svn: 281594
2016-09-15 08:47:59 +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
Sean Callanan 561a9bbffc More cleanup in `frame diagnose,` eliminating a bunch of messy cases.
llvm-svn: 281545
2016-09-14 21:54:28 +00:00
Sean Callanan aa4b44c662 Replaced two instances of std::function with auto.
Thanks to Zachary Turner for the suggestion.  It's distasteful that the actual
type of the lambda can't be spelled out, but it should be evident from the
definition of the lambda body.

llvm-svn: 281536
2016-09-14 20:58:31 +00:00
Sean Callanan 0ac172d8ed Cleaned up a little bit of redundant code in 'frame diagnose.`
llvm-svn: 281534
2016-09-14 20:29:57 +00:00