summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/MacOSX
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-041-4/+92
| | | | | | | | | 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.
* 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
* 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
* 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
* [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
* Upstream a few small Apple changes to debugserver - arm64_32, CatalystJason Molenda2019-08-075-26/+115
| | | | | | | | | 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
* [CMake] Folder structure for generated Xcode project to cover more targetsStefan Granitz2019-05-282-0/+4
| | | | llvm-svn: 361799
* Fix integer literals which are cast to boolJonas Devlieghere2019-05-241-1/+1
| | | | | | | | | This change replaces built-in types that are implicitly converted to booleans. Differential revision: https://reviews.llvm.org/D62284 llvm-svn: 361580
* 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-151-2/+2
| | | | | | | Applies modernize-use-equals-delete to the LLDB code base and removes the now redundant comments. llvm-svn: 360751
* typedef enum -> enumFangrui Song2019-05-145-14/+14
| | | | | | | | 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
* [NFC] Remove ASCII lines from commentsJonas Devlieghere2019-04-1018-79/+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-111-2/+2
| | | | | | 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
* 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
* Ah, misunderstood Jonas' feedback - fix this so we'llJason Molenda2019-02-181-1/+2
| | | | | | | do the right thing when both API are available. We want to try both of them if the first one fails. llvm-svn: 354288
* Clean up an unused variable warning when building this forJason Molenda2019-02-181-0/+4
| | | | | | mac native. llvm-svn: 354287
* Add some unconditional logging on the failure points when attachingJason Molenda2019-02-153-42/+69
| | | | | | | | | | | | | | to a process so we'll always get messages in the console logs. Also make the "is frontboard process" / "is backboard process" determination lazy, specifically take it out of the MachProcess::AttachForDebug codepath when we are attaching to a process, to simplify attaching. <rdar://problem/47982516> <rdar://problem/48060134> llvm-svn: 354181
* Replace 'ap' with 'up' suffix in variable names. (NFC)Jonas Devlieghere2019-02-132-28/+28
| | | | | | | | | | | | | | | | | The `ap` suffix is a remnant of lldb's former use of auto pointers, before they got deprecated. Although all their uses were replaced by unique pointers, some variables still carried the suffix. In r353795 I removed another auto_ptr remnant, namely redundant calls to ::get for unique_pointers. Jim justly noted that this is a good opportunity to clean up the variable names as well. I went over all the changes to ensure my find-and-replace didn't have any undesired side-effects. I hope I didn't miss any, but if you end up at this commit doing a git blame on a weirdly named variable, please know that the change was unintentional. llvm-svn: 353912
* Use std::make_shared in LLDB (NFC)Jonas Devlieghere2019-02-112-8/+11
| | | | | | | | | | | Unlike std::make_unique, which is only available since C++14, std::make_shared is available since C++11. Not only is std::make_shared a lot more readable compared to ::reset(new), it also performs a single heap allocation for the object and control block. Differential revision: https://reviews.llvm.org/D57990 llvm-svn: 353764
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1957-228/+171
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Simplify Boolean expressionsJonas Devlieghere2018-12-156-24/+14
| | | | | | | | | | | This patch simplifies boolean expressions acorss LLDB. It was generated using clang-tidy with the following command: run-clang-tidy.py -checks='-*,readability-simplify-boolean-expr' -format -fix $PWD Differential revision: https://reviews.llvm.org/D55584 llvm-svn: 349215
* Remove header grouping comments.Jonas Devlieghere2018-11-111-4/+0
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Enable listening for EXC_RESOURCE events, and format machJason Molenda2018-11-101-19/+36
| | | | | | | | | | | | | | | | | | | | event as a thread stop reason if we receive one, using some macros to decode the payload. Patch originally written by Fred Riss, with a few small changes by myself. Writing a test for this is a little tricky because the mach exception data interpretation relies on header macros or function calls - it may change over time and writing a gdb_remote_client test for this would break as older encoding interpretation is changed. I'll tak with Fred about this more, but neither of us has been thrilled with the kind of tests we could write for it. <rdar://problem/13097323>, <rdar://problem/40144456> llvm-svn: 346571
* Re-instate a bit of code that was commented out in r188246 whichJason Molenda2018-09-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | reads an ObjectFileMachO's string table in one chunk. Originally this was commented out because binaries in the system's shared cache all share a mega-string table and so reading the entire mega-strtab for each binary was a performance problem. In the reinstated code, I add a check that the binary we're reading from memory is not in the shared cache (there isn't a constant in <mach-o/loader.h> for this bit yet; we hardcode the value in one other place in ObjectFileMachO alread). For binaries that we're reading out of memory that are NOT in the shared cache, reading the string table in one chunk is a big performance improvement. Also have debugserver send up the flags value for binaries in its response to the jGetLoadedDynamicLibrariesInfos request. NFC. <rdar://problem/33604496> llvm-svn: 341511
* Add support for PLATFORM_*SIMULATORFrederic Riss2018-06-151-0/+8
| | | | | | | | | | The toolchain in Xcode 10 uses a new LC_BUILD_VERSION entry to identify simulator binaries. Add support for reading those to debugserver. The exisitng test testing that code is currently failling when run with Xcode 10, no need for a new test. llvm-svn: 334784
* 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
* [debugserver] Fix the G packet handling.Frederic Riss2018-04-271-1/+3
| | | | | | Of course r331004 needed a counterpart on the write side. llvm-svn: 331073
* [debugserver] Fix handling of the 'g' packetFrederic Riss2018-04-271-1/+3
| | | | | | | | | | | | | | LLDB doesn't use this packet so we never hit this, but it looks like some other projects talk to debugserver and are hitting an assert (https://github.com/derekparker/delve/issues/1015). We had an off by 1 in the accounting of the FPU structure sizes. I added a test that basically just check that 'g' doesn't return an error (currently it assert in debug builds). I didn't make it an lldb-server test because it looks like lldb-server doesn't implement the g packet. llvm-svn: 331004
* [debugserver] Return 'ios' instead of 'iphoneos' for the ostype.Frederic Riss2018-04-251-2/+2
| | | | | | | | | | | | | When I merged the 2 codepaths that return an OS type, I hade checked that the places accepting 'iphoneos' would also accept 'ios', but then I got it backwards and return 'iphoneos'. We use this value to build triples, and there 'iphoneos' is invalid. This also makes the test slightly simpler. llvm-svn: 330877
* [debugserver] Fix LC_BUILD_VERSION load command handling.Frederic Riss2018-04-062-81/+77
| | | | | | | | | | | | | | | | | | | | | | Summary: In one of the 2 places the LC_BUILD_VERSION load command is handled, there is a bug preventing us from actually handling them (the address where to read the load command was not updated). This patch factors reading the deployment target load commands into a helper and adds testing for the 2 code paths calling the helper. The testing is a little bit complicated because the only times those load commands matter is when debugging a simulator process. I added a new decorator to check that a specific SDK is available. The actual testing was fairly easy once I knew how to run a simulated process. Reviewers: jasonmolenda, labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D45298 llvm-svn: 329374
* Prevent double release of mach portsFrederic Riss2018-03-291-2/+0
| | | | | | | | | | | | | | | | Summary: When a MIG routine returns KERN_FAILURE, the demux function will release any OOL resources like ports. In this case, task_port and thread_port will be released twice, potentially resulting in use after free of the ports. I don't think we can test this in any useful way rdar://problem/37331387 Reviewers: jasonmolenda Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D45011 llvm-svn: 328761
* Upstreaming avx512 register support in debugserver. These changesJason Molenda2018-03-067-22/+1148
| | | | | | | | | | | | | | | | | | | were originally written by Chris Bieneman, they've undergone a number of changes since then. Also including the debugserver bridgeos support, another arm environment that runs Darwin akin to ios. These codepaths are activated when running in a bridgeos environment which we're not set up to test today. There's additional (small) lldb changes to handle bridgeos binaries that still need to be merged up. Tested on a darwin system with avx512 hardware and without. <rdar://problem/36424951> llvm-svn: 326756
* Add ability to collect memory limit.Han Ming Ong2018-02-283-6/+30
| | | | | | | | Reviewer: Jason Molenda <rdar://problem/37686560> llvm-svn: 326374
* Removed accidentally committed code from previous commit.Han Ming Ong2018-02-271-5/+1
| | | | llvm-svn: 326214
* Got rid of weak imports of libpenergy and libpsample because we are already ↵Han Ming Ong2018-02-271-3/+5
| | | | | | | requiring a modern macOS (at least 10.11) Reviewer: Jason Molenda llvm-svn: 326213
* Delete dead code in MachVMMemory.cpp, NFCVedant Kumar2018-02-241-36/+0
| | | | | | This addresses a compiler warning. llvm-svn: 326002
* Make use of physical footprint as memory measurement.Han Ming Ong2018-02-013-336/+18
| | | | | | | | | | | | Remove obsolete measurements. This check in requires at least 10.11 Reviewed: Jason Molenda, Jim Ingham <rdar://problem/37047106> Xcode Memory gauge should show the jetsam ledger footprint rather than anonymous llvm-svn: 324013
* Change uses of strncpy in debugserver to strlcpyJason Molenda2017-12-091-5/+5
| | | | | | | | for better safety. <rdar://problem/32906923> llvm-svn: 320242
OpenPOWER on IntegriCloud