Commit Graph

78 Commits

Author SHA1 Message Date
Serge Guelton 0bc1447845 Python 2/3 compat: str vs basestring
Differential Revision: https://reviews.llvm.org/D59589

llvm-svn: 356908
2019-03-25 15:21:29 +00:00
Serge Guelton cdfcbbd348 Python 2/3 compat: unichr vs chr
llvm-svn: 356904
2019-03-25 15:12:48 +00:00
Serge Guelton 525cd59f5a Python 2/3 compatibility: from __future__ import print_function
Differential Revision: https://reviews.llvm.org/D59580

llvm-svn: 356695
2019-03-21 18:27:40 +00:00
Davide Italiano ca715b6ea0 [Python] Fix another batch of python 2/python 3 portability issues.
llvm-svn: 355998
2019-03-13 00:48:29 +00:00
Nathan Lanza f9c2f2c0b7 Fix order of arguments in an lldb type summary in examples
The format for the -w argument is:

    -w name ( --category name )

Rearrange the flags correctly.

llvm-svn: 351664
2019-01-19 20:08:41 +00:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50: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
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
Zachary Turner 2adc80107a Py3'ify some of the examples that get run at startup.
Even though these are under examples/, they actually get loaded
when LLDB starts up during initialization of ScriptInterpreterPython.
There's obviously some kind of layering issue here (and comments
in the code even point to that as well), but for now just make them
py3 compatible.

llvm-svn: 250710
2015-10-19 17:35:02 +00:00
Bruce Mitchener adb99821bc Fix typos.
Summary: Another round of minor typo fixes.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 248243
2015-09-22 05:07:56 +00:00
Sylvestre Ledru f6102892ef Fix some typos:
* transfered => transferred
* unkown => unknown
* sucessfully => successfully

llvm-svn: 215367
2014-08-11 18:06:28 +00:00
Enrico Granata 9b55aa4e8f An example summary provider for PyObject and the LLDB wrapper PythonObject hierarchy - this would have probably helped track down those refcount bugs..
llvm-svn: 200879
2014-02-05 21:38:50 +00:00
Enrico Granata 64d2a2853b An example of data formatters that generate a summary for a Unicode UTF encoded string represented as a (pointer,length) pair
llvm-svn: 192206
2013-10-08 17:29:27 +00:00
Enrico Granata 6d37cc6501 This checkin removes the last Cocoa formatters that were implemented in Python and reimplements them in C++. The Python Cocoa formatters are not shipped as part of LLDB anymore, but still exist in the source repository for user reference. Python formatters still exist for STL classes and users can still define their own Python formatters
llvm-svn: 177366
2013-03-19 00:27:22 +00:00
Enrico Granata 6a92511a08 NS(Mutable)IndexSet formatter moves from Python to C++
llvm-svn: 177217
2013-03-16 01:18:00 +00:00
Enrico Granata 50b5ee5023 Converting more data formatters to C++ - NSBundle, CFBinaryHeap, NSMachPort and NSNotification
llvm-svn: 177213
2013-03-16 00:50:25 +00:00
Enrico Granata e1fb1654c8 Quick fix for the libc++ std::map synthetic children provider
If you try to access any child > 0 without having touched child 0, LLDB won't be able to reconstruct type information from the debug info.
Previously, we would fail.
Now, we simply go fetch child 0 and then come back.

llvm-svn: 174795
2013-02-09 01:44:23 +00:00
Enrico Granata 54f279fff6 <rdar://problem/12552374> & <rdar://problem/13100674>
The vtable pointer field is not necessarily a pointer and hence cannot be used for validation

llvm-svn: 173947
2013-01-30 17:44:16 +00:00
Enrico Granata e1d29e4642 Replacing reference to radar number with svn revision
llvm-svn: 172641
2013-01-16 19:41:57 +00:00
Enrico Granata b5d9d630d8 Greg created a new API on SBProcess to get an ID that is guaranteed to be unique even in situations where underlying platforms would actually duplicate or hardcode PIDs
The Python data formatters use a per-process cache that was previously keying off the PID. Moving that to be based on this new notion of unique ID.

llvm-svn: 172633
2013-01-16 18:34:23 +00:00
Enrico Granata 0126132e2f Tweaking a comment in the NSURL formatter for correctness - the code was doing the right thing, but the comment was highly misleading
llvm-svn: 170441
2012-12-18 19:22:05 +00:00
Enrico Granata 37c3e9104c <rdar://problem/12817233>
Change the wording of NSNumber summary from absurd value to unexpected value when a tagged pointer shows up that does not match our knowledge of the internals

