summaryrefslogtreecommitdiffstats
path: root/lldb/source
Commit message (Collapse)AuthorAgeFilesLines
* Add data formatter for libc++ std::queuePavel Labath2017-11-014-0/+74
| | | | | | | | | | | | | | Summary: std::queue is just a fancy wrapper around another container, so all we need to do is to delegate to the it. Reviewers: jingham, EricWF Subscribers: srhines, mgorny, lldb-commits, eugene Differential Revision: https://reviews.llvm.org/D35666 llvm-svn: 317099
* Add data formatter for libc++ std::tuplePavel Labath2017-11-014-0/+91
| | | | | | | | | | Reviewers: jingham, EricWF Subscribers: srhines, eugene, lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D35615 llvm-svn: 317095
* Remove uint32_t assignment operator from StatusPavel Labath2017-11-011-10/+0
| | | | | | | | | | | | | | | | Summary: It is not presently used, and it's quite dangerous to use -- it assumes the integer is an osx kern_return_t, but very few of the integers we have lying around are mach kernel error codes. The error can still be used to a mach error using a slightly longer (but more explicit) syntax. Reviewers: jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D35305 llvm-svn: 317093
* Fix LLVM_LINK_LLVM_DYLIB build (pr35053)Pavel Labath2017-10-312-8/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: r316368 broke this build when it introduced a reference to a pthread function to the Utility module. This caused cmake to generate an incorrect link line (wrong order of libs) because it did not see the dependency from Utility to the system libraries. Instead these libraries were being manually added to each final target. This changes moves the dependency management from the individual targets to the lldbUtility module, which is consistent with how llvm does it. The final targets will pick up these libraries as they will be a part of the link interface of the module. Technically, some of these dependencies could go into the host module, as that's where most of the os-specific code is, but I did not try to investigate which ones. Reviewers: zturner, sylvestre.ledru Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D39246 llvm-svn: 316997
* Increase AdbClient read timeoutPavel Labath2017-10-311-1/+1
| | | | | | | | The previous value was not sufficient for Pixel 2 phones. One would have hoped that the newer phones are faster, but that does not seem to be the case here. llvm-svn: 316993
* Add data formatter for libc++'s forward_listPavel Labath2017-10-313-85/+183
| | | | | | | | | | | | | | | Summary: This adds a data formatter for the implementation of forward_list in libc++. I've refactored the existing std::list data formatter a bit to enable more sharing of code (mainly the loop detection stuff). Reviewers: jingham, EricWF Subscribers: srhines, eugene, lldb-commits Differential Revision: https://reviews.llvm.org/D35556 llvm-svn: 316992
* Fix mac build broken in r316987Pavel Labath2017-10-311-1/+1
| | | | | | Forgot one occurence of ArchSpec::SetTriple in mac-specific code. llvm-svn: 316990
* Invert ArchSpec<->Platform dependencyPavel Labath2017-10-3111-112/+70
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: ArchSpec::SetTriple was taking a Platform as an argument, and used it to fill in missing pieces of the specified triple. I invert the dependency by moving this code to other classes. For this purpose, I've created three new functions. - HostInfo::GetAugmentedArchSpec: fills in the triple using the host platform (this used to be implemented by passing a null platform pointer). By putting this code in the Host module, we can provide a way to anyone who does not have a platform instance (lldb-server) an easy way to get Host data. - Platform::GetAugmentedArchSpec: if you have a platform instance, you can call this to let it fill in the triple. - static Platform::GetAugmentedArchSpec: implements the "if platform == 0 then use_host() else use_platform()" part. Reviewers: zturner, jingham, clayborg Subscribers: mgorny, javed.absar, lldb-commits Differential Revision: https://reviews.llvm.org/D39387 llvm-svn: 316987
* Remove a stray space.Jim Ingham2017-10-301-1/+1
| | | | llvm-svn: 316954
* Fix windows build broken in r316915Pavel Labath2017-10-301-1/+0
| | | | | | I accidentally left a linux-specific include in generic code. llvm-svn: 316919
* MainLoop: work around an android libc bugPavel Labath2017-10-301-6/+26
| | | | | | | | | | | | | Versions of android before kitkat implemented pselect non-atomically, which caused flakyness, as we were relying on it atomically setting the signal mask to implement waiting for signals. This patch implements a direct call to the the pselect kernel syscall, which does not suffer from this problem. The code itself is not very pretty, but fortunately the uglyness is contained in the android version of the MainLoop::RunImpl::Poll function. llvm-svn: 316915
* Add specific ppc64le hardware watchpoint handlerPavel Labath2017-10-273-10/+318
| | | | | | | | | | | | | | | Summary: Add hardware watchpoint funcionality for ppc64le Reviewers: clayborg, zturner Reviewed By: clayborg Subscribers: eugene, clayborg, zturner, lbianc, gut, nemanjai, alexandreyy, kbarton, lldb-commits Differential Revision: https://reviews.llvm.org/D38897 Patch by Ana Julia Caetano <ana.caetano@eldorado.org.br> llvm-svn: 316772
* Fix a use-after-free in lldb-serverPavel Labath2017-10-271-2/+3
| | | | | | | | UriParser::Parse is returning a StringRef pointing the the parsed string, but we were calling it with a temporary string. Change this to a local variable to make sure the string persists as long as we need it. llvm-svn: 316740
* Allow SysV-i386 ABI on everything other than Apple targetsStephane Sezer2017-10-261-5/+6
| | | | | | | | | | | | | | Summary: This matches other SysV ABIs that are different on Apple and non-Apple targets, like `ABISysV_arm.cpp` for instance. Reviewers: clayborg, emaste Subscribers: aemerson, kristof.beyls, lldb-commits Differential Revision: https://reviews.llvm.org/D39335 llvm-svn: 316673
* Move StopInfoOverride callback to the new architecture pluginPavel Labath2017-10-2511-157/+285
| | | | | | | | | | | | | | | This creates a new Architecture plugin and moves the stop info override callback to this place. The motivation for this is to remove complex dependencies from the ArchSpec class because it is used in a lot of places that (should) know nothing about Process instances and StopInfo objects. I also add a test for the functionality covered by the override callback. Differential Revision: https://reviews.llvm.org/D31172 llvm-svn: 316609
* Fix a compile warning on linuxStephane Sezer2017-10-241-1/+1
| | | | | | | Can't cast directly between a pointer to function and a pointer to object. llvm-svn: 316533
* Allow ObjectFilePECOFF to initialize with ARM binaries.Stephane Sezer2017-10-241-0/+5
| | | | | | | | | | | | | | Summary: This is required to start debugging WinPhone ARM targets. Reviewers: compnerd, zturner, omjavaid Reviewed By: compnerd Subscribers: jasonmolenda, aemerson, rengolin, lldb-commits Differential Revision: https://reviews.llvm.org/D19604 llvm-svn: 316532
* [FreeBSD] Remove more dead code. NFCI.Davide Italiano2017-10-241-26/+0
| | | | llvm-svn: 316530
* [ExpressionParser] Garbage-collect dead code. NFCI.Davide Italiano2017-10-241-9/+0
| | | | llvm-svn: 316529
* Remove some unused function calls from ClangUserExpression.cppStephane Sezer2017-10-241-1/+0
| | | | llvm-svn: 316527
* Remove some dead code from ClangExpressionDeclMap.cppStephane Sezer2017-10-241-47/+3
| | | | llvm-svn: 316526
* [Symbol] Remove dead code. NFCI.Davide Italiano2017-10-231-23/+0
| | | | llvm-svn: 316390
* Logging: Disable logging after fork()Pavel Labath2017-10-234-6/+18
| | | | | | | | | | | | | | | | | | | | | | | Summary: We had a bug where if we had forked (in the ProcessLauncherPosixFork) while another thread was writing a log message, we would deadlock. This happened because the fork child inherited the locked log rwmutex, which would never get unlocked. This meant the child got stuck trying to disable all log channels. The bug existed for a while but only started being apparent after D37930, which started using ThreadLauncher (which uses logging) instead of std::thread (which does not) for launching TaskPool threads. The fix is to use pthread_atfork to disable logging in the forked child. Reviewers: zturner, eugene, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D38938 llvm-svn: 316368
* Revert "Logging: Make sure logging machinery is in a consistent state after ↵Pavel Labath2017-10-203-20/+2
| | | | | | | | | | | | | | forking" The pthread_atfork trick breaks on android, because pthread_rwlock_unlock detects that it is not the same thread which locked the lock. This means that the subsequent lock attempt will still deadlock (only this time it happens deterministically instead of at random). Reverting to find a better solution. This reverts commit r316173. llvm-svn: 316231
* Logging: Make sure logging machinery is in a consistent state after forkingPavel Labath2017-10-193-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | Summary: We had a bug where if we had forked (in the ProcessLauncherPosixFork) while another thread was writing a log message, we would deadlock. This happened because the fork child inherited the locked log rwmutex, which would never get unlocked. This meant the child got stuck trying to disable all log channels. The bug existed for a while but only started being apparent after D37930, which started using ThreadLauncher (which uses logging) instead of std::thread (which does not) for launching TaskPool threads. The fix is to use pthread_atfork to make sure noone is writing a log message while we are forking. Reviewers: zturner, eugene, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D38938 llvm-svn: 316173
* Silence some "implicit conversion of string literal" warningsPavel Labath2017-10-172-7/+7
| | | | llvm-svn: 316038
* Remove shared_pointer from NativeThreadProtocolPavel Labath2017-10-178-281/+208
| | | | | | | | | | | | | | | | | | | Summary: The NativeThread class is useless without the containing process (and in some places it is already assuming the process is always around). This makes it clear that the NativeProcessProtocol is the object owning the threads, and makes the destruction order deterministic (first threads, then process). The NativeProcess is the only thing holding a thread unique_ptr, and methods that used to hand out thread shared pointers now return raw pointers or references. Reviewers: krytarowski, eugene Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D35618 llvm-svn: 316007
* Reverting r315966 - it caused a build failure on an ubuntu x android bot.Jason Molenda2017-10-176-284/+18
| | | | llvm-svn: 315967
* Committing this for Larry D'Anna:Jason Molenda2017-10-176-18/+284
| | | | | | | | | | | This patch adds support for passing an arbitrary python stream (anything inheriting from IOBase) to SetOutputFileHandle or SetErrorFileHandle. Differential revision: https://reviews.llvm.org/D38829 <rdar://problem/34870417> llvm-svn: 315966
* Add cases for new type DependentAddressSpace, added in r314649Ted Woodward2017-10-111-0/+9
| | | | llvm-svn: 315524
* Fix dumping of characters with non-standard sizesPetr Pavlu2017-10-112-72/+46
| | | | | | | | | | | | | | | | * Prevent dumping of characters in DumpDataExtractor() with item_byte_size bigger than 8 bytes. This case is not supported by the code and results in a crash because the code calls DataExtractor::GetMaxU64Bitfield() -> GetMaxU64() that asserts for byte size > 8 bytes. * Teach DataExtractor::GetMaxU64(), GetMaxU32(), GetMaxS64() and GetMaxU64_unchecked() how to handle byte sizes that are not a multiple of 2. This allows DumpDataExtractor() to dump characters and booleans with item_byte_size in the interval of [1, 8] bytes. Values that are not a multiple of 2 would previously result in a crash because they were not handled by GetMaxU64(). llvm-svn: 315444
* [lldb] Enable using out-of-tree dwpsAlexander Shaposhnikov2017-10-102-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously LLDB required the DWP file to be located next to the executable file. This diff uses the helper function Symbols::LocateExecutableSymbolFile to search for DWP files in the standard locations for debug symbols. Test plan: Build a toy test example: main.cpp clang -gsplit-dwarf -g -O0 main.cpp -o main.exe llvm-dwp -e main.exe -o main.exe.dwp mkdir -p debug_symbols mv main.exe.dwp debug_symbols/main.exe.dwp Run lldb: lldb settings set target.debug-file-search-paths ./debug_symbols file ./main.exe br set --name f run Check that debugging works: setting breakpoints, printing local variables. Differential revision: https://reviews.llvm.org/D38568 llvm-svn: 315387
* Support: Have directory_iterator::status() return ↵Peter Collingbourne2017-10-102-10/+10
| | | | | | | | | | | | | | | | | | FindFirstFileEx/FindNextFile results on Windows. This allows clients to avoid an unnecessary fs::status() call on each directory entry. Because the information returned by FindFirstFileEx is a subset of the information returned by a regular status() call, I needed to extract a base class from file_status that contains only that information. On my machine, this reduces the time required to enumerate a ThinLTO cache directory containing 520k files from almost 4 minutes to less than 2 seconds. Differential Revision: https://reviews.llvm.org/D38716 llvm-svn: 315378
* Update ABISysV_arm64::RegisterIsVolatile to accept registers prefixed with rStephane Sezer2017-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: While the specification says that the 64bit registers are prefixed with `x`, it seems that many people still use `r`. Until recently, we had been using the `r` prefix instead of the `x` prefix in ds2. This caused lldb to fail during unwinding. I think it's reasonable to check for a register prefixed with `r`, since some people still choose to use `r`. Reviewers: sas, fjricci, clayborg Reviewed By: sas, clayborg Subscribers: aemerson, javed.absar, kristof.beyls Differential Revision: https://reviews.llvm.org/D38376 Change by Alex Langford <apl@fb.com> llvm-svn: 315221
* [DWARFDIE] Rewrite `operator !=` using `operator ==`. NFCI.Davide Italiano2017-10-091-1/+1
| | | | llvm-svn: 315200
* [SymbolFile/DWARF] Simplify two functions. NFCI.Davide Italiano2017-10-091-8/+2
| | | | llvm-svn: 315199
* Implement interactive command interruptionLeonard Mosescu2017-10-054-15/+103
| | | | | | | | | | | | | | | | | | | The core of this change is the new CommandInterpreter::m_command_state, which models the state transitions for interactive commands, including an "interrupted" state transition. In general, command interruption requires cooperation from the code executing the command, which needs to poll for interruption requests through CommandInterpreter::WasInterrupted(). CommandInterpreter::PrintCommandOutput() implements an optionally interruptible printing of the command output, which for large outputs was likely the longest blocking part. (ex. target modules dump symtab on a complex binary could take 10+ minutes) Differential Revision: https://reviews.llvm.org/D37923 llvm-svn: 315037
* Enable breakpoints and read/write GPRs for ppc64leEugene Zemtsov2017-10-0513-2/+766
| | | | | | | | | | | | Add support for ppc64le to create breakpoints and read/write general purpose registers. Other features for ppc64le and functions to read/write other registers are being implemented. Patch by Alexandre Yukio Yamashita (alexandreyy) Differential Revision: https://reviews.llvm.org/D38323 llvm-svn: 315008
* [lldb] Fix initialization of m_debug_cu_index_mapAlexander Shaposhnikov2017-10-032-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | SymbolFileDWARFDwp contains m_debug_cu_index_map which was previously initialized incorrectly: before m_debug_cu_index.parse is called m_debug_cu_index is empty, thus the map was not actually getting populated properly. This diff moves this step into a private helper method and calls it after m_debug_cu_index.parse inside SymbolFileDWARFDwp::Create. Test plan: Build a toy test example main.cpp clang -gsplit-dwarf -g -O0 main.cpp -o main.exe llvm-dwp -e main.exe -o main.exe.dwp Build LLDB with ENABLE_DEBUG_PRINTF set. Run: lldb -- ./main.exe Check that the indexes are now correct (before this change they were empty) Check that debugging works (setting breakpoints, printing local variables (this was not working before)) Differential revision: http://reviews.llvm.org/D38492 llvm-svn: 314832
* Improve FreeBSD kernel debuggingEd Maste2017-10-028-51/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FreeBSD kernel modules are actually relocatable (.o) ELF files and this previously caused some issues for LLDB. This change addresses these when using lldb to symbolicate FreeBSD kernel backtraces. The major problems: - Relocations were not being applied to the DWARF debug info despite there being code to do this. Several issues prevented it from working: - Relocations are computed at the same time as the symbol table, but in the case of split debug files, symbol table parsing always redirects to the primary object file, meaning that relocations would never be applied in the debug file. - There's actually no guarantee that the symbol table has been parsed yet when trying to parse debug information. - When actually applying relocations, it will segfault because the object files are not mapped with MAP_PRIVATE and PROT_WRITE. - LLDB returned invalid results when performing ordinary address-to- symbol resolution. It turned out that the addresses specified in the section headers were all 0, so LLDB believed all the sections had overlapping "file addresses" and would sometimes return a symbol from the wrong section. Patch by Brian Koropoff Differential Revision: https://reviews.llvm.org/D38142 llvm-svn: 314672
* [ExpressionParser] Prefer isa<> to dyn_cast<>. NFCI.Davide Italiano2017-09-301-2/+1
| | | | | | The result type is unused anyway. llvm-svn: 314602
* Fix compilation errorEugene Zemtsov2017-09-292-15/+15
| | | | llvm-svn: 314487
* [Expression parser] Setting to enable use of ExternalASTMergerSean Callanan2017-09-2810-114/+563
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This setting can be enabled like this at the target level: (lldb) settings set target.experimental.use-modern-type-lookup true This causes several new behaviors in the Clang expression parser: - It completely disables use of ClangASTImporter. None are created at all, and all users of it are now conditionalized on its presence. - It instead constructs a per-expression ExternalASTMerger, which exists inside Clang and contains much of the type completion logic that hitherto lived in ExternalASTSource, ClangExpressionDeclMap, and ClangASTImporter. - The expression parser uses this Merger as a backend for copying and completing types. - It also constructs a persistent ExternalASTMerger which is connected to the Target's persistent AST context. This is a major chunk of LLDB functionality moved into Clang. It can be tested in two ways: 1. For an individual debug session, enable the setting before running a target. 2. For the testsuite, change the option to be default-true. This is done in Target.cpp's g_experimental_properties. The testsuite is not yet clean with this, so I have not committed that switch. I have filed a Bugzilla for extending the testsuite to allow custom settings for all tests: https://bugs.llvm.org/show_bug.cgi?id=34771 I have also filed a Bugzilla for fixing the remaining testsuite failures with this setting enabled: https://bugs.llvm.org/show_bug.cgi?id=34772 llvm-svn: 314458
* Revert patch r313904, as it breaks "command source" and in Jim Ingham2017-09-284-90/+14
| | | | | | | | | | | | particular causes lldb to die on startup if you have a ~/.lldbinit file. I filed: https://bugs.llvm.org/show_bug.cgi?id=34758 to cover fixing the bug. llvm-svn: 314371
* Update the Objective-C runtime interface code to handle objc objectsJason Molenda2017-09-274-12/+180
| | | | | | | | whose isa is an index instead of a pointer. Currently, this type of isa encoding is only used on watchos. <rdar://problem/34675497> llvm-svn: 314343
* Update ABIMacOSX_arm::PrepareTrivialCall to correctly align theJason Molenda2017-09-271-4/+5
| | | | | | | | | stack pointer for apple's armv7 ABI. When in a frameless function or in a prologue/epilogue where sp wasn't properly aligned, we could try to make function calls with an unaligned sp; the expression would crash. llvm-svn: 314265
* [Expression Parser] Inhibit global lookups for symbols in the IR dynamic checksSean Callanan2017-09-264-105/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The IR dynamic checks are self-contained functions whose job is to - verify that pointers referenced in an expression are valid at runtime; and - verify that selectors sent to Objective-C objects by an expression are actually supported by that object. These dynamic checks forward-declare all the functions they use and should not require any external debug information. The way they ensure this is by marking all the names they use with a dollar sign ($). The expression parser recognizes such symbols and perform no lookups for them. This patch fixes three issues surrounding the use of the dollar sign: - to fix a MIPS issue, the name of the pointer checker was changed from starting with $ to starting with _$, but this was not properly ignored; and - the Objective-C object checker used a temporary variable that did not start with $. - the Objective-C object checker used an externally-defined struct (struct objc_selector) but didn't need to. The patch also implements some cleanup in the area: - it reformats the string containing the Objective-C object checker, which was mangled horribly when the code was transformed to a uniform width of 80 columns, and - it factors out the logic for ignoring global $-symbols into common code shared between ClangASTSource and ClangExpressionDeclMap. Differential Revision: https://reviews.llvm.org/D38153 llvm-svn: 314225
* Use socketpair on all Unix platformsEugene Zemtsov2017-09-251-3/+3
| | | | | | | | | | | | | Using TCP sockets is insecure against local attackers, and possibly against remote attackers too (some vulnerabilities may allow tricking a browser to make a request to localhost). Use socketpair (which is immune to such attacks) on all Unix platforms. Patch by Demi Marie Obenour < demiobenour@gmail.com > Differential Revision: https://reviews.llvm.org/D33213 llvm-svn: 314127
* Implement trampoline step-through for Windows-x86.Stephane Sezer2017-09-221-1/+43
| | | | | | | | | | | | | | | | | | Summary: This is required to be able to step through calls to external functions that are not properly marked with __declspec(dllimport). When a call like this is emitted, the linker will inject a trampoline to produce an indirect call through the IAT. Reviewers: zturner, jingham Reviewed By: jingham Subscribers: sas, jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D22231 llvm-svn: 314045
* [LLDB] Implement interactive command interruptionAdrian McCarthy2017-09-214-14/+90
| | | | | | | | | | | | | | | | | | | | | The core of this change is the new CommandInterpreter::m_command_state, which models the state transitions for interactive commands, including an "interrupted" state transition. In general, command interruption requires cooperation from the code executing the command, which needs to poll for interruption requests through CommandInterpreter::WasInterrupted(). CommandInterpreter::PrintCommandOutput() implements an optionally interruptible printing of the command output, which for large outputs was likely the longest blocking part. (ex. target modules dump symtab on a complex binary could take 10+ minutes) patch by lemo Differential Revision: https://reviews.llvm.org/D37923 llvm-svn: 313904
OpenPOWER on IntegriCloud