summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source
Commit message (Collapse)AuthorAgeFilesLines
* Save more descriptive error msg from FBS/BKS, relay it up to lldb.Jason Molenda2020-01-081-20/+26
| | | | | | | | | | | | | | | | | | | When lldb requests an app launch through FrontBoard/BackBoard, we get back an NSError object if there was a problem with an integer error code and a descriptive text string. debugserver would log the descriptive text string to the console, but it would only save the error code value, ask for the much-less-specific name of that error code, and send that very generic error word back to lldb. This patch saves the longer description of the failure when available, and sends that to lldb. If unavailable, it falls back to sending up the generic description of the error code as it was doing before. This only impacts the iOS on-device debugserver. <rdar://problem/49953304>
* Rewrite comment about what watchpoints Aarch64 supports.Jason Molenda2020-01-071-21/+29
|
* [lldb][NFC] Use static_cast instead of reinterpret_cast where possibleRaphael Isemann2020-01-073-29/+31
| | | | | | | | | | | | | | Summary: There are a few places in LLDB where we do a `reinterpret_cast` for conversions that we could also do with `static_cast`. This patch moves all this code to `static_cast`. Reviewers: shafik, JDevlieghere, labath Reviewed By: labath Subscribers: arphaman, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D72161
* Upstream debugserver arm64e support.Jason Molenda2019-12-043-4/+117
| | | | | | | | | The changes are minor; primarily debugserver needs to go through accessor functions/macros when changing pc/fp/sp/lr, and debugserver needs to clear any existing pointer auth bits from values in two cases. debugserver can fetch the number of bits used for addressing from a sysctl, and will include that in the qHostInfo reply. Update qHostInfo documentation to document it.
* [debugserver] Set arch based on TARGET_TRIPLEVedant Kumar2019-11-201-4/+4
| | | | | | Use TARGET_TRIPLE instead of LLVM_DEFAULT_TARGET_TRIPLE, as the latter isn't exported by LLVMConfig.cmake, which means arch detection fails if lldb is built separately from llvm.
* [lldb] Fix JSON parser to allow empty arraysAlex Cameron2019-11-182-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=39405 ``` alexc@kitty:~/work/wiredtiger/build_posix$ cat breakpoint.json [{"Breakpoint" : {"BKPTOptions" : {"AutoContinue" : false,"ConditionText" : "","EnabledState" : true,"IgnoreCount" : 0,"OneShotState" : false},"BKPTResolver" : {"Options" : {"NameMask" : [56],"Offset" : 0,"SkipPrologue" : true,"SymbolNames" : ["__wt_btcur_search"]},"Type" : "SymbolName"},"Hardware" : false,"SearchFilter" : {"Options" : {},"Type" : "Unconstrained","Foo" : []}}}] ``` **Before** ``` (lldb) breakpoint read --file breakpoint.json error: Invalid JSON from input file: /home/alexc/work/wiredtiger/build_posix/breakpoint.json. ``` **After** ``` (lldb) breakpoint read --file breakpoint.json New breakpoints: Breakpoint 1: where = libwiredtiger-3.2.2.so`__wt_btcur_search + 15 at bt_cursor.c:522:5, address = 0x00007ffff576ab2f ``` Reviewers: xbolva00, davide, labath Reviewed By: davide, labath Subscribers: mgorny, jingham, labath, davide, JDevlieghere, lldb-commits Tags: #llvm, #lldb Differential Revision: https://reviews.llvm.org/D68179
* [lldb] Record framework build path and use it everywhereHaibo Huang2019-11-061-2/+1
| | | | This avoids config time dependencies on liblldb. And enables other refactoring.
* DebugServer: be more lenient about the target tripleSaleem Abdulrasool2019-10-301-1/+5
| | | | | | | When building standalone, `LLVM_DEFAULT_TARGET_TRIPLE` may be undefined. Matching against an empty string does not work as desired in CMake, so, fallback to the old behaviour, defaulting `LLDB_DEBUGSERVER_ARCH` to `CMAKE_OSX_ARCHITECTURES`.
* build: workaround stale caches (NFC)Saleem Abdulrasool2019-10-291-1/+1
| | | | | | | | `LLVM_DEFAULT_TARGET_TRIPLE` is a cached variable, which means that it may actually be unset. Furthermore, in standalone builds, the variable may be fully undefined. Apply the regular expression over the empty string in such a case. This should improve the state of the green dragon bot.
* [debugserver] Detect arch from LLVM_DEFAULT_TARGET_TRIPLEVedant Kumar2019-10-281-3/+17
| | | | | | | | | | | | | | | | The debugserver build needs to conditionally include files depending on the target architecture. Switch on the architecture specified by LLVM_DEFAULT_TARGET_TRIPLE, as the llvm and swift build systems use this variable to identify the target (the latter, indirectly, through LLVM_HOST_TRIPLE). It would be possible to switch on CMAKE_OSX_ARCHITECTURES, but the swift build does not provide it, preferring instead to pass arch-specific CFLAGS etc explicitly. Switching on LLVM_HOST_TRIPLE is also an option, but it breaks down when cross-compiling. Differential Revision: https://reviews.llvm.org/D69523
* Add arm64_32 support to lldb, an ILP32 codegen Jason Molenda2019-10-161-1/+2
| | | | | | | | | | that runs on arm64 ISA targets, specifically Apple watches. Differential Revision: https://reviews.llvm.org/D68858 llvm-svn: 375032
* Change debugserver to use the brk #0 for breakpoints.Jason Molenda2019-10-101-3/+1
| | | | | | | | | | debugserver had been using an instruction that would work for armv7 or aarch64 processes, but we don't have armv7 code running on arm64 devices any more so this is unnecessary. <rdar://problem/56133118> llvm-svn: 374264
* [debugserver] Include the correct header.Davide Italiano2019-10-071-1/+1
| | | | | | <rdar://problem/55916729> llvm-svn: 373957
* [debugserver] Don't link against Cocoa, it's not needed.Davide Italiano2019-10-041-2/+0
| | | | | | <rdar://problem/55916729> llvm-svn: 373795
* [lldb] Fix that 'ninja clean' breaks the build by deleting debugserver_vers.cRaphael Isemann2019-10-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We mark debugserver_vers.c as a generated file in CMake. This means that when we run `ninja clean` we end up deleting that file, but any following `ninja` invocation will fail due to the file missing. The file can't be generated as `ninja` doesn't know it has to rerun CMake to create the file. Turns out that marking the output of configure_file as generated is wrong as explained in this bug report: https://gitlab.kitware.com/cmake/cmake/issues/18032 This patch just removes that property. The only side effect of this seems to be that this file maybe shows up in your IDE when opening our CMake project, but that seems like a small sacrifice. This patch can be quickly tested by running `ninja clean ; ninja lldbDebugserverCommon`. Before this patch the build will fail due to debugserver_vers.c missing. Reviewers: JDevlieghere, labath Reviewed By: labath Subscribers: mgorny, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68376 llvm-svn: 373723
* [debugserver] Add --version/-V command line option to debugserver.Jonas Devlieghere2019-09-271-0/+11
| | | | | | | | | | | When not running under a TTY the output is buffered and not flushed before debugserver exits which makes it impossible to parse the version string. This adds a -V/--version command that just prints the version to stdout and exits with an exit code zero. Differential revision: https://reviews.llvm.org/D68156 llvm-svn: 373127
* [CMake] Copy over the system debugserver when using LLDB_USE_SYSTEM_DEBUGSERVERJonas Devlieghere2019-09-241-4/+2
| | | | | | | | | | | | | | | | r366433 broke support for the system debugserver. Although the change was well-intended, it (presumably) unintentionally removed the logic to copy over the debugserver. As a result, even with LLDB_USE_SYSTEM_DEBUGSERVER enabled, we ended up building, signing and using the just-built debugserver. This patch partially recovers the old behavior: when LLDB_USE_SYSTEM_DEBUGSERVER is set we don't build debugserver and just copy over the system one. Differential revision: https://reviews.llvm.org/D67991 llvm-svn: 372786
* Fix a thinko in handling the QSetLogging packet.Jim Ingham2019-09-101-3/+3
| | | | | | | The comparison against LOG_MEMORY shortcut all the LOG_MEMORY_* log channels. It has to come last. llvm-svn: 371560
* Upstream macCatalyst support in debugserver and the macOS dynamic loaderAdrian Prantl2019-09-041-9/+15
| | | | | | | | | | | plugin. Unfortunately the test is currently XFAILed because of missing changes to the clang driver. Differential Revision: https://reviews.llvm.org/D67124 llvm-svn: 370931
* Workaround TestConcurrentMany* flakiness in a more pricipled wayFrederic Riss2019-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | The flakiness on our local machines seems to come for a race in the kernel between task_suspend and the creation of the Mach exceptions for the threads that hit breakpoints. The debugserver code is written with the assumption that the kernel will be able to provide us with all the exceptions for a given task once task_suspend returns. On machines with higher core counts, this seems not to be the case. The first batch of exceptions we get after task_suspend does not contain exceptions for all the threads that have hit a breakpoint, thus they get misreprorted in the first stop packet. Adding a 1ms timeout to the call that retrieves the batch of exceptions seems to workaround the issue reliably on our machines, and it shoulnd't impact standard debugging scenarios too much (a stop will incur an additional 1ms delay). We'll be talking to the kernel team to figure out the right contract for those APIs. This patch also reverts part of Jonas' previous workaround for the issue (r370785). llvm-svn: 370916
* Send error message on failed attach from debugerserver.Jason Molenda2019-08-271-2/+18
| | | | | | | | | | | | Instead of using a magic return error code from debugserver to indicate that an attach failed because of SIP being enabled in RNBRemote::HandlePacket_v, use the extended error reporting that Pavel added to lldb/lldb-server in https://reviews.llvm.org/D45573 <rdar://problem/39398385> llvm-svn: 369990
* [debugserver] Switch back to std::once_flagJonas Devlieghere2019-08-221-1/+1
| | | | | | | We cannot use llvm::once_flag in debugserver because doesn't link against llvm. llvm-svn: 369621
* [lldb] Replace std::once_flag with llvm::once_flag.Davide Italiano2019-08-221-1/+1
| | | | | | | | | | | | | | | | Summary: The former seems like it's not working on some platforms. All the other uses use `llvm::`, so, let's change for consistency. Reviewers: jasonmolenda, friss Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D66566 llvm-svn: 369618
* [NFC] Return llvm::StringRef from StringExtractor::GetStringRef.Jonas Devlieghere2019-08-211-2/+0
| | | | | | | | | | This patch removes the two variant of StringExtractor::GetStringRef that return (non-)const references to std::string. The non-const one was being abused to reinitialize the StringExtractor and its uses are replaced by calls to the copy asignment operator. The const variant was refactored to return an actual llvm::StringRef. llvm-svn: 369493
* [NFC] Remove unused function GetHexWithFixedSizeJonas Devlieghere2019-08-212-31/+0
| | | | | | | | The implementation of this function was obviously incorrect, as the result variable was never used. This led me to check if it was actually used anywhere, which came back negative. llvm-svn: 369492
* [lldb][CMake] Workaround debugserver code-signing issue in generated Xcode ↵Stefan Granitz2019-08-071-0/+28
| | | | | | | | | | | | | | | | | | | | | project Summary: Explicitly code-sign the LLDB.framework copy of debugserver in the build-tree. This is necessary, because the Xcode-specific logic in `llvm_codesign` [1] has the side-effect that Xcode code-signs after post-build steps (here: after copying debugserver over into the framework). The special case for Xcode was necessary to avoid double-signing errors in the past (see D55116 and D55816). [1] https://github.com/llvm/llvm-project/blob/36fb93982f0e/llvm/cmake/modules/AddLLVM.cmake#L1676 Reviewers: jingham, davide, JDevlieghere, teemperor Reviewed By: JDevlieghere Subscribers: beanz, mgorny, lldb-commits, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D65566 llvm-svn: 368151
* Upstream a few small Apple changes to debugserver - arm64_32, CatalystJason Molenda2019-08-079-29/+170
| | | | | | | | | Adrian's changes to support Catalyst processes and my changes to support debugserver running on an arm64_32 device (Apple Watch Series 4, which uses an IPL32 model on arm64 cpus). llvm-svn: 368118
* [lldb] Configure debugserver_vers.c from CMakeStefan Granitz2019-07-242-0/+4
| | | | llvm-svn: 366932
* Remove Xcode project remnantsJonas Devlieghere2019-07-221-8/+0
| | | | llvm-svn: 366745
* [NFC] Remove indent after r366433Stefan Granitz2019-07-191-120/+118
| | | | llvm-svn: 366560
* [CMake] Always build debugserver on Darwin and allow tests to use the ↵Stefan Granitz2019-07-181-124/+61
| | | | | | | | | | | | | | | | | | | | | | | | system's one Summary: We can always build debugserver, but we can't always sign it to be useable for testing. `LLDB_USE_SYSTEM_DEBUGSERVER` should only tell whether or not the system debugserver should be used for testing. The old behavior complicated the logic around debugserver a lot. The new logic sorts out most of it. Please note that this patch is in early stage and needs some more testing. It should not affect platfroms other than Darwin. It builds on Davide's approach to validate the code-signing identity at configuration time. What do you think? Reviewers: xiaobai, JDevlieghere, davide, compnerd, friss, labath, mgorny, jasonmolenda Reviewed By: JDevlieghere Subscribers: lldb-commits, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D64806 llvm-svn: 366433
* [CMake] `install-distribution` for LLDB on DarwinStefan Granitz2019-07-101-12/+4
| | | | | | | | | | | | | | | | | | | | | Summary: There's a number of requirements for installing LLDB on macOS that are untypical for LLVM projects: use special install-prefix for LLDB.framework, ship headers and tools as framework resources, patch RPATHs, externalize debug-info to dSYM's and strip binaries with `-ST`. For some of it we could use `llvm_externalize_debuginfo()` in the past and just add special cases. However, this complicates the code for all projects and comes with the major drawback, that it adds all these actions at build-time, i.e. dSYM creation and stripping take a lot of time and don't make sense at build-time. LLVM's distribution mechanism (https://llvm.org/docs/BuildingADistribution.html) appears to be the natural candidate to install LLDB. Based on D64399 (enable in standalone builds), this patch integrates framework installation with the distribution mechanism and adds custom stripping flags and dSYM creation at install-time. Unlike the abandoned D61952, it leaves build-tree binaries untouched, so there's no side-effects on testing. Potential install-order issues must be handled externally. Please let me know what you think, while I run a few more tests and add remarks+documentation. Reviewers: xiaobai, compnerd, JDevlieghere, davide, labath, mgorny Reviewed By: xiaobai, JDevlieghere Subscribers: lldb-commits, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D64408 llvm-svn: 365617
* [CMake] Check that a certificate for lldb is present at build time.Davide Italiano2019-06-251-0/+15
| | | | | | | | | | | | Reviewers: JDevlieghere, sgraenitz, aprantl, friss Subscribers: mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D63745 llvm-svn: 364334
* [CMake] Two extra FOLDER properties for debugserverStefan Granitz2019-06-121-0/+4
| | | | llvm-svn: 363171
* [CMake] LLDB.framework tools handlingStefan Granitz2019-05-291-0/+4
| | | | | | | | | | | | | | | | | | | | Summary: Modify the way LLDB.framework tools are collected. This allows for better fine-tuning of the install behavior downstream. Each target calls `lldb_add_to_framework()` individually. When entering the function, the target exists and we can tweak its very own post-build and install steps. This was not possible with the old `LLDB_FRAMEWORK_TOOLS` approach. No function change otherwise. This is a reduced follow-up from the proposal in D61952. Reviewers: xiaobai, compnerd, JDevlieghere Reviewed By: JDevlieghere Subscribers: clayborg, friss, ki.stfu, mgorny, lldb-commits, labath, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D62472 llvm-svn: 361946
* [CMake] Folder structure for generated Xcode project to cover more targetsStefan Granitz2019-05-283-0/+5
| | | | llvm-svn: 361799
* Fix integer literals which are cast to boolJonas Devlieghere2019-05-246-11/+11
| | | | | | | | | This change replaces built-in types that are implicitly converted to booleans. Differential revision: https://reviews.llvm.org/D62284 llvm-svn: 361580
* [NFC] Add blank line (test commit)J. Ryan Stinnett2019-05-231-0/+1
| | | | llvm-svn: 361555
* Delete unnecessary copy ctorsFangrui Song2019-05-222-18/+0
| | | | llvm-svn: 361358
* Replace assert with static_assert here applicable.Jonas Devlieghere2019-05-151-1/+1
| | | | | | | Replaces assert() with static_assert() if the condition is can be evaluated at compile time. llvm-svn: 360753
* Mark private unimplemented functions as deletedJonas Devlieghere2019-05-156-14/+10
| | | | | | | Applies modernize-use-equals-delete to the LLDB code base and removes the now redundant comments. llvm-svn: 360751
* typedef enum -> enumFangrui Song2019-05-1412-29/+29
| | | | | | | | Reviewed By: labath Differential Revision: https://reviews.llvm.org/D61883 llvm-svn: 360654
* Fix file names in file headers. NFCFangrui Song2019-05-136-6/+6
| | | | llvm-svn: 360554
* [debugserver] Relax the codesigning identity checkFrederic Riss2019-04-161-11/+7
| | | | | | | | | | | | | In an effort to help new LLDB developers, we added checks and messaging around the selection of your codesigning identity on macOS. While helpful, it is not actually correct. It's perfectly valid to codesign with an identity that is not named lldb_codesign. Currently this fails the build. This patch keeps a warning that informs developers how to setup lldb_codesign and how to pass it to cmake, but it allows the build to proceed with a different identity. llvm-svn: 358525
* [NFC] Remove ASCII lines from commentsJonas Devlieghere2019-04-1037-331/+0
| | | | | | | | | | | | | | | | | | | | | | | A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
* Change the logging on ptrace(PT_KILL) in MachProcess::Kill to logJason Molenda2019-03-201-3/+5
| | | | | | | | if LOG_PROCESS is enabled or if there was an error making that call. <rdar://problem/49036508> llvm-svn: 356626
* Bring Doxygen comment syntax in sync with LLVM coding style.Adrian Prantl2019-03-113-6/+6
| | | | | | This changes '@' prefix to '\'. llvm-svn: 355841
* [debugserver] Fix IsUserReady thread filteringFrederic Riss2019-03-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In 2010 (r118866), filtering code was added to debugserver to avoid reporting threads that were "not ready to be displayed to the user". This code inspects the thread's state and discards threads marked 'uninterruptible'. Turns out, this state is pretty common and not only a characterisitic of 'user-readiness'. This filtering was tracked down as the source of the flakiness of TestQueues and TestConcurrent* with the symptom of missing threads. We discussed with the kernel team and there should be no need for us to filter the restult of task_threads(). Everything that is returned from there can be examined. So I went on and tried to remove the filtering completely. This produces other test failures, where we were reporting more theads than expected. Always threads that had been terminated, but weren't removed from the task bookkeeping structures yet. Those threads always had a PC of 0. This patch changes the heuristic to make the filtering a little less strict and only rejects threads that are 'uninteruptible' *and* have a PC of 0. This has proven to be solid in my testing. Reviewers: jasonmolenda, clayborg, jingham Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D58912 llvm-svn: 355555
* Update com.apple.diagnosticd.diagnostic entitlementJason Molenda2019-03-012-2/+2
| | | | | | | | name to the newer com.apple.private.logging.diagnostic. <rdar://problem/47183116> llvm-svn: 355170
* One more fix while I'm looking at this - remove the Jason Molenda2019-02-181-7/+1
| | | | | | | | | unused IsSBProcess method, and have IsFBSProcess return false if we don't have API that we can use to make that determination, so we'll try other API if we can. llvm-svn: 354289
OpenPOWER on IntegriCloud