llvm-svn: 169751
2012-12-10 19:23:00 +00:00
Enrico Granata 7b3d205ee3 Changing the NSDate data formatter to use GetData().uint64[] instead of relying on SBValue.GetValueAsUnsigned() to reinterpret a double as a uint64_t
llvm-svn: 166610
2012-10-24 19:05:32 +00:00
Enrico Granata e3fcd2bb53 <rdar://problem/12426557> Fixing the NSIndexSet data formatter
llvm-svn: 165341
2012-10-05 22:58:46 +00:00
Enrico Granata 5d31103974 <rdar://problem/11398693> Making sure we do not attempt to run code on zombie objects when attempting to format them
llvm-svn: 164156
2012-09-18 18:34:14 +00:00
Enrico Granata 63d2a23618 Fix a potential issue where data formatters can get confused over malformed UUIDs
llvm-svn: 164151
2012-09-18 18:15:27 +00:00
Enrico Granata 69277bac23 <rdar://problem/12161825> Rephrase formatter for NSIndexSet in terms of indexes instead of objects
llvm-svn: 164149
2012-09-18 18:06:37 +00:00
Enrico Granata 39cf67e573 <rdar://problem/12068655> Make sure [NSDate distantPast] is formatted correctly
llvm-svn: 163162
2012-09-04 20:02:39 +00:00
Enrico Granata 7a204359dc Editing a comment to make sure people know not to blame CFString.py for CFString summary errors
llvm-svn: 163157
2012-09-04 19:18:17 +00:00
Enrico Granata 3467d80ba3 <rdar://problem/11485744> Implement important data formatters in C++. Have the Objective-C language runtime plugin expose class descriptors objects akin to the objc_runtime.py Pythonic implementation. Rewrite the data formatters for some core Cocoa classes in C++ instead of Python.
llvm-svn: 163155
2012-09-04 18:47:54 +00:00
Filipe Cabecinhas bbb648ef80 Make the objc-runtime work with Python 2.6
llvm-svn: 161111
2012-08-01 14:38:37 +00:00
Jim Ingham 584745a692 Added a few more summaries I find useful for lldb.
llvm-svn: 160909
2012-07-28 00:37:21 +00:00
Enrico Granata 4b7b5aa0bc <rdar://problem/11773899> Formatters for BOOL* and BOOL&
llvm-svn: 160181
2012-07-13 18:55:41 +00:00
Enrico Granata 811e9055fd <rdar://problem/11753405> Making sure we deal correctly with signed NSNumber values
llvm-svn: 160179
2012-07-13 18:53:14 +00:00
Enrico Granata 7c015e1020 Fixes for performance to data formatters - Python < 3.0 is much slower when using True/False as compared to 1/0 for logical values. Wexploit this to our advantage. Other minor tweaks
llvm-svn: 157209
2012-05-21 21:52:38 +00:00
Enrico Granata 263ebe5f78 Optimizations to the Python ObjC formatters - Benchmarking infrastructure
llvm-svn: 157066
2012-05-18 19:55:37 +00:00
Enrico Granata bd5a7a9f03 Fixing a bug where the summary for certain NSStrings was being returned as empty in spite of the string actually having a content
llvm-svn: 156793
2012-05-15 01:22:45 +00:00
Enrico Granata 9123950ab1 A simple implementation of a summary and synthetic children providers for LLDB-specific shared pointers - This could be generalized to work with C++11 shared pointers with relative ease
llvm-svn: 156410
2012-05-08 19:21:13 +00:00
Enrico Granata 73076f9269 Automatically enabling the Cocoa formatter categories for command-line LLDB. Previously, the categories were filled in but disabled by default. Tweaking test cases appropriately to keep working and do the right thing
llvm-svn: 155605
2012-04-26 01:40:38 +00:00
Enrico Granata de93b6b42f Fixing a typo in the NSArray data formatter
llvm-svn: 155586
2012-04-25 20:59:02 +00:00
Enrico Granata 7d22221759 Returning data formatters to their previous working condition - Plus fixing an issue that was preventing Python oneliners from executing
llvm-svn: 155563
2012-04-25 17:53:41 +00:00
Enrico Granata 28399adad8 Making the Cocoa formatters comply with the new on-disk layout of the Python resources - This is one of the steps towards making the data formatters work again
llvm-svn: 155526
2012-04-25 01:39:27 +00:00
Greg Clayton 6d98f56c58 Maked LLDB into a package so we can import things without poluting the global namespace.
Enrico will follow this up with fixing the data formatter test cases that are failing.

llvm-svn: 155514
2012-04-25 00:58:03 +00:00
Enrico Granata 51e318737a One last syntax error fix
llvm-svn: 153911
2012-04-02 23:49:34 +00:00
Enrico Granata a20e863875 Fixing syntax typos in Python formatters
llvm-svn: 153910
2012-04-02 23:43:22 +00:00
Enrico Granata 98bcde4264 Removing some instances of str(SBValue)
llvm-svn: 153899
2012-04-02 21:37:02 +00:00
Enrico Granata 247bd419ce Logging for data formatters.
llvm-svn: 153878
2012-04-02 16:39:29 +00:00
Enrico Granata a7daeebbff Fixing a whole class of crashers and potential crashers related to data formatters eating up all the stack when an unknown class has to be summarized ; this should make the whole Objective-C summaries more stable
llvm-svn: 153712
2012-03-30 00:51:12 +00:00
Enrico Granata d50f18b1a0 Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow


synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions

to set the cap to a different value:

(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)

you can optionally disable the loop detection algorithm for lists

(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False

llvm-svn: 153676
2012-03-29 19:29:45 +00:00
Enrico Granata 86ea8d821a Fixing an issue where Unicode characters in an NSString were printed as escape sequences by the summary provider shipping with LLDB - Added relevant test case code. Bonus points for identifying the source of the quotes :-)
llvm-svn: 153624
2012-03-29 01:34:34 +00:00