Commit Graph

838 Commits

Author SHA1 Message Date
Kamil Rytarowski 4791532830 Install six.py conditionally
Summary:
The current version of LLDB installs six.py into global python library directory. This approach produces conflicts downstream with distribution's py-six copy.

Introduce new configure option LLDB_USE_SYSTEM_SIX (disabled by default). Once specified as TRUE, six.py won't be installed to Python's directory.

Add new option in finishSwigWrapperClasses.py, namely --useSystemSix.

Sponsored by <The NetBSD Foundation>

Reviewers: mgorny, emaste, clayborg, joerg, labath

Reviewed By: labath

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 294071
2017-02-04 00:20:24 +00:00
Jason Molenda 753e13c0eb Add logging to SBThread::GetInfoItemByPathAsString to
print the path being requested.

Change the GetInfoItemByPathAsString docuemtnation in 
the .i file to use docstring instead of autodoc so
the function signature is included in the python
help.
<rdar://problem/29999567> 

llvm-svn: 293858
2017-02-02 03:02:51 +00:00
Zachary Turner 5a4167fbd3 Install lldb Python module on Windows.
Patch by Vadim Chugunov
Differential Revision: https://reviews.llvm.org/D27476

llvm-svn: 291291
2017-01-06 22:05:35 +00:00
Sylvestre Ledru 521d7b45ba Fix the cmake declaration syntax
llvm-svn: 290045
2016-12-17 13:04:35 +00:00
Sylvestre Ledru 47b071deff Support of lldb on Kfreebsd
Summary: Patch by Pino Toscano. Reported in http://bugs.debian.org/835665

Reviewers: tfiala, emaste

Subscribers: beanz, mgorny, emaste, krytarowski, brucem, tberghammer, danalbert, srhines, #lldb

Tags: #lldb

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

llvm-svn: 290044
2016-12-17 12:48:06 +00:00
Luke Drummond c3d0165c49 Fix broken escaping of commands in the build
A combination of broken escaping in CMake and in the python swig
generation scripts meant that the swig generation step would fail
whenever there were spaces or special characters in parameters passed to
swig.

The fix for this in CMakeLists is to use the VERBATIM option on all
COMMAND-based custom builders relying on CMake to properly escape each
argument in the generated file.

Within the python swig scripts, the fix is to call subprocess.Popen with
a list of raw argument strings rather than ones that are incorrectly
manually escaped, then passed to a shell subprocess via
subprocess.Popen(' '.join(params)). This also prevents nasty things
happening such as accidental command-injection.

This allows us to have the swig / python executables in paths containing
special chars and spaces, (or on shared storage on Win32, e.g
\\some\path or C:\Program Files\swig\swig.exe).

Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D26757

llvm-svn: 289956
2016-12-16 16:38:25 +00:00
Sean Callanan 237c3ed95e Adopt PrettyStackTrace in LLDB
LLDB needs some minor changes to adopt PrettyStackTrace after https://reviews.llvm.org/D27683.
We remove our own SetCrashDescription() function and use LLVM-provided RAII objects instead.
We also make sure LLDB doesn't define __crashtracer_info__ which would collide with LLVM's definition.

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

llvm-svn: 289711
2016-12-14 21:31:31 +00:00
Pavel Labath 7a6252158e Clean up some use of __ANDROID_NDK__ in the cmake files
Rationale:
scripts/Python/modules: android is excluded at a higher level, so no point in
  checking here
tools/lldb-mi: lldb-mi builds fine (with some cosmetic tweaks) on android, and
  there is no reason it shouldn't.
tools/lldb-server: LLDB_DISABLE_LIBEDIT/CURSES already take the platform into
  account, so there is no point in checking again.

I am reasonably confident this should not break the build on any platform, but
I'll keep an eye out on the bots.

llvm-svn: 288661
2016-12-05 11:15:36 +00:00
Jim Ingham 6a9767c7e6 Clean up the stop printing header lines.
I added a "thread-stop-format" to distinguish between the form
that is just the thread info (since the stop printing immediately prints
the frame info) and one with more frame 0 info - which is useful for
"thread list" and the like.

