summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor Timer classPavel Labath2016-11-031-106/+41
| | | | | | | | | | | | | | | | | | | | | | Summary: While removing TimeValue from this class I noticed a lot of room for small simplifications here. Main are: - instead of complicated start-stop dances to compute own time, each Timer just starts the timer once, and keeps track of the durations of child timers. Then the own time can be computed at the end by subtracting the two values. - remove double accounting in TimerStack - the stack object already knows the number of timers. The interface does not lend itself well to unit testing, but I have added a couple of tests which can (and did) catch any obvious errors. Reviewers: tberghammer, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D26243 llvm-svn: 285890
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-0210-20/+20
| | | | | | | | | | Reviewers: zturner, labath Subscribers: tberghammer, danalbert, lldb-commits Differential Revision: https://reviews.llvm.org/D26233 llvm-svn: 285855
* Remove TimeValue usage from two filesPavel Labath2016-11-022-18/+20
| | | | llvm-svn: 285801
* Remove TimeValue usage from FileSpec.hPavel Labath2016-11-013-33/+21
| | | | | | | | | | | | | | | | | | | | | Summary: The only usage there was in GetModificationTime(). I also took the opportunity to move this function from FileSpec to the FileSystem class - since we are using FileSpecs to also represent remote files for which we cannot (easily) retrieve modification time, it makes sense to make the decision to get the modification time more explicit. The new function returns a llvm::sys::TimePoint<>. To aid the transition from TimeValue, I have added a constructor to it which enables implicit conversion from a time_point. Reviewers: zturner, clayborg Subscribers: mehdi_amini, tberghammer, danalbert, beanz, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D25392 llvm-svn: 285702
* [LLDB][MIPS] Fix qProcessInfo to return correct pointer size based on ELF ABINitesh Jain2016-10-121-1/+38
| | | | | | | | | | Reviewers: clayborg, labath Subscribers: jaydeep, bhushan, slthakur, lldb-commits Differential Revision: https://reviews.llvm.org/D25021 llvm-svn: 284001
* [LLDB][MIPS] Fix register read/write for 32 bit big endian systemNitesh Jain2016-10-101-0/+3
| | | | | | | | | | Reviewers: clayborg, labath Subscribers: jaydeep, bhushan, mohit.bhakkad, slthakur, llvm-commits Differential Revision: https://reviews.llvm.org/D24124 llvm-svn: 283728
* Convert UniqueCStringMap to use StringRef.Zachary Turner2016-10-061-4/+6
| | | | llvm-svn: 283494
* Convert some Args index-based iteration to range-style iteration.Zachary Turner2016-10-051-0/+10
| | | | | | | | | | | | | | This is better for a number of reasons. Mostly style, but also: 1) Signed-unsigned comparison warnings disappear since there is no loop index. 2) Iterating with the range-for style gives you back an entry that has more than just a const char*, so it's more efficient and more useful. 3) Makes code safter since the type system enforces that it's impossible to index out of bounds. llvm-svn: 283413
* Convert CommandObject constructors to StringRef.Zachary Turner2016-10-051-0/+4
| | | | llvm-svn: 283384
* Make lldb -Werror clean on Windows.Zachary Turner2016-10-052-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D25247 llvm-svn: 283344
* Refactor the Args class.Zachary Turner2016-10-032-25/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were a number of issues with the Args class preventing efficient use of strings and incoporating LLVM's StringRef class. The two biggest were: 1. Backing memory stored in a std::string, so we would frequently have to use const_cast to get a mutable buffer for passing to various low level APIs. 2. backing std::strings stored in a std::list, which doesn't provide random access. I wanted to solve these two issues so that we could provide StringRef access to the underlying arguments, and also a way to provide range-based access to the underlying argument array while still providing convenient c-style access via an argv style const char**. The solution here is to store arguments in a single "entry" class which contains the backing memory, a StringRef with precomputed length, and the quote char. The backing memory is a manually allocated const char* so that it is not invalidated when the container is resized, and there is a separate argv array provided for c-style access. Differential revision: https://reviews.llvm.org/D25099 llvm-svn: 283157
* [lldb-mi] Fix prompt which can get inserted in the middle of program output ↵Dawn Perchik2016-10-011-1/+3
| | | | | | | | | | | | | | in lldb-mi Summary: The code added in svn r264332 causes "(lldb) " to be printed in the middle of program console output. This fix restores the behavior for non-Windows platforms to before the patch. Reviewers: ted, zturner, clayborg Subscribers: amccarth, lldb-commits Differential Revision: http://reviews.llvm.org/D25137 llvm-svn: 283031
* Change Module::RemapPath to use StringRef.Zachary Turner2016-09-231-1/+2
| | | | llvm-svn: 282277
* Update the prompt related functions to use StringRefs.Zachary Turner2016-09-233-24/+25
| | | | llvm-svn: 282269
* Fix TestBreakpointSerialization on windowsPavel Labath2016-09-221-1/+1
| | | | | | | | | The test exposed a bug in the StructuredData Serialization code, which did not escape the backslash properly. This manifested itself as windows breakpoint serialization roundtrip test not succeeding (as windows paths included backslashes). llvm-svn: 282167
* Fix for loop sign fix in r282112 for column = 0Ed Maste2016-09-211-1/+1
| | | | llvm-svn: 282119
* Fix integer sign warning from r282105Ed Maste2016-09-211-1/+1
| | | | llvm-svn: 282112
* add stop column highlighting supportTodd Fiala2016-09-213-13/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix failing regex tests.Zachary Turner2016-09-211-1/+1
| | | | | | | | | | | 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
* Make lldb::Regex use StringRef.Zachary Turner2016-09-215-22/+24
| | | | | | | | | | 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
* Set the correct triple when creating an ArchSpec for Windows.Zachary Turner2016-09-161-0/+3
| | | | | | | Patch by Walter Erquinigo Differential Revision: https://reviews.llvm.org/D24283 llvm-svn: 281765
* First tests for serializing breakpoints.Jim Ingham2016-09-161-33/+32
| | | | | | Plus a few bug fixes I found along the way. llvm-svn: 281690
* Allow ArchSpec to take a StringRef.Zachary Turner2016-09-151-103/+102
| | | | llvm-svn: 281662
* Convert ArchSpec::ParseMachOCPUDashSubtypeTriple to use StringRef.Zachary Turner2016-09-151-37/+34
| | | | | | | | | | | | | 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
* More cleanup in `frame diagnose,` eliminating a bunch of messy cases.Sean Callanan2016-09-141-0/+11
| | | | llvm-svn: 281545
* Add SB API's for writing breakpoints to & creating the from a file.Jim Ingham2016-09-141-2/+2
| | | | | | | | | | | 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
* Cleaned up some of the "frame diagnose" code to use Operands as currency.Sean Callanan2016-09-131-0/+113
| | | | | | | Also added some utility functions around Operands to make code easier and more compact to write. llvm-svn: 281398
* Add some unit tests for ArchSpec.Zachary Turner2016-09-131-2/+2
| | | | | | | | | | | | I'm was trying to do some cleanup and code modernization and in doing so I needed to change ParseMachCPUDashSubtypeTriple to take a StringRef. To ensure I don't break anything, I'm adding some unit tests for this function. As a side benefit, this also expands test coverage of this function to all platforms, since in general this code would rarely be exercised on non Mac platforms, and never in the test suite. llvm-svn: 281387
* Some more pointer safety in Breakpoint.Zachary Turner2016-09-131-1/+2
| | | | | | | | | | | 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
* Fix linux build after rL281273Tamas Berghammer2016-09-131-1/+1
| | | | llvm-svn: 281309
* Add a few const's (thanks Zachary) and return shared or unique pointersJim Ingham2016-09-131-28/+33
| | | | | | in places where they help prevent leaks. llvm-svn: 281288
* This is the main part of a change to add breakpoint save and restore to lldb.Jim Ingham2016-09-122-5/+310
| | | | | | | | | | | | | | | 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
* Fix about a dozen compile warningsIlia K2016-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: It fixes the following compile warnings: 1. '0' flag ignored with precision and ‘%d’ gnu_printf format 2. enumeral and non-enumeral type in conditional expression 3. format ‘%d’ expects argument of type ‘int’, but argument 4 has type ... 4. enumeration value ‘...’ not handled in switch 5. cast from type ‘const uint64_t* {aka ...}’ to type ‘int64_t* {aka ...}’ casts away qualifiers 6. extra ‘;’ 7. comparison between signed and unsigned integer expressions 8. variable ‘register_operand’ set but not used 9. control reaches end of non-void function Reviewers: jingham, emaste, zturner, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D24331 llvm-svn: 281191
* Fix unused variable and integer sign warnings from r280906Ed Maste2016-09-081-3/+2
| | | | llvm-svn: 280931
* I'm experimenting with changing how the mixed source & assemblyJason Molenda2016-09-081-32/+269
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mode in lldb works. I've been discussing this with Jim Ingham, Greg Clayton, and Kate Stone for the past week or two. Previously lldb would print three source lines (centered on the line table entry line for the current line) followed by the assembly. It would print the context information (module`function + offset) before those three lines of source. Now lldb will print up to two lines before/after the line table entry. It prints two '*' characters for the line table line to make it clear what line is showing assembly. There is one line of whitespace before/after the source lines so the separation between source & assembly is clearer. I don't print the context line (module`function + offset). I stop printing context lines if it's a different line table entry, or if it's a source line I've already printed as context to another source line. If I have two line table entries one after another for the same source line (I get these often with clang - with different column information in them), I only print the source line once. I'm also using the target.process.thread.step-avoid-regexp setting (which keeps you from stepping into STL functions that have been inlined into your own code) and avoid printing any source lines from functions that match that regexp. When lldb disassembles into a new function, it will try to find the declaration line # for the function and print all of the source lines between the decl and the first line table entry (usually a { curly brace) so we have a good chance of including the arguments, at least with the debug info emitted by clang. Finally, the # of source lines of context to show has been separated from whether we're doing mixed source & assembly or not. Previously specifying 0 lines of context would turn off mixed source & assembly. I think there's room for improvement, and maybe some bugs I haven't found yet, but it's in good enough shape to upstream and iterate at this point. I'm not sure how best to indicate which source line is the actual line table # versus context lines. I'm using '**' right now. Both Kate and Greg had the initial idea to reuse '->' (normally used to indicate "currently executing source line") - I tried it but I wasn't thrilled, I'm too used to the established meaning of ->. Greg had the interesting idea of avoiding context source lines only in two line table entries in the same source file. So we'd print two lines before & after a source line, and then the next line table entry (if it was on the next source line after those two context lines) we'd display only the following two lines -- the previous two had just been printed. If an inline source line was printed between these two, though, we'd print the context lines for both of them. It's an interesting idea, and I want to see how it works with both -O0 and -O3 codegen where we have different amounts of inlining. <rdar://problem/27961419> llvm-svn: 280906
* Use llvm's demangler.Rafael Espindola2016-09-073-4405/+3
| | | | | | | LLVM now has a copy of libcxxabi demangler, so lldb doesn't need to keep one too. llvm-svn: 280821
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-0673-46071/+39041
| | | | | | | | | | | | | | | | | | | | | | | *** 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
* Check for nullEnrico Granata2016-09-021-0/+7
| | | | llvm-svn: 280513
* Reapply "Make Scalar::GetValue more consistent"Pavel Labath2016-09-021-4/+4
| | | | | | | | this is a resubmission of r280476. The problem with the original commit was that it was printing out all numbers as signed, which was wrong for unsigned numbers with the MSB set. Fix that and add a unit test covering that case. llvm-svn: 280480
* Revert "Make Scalar::GetValue more consistent"Pavel Labath2016-09-021-3/+5
| | | | | | | This reverts commit r280476 as it breaks several tests on i386. I was fixing an 32-bit breakage, and I did not run the 32-bit test suite before submitting, oops. llvm-svn: 280478
* Make Scalar::GetValue more consistentPavel Labath2016-09-021-5/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: It seems the original intention of the function was printing signed values in decimal format, and unsigned values in hex (without the leading "0x"). However, signed and unsigned long were exchanged, which lead to amusing test failures in TestMemoryFind.py. Instead of just switching the two, I think we should just print everything in decimal here, as the current behaviour is very confusing (especially when one does not request printing of types). Nothing seems to depend on this behaviour except and we already have a way for the user to request the format he wants when printing values for most commands (which presumably does not go through this function). I also add a unit tests for the function in question. Reviewers: clayborg, granata.enrico Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D24126 llvm-svn: 280476
* When updating a ValueObjectRegister, set the flag to remind yourself of ↵Enrico Granata2016-09-011-0/+2
| | | | | | whether it changed llvm-svn: 280395
* Revert r280137 and 280139 and subsequent build fixesPavel Labath2016-08-311-13/+0
| | | | | | | | | | The rewrite of StringExtractor::GetHexMaxU32 changes functionality in a way which makes lldb-server crash. The crash (assert) happens when parsing the "qRegisterInfo0" packet, because the function tries to drop_front more bytes than the packet contains. It's not clear to me whether we should consider this a bug in the caller or the callee, but it any case, it worked before, so I am reverting this until we can figure out what the proper interface should be. llvm-svn: 280207
* Teach ValueObject::ReadPointedString how to read char[] in host memoryEnrico Granata2016-08-301-5/+16
| | | | llvm-svn: 280166
* A few minor stylistic cleanups in StringExtractor.Zachary Turner2016-08-301-0/+13
| | | | | | | | | | | Makes Peek() return a StringRef instead of a const char*. This leads to a few callers of Peek() being able to be made a little nicer (for example using StringRef member functions instead of c-style strncmp and related functions) and generally safer usage. llvm-svn: 280139
* Remove std::atomic from lldb::Address.Zachary Turner2016-08-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | std::atomic<uint64_t> requires 64-bit alignment in order to guarantee atomicity. Normally the compiler is pretty good about aligning types, but an exception to this is when the type is passed by value as a function parameter. In this case, if your stack is 4-byte aligned, most modern compilers (including clang as of LLVM 4.0) fail to align the type, rendering the atomicity ineffective. A deeper investigation of the class's implementation suggests that the use of atomic was in vain anyway, because if the class were to be shared amongst multiple threads, there were already other data races present, and that the proper way to ensure thread-safe access to this data would be to use a mutex from a higher level. Since the std::atomic was not serving its intended purpose anyway, and since the presence of it generates compiler errors on some platforms that cannot be workaround, we remove std::atomic from Address here. Although unlikely, if data races do resurface the proper fix should involve a mutex from a higher level, or an attempt to limit the Address's access to a single thread. llvm-svn: 279994
* Add cmake option to choose whether to use the builtin demanglerPavel Labath2016-08-261-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously the builting demangler was on for platforms that explicitly set a flag by modifying Mangled.cpp (windows, freebsd). The Xcode build always used builtin demangler by passing a compiler flag. This adds a cmake flag (defaulting to ON) to configure the demangling library used at build time. The flag is only available on non-windows platforms as there the system demangler is not present (in the form we're trying to use it, at least). The impact of this change is: - linux: switches to the builtin demangler - freebsd, windows: NFC (I hope) - netbsd: switches to the builtin demangler - osx cmake build: switches to the builtin demangler (matching the XCode build) The main motivation for this is the cross-platform case, where it should bring more consistency by removing the dependency on the host demangler (which can be completely unrelated to the debug target). Reviewers: zturner, emaste, krytarowski Subscribers: emaste, clayborg, lldb-commits Differential Revision: https://reviews.llvm.org/D23830 llvm-svn: 279808
* Add StructuredData plugin type; showcase with new DarwinLog featureTodd Fiala2016-08-193-3/+390
| | | | | | | | | | | | 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
* Revert "Add StructuredData plugin type; showcase with new DarwinLog feature"Todd Fiala2016-08-193-390/+3
| | | | | | This reverts commit 1d885845d1451e7b232f53fba2e36be67aadabd8. llvm-svn: 279200
* Add StructuredData plugin type; showcase with new DarwinLog featureTodd Fiala2016-08-193-3/+390
| | | | | | | | | See docs/structured_data/StructuredDataPlugins.md for details. differential review: https://reviews.llvm.org/D22976 reviewers: clayborg, jingham llvm-svn: 279198
OpenPOWER on IntegriCloud