summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
Commit message (Collapse)AuthorAgeFilesLines
...
* Add GDB remote packet reproducer.Jonas Devlieghere2018-11-131-0/+12
| | | | llvm-svn: 346780
* Re-land "Extract construction of DataBufferLLVM into FileSystem"Jonas Devlieghere2018-11-121-2/+2
| | | | | | This fixes some UB in isLocal detected by the sanitized bot. llvm-svn: 346707
* Revert "Extract construction of DataBufferLLVM into FileSystem"Davide Italiano2018-11-121-2/+2
| | | | | | It broke the lldb sanitizer bots. llvm-svn: 346694
* [lldb] Fix "code requires global destructor" warning in g_architecture_mutexKuba Mracek2018-11-121-4/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D44060 llvm-svn: 346673
* [ClangASTContext] Extract VTable pointers from C++ objectsAleksandr Urakov2018-11-121-25/+0
| | | | | | | | | | | | | | | | | | This patch processes the case of retrieving a virtual base when the object is already read from the debuggee memory. To achieve that ValueObject::GetCPPVTableAddress was removed and was reimplemented in ClangASTContext (because access to the process is needed to retrieve the VTable pointer in general, and because this is the only place that used old version of ValueObject::GetCPPVTableAddress). This patch allows to use real object's VTable instead of searching virtual bases by offsets restored by MicrosoftRecordLayoutBuilder. PDB has no enough info to restore VBase offsets properly, so we have to read real VTable instead. Differential revision: https://reviews.llvm.org/D53506 llvm-svn: 346669
* Remove header grouping comments.Jonas Devlieghere2018-11-112-5/+0
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Remove comments after header includes.Jonas Devlieghere2018-11-1139-405/+405
| | | | | | | | | | This patch removes the comments following the header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. Differential revision: https://reviews.llvm.org/D54385 llvm-svn: 346625
* Extract construction of DataBufferLLVM into FileSystemJonas Devlieghere2018-11-101-2/+2
| | | | | | | | | | This moves construction of data buffers into the FileSystem class. Like some of the previous refactorings we don't translate the path yet because the functionality hasn't been landed in LLVM yet. Differential revision: https://reviews.llvm.org/D54272 llvm-svn: 346598
* Revert "Fix bug in PE/COFF plugin and ValueObjectVariable."Davide Italiano2018-11-081-10/+3
| | | | | | It breaks some tests on MacOS. llvm-svn: 346444
* Fix bug in PE/COFF plugin and ValueObjectVariable.Zachary Turner2018-11-081-3/+10
| | | | | | | | | | | | | | | | | | There are two bugs here. The first is that MSVC and clang-cl emit their bss section under the name '.data' instead of '.bss' but with the size and file offset set to 0. ObjectFilePECOFF didn't handle this, and would only recognize a section as bss if it was actually called '.bss'. The effect of this is that if we tried to print the value of a variable that lived in BSS we would fail. The second bug is that ValueObjectVariable was only returning the forward type, which is insufficient to print the value of an enum. So we bump this up to the layout type. Differential Revision: https://reviews.llvm.org/D54241 llvm-svn: 346430
* [FileSystem] Add convenience method to check for directories.Jonas Devlieghere2018-11-082-2/+2
| | | | | | | | | | | Replace calls to LLVM's is_directory with calls to LLDB's FileSytem class. For this I introduced a new convenience method that, like the other methods, takes either a path or filespec. This still uses the LLVM functions under the hood. Differential revision: https://reviews.llvm.org/D54135 llvm-svn: 346375
* Fix (and improve) the support for C99 variable length array typesAdrian Prantl2018-11-057-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang recently improved its DWARF support for C VLA types. The DWARF now looks like this: 0x00000051: DW_TAG_variable [4] DW_AT_location( fbreg -32 ) DW_AT_name( "__vla_expr" ) DW_AT_type( {0x000000d3} ( long unsigned int ) ) DW_AT_artificial( true ) ... 0x000000da: DW_TAG_array_type [10] * DW_AT_type( {0x000000cc} ( int ) ) 0x000000df: DW_TAG_subrange_type [11] DW_AT_type( {0x000000e9} ( __ARRAY_SIZE_TYPE__ ) ) DW_AT_count( {0x00000051} ) Without this patch LLDB will naively interpret the DIE offset 0x51 as the static size of the array, which is clearly wrong. This patch extends ValueObject::GetNumChildren to query the dynamic properties of incomplete array types. See the testcase for an example: 4 int foo(int a) { 5 int vla[a]; 6 for (int i = 0; i < a; ++i) 7 vla[i] = i; 8 -> 9 pause(); // break here 10 return vla[a-1]; 11 } (lldb) fr v vla (int []) vla = ([0] = 0, [1] = 1, [2] = 2, [3] = 3) (lldb) quit rdar://problem/21814005 Differential Revision: https://reviews.llvm.org/D53530 llvm-svn: 346165
* [FileSystem] Open File instances through the FileSystem.Jonas Devlieghere2018-11-021-6/+11
| | | | | | | | | | | This patch modifies how we open File instances in LLDB. Rather than passing a path or FileSpec to the constructor, we now go through the virtual file system. This is needed in order to make things work with the VFS in the future. Differential revision: https://reviews.llvm.org/D54020 llvm-svn: 346049
* [FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere2018-11-016-15/+13
| | | | | | | | | This patch removes the logic for resolving paths out of FileSpec and updates call sites to rely on the FileSystem class instead. Differential revision: https://reviews.llvm.org/D53915 llvm-svn: 345890
* [FileSystem] Remove Exists() from FileSpecJonas Devlieghere2018-11-016-12/+19
| | | | | | | | | This patch removes the Exists method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53845 llvm-svn: 345854
* [FileSystem] Remove GetByteSize() from FileSpecJonas Devlieghere2018-11-011-1/+2
| | | | | | | | | This patch removes the GetByteSize method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53788 llvm-svn: 345812
* [FileSystem] Move EnumerateDirectory from FileSpec to FileSystem.Jonas Devlieghere2018-11-012-23/+29
| | | | | | | | | | | | | | This patch moves the EnumerateDirectory functionality and related enum and typedef from FileSpec to FileSystem. This is part of a set of patches that extracts file system related convenience methods from FileSpec. The long term goal is to remove this method altogether and use the iterators directly, but for introducing the VFS into LLDB this change is sufficient. Differential revision: https://reviews.llvm.org/D53785 llvm-svn: 345800
* [FileSystem] Extend file system and have it use the VFS.Jonas Devlieghere2018-10-314-12/+12
| | | | | | | | | | | | | | | | This patch extends the FileSystem class with a bunch of functions that are currently implemented as methods of the FileSpec class. These methods will be removed in future commits and replaced by calls to the file system. The new functions are operated in terms of the virtual file system which was recently moved from clang into LLVM so it could be reused in lldb. Because the VFS is stateful, we turned the FileSystem class into a singleton. Differential revision: https://reviews.llvm.org/D53532 llvm-svn: 345783
* Don't type-erase the FunctionNameType or TypeClass enums.Zachary Turner2018-10-252-9/+12
| | | | | | | | | | This is similar to D53597, but following up with 2 more enums. After this, all flag enums should be strongly typed all the way through to the symbol files plugins. Differential Revision: https://reviews.llvm.org/D53616 llvm-svn: 345314
* Don't type-erase the SymbolContextItem enumeration.Zachary Turner2018-10-255-23/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When we get the `resolve_scope` parameter from the SB API, it's a `uint32_t`. We then pass it through all of LLDB this way, as a uint32. This is unfortunate, because it means the user of an API never actually knows what they're dealing with. We can call it something like `resolve_scope` and have comments saying "this is a value from the `SymbolContextItem` enumeration, but it makes more sense to just have it actually *be* the correct type in the actual C++ type system to begin with. This way the person reading the code just knows what it is. The reason to use integers instead of enumerations for flags is because when you do bitwise operations on enumerations they get promoted to integers, so it makes it tedious to constantly be casting them back to the enumeration types, so I've introduced a macro to make this happen magically. By writing LLDB_MARK_AS_BITMASK_ENUM after defining an enumeration, it will define overloaded operators so that the returned type will be the original enum. This should address all the mechanical issues surrounding using rich enum types directly. This way, we get a better debugger experience, and new users to the codebase can get more easily acquainted with the codebase because their IDE features can help them understand what the types mean. Differential Revision: https://reviews.llvm.org/D53597 llvm-svn: 345313
* [LLDB] - Implement the support for the .debug_loclists section.George Rimar2018-10-231-0/+2
| | | | | | | | | | | This implements the support for .debug_loclists section, which is DWARF 5 version of .debug_loc. Currently, clang is able to emit it with the use of D53365. Differential revision: https://reviews.llvm.org/D53436 llvm-svn: 345016
* [ValueObject] Stop assuming types are non-zero sized.Davide Italiano2018-10-231-1/+7
| | | | | | | | | | Some backends might violate this assumption. No test case upstream unfortunately as this is not the case with C++, but I'm going to add a test in swift language support. <rdar://problem/40962410> llvm-svn: 344982
* Delete commented-out code.Adrian Prantl2018-10-161-2/+0
| | | | llvm-svn: 344648
* [LLDB] - Add basic support for .debug_rnglists section (DWARF5)George Rimar2018-10-101-0/+2
| | | | | | | | | This adds a basic support of the .debug_rnglists section. Only the DW_RLE_start_length and DW_RLE_end_of_list entries are supported. Differential revision: https://reviews.llvm.org/D52981 llvm-svn: 344119
* Add support for artificial tail call framesVedant Kumar2018-10-052-2/+13
| | | | | | | | | | | | | | | | This patch teaches lldb to detect when there are missing frames in a backtrace due to a sequence of tail calls, and to fill in the backtrace with artificial tail call frames when this happens. This is only done when the execution history can be determined from the call graph and from the return PC addresses of calls on the stack. Ambiguous sequences of tail calls (e.g anything involving tail calls and recursion) are detected and ignored. Depends on D49887. Differential Revision: https://reviews.llvm.org/D50478 llvm-svn: 343900
* Escape newlines in default disassembly format.Jonas Devlieghere2018-10-011-2/+2
| | | | | | | We can safely escape newlines in format strings because they will be ignored by the format entity parser. llvm-svn: 343470
* Replace pointer to C-array of PropertyDefinition with llvm::ArrayRefTatyana Krasnukha2018-09-272-4/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D52572 llvm-svn: 343181
* Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer ↵Tatyana Krasnukha2018-09-262-46/+40
| | | | | | | | llvm::ArrayRef Differential Revision: https://reviews.llvm.org/D49017 llvm-svn: 343130
* build: add libedit to include pathsTatyana Krasnukha2018-09-211-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D51999 llvm-svn: 342757
* [NFC] Turn "load dependent files" boolean into an enumJonas Devlieghere2018-09-201-2/+1
| | | | | | | | | | | | | | This is an NFC commit to refactor the "load dependent files" parameter from a boolean to an enum value. We want to be able to specify a default, in which case we decide whether or not to load the dependent files based on whether the target is an executable or not (i.e. a dylib). This is a dependency for D51934. Differential revision: https://reviews.llvm.org/D51859 llvm-svn: 342633
* Make the eSearchDepthFunction searches work, add tests Jim Ingham2018-09-141-2/+37
| | | | | | | | using the scripted breakpoint resolver. Differential Revision: https://reviews.llvm.org/D52111 llvm-svn: 342259
* Add a "scripted" breakpoint type to lldb.Jim Ingham2018-09-131-2/+10
| | | | | | | | | | This change allows you to write a new breakpoint type where the logic for setting breakpoints is determined by a Python callback written using the SB API's. Differential Revision: https://reviews.llvm.org/D51830 llvm-svn: 342185
* Add support for descriptions with command completions.Raphael Isemann2018-09-131-22/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a framework for adding descriptions to the command completions we provide. It also adds descriptions for completed top-level commands so that we can test this code. Completions are in general supposed to be displayed alongside the completion itself. The descriptions can be used to provide additional information about the completion to the user. Examples for descriptions are function signatures when completing function calls in the expression command or the binary name when providing completion for a symbol. There is still some boilerplate code from the old completion API left in LLDB (mostly because the respective APIs are reused for non-completion related purposes, so the CompletionRequest doesn't make sense to be used), so that's why I still had to change some function signatures. Also, as the old API only passes around a list of matches, and the descriptions are for these functions just another list, I had to add some code that essentially just ensures that both lists are always the same side (e.g. all the manual calls to `descriptions->AddString(X)` below a `matches->AddString(Y)` call). The initial command descriptions that come with this patch are just reusing the existing short help that is already added in LLDB. An example completion with descriptions looks like this: ``` (lldb) pl Available completions: platform -- Commands to manage and create platforms. plugin -- Commands for managing LLDB plugins. ``` Reviewers: #lldb, jingham Reviewed By: #lldb, jingham Subscribers: jingham, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D51175 llvm-svn: 342181
* [LLDB] - Improved DWARF5 support.George Rimar2018-09-131-0/+2
| | | | | | | | | This patch improves the support of DWARF5. Particularly the reporting of source code locations. Differential revision: https://reviews.llvm.org/D51935 llvm-svn: 342153
* Remove byte counting from SourceManager [NFC]Raphael Isemann2018-09-131-10/+10
| | | | | | | | | | | | | | | | Summary: Similar to what we did in D50681, we now stop manually byte counting here in the SourceManager. Reviewers: #lldb, JDevlieghere Reviewed By: #lldb, JDevlieghere Subscribers: JDevlieghere, abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D50809 llvm-svn: 342121
* Rollback "Fix raw address breakpoints not resolving".Davide Italiano2018-09-101-2/+8
| | | | | | | It broke a bunch of bots. Ted confirmed, but can't revert for now so I'm reverting on his behalf. llvm-svn: 341878
* Fix raw address breakpoints not resolvingTed Woodward2018-09-101-8/+2
| | | | | | | | | | | | | | Summary: An address breakpoint of the form "b 0x1000" won't resolve if it's created while the process isn't running. This patch deletes Address::SectionWasDeleted, renames Address::SectionWasDeletedPrivate to SectionWasDeleted (and makes it public), and changes the section check in Breakpoint::ModulesChanged back to its original form Reviewers: jingham, #lldb Reviewed By: jingham Subscribers: davide, lldb-commits Differential Revision: https://reviews.llvm.org/D51816 llvm-svn: 341849
* Check if a terminal supports colors on Windows properlyDavid Bolvansky2018-09-081-1/+0
| | | | | | | | | | | | | | | | | Summary: Previously we SetUseColor(true) wrongly when output was not a terminal so it broken some (not public) bots. Thanks for issue report, @stella.stamenova Reviewers: stella.stamenova, zturner Reviewed By: stella.stamenova Subscribers: abidh, lldb-commits, stella.stamenova Differential Revision: https://reviews.llvm.org/D51772 llvm-svn: 341746
* NFC: Move Searcher::Depth into lldb-enumerations as SearchDepth.Jim Ingham2018-09-074-16/+16
| | | | | | | | In a subsequent commit, I will need to expose the search depth to the SB API's, so I'm moving this define into lldb-enumerations where it will get added to the lldb module. llvm-svn: 341690
* Print column info in backtraces et al. if availableAdrian Prantl2018-09-052-1/+14
| | | | | | | | | | | | This patch allows LLDB to print column info in backtraces et al. if available, which is useful when the backtrace contains a frame like the following: f(can_crash(0), can_crash(1)); Differential Revision: https://reviews.llvm.org/D51661 llvm-svn: 341506
* Set Windows console mode to enable support for ansi escape codesDavid Bolvansky2018-09-051-0/+9
| | | | | | | | | | | | | | | | | | | | Summary: Windows console now supports supports ANSI escape codes, but we need to enable it using SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING flag. https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences. Syntax hightlighting now works fine on Windows: https://i.imgur.com/P0i04A7.png Reviewers: JDevlieghere, teemperor, zturner Reviewed By: zturner Subscribers: abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D51615 llvm-svn: 341497
* Silence some "control reaches end of non-void function" warnings with gccPavel Labath2018-08-312-0/+3
| | | | llvm-svn: 341163
* Move Predicate.h from Host to UtilityRaphael Isemann2018-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This class was initially in Host because its implementation used to be very OS-specific. However, with C++11, it has become a very simple std::condition_variable wrapper, with no host-specific code. It is also a general purpose utility class, so it makes sense for it to live in a place where it can be used by everyone. This has no effect on the layering right now, but it enables me to later move the Listener+Broadcaster+Event combo to a lower layer, which is important, as these are used in a lot of places (notably for launching a process in Host code). Reviewers: jingham, zturner, teemperor Reviewed By: zturner Subscribers: xiaobai, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D50384 llvm-svn: 341089
* Support setting a breakpoint by FileSpec+Line+Column in the SBAPI.Adrian Prantl2018-08-301-0/+2
| | | | | | | | | | | | This patch extends the SBAPI to allow for setting a breakpoint not only at a specific line, but also at a specific (minimum) column. When a column is specified, it will try to find an exact match or the closest match on the same line that comes after the specified location. Differential Revision: https://reviews.llvm.org/D51461 llvm-svn: 341078
* Move the column marking functionality to the Highlighter frameworkRaphael Isemann2018-08-303-87/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The syntax highlighting feature so far is mutually exclusive with the lldb feature that marks the current column in the line by underlining it via an ANSI color code. Meaning that if you enable one, the other is automatically disabled by LLDB. This was caused by the fact that both features inserted color codes into the the source code and were likely to interfere with each other (which would result in a broken source code printout to the user). This patch moves the cursor code into the highlighting framework, which provides the same feature to the user in normal non-C source code. For any source code that is highlighted by Clang, we now also have cursor marking for the whole token that is under the current source location. E.g., before we underlined only the '!' in the expression '1 != 2', but now the whole token '!=' is underlined. The same for function calls and so on. Below you can see two examples where we before only underlined the first character of the token, but now underline the whole token. {F7075400} {F7075414} It also simplifies the DisplaySourceLines method in the SourceManager as most of the code in there was essentially just for getting this column marker to work as a FormatEntity. Reviewers: aprantl Reviewed By: aprantl Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D51466 llvm-svn: 341003
* Don't cancel the current IOHandler when we push a handler for an utility ↵Raphael Isemann2018-08-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function run. Summary: D48465 is currently blocked by the fact that tab-completing the first expression is deadlocking LLDB. The reason for this deadlock is that when we push the ProcessIO handler for reading the Objective-C runtime information from the executable (which is triggered when we parse the an expression for the first time), the IOHandler can't be pushed as the Editline::Cancel method is deadlocking. The deadlock in Editline is coming from the m_output_mutex, which is locked before we go into tab completion. Even without this lock, calling Cancel on Editline will mean that Editline cleans up behind itself and deletes the current user-input, which is screws up the console when we are tab-completing at the same time. I think for now the most reasonable way of fixing this is to just not call Cancel on the current IOHandler when we push the IOHandler for running an internal utility function. As we can't really write unit tests for IOHandler itself (due to the hard dependency on an initialized Debugger including all its global state) and Editline completion is currently also not really testable in an automatic fashion, the test for this has to be that the expression command completion in D48465 doesn't fail when requesting completion the first time. A more precise test plan for this is: 1. Apply D48465. 2. Start lldb and break in some function. 3. Type `expr foo` and press tab to request completion. 4. Without this patch, we deadlock and LLDB stops responding. I'll provide an actual unit test for this once I got around and made the IOHandler code testable, but for now unblocking D48465 is more critical. Thanks to Jim for helping me debugging this. Reviewers: jingham Reviewed By: jingham Subscribers: emaste, clayborg, abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D50912 llvm-svn: 340988
* Disable use-color if the output stream is not a terminal with color support.Raphael Isemann2018-08-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: LLDB currently only checks the output terminal for color support by looking at the `TERM` environment variable and comparing it to `"dumb"`. This causes that when running LLDB on a CI node, the syntax highlighter will not be deactivated by LLDB and the output log is filled with color codes (unless the terminal emulator actually exposes itself as dumb). This patch now relies on the LLVM code for detecting color support which is more reliable. We now also correctly actually initialize the `m_supports_colors` variable in `File`. `m_supports_colors` was so far uninitialized, but the code path that uses `m_supports_colors` was also dead so the sanitizers didn't sound an alarm. The old check that compares `TERM` is not removed by this patch as the new LLVM code doesn't seem to handle this case (and it's a good thing to check for "dumb" terminals). Reviewers: aprantl, javed.absar Reviewed By: aprantl Subscribers: kristof.beyls, abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D51243 llvm-svn: 340747
* Remove manual byte counting from Opcode::DumpRaphael Isemann2018-08-201-13/+14
| | | | | | | | | | | | | | | | Summary: Stream now has byte-counting functionality, so let's use this instead of manual byte counting. Reviewers: clayborg, davide Reviewed By: davide Subscribers: davide, lldb-commits Differential Revision: https://reviews.llvm.org/D50677 llvm-svn: 340179
* Remove manual byte counting from Highlighter code.Raphael Isemann2018-08-142-20/+13
| | | | | | | | | | | | | | | | | | | | Summary: This removes the manual byte counting mechanism from the syntax highlighting code. This is no longer necessary as the Stream class now has built-in support for automatically counting the bytes that were written to it so far. The advantage of automatic byte counting via Stream is that it is less error-prone than the manual version and we need to write less boilerplate code. Reviewers: labath Reviewed By: labath Subscribers: labath, lldb-commits Differential Revision: https://reviews.llvm.org/D50676 llvm-svn: 339695
* Use a DenseMap for looking up functions by UID in CompileUnit::FindFunctionByUIDRaphael Isemann2018-08-111-6/+4
| | | | | | | | | | | | | | | | | | Summary: Instead of iterating over our vector of functions, we might as well use a map here to directly get the function we need. Thanks to Vedant for pointing this out. Reviewers: vsk Reviewed By: vsk Subscribers: mgrang, lldb-commits Differential Revision: https://reviews.llvm.org/D50225 llvm-svn: 339504
OpenPOWER on IntegriCloud