I also added a frame.no-debug boolean to the format entities so you can
print frame information differently between frames with source info and those
without.

This closes https://reviews.llvm.org/D26383.
<rdar://problem/28273697>

llvm-svn: 286288
2016-11-08 20:36:40 +00:00
Chris Bieneman 91967bd301 [CMake] Rename lldb-launcher to darwin-debug
Summary: This tool is only built on Darwin, and the name darwin-debug matches the Xcode project. We should have this in sync unless there is a good reason not to.

Reviewers: zturner, tfiala, labath

Subscribers: labath, mgorny, lldb-commits

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

llvm-svn: 285356
2016-10-27 22:51:41 +00:00
Vadim Macagon bdff2dc8d7 Fix Python binding generation build step on Windows
Summary:
If Python is installed to a location that contains spaces
(e.g. "C:\Program Files\Python3") then the build fails while attempting
to run the modify-python-lldb.py script because the path to the Python
executable is not double-quoted before being passed to the shell. The
fix consists of letting Python handle the formatting of the command
line, since subprocess.Popen() is perfectly capable of handling paths
containing spaces if it's given the command and arguments as a list
instead of a single pre-formatted string.

Reviewers: zturner, clayborg

Subscribers: lldb-commits

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

llvm-svn: 284100
2016-10-13 04:07:22 +00:00
Enrico Granata f8802502f2 Add an accessor to get the value of RC_PLATFORM_NAME at build time
llvm-svn: 282310
2016-09-23 22:30:08 +00:00
Jim Ingham 2d3628e1f0 Add the ability to append breakpoints to the save file.
llvm-svn: 282212
2016-09-22 23:42:42 +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
Enrico Granata 5edef42e7f Actually, do it this way because I will want to know if I am in a host build elsewhere too
llvm-svn: 282179
2016-09-22 17:59:58 +00:00
Enrico Granata 9a4a6b260f The host version of lldb always builds for macosx
llvm-svn: 282178
2016-09-22 17:47:33 +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 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
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
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 01f1666471 Add SB API's for writing breakpoints to & creating the from a file.
Moved the guts of the code from CommandObjectBreakpoint to Target (should
have done it that way in the first place.)  Added an SBBreakpointList class
so there's a way to specify which breakpoints to serialize and to report the
deserialized breakpoints.

<rdar://problem/12611863> 

llvm-svn: 281520
2016-09-14 19:07:35 +00:00
Abhishek Aggarwal 3c7f070956 LLDB: API for iPermission of object file's sections
Summary:
 - Added an API to public interface that provides permissions (RWX) of
   individual sections of an object file
   
 - Earlier, there was no way to find out this information through SB
   APIs
    
 - A possible use case of this API is:
   when a user wants to know the sections that have executable machine
   instructions and want to write a tool on top of LLDB based on this
   information

 - Differential Revision: https://reviews.llvm.org/D24251

llvm-svn: 280924
2016-09-08 12:22: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
Pavel Labath 93b5b660e8 Fixup TestPyObjSynthProvider.py and enable it again
Summary:
- copies the new file in the cmake build
- adds an additional import statement
- marks the test as no-debug-info specific, as it seems to be testing a python feature

Reviewers: granata.enrico

Subscribers: lldb-commits

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

llvm-svn: 280261
2016-08-31 17:38:17 +00:00
Enrico Granata 42ff957e25 Add an helper class lldb.formatters.synth.PythonObjectSyntheticChildProvider
This class enables one to easily write a synthetic child provider by writing a class that returns pairs of names and primitive Python values - the base class then converts those into LLDB SBValues

Comes with a test case

llvm-svn: 280172
2016-08-30 23:00:02 +00:00
Enrico Granata 639392fe76 Add SBType::GetArrayType() such that - given a type - one can make an array (of a given size) of that type
This is currently only implemented for the clang-based TypeSystem, but other languages are welcome to jump in!

llvm-svn: 280151
2016-08-30 20:39:58 +00:00
Todd Fiala 759300192a Add StructuredData plugin type; showcase with new DarwinLog feature
Take 2, with missing cmake line fixed.  Build tested on
Ubuntu 14.04 with clang-3.6.

