summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host
Commit message (Collapse)AuthorAgeFilesLines
...
* Correctly get the arguments and environment, even for processes that have a ↵Greg Clayton2015-07-201-9/+12
| | | | | | | | | | large amount or arguments and/or environment variables. We previously passed in a 8192 byte buffer but this wasn't large enough. We now calculate the size we need and then add 128 to it and get the environment. If we pass exactly the number of bytes it says is needs, the sysctl() returns junk. Adding 1 seemed to do the trick, but to err on the side of caution, I added a few bytes more. <rdar://problem/21883842> llvm-svn: 242729
* [Makefiles] Re-add OSX specific code that got lost in lldbHost consolidationKeno Fischer2015-07-171-1/+10
| | | | llvm-svn: 242577
* Implement FileSystem::GetPermissions for Windows. Differential Revision: ↵Adrian McCarthy2015-07-171-1/+19
| | | | | | http://reviews.llvm.org/D11303 llvm-svn: 242568
* freeaddrinfo(NULL) segfaults on Android.Chaoren Lin2015-07-171-2/+4
| | | | | | | | | | Reviewers: tberghammer Subscribers: tberghammer, danalbert, lldb-commits Differential Revision: http://reviews.llvm.org/D11285 llvm-svn: 242560
* [MainLoop] Fix assertion failurePavel Labath2015-07-171-2/+2
| | | | | | | | | Upon connection termination the waitable handle of an IOObject gets reset to an invalid handle. This caused a problem since we used the object->GetWaitableHandle as a key to the set of registered events. The fix is to use something more immutable as a key: we make a copy of the original waitable handle, instead of holding onto the IOObject. llvm-svn: 242515
* Add missing include for android-arm buildTamas Berghammer2015-07-161-0/+1
| | | | llvm-svn: 242396
* Revert "[NativeProcessLinux] Integrate MainLoop"Pavel Labath2015-07-161-2/+6
| | | | | | This seems to be causing major slowdows on the android buildbot. Reverting while I investigate. llvm-svn: 242391
* Use accept instead of accept4 for Android.Chaoren Lin2015-07-151-2/+19
| | | | | | | | | | | | | | | Summary: The accept4 syscall is missing on older ARM Android kernels, and the accept() call is implemented with the accept4 syscall, so we'll need to call the accept syscall directly. Reviewers: vharron, tberghammer, labath Subscribers: ovyalov, chaoren, labath, tberghammer, aemerson, lldb-commits Differential Revision: http://reviews.llvm.org/D10887 llvm-svn: 242319
* [NativeProcessLinux] Integrate MainLoopPavel Labath2015-07-151-6/+2
| | | | | | | | | | | | | | | | Summary: This commit integrates MainLoop into NativeProcessLinux. By registering a SIGCHLD handler with the llgs main loop, we can get rid of the special monitor thread in NPL, which saves as a lot of thread ping-pong when responding to client requests (e.g. qThreadInfo processing time has been reduced by about 40%). It also makes the code simpler, IMHO. Reviewers: ovyalov, clayborg, tberghammer, chaoren Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11150 llvm-svn: 242305
* [Makefiles] Align library names with CMake buildKeno Fischer2015-07-147-114/+23
| | | | | | | | | | | | Summary: This aligns the library names used by the Makefile build to be the same as those create by the CMake build to make switching between the two easier. The only major difficulty was lldbHost which was one library in the CMake system and several in the Makefile system. Most of the other changes are trivial renames. Reviewers: labath Subscribers: emaste, tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D11154 llvm-svn: 242196
* Refactor Unix signals.Chaoren Lin2015-07-143-38/+4
| | | | | | | | | | | | | | | | | | Summary: - Consolidate Unix signals selection in UnixSignals. - Make Unix signals available from platform. - Add jSignalsInfo packet to retrieve Unix signals from remote platform. - Get a copy of the platform signal for each remote process. - Update SB API for signals. - Update signal utility in test suite. Reviewers: ovyalov, clayborg Subscribers: chaoren, jingham, labath, emaste, tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D11094 llvm-svn: 242101
* Introduce a MainLoop class and switch llgs to use itPavel Labath2015-07-132-0/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first part of our effort to make llgs single threaded. Currently, llgs consists of about three threads and the synchronisation between them is a major source of latency when debugging linux and android applications. In order to be able to go single threaded, we must have the ability to listen for events from multiple sources (primarily, client commands coming over the network and debug events from the inferior) and perform necessary actions. For this reason I introduce the concept of a MainLoop. A main loop has the ability to register callback's which will be invoked upon receipt of certain events. MainLoopPosix has the ability to listen for file descriptors and signals. For the moment, I have merely made the GDBRemoteCommunicationServerLLGS class use MainLoop instead of waiting on the network socket directly, but the other threads still remain. In the followup patches I indend to migrate NativeProcessLinux to this class and remove the remaining threads. Reviewers: ovyalov, clayborg, amccarth, zturner, emaste Subscribers: tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D11066 llvm-svn: 242018
* Avoid going through Platform when creating a NativeProcessProtocol instancePavel Labath2015-07-091-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit avoids the Platform instance when spawning or attaching to a process in lldb-server. Instead, I have the server call a (static) method of NativeProcessProtocol directly. The reason for this is that I believe that NativeProcessProtocol should be decoupled from the Platform (after all, it always knows which platform it is running on, unlike the rest of lldb). Additionally, the kind of platform actions a NativeProcessProtocol instance is likely to differ greatly from the platform actions of the lldb client, so I think the separation makes sense. After this, the only dependency NativeProcessLinux has on PlatformLinux is the ResolveExecutable method, which needs additional refactoring. This is a resubmit of r241672, after it was reverted due to build failueres on non-linux platforms. Reviewers: ovyalov, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10996 llvm-svn: 241796
* Make the "lldb/Utility/JSON.h" able to parse JSON into tokens with the new ↵Greg Clayton2015-07-061-59/+83
| | | | | | | | | | JSONParser class. Change over existing code to use this new parser so StructuredData can use the tokenizer to parse JSON instead of doing it manually. This allowed us to easily parse JSON into JSON* objects as well as into StructuredData. llvm-svn: 241522
* Fix windows build.Ewan Crawford2015-06-301-34/+28
| | | | | | Windows build was broken in either r240983 or r240978 in the changes to FileSpec.cpp llvm-svn: 241071
* Add a missing headerPavel Labath2015-06-301-0/+1
| | | | llvm-svn: 241056
* Rewrite FileSpec::EnumerateDirectory to avoid code duplication.Chaoren Lin2015-06-291-197/+16
| | | | | | | | | | | | Reviewers: clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10811 llvm-svn: 240983
* Avoid a recursive function call that could run LLDB out of file descriptors ↵Greg Clayton2015-06-292-18/+226
| | | | | | | | | | | | | | | | | in FileSystem::DeleteDirectory(...). Fixes include: - use FileSystem::Unlink() instead of a direct call to ::unlink(...) when deleting files when iterating through the current directory - save directories from current directory in a list and iterate through those _after_ the current directory has been iterated - Use new FileSpec::ForEachItemInDirectory() instead of manually iterating across directories with opendir()/readdir()/closedir() We should switch all code over to using FileSpec::ForEachItemInDirectory(...) in the near future and get rid of FileSpec::EnumerateDirectory(). This is a follow up patch to: http://reviews.llvm.org/D10787 llvm-svn: 240978
* [linux] Use cmake to detect support process_vm_readv (bug #23918)Pavel Labath2015-06-293-9/+31
| | | | | | | | | | | | | | | | | | Summary: Some old linux versions do not have process_vm_readv function defined. Even older versions do not have even the __NR_process_vm_readv syscall number. We use cmake to detect these situations and fallback appropriately: in the first case, we can issue the syscall manually, while it the latter case, we need to drop fast memory read support completely. Test Plan: linux test suite passes Reviewers: ovyalov, Eugene.Zelenko Subscribers: tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D10727 llvm-svn: 240927
* Replace `rm -rf` with more portable implementation.Chaoren Lin2015-06-271-5/+20
| | | | | | | | | | Reviewers: clayborg, vharron Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10787 llvm-svn: 240895
* [LLDB][MIPS] MIPS32 branch emulation and single-steppingJaydeep Patil2015-06-231-0/+6
| | | | | | | | | | | | | | | SUMMARY: This patch implements 1. Emulation of MIPS32 branch instructions 2. Enable single-stepping for MIPS32 instructions 3. Correction in emulation of MIPS64 branch instructions with delay slot 4. Adjust breakpoint address when breakpoint is hit in a forbidden slot of compact branch instruction Reviewers: clayborg Subscribers: mohit.bhakkad, sagar, bhushan, lldb-commits, emaste, nitesh.jain Differential Revision: http://reviews.llvm.org/D10596 llvm-svn: 240373
* Fix a variety of typos.Bruce Mitchener2015-06-182-2/+2
| | | | | | No functional change. llvm-svn: 239995
* [NativeProcessLinux] Use fast memory reads, if the system supports itPavel Labath2015-06-171-1/+11
| | | | | | | | | | | | | | | | | | | | | | | Summary: Memory reads using the ptrace API need to be executed on a designated thread and in 4-byte increments. The process_vm_read syscall has no such requirements and it is about 50 times faster. This patch makes lldb-server use the faster API if the target kernel supports it. Kernel support for this feature is determined at runtime. Using process_vm_writev in the same manner is more complicated since this syscall (unlike ptrace) respects page protection settings and so it cannot be used to set a breakpoint, since code pages are typically read-only. However, memory writes are not currently a performance bottleneck as they happen much more rarely. Test Plan: all tests continue to pass Reviewers: ovyalov, vharron Subscribers: tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D10488 llvm-svn: 239924
* [LLDB][MIPS] Getting correct signals for MIPS HostMohit K. Bhakkad2015-06-101-3/+16
| | | | | | | | | | Patch by Nitesh Jain Reviewers: clayborg, ovyalov. Subscribers: jaydeep, bhushan, dsanders, mohit.bhakkad, sagar, labath, lldb-commits. Differential Revision: http://reviews.llvm.org/D10180 llvm-svn: 239463
* Rename `FileSpec::IsRelativeToCurrentWorkingDirectory` to `IsRelative`.Chaoren Lin2015-06-092-2/+8
| | | | | | | | | | | | | | | | | Summary: `IsRelativeToCurrentWorkingDirectory` was misleading, because relative paths are sometimes appended to other directories, not just the cwd. Plus, the new name is shorter. Also added `IsAbsolute` for completeness. Reviewers: clayborg, ovyalov Reviewed By: ovyalov Subscribers: tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D10262 llvm-svn: 239419
* Delegate path operations to FileSpec.Chaoren Lin2015-06-051-5/+44
| | | | | | | | | | | | | | | | | Summary: - Added PrependPathComponent utility functions to FileSpec. - Delegate path operations in ParseCompileUnit to FileSpec. - Delegate path operations in ParseSupportFiles to FileSpec. Reviewers: clayborg, vharron, ovyalov Reviewed By: ovyalov Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10253 llvm-svn: 239127
* Fix LLDB so that it can correctly track down dependent shared libraries that ↵Greg Clayton2015-06-021-0/+8
| | | | | | | | use @rpath. <rdar://problem/8371885> llvm-svn: 238886
* Change use of keyword 'or' to '||' as keyword not supported by visual ↵Aidan Dodds2015-06-021-2/+2
| | | | | | studio 2013. llvm-svn: 238819
* Don't close handle returned by _get_osfhandle.Oleksiy Vyalov2015-06-011-5/+0
| | | | | | http://reviews.llvm.org/D9931 llvm-svn: 238770
* Fix TestPaths.Chaoren Lin2015-06-011-2/+2
| | | | | | | | | | | | Reviewers: vharron, clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10164 llvm-svn: 238767
* Fix inferior's i/o connections to its console window on Windows 7.Adrian McCarthy2015-05-291-3/+3
| | | | llvm-svn: 238629
* Working directory FileSpec should use remote path syntax to display correctly.Chaoren Lin2015-05-291-0/+15
| | | | | | | | | | | | | | Summary: Depends on D9728. Reviewers: ovyalov, zturner, clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9806 llvm-svn: 238605
* Refactor many file functions to use FileSpec over strings.Chaoren Lin2015-05-2913-146/+167
| | | | | | | | | | | | | | | | | Summary: This should solve the issue of sending denormalized paths over gdb-remote if we stick to GetPath(false) in GDBRemoteCommunicationClient, and let the server handle any denormalization. Reviewers: ovyalov, zturner, vharron, clayborg Reviewed By: clayborg Subscribers: tberghammer, emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D9728 llvm-svn: 238604
* Implement snprintf for MSVC with correct return value.Chaoren Lin2015-05-291-2/+27
| | | | | | | | | | Reviewers: zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10048 llvm-svn: 238599
* Re-add #include "lldb-python.h" back in two places.Zachary Turner2015-05-292-0/+3
| | | | | | | Fixing these two instances will require some work, so for now I'm adding these 2 includes back to get the build working. llvm-svn: 238587
* Don't #include "lldb-python.h" from anywhere.Zachary Turner2015-05-292-4/+0
| | | | | | | | | | | | | Since interaction with the python interpreter is moving towards being more isolated, we won't be able to include this header from normal files anymore, all includes of it should be localized to the python library which will live under source/bindings/API/Python after a future patch. None of the files that were including this header actually depended on it anyway, so it was just a dead include in every single instance. llvm-svn: 238581
* Make FileSpec::Dump use FileSpec::GetPath(), not the other way around.Chaoren Lin2015-05-281-44/+62
| | | | | | | | | | | | | | | | | Summary: Fix FileSpec::Dump() to output denormalized path. See D9942 for previous discussions. Reviewers: zturner Reviewed By: zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10077 llvm-svn: 238440
* Improve LLDB prompt handlingPavel Labath2015-05-271-38/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There is an issue in lldb where the command prompt can appear at the wrong time. The partial fix we have in for this is not working all the time and is introducing unnecessary delays. This change does: - Change Process:SyncIOHandler to use integer start id's for synchronization to avoid it being confused by quick start-stop cycles. I picked this up from a suggested patch by Greg to lldb-dev. - coordinates printing of asynchronous text with the iohandlers. This is also based on a (different) Greg's patch, but I have added stronger synchronization to it to avoid races. Together, these changes solve the prompt problem for me on linux (both with and without libedit). I think they should behave similarly on Mac and FreeBSD and I think they will not make matters worse for windows. Test Plan: Prompt comes out alright. All tests still pass on linux. Reviewers: clayborg, emaste, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9823 llvm-svn: 238313
* Allow clients to get parsing errors and also fix the ApplePropertyList so it ↵Greg Clayton2015-05-271-2/+21
| | | | | | parses the structured data correctly. llvm-svn: 238280
* Modify the ApplePropertyList to be able to create StructuredData objects ↵Greg Clayton2015-05-261-0/+126
| | | | | | from the plist XML. llvm-svn: 238260
* Added XML to the host layer.Greg Clayton2015-05-262-0/+549
| | | | | | | | | | | | We know have on API we should use for all XML within LLDB in XML.h. This API will be easy back the XML parsing by different libraries in case libxml2 doesn't work on all platforms. It also allows the only place for #ifdef ...XML... to be in XML.h and XML.cpp. The API is designed so it will still compile with or without XML support and there is a static function "bool XMLDocument::XMLEnabled()" that can be called to see if XML is currently supported. All APIs will return errors, false, or nothing when XML isn't enabled. Converted all locations that used XML over to using the host XML implementation. Added target.xml support to debugserver. Extended the XML register format to work for LLDB by including extra attributes and elements where needed. This allows the target.xml to replace the qRegisterInfo packets and allows us to fetch all register info in a single packet. <rdar://problem/21090173> llvm-svn: 238224
* Fix compiler warnings regarding size_t not always being 64 bit in the printf.Greg Clayton2015-05-251-8/+8
| | | | llvm-svn: 238127
* Did some cleanup to stop us from leaking Pipe file descriptors.Greg Clayton2015-05-231-0/+3
| | | | | | | | | | The main issue was the Communication::Disconnect() was calling its Connection::Disconnect() but this wouldn't release the pipes that the ConnectionFileDescriptor was using. We also have someone that is holding a strong reference to the Process so that when you re-run, target replaces its m_process_sp, but it doesn't get destructed because someone has a strong reference to it. I need to track that down. But, even if we have a strong reference to the a process that is outstanding, we need to call Process::Finalize() to have it release as much of its resources as possible to avoid memory bloat. Removed the ProcessGDBRemote::SetExitStatus() override and replaced it with ProcessGDBRemote::DidExit(). Now we aren't leaking file descriptors and the stand alone test suite should run much better. llvm-svn: 238089
* Implement PlatformWindows::GetEnvironment.Zachary Turner2015-05-222-11/+18
| | | | | | | This fixes a couple of tests that rely on being able to get the host's environment or spawn an inferior with specific arguments. llvm-svn: 238042
* Only check for matching arch and UUID when looking for dsym in vincinity of ↵Robert Flack2015-05-211-4/+22
| | | | | | | | | | | | | | | | | executable. ModuleSpecs::FindMatchingModuleSpec looks for matching filenames but when looking for the dSYM we should only be looking for a matching architecture and and UUID. Jason pointed out this mistake in http://reviews.llvm.org/D9174 when this function was incorrectly converted to not be Mac specific. Test Plan: Running LLDB on test/lang/c/shared_lib_stripped_symbols/a.out in a debugger I've verified LocateDSYMInVincinityOfExecutable correctly locates the matching dSYM. Differential Revision: http://reviews.llvm.org/D9896 llvm-svn: 237907
* Remove trailing slash from dumping directory FileSpec.Chaoren Lin2015-05-191-3/+4
| | | | | | | | | | | | Reviewers: domipheus, ovyalov Reviewed By: ovyalov Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9862 llvm-svn: 237741
* This patch adds support for setting/clearing hardware watchpoints and ↵Omair Javaid2015-05-151-1/+1
| | | | | | | | breakpoints on AArch64 (Arm v8) 64-bit hardware. http://reviews.llvm.org/D9706 llvm-svn: 237419
* Don't bother dynamic loading the Windows Slim RW Lock API.Zachary Turner2015-05-141-215/+80
| | | | | | | | | | | | This API has been present since XP, and I think it's safe to drop support for XP (since other things have been introduced long ago which already don't work on XP anyway). With this patch, we can statically bind against the exports and not bother falling back to a CRITICAL_SECTION if we can't load the API. llvm-svn: 237402
* Fix an issue with finding python on Windows.Zachary Turner2015-05-131-2/+1
| | | | | | | | | | | | | Someone must have changed the behavior of FileSpec slightly relating to whether or not there is a trailing backslash when calling GetPath() and GetDirectory(). This caused ScriptInterpreterPython to find the wrong values when initializing sys.path, and as a result we couldn't find the lldb module. This patch fixes the issue, and also adds a test to make sure that GetDirectory() does not return a string containing a trailing slash. llvm-svn: 237282
* Fixed a ton of gcc compile warningsVince Harron2015-05-132-6/+6
| | | | | | | | | | Removed some unused variables, added some consts, changed some casts to const_cast. I don't think any of these changes are very controversial. Differential Revision: http://reviews.llvm.org/D9674 llvm-svn: 237218
OpenPOWER on IntegriCloud