summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
Commit message (Collapse)AuthorAgeFilesLines
...
* Support nwere versions of the Segger J-Link jtag board software.Jason Molenda2018-10-232-1/+18
| | | | | | | | | | | | | | | | | | | | | | Add support in ProcessGDBRemote::GetGDBServerRegisterInfo for recognizing a generic "arm" architecture that will be used if nothing better is available so that we don't ignore the register definitions if we didn't already have an architecture set. Also in ProcessGDBRemote::DoConnectRemote don't set the target arch unless we have a valid architecture to set it to. Platform::ConnectProcess will try to get the current target's architecture, or the default architecture, when creating the target for the connection to be attempted. If lldb was started with a target binary, we want to create this target with that architecture in case the remote gdb stub doesn't supply a qHostInfo arch. Add logging to Target::MergeArchitecture. <rdar://problem/34916465> llvm-svn: 345106
* Change the default handling for SIGPIPE to pass/,no-stop/no-notify.Jim Ingham2018-10-121-1/+1
| | | | | | | | | Most of the time SIGPIPE is just annoying, and so we should pass it on silently it by default. <rdar://problem/39359145> llvm-svn: 344418
* Adding support to step into the callable wrapped by libc++ std::functionShafik Yaghmour2018-10-122-1/+84
| | | | | | | | rdar://problem/14365983 Differential Revision: https://reviews.llvm.org/D52851 llvm-svn: 344371
* Add support for artificial tail call framesVedant Kumar2018-10-053-31/+234
| | | | | | | | | | | | | | | | 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
* Replace pointer to C-array of PropertyDefinition with llvm::ArrayRefTatyana Krasnukha2018-09-274-10/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D52572 llvm-svn: 343181
* [target] Fix typo and give bool a default valueJonas Devlieghere2018-09-271-5/+5
| | | | | | This addresses Stella's review feedback in D51859. llvm-svn: 343180
* Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer ↵Tatyana Krasnukha2018-09-264-133/+134
| | | | | | | | llvm::ArrayRef Differential Revision: https://reviews.llvm.org/D49017 llvm-svn: 343130
* Change the unwinder to not use a hard-coded limit on theJason Molenda2018-09-251-1/+10
| | | | | | | | | | max number of stack frames to backtrace, make it a setting, target.process.thread.max-backtrace-depth. Add a test case for the setting. <rdar://problem/28759559> llvm-svn: 343029
* Move architecture-specific address adjustment to architecture pluginsTatyana Krasnukha2018-09-211-236/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D48623 llvm-svn: 342762
* Refactor FindVariable() core functionality into StackFrame out of SBFrameShafik Yaghmour2018-09-201-0/+35
| | | | | | | | | | rdar://problem/14365983 Patch by Shafik Yaghmour Differential Revision: https://reviews.llvm.org/D52247 llvm-svn: 342663
* [NFC] Turn "load dependent files" boolean into an enumJonas Devlieghere2018-09-204-16/+29
| | | | | | | | | | | | | | 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
* Add a "scripted" breakpoint type to lldb.Jim Ingham2018-09-131-0/+45
| | | | | | | | | | 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
* Remove another unused mislayered include.Benjamin Kramer2018-09-121-1/+0
| | | | llvm-svn: 342047
* Remove unused include that's also a layering violation.Benjamin Kramer2018-09-121-1/+0
| | | | llvm-svn: 342046
* Refactoring std::function formatter to move core functionality into ↵Shafik Yaghmour2018-09-111-0/+224
| | | | | | | | | | CPPLanguageRuntime Patch by Shafik Yaghmour. Differential Revision: https://reviews.llvm.org/D51896 llvm-svn: 341991
* NFC: Move Searcher::Depth into lldb-enumerations as SearchDepth.Jim Ingham2018-09-071-2/+2
| | | | | | | | 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
* Support setting a breakpoint by FileSpec+Line+Column in the SBAPI.Adrian Prantl2018-08-301-3/+3
| | | | | | | | | | | | 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
* Don't cancel the current IOHandler when we push a handler for an utility ↵Raphael Isemann2018-08-291-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Respect platform sysroot when loading core filesPavel Labath2018-08-281-10/+29
| | | | | | | Patch by Eugene Birukov <eugenebi@microsoft.com> Differential Revision: https://reviews.llvm.org/D49685 llvm-svn: 340841
* [StackFrame] Add more clarifying comments to StackFrameList (NFC)Vedant Kumar2018-08-071-3/+3
| | | | llvm-svn: 339205
* Misc module/dwarf logging improvementsLeonard Mosescu2018-08-071-3/+3
| | | | | | | | | | | | | | This change improves the logging for the lldb.module category to note a few interesting cases: 1. Local object file found, but specs not matching 2. Local object file not found, using a placeholder module The handling and logging for the cases wehre we fail to load compressed dwarf symbols is also improved. Differential Revision: https://reviews.llvm.org/D50274 llvm-svn: 339161
* Move RegisterValue,Scalar,State from Core to UtilityPavel Labath2018-08-0712-13/+13
| | | | | | | | | | | | | These three classes have no external dependencies, but they are used from various low-level APIs. Moving them down to Utility improves overall code layering (although it still does not break any particular dependency completely). The XCode project will need to be updated after this change. Differential Revision: https://reviews.llvm.org/D49740 llvm-svn: 339127
* Add support for ARM and ARM64 breakpad generated minidump files (version 2).Greg Clayton2018-08-061-1/+21
| | | | | | | | | | | | | | | | In this patch I add support for ARM and ARM64 break pad files. There are two flavors of ARM: Apple where FP is R7, and non Apple where FP is R11. Added minimal tests that load up ARM64 and the two flavors or ARM core files with a single thread and known register values in each register. Each register is checked for the exact value. This is a fixed version of: https://reviews.llvm.org/D49750 The changes from D49750 are: Don't init the m_arch in the Initialize call as a system info isn't required. This keeps the thread list, module list and other tests from failing Added -Wextended-offsetof to Xcode project so we catch use extended usages of offsetof before submission Fixed any extended offset of warnings Differential Revision: https://reviews.llvm.org/D50336 llvm-svn: 339032
* Revert "Add support for ARM and ARM64 breakpad generated minidump files"Pavel Labath2018-08-031-21/+1
| | | | | | | | This reverts commit r338734 (and subsequent fixups in r338772 and r338746), because it breaks some minidump unit tests and introduces a lot of compiler warnings. llvm-svn: 338828
* Add support for ARM and ARM64 breakpad generated minidump filesGreg Clayton2018-08-021-1/+21
| | | | | | | | In this patch I add support for ARM and ARM64 break pad files. There are two flavors of ARM: Apple where FP is R7, and non Apple where FP is R11. Added minimal tests that load up ARM64 and the two flavors or ARM core files with a single thread and known register values in each register. Each register is checked for the exact value. Differential Revision: https://reviews.llvm.org/D49750 llvm-svn: 338734
* [LLDB] Added syntax highlighting supportRaphael Isemann2018-08-021-0/+32
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds syntax highlighting support to LLDB. When enabled (and lldb is allowed to use colors), printed source code is annotated with the ANSI color escape sequences. So far we have only one highlighter which is based on Clang and is responsible for all languages that are supported by Clang. It essentially just runs the raw lexer over the input and then surrounds the specific tokens with the configured escape sequences. Reviewers: zturner, davide Reviewed By: davide Subscribers: labath, teemperor, llvm-commits, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D49334 llvm-svn: 338662
* [StackFrame] Add doxygen comments to the StackFrameList API (NFC)Vedant Kumar2018-08-011-19/+1
| | | | | | | | | Clarify how StackFrameList works by documenting its methods. Also, delete some dead code and insert some TODOs. Differential Revision: https://reviews.llvm.org/D50087 llvm-svn: 338590
* [StackFrame] Use early returns in ResetCurrentInlinedDepth (NFC)Vedant Kumar2018-08-011-116/+108
| | | | | | | Using early returns in this function substantially reduces the nesting level, making the logic easier to understand. llvm-svn: 338589
* [StackFrame] Factor GetOnlyConcreteFramesUpTo out of GetFramesUpTo (NFC)Vedant Kumar2018-08-011-163/+166
| | | | | | | | Splitting GetOnlyConcreteFramesUpTo will make it easier to implement support for synthetic tail call frames in backtraces. This is just a prep change, no functionality is affected. llvm-svn: 338588
* Move dumping code out of RegisterValue classPavel Labath2018-07-242-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The dump function was the only part of this class which depended on high-level functionality. This was due to the DumpDataExtractor function, which uses info from a running target to control dump format (although, RegisterValue doesn't really use the high-level part of DumpDataExtractor). This patch follows the same approach done for the DataExtractor class, and extracts the dumping code into a separate function/file. This file can stay in the higher level code, while the RegisterValue class and anything that does not depend in dumping can stay go to lower layers. The XCode project will need to be updated after this patch. Reviewers: zturner, jingham, clayborg Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D48351 llvm-svn: 337832
* Add a way to load an image using a library name and list of paths.Jim Ingham2018-06-281-5/+24
| | | | | | | | | | This provides an efficient (at least on Posix platforms) way to offload to the target process the search & loading of a library when all we have are the library name and a set of potential candidate locations. <rdar://problem/40905971> llvm-svn: 335912
* Add missing constness.Tatyana Krasnukha2018-06-272-2/+2
| | | | llvm-svn: 335711
* The Process class ivar ivar was changed to a weak pointer, but was still _sp.Jim Ingham2018-06-261-2/+2
| | | | | | Fix that to _wp. llvm-svn: 335689
* Change AddressClass type from 'enum' to 'enum class'.Tatyana Krasnukha2018-06-265-31/+31
| | | | | | If we have a function with signature f(addr_t, AddressClass), it is easy to muddle up the order of arguments without any warnings from compiler. 'enum class' prevents passing integer in place of AddressClass and vice versa. llvm-svn: 335599
* Use llvm::VersionTuple instead of manual version marshallingPavel Labath2018-06-181-39/+22
| | | | | | | | | | | | | | | | | | Summary: This has multiple advantages: - we need only one function argument/instance variable instead of three - no need to default initialize variables - no custom parsing code - VersionTuple has comparison operators, which makes version comparisons much simpler Reviewers: zturner, friss, clayborg, jingham Subscribers: emaste, lldb-commits Differential Revision: https://reviews.llvm.org/D47889 llvm-svn: 334950
* [FileSpec] Make style argument mandatory for SetFile. NFCJonas Devlieghere2018-06-133-5/+7
| | | | | | | | | | | | | | | | SetFile has an optional style argument which defaulted to the native style. This patch makes that argument mandatory so clients of the FileSpec class are forced to think about the correct syntax. At the same time this introduces a (protected) convenience method to update the file from within the FileSpec class that keeps the current style. These two changes together prevent a potential pitfall where the style might be forgotten, leading to the path being updated and the style unintentionally being changed to the host style. llvm-svn: 334663
* Fix/unify the spelling of Objective-C.Adrian Prantl2018-06-131-1/+1
| | | | llvm-svn: 334614
* [lldb, process] Fix occasional hang when launching a process in LLDBStella Stamenova2018-06-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Occasionally, when launching a process in lldb (especially on windows, but not limited to), lldb will hang before the process is launched and it will never recover. This happens because the timing of the processing of the state changes can be slightly different. The state changes that are issued are: 1) SetPublicState(eStateLaunching) 2) SetPrivateState(eStateLaunching) 3) SetPublicState(eStateStopped) 4) SetPrivateState(eStateStopped) What we expect to see is: public state: launching -> launching -> stopped private state: launching -> stopped What we see is: public state: launching -> stopped -> launching private state: launching -> stopped The second launching change to the public state is issued when WaitForProcessStopPrivate calls HandlePrivateEvent on the event which was created when the private state was set to launching. HandlePrivateEvent has logic to determine whether to broadcase the event and a launching event is *always* broadcast. At the same time, when the stopped event is processed by WaitForProcessStopPrivate next, the function exists and that event is never broadcast, so the public state remains as launching. HandlePrivateEvent does two things: determine whether there's a next action as well as determine whether to broadcast the event that was processed. There's only ever a next action set if we are trying to attach to a process, but WaitForProcessStopPrivate is only ever called when we are launching a process or connecting remotely, so the first part of HandlePrivateEvent (handling the next action) is irrelevant for WaitForProcessStopPrivate. As far as broadcasting the event is concerned, since we are handling state changes that already occurred to the public state (and are now duplicated in the private state), I believe the broadcast step is unnecessary also (and in fact, it causes the hang). This change removes the call to HandlePrivateEvent from inside WaitForProcessStopPrivate. Incidentally, there was also a bug filed recently that is the same issue: https://bugs.llvm.org/show_bug.cgi?id=37496 Reviewers: asmith, labath, zturner, jingham Reviewed By: zturner, jingham Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47609 llvm-svn: 333781
* [lldb-test] Add a testing harness for the JIT's IRMemoryMapVedant Kumar2018-05-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This teaches lldb-test how to launch a process, set up an IRMemoryMap, and issue memory allocations in the target process through the map. This makes it possible to test IRMemoryMap in a targeted way. This has uncovered two bugs so far. The first bug is that Malloc performs an adjustment on the pointer returned from AllocateMemory (for alignment purposes) which ultimately allows overlapping memory regions to be created. The second bug is that after most of the address space on the host side is exhausted, Malloc may return the same address multiple times. These bugs (and hopefully more!) can be uncovered and tested for with targeted lldb-test commands. At an even higher level, the motivation for addressing these bugs is that they can lead to strange user-visible failures (e.g, variables assume the wrong value during expression evaluation, or the debugger crashes). See my third comment on this swift-lldb PR for an example: https://github.com/apple/swift-lldb/pull/652 I hope lldb-test is the right place to add this testing harness. Setting up a gtest-style unit test proved too cumbersome (you need to recreate or mock way too much debugger state), as did writing end-to-end tests (it's hard to write a test that actually hits a buggy path). With lldb-test, it's easy to read/generate the test input and parse the test output. I'll attach a simple "fuzz" tester which generates failing test cases to the Phab review. Here's an example: ``` Command: malloc(size=1024, alignment=32) Malloc: address = 0xca000 Command: malloc(size=64, alignment=16) Malloc: address = 0xca400 Command: malloc(size=1024, alignment=16) Malloc: address = 0xca440 Command: malloc(size=16, alignment=8) Malloc: address = 0xca840 Command: malloc(size=2048, alignment=16) Malloc: address = 0xcb000 Command: malloc(size=64, alignment=32) Malloc: address = 0xca860 Command: malloc(size=1024, alignment=16) Malloc: address = 0xca890 Malloc error: overlapping allocation detected, previous allocation at [0xca860, 0xca8a0) ``` {F6288839} Differential Revision: https://reviews.llvm.org/D47508 llvm-svn: 333583
* Typo fixes.Bruce Mitchener2018-05-291-2/+2
| | | | | | | | | | Reviewers: javed.absar Subscribers: ki.stfu, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D47421 llvm-svn: 333399
* Fix format stringBenjamin Kramer2018-05-251-1/+1
| | | | | | | PRIx64 already has the x inside, so this was creating a nonsensical format string. llvm-svn: 333273
* pc's should be printed in hex...Jim Ingham2018-05-241-1/+1
| | | | llvm-svn: 333208
* Normalize some lldb #include statements.James Y Knight2018-05-221-2/+0
| | | | | | | | | | | Most non-local includes of header files living under lldb/sources/ were specified with the full path starting after sources/. However, in a few instances, other sub-directories were added to include paths, or Normalize those few instances to follow the style used by the rest of the codebase, to make it easier to understand. llvm-svn: 333035
* Work around some odd instruction single-step behavior on macOS.Jim Ingham2018-05-221-21/+47
| | | | | | | | | | | | | | | | | | | | | We've seen some cases on macOS where you go to instruction single step (over a breakpoint), and single step returns but the instruction hasn't been executed (and the pc hasn't moved.) The ThreadPlanStepOverBreakpoint used to handle this case by accident, but the patches to handle two adjacent breakpoints broke that accident. This patch fixes the logic of ExplainsStop to explicitly handle the case where the pc didn't move. It also adds a WillPop that re-enables the breakpoint we were stepping over. We never want an unexpected path through the plan to fool us into not doing that. I have no idea how to make this bug happen. It is very inconsistent when it occurs IRL. We really need a full MockProcess Plugin before we can start to write tests for this sort of system hiccup. <rdar://problem/38505726> llvm-svn: 332922
* Fix PathMappingList for relative and empty paths after recent FileSpec ↵Greg Clayton2018-05-212-47/+57
| | | | | | | | | | | | | | | | | | normalization changes PathMappingList was broken for relative and empty paths after normalization changes in FileSpec. There were also no tests for PathMappingList so I added those. Changes include: Change PathMappingList::ReverseRemapPath() to take FileSpec objects instead of ConstString. The only client of this was doing work to convert to and from ConstString objects for no reason. Normalize all paths prefix and replacements that are added to the PathMappingList vector so they match the paths that have been already normalized in the debug info Unify code in the two forms of PathMappingList::RemapPath() so only one contains the actual functionality. Prior to this, there were two versions of this code. Use FileSpec::AppendPathComponent() and remove a long standing TODO so paths are correctly appended to each other. Added tests for absolute, relative and empty paths. Differential Revision: https://reviews.llvm.org/D47021 llvm-svn: 332842
* Reapply "Remove Process references from the Host module"Pavel Labath2018-05-151-0/+7
| | | | | | This re-lands r332250/D46395, after fixing Mac build errors. llvm-svn: 332353
* Revert "Remove Process references from the Host module"Pavel Labath2018-05-141-7/+0
| | | | | | | | | | The first fix wasn't enough, there is still a missing ProcessInstanceInfo include in Host.mm. I won't be able to test a fix before leaving work, so I am reverting both commits. This reverts commit r332250 and the subsequent fix attempt. llvm-svn: 332261
* Remove Process references from the Host modulePavel Labath2018-05-141-0/+7
| | | | | | | | | | | | | | | | | | | | | The Process class was only being referenced because of the last-ditch effort in the process launchers to set a process death callback in case one isn't set already. Although launching a process for debugging is the most important kind of "launch" we are doing, it is by far not the only one, so assuming this particular callback is the one to be used is not a good idea (besides breaking layering). Instead of assuming a particular exit callback, I change the launcher code to require the callback to be set by the user (and fix up the two call sites which did not set the callback already). Reviewers: jingham, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D46395 llvm-svn: 332250
* Add a lock to PlatformPOSIX::DoLoadImageFrederic Riss2018-05-111-7/+5
| | | | | | | | | | | | | | Summary: Multiple threads could be calling into DoLoadImage concurrently, only one should be allowed to create the UtilityFunction. Reviewers: jingham Subscribers: emaste, lldb-commits Differential Revision: https://reviews.llvm.org/D46733 llvm-svn: 332115
* Convert all RunShellCommand functions to use the Timeout classPavel Labath2018-05-101-4/+2
| | | | | | | this completes the Timeout migration started in r331880 with the Predicate class. llvm-svn: 331970
OpenPOWER on IntegriCloud