See docs/structured_data/StructuredDataPlugins.md for details.

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

reviewers: clayborg, jingham
llvm-svn: 279202
2016-08-19 04:21:48 +00:00
Todd Fiala a07e4a8352 Revert "Add StructuredData plugin type; showcase with new DarwinLog feature"
This reverts commit 1d885845d1451e7b232f53fba2e36be67aadabd8.

llvm-svn: 279200
2016-08-19 03:03:58 +00:00
Todd Fiala aef7de8492 Add StructuredData plugin type; showcase with new DarwinLog feature
See docs/structured_data/StructuredDataPlugins.md for details.

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

reviewers: clayborg, jingham
llvm-svn: 279198
2016-08-19 02:52:07 +00:00
Todd Fiala af32ccb195 fix lldb-gtest target of Xcode build
Change r278527 was filtering out too many libraries.
The Xcode lldb-gtest target depends on linking libgtest*.a,
but those were not being included.  This caused the lldb-gtest
linkage step to fail to find a main entry point that is present
in the filtered out libs.

This change restores the libgtest* libraries to the link list
by whitelisting them in the filter.

llvm-svn: 278552
2016-08-12 19:27:05 +00:00
Todd Fiala 1dc065b659 Link LLDB only against libclang and libLLVM .a files to fix macOS build
The Xcode macOS build of LLDB is currently broken after
https://reviews.llvm.org/D23232 landed, see
http://lab.llvm.org:8080/green/job/lldb_build_test/20014/console,
because we’re trying to link against all .a files found in the
llvm-build/lib directory. Let’s be more specific in what we link
against. This patch applies a regexp to only use “libclang.*”,
“libLLVM.*” and not “libclang_rt.*” static archives.

Change by Kuba Mracek (formerly Kuba Brecka)

See review here:
https://reviews.llvm.org/D23444

Reviewers: tfiala, compnerd
llvm-svn: 278527
2016-08-12 17:01:19 +00:00
Jim Ingham c915a7d2e8 Add a few more needed bits to the scripted thread plans.
llvm-svn: 277879
2016-08-05 22:06:12 +00:00
Stephane Sezer 185ab5b030 Add LLVM build config for BuildAndIntegration.
Reviewers: tfiala, clayborg

Subscribers: lldb-commits

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

llvm-svn: 275140
2016-07-12 01:44:58 +00:00
Stephane Sezer de76548f9a Apply local patches when building llvm on Mac.
Summary:
This is already done when building for linux with the CMake build
system. This functionality disappeared recently when some of the build
scripts used by the xcode build system changed.

Reviewers: tfiala, clayborg

Subscribers: lldb-commits

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

llvm-svn: 275134
2016-07-12 01:28:59 +00:00
Jim Ingham 4ac8e93a4e Add an API to unwind from a hand-called expression.
This is just an SB API way of doing "thread return -x".
<rdar://problem/27110360>

llvm-svn: 274822
2016-07-08 02:12:05 +00:00
Howard Hellyer ad00756301 Implement GetMemoryRegions() for Linux and Mac OSX core files.
Summary:
This patch fills in the implementation of GetMemoryRegions() on the Linux and Mac OS core file implementations of lldb_private::Process (ProcessElfCore::GetMemoryRegions and ProcessMachCore::GetMemoryRegions.) The GetMemoryRegions API was added under: http://reviews.llvm.org/D20565

The patch re-uses the m_core_range_infos list that was recently added to implement GetMemoryRegionInfo in both ProcessElfCore and ProcessMachCore to ensure the returned regions match the regions returned by Process::GetMemoryRegionInfo(addr_t load_addr, MemoryRegionInfo &region_info).

Reviewers: clayborg

Subscribers: labath, lldb-commits

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

llvm-svn: 274741
2016-07-07 08:21:28 +00:00
Enrico Granata 106aae5108 Because of our lifetime rules w.r.t. ValueObjects and ClusterManagers, synthetic children caching is a tricky area:
- if a synthetic child comes from the same hierarchy as its parent object, then it can't be cached by SharedPointer inside the synthetic provider, or it will cause a reference loop;
- but, if a synthetic child is made from whole cloth (e.g. from an expression, a memory region, ...), then it better be cached by SharedPointer, or it will be cleared out and cause an assert() to fail if used at a later point

For most cases of self-rooted synthetic children, we have a flag we set "IsSyntheticChildrenGenerated", but we were not using it to track caching. So, what ended up happening is each provider would set up its own cache, and if it got it wrong, a hard to diagnose crash would ensue

This patch fixes that by centralizing caching in ValueObjectSynthetic - if a provider returns a self-rooted child (as per the flag), then it gets cached centrally by the ValueObject itself
This cache is used only for lifetime management and not later retrieval of child values - a different cache handles that (because we might have a mix of self-rooted and properly nested child values for the same parent, we can't trivially use this lifetime cache for retrieval)

Fixes rdar://26480007

llvm-svn: 274683
2016-07-06 21:24:28 +00:00
Greg Clayton d458c4de36 Fix "lldb.SBProcess.is_stopped" and "lldb.SBProcess.is_running" to do the right thing.
https://llvm.org/bugs/show_bug.cgi?id=28428

llvm-svn: 274568
2016-07-05 18:19:43 +00:00
Jim Ingham 279b2e889a fixits are apparently called fix-its.
<rdar://problem/26998596>

llvm-svn: 273979
2016-06-28 01:33:03 +00:00
Greg Clayton 4d32eb6939 Add .i files for SBMemoryRegionInfo and SBMemoryRegionInfoList and also hook up the new calls in SBProcess that give out SBMemoryRegionInfo and SBMemoryRegionInfoList objects.
Also make sure the right headers and .i files are included so SWIG can hook everything up.

llvm-svn: 273749
2016-06-24 23:40:35 +00:00
Enrico Granata a5d6765cb0 Fix an issue where the @lldb.command marker would not work with the new 5-argument version of the Python command function
This:
a) teaches PythonCallable to look inside a callable object
b) teaches PythonCallable to discover whether a callable method is bound
c) teaches lldb.command to dispatch to either the older 4 argument version or the newer 5 argument version

llvm-svn: 273640
2016-06-24 02:07:15 +00:00
Todd Fiala 85df931dea Look for CMake.app when searching for cmake
On OS X systems, look for /Applications/CMake.app and ~/Applications/CMake.app
versions of the cmake command line binary when trying harder to find a cmake not
on the system path.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 269713
2016-05-16 22:29:15 +00:00
Kamil Rytarowski f49f2ee6d6 Add CMake bits necessary for standalone build
Summary: Developed on NetBSD with pkgsrc.

Reviewers: zturner, labath

Subscribers: jevinskie, zturner, tfiala, Eugene.Zelenko, artagnon, joerg, lldb-commits

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

llvm-svn: 269332
2016-05-12 19:49:17 +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
Francis Ricci 4692f52daa Create _lldb python symlink correctly when LLVM_LIBDIR_SUFFIX is used
Summary:
Do not assume that liblldb.so is located in $(lldb -P)/../../../lib
when creating the _lldb python symlink. Instead, use the path passed
to LLVM_LIBDIR_SUFFIX, defaulting to $(lldb -P)/../../../lib when this
variable is not set.

Reviewers: vharron, emaste, zturner

Subscribers: zturner, labath, lldb-commits, sas

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

llvm-svn: 267462
2016-04-25 20:34:34 +00:00
Greg Clayton b6bd4618eb Fix a build-llvm.py crasher when we can't find cmake. Now it exits with a valid error that explains what went wrong.
llvm-svn: 267235
2016-04-22 22:15:59 +00:00
Todd Fiala c4a2134f26 Fix #ifdef __APPLE__ code is the swig Python bindings
This code was getting evaluated unintentionally at binding
generation time instead of binding file compilation time.

Addresses:
https://bugs.swift.org/browse/SR-1192

llvm-svn: 265829
2016-04-08 18:58:07 +00:00
Pavel Labath 4e4bdc43f6 Add missing swig wrappers for r264662
llvm-svn: 264713
2016-03-29 10:41:40 +00:00