summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
Commit message (Collapse)AuthorAgeFilesLines
* [lldb] [Process/NetBSD] Improve threading supportMichał Górny2019-11-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Implement major improvements to multithreaded program support. Notably, support tracking new and exited threads, associate signals and events with correct threads and support controlling individual threads when resuming. Firstly, use PT_SET_EVENT_MASK to enable reporting of created and exited threads via SIGTRAP. Handle TRAP_LWP events to keep track of the currently running threads. Secondly, update the signal (both generic and SIGTRAP) handling code to account for per-thread signals correctly. Signals delivered to the whole process are reported on all threads, while per-thread signals and events are reported only to the specific thread. The remaining threads are marked as 'stopped with no reason'. Note that NetBSD always stops all threads on debugger events. Thirdly, implement the ability to set every thread as running, stopped or single-stepping separately while continuing the process. This also provides the ability to send a signal to the whole process or to one of its thread while resuming. Differential Revision: https://reviews.llvm.org/D70022
* [lldb] [Process/NetBSD] Use PT_STOP to stop the process [NFCI]Michał Górny2019-11-121-0/+2
| | | | Differential Revision: https://reviews.llvm.org/D70060
* Revert "Revert "Implement xfer:libraries-svr4:read packet""Antonio Afonso2019-07-231-2/+2
| | | | | | This reverts commit 08c38f77c5fb4d3735ec215032fed8ee6730b3db. llvm-svn: 366847
* Revert "Implement xfer:libraries-svr4:read packet"Pavel Labath2019-07-011-2/+2
| | | | | | | | | | | | | | | | | | | D62502, together with D62503 have broken the builds which have XML support enabled. Reverting D62503 (r364355) fixed that, but has broken has left some of the tests introduced by D62502 broken more or less nondeternimistically (it depended on whether the system happens to place the library list near unreadable pages of memory). I attempted to make a partial fix for this in r364748, but Jan Kratochvil pointed out that this reintroduces the problem which reverting D62503 was trying to solve. So instead, I back out the whole thing so we can get back to a clean slate that works for everyone. We can figure out a way forward from there. This reverts r364748, r363772 and r363707. llvm-svn: 364751
* Implement xfer:libraries-svr4:read packetAntonio Afonso2019-06-181-2/+2
| | | | | | | | | | | | | | | | | | | Summary: This is the fourth patch to improve module loading in a series that started here (where I explain the motivation and solution): D62499 Implement the `xfer:libraries-svr4` packet by adding a new function that generates the list and then in Handle_xfer I generate the XML for it. The XML is really simple so I'm just using string concatenation because I believe it's more readable than having to deal with a DOM api. Reviewers: clayborg, xiaobai, labath Reviewed By: labath Subscribers: emaste, mgorny, srhines, krytarowski, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D62502 llvm-svn: 363707
* [NFC] Remove ASCII lines from commentsJonas Devlieghere2019-04-101-6/+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
* Bring Doxygen comment syntax in sync with LLVM coding style.Adrian Prantl2019-03-111-1/+1
| | | | | | This changes '@' prefix to '\'. llvm-svn: 355841
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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
* Pull FixupBreakpointPCAsNeeded into base classPavel Labath2018-10-031-1/+0
| | | | | | | | | | | | | | | | | Summary: This function existed (with identical code) in both NativeProcessLinux and NativeProcessNetBSD, and it is likely that it would be useful to any future implementation of NativeProcessProtocol. Therefore I move it to the base class. Reviewers: krytarowski Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D52719 llvm-svn: 343683
* Fix NetBSD build for r343409Pavel Labath2018-09-301-1/+0
| | | | | | Forgot to remove the method declaration from the header. llvm-svn: 343411
* NativeProcessProtocol: Sink ReadMemoryWithoutTrap into base classPavel Labath2018-09-131-3/+0
| | | | | | | | The two existing implementations have the function implemented identically, and there's no reason to believe that this would be different for other implementations. llvm-svn: 342167
* Re-commit "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"Pavel Labath2018-09-091-10/+0
| | | | | | | | | | | | | This recommits r341487, which was reverted due to failing tests with clang. It turned out I had incorrectly expected that the literal arrays passed to ArrayRef constructor will have static (permanent) storage. This was only the case with gcc, while clang was constructing them on stack, leading to dangling pointers when the function returns. The fix is to explicitly assign static storage duration to the opcode arrays. llvm-svn: 341758
* Revert "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"Pavel Labath2018-09-081-0/+10
| | | | | | | This reverts commit r341487. Jan Kratochvil reports it breaks LLDB when compiling with clang. llvm-svn: 341747
* Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcodePavel Labath2018-09-051-10/+0
| | | | | | | | | | | | return the opcode as a Expected<ArrayRef> instead of a Status+pointer+size combo. I also move the linux implementation to the base class, as the trap opcodes are likely to be the same for all/most implementations of the class (except the arm one, where linux chooses a different opcode than what the arm spec recommends, which I keep linux-specific). llvm-svn: 341487
* Enable AUTOBRIEF in doxygen configuration.Adrian Prantl2018-05-021-3/+3
| | | | | | | | | | | | | | This brings the LLDB configuration closer to LLVM's and removes visual clutter in the source code by removing the @brief commands from comments. This patch also reflows the paragraphs in all doxygen comments. See also https://reviews.llvm.org/D46290. Differential Revision: https://reviews.llvm.org/D46321 llvm-svn: 331373
* Fix netbsd, freebsd and osx builds for ArchSpec movePavel Labath2017-11-131-5/+1
| | | | llvm-svn: 318052
* Simplify NativeProcessProtocol::GetArchitecture/GetByteOrderPavel Labath2017-11-091-1/+1
| | | | | | | | | | | | | | | | | | | Summary: These functions used to return bool to signify whether they were able to retrieve the data. This is redundant because the ArchSpec and ByteOrder already have their own "invalid" states, *and* because both of the current implementations (linux, netbsd) can always provide a valid result. This allows us to simplify bits of the code handling these values. Reviewers: eugene, krytarowski Subscribers: javed.absar, lldb-commits Differential Revision: https://reviews.llvm.org/D39733 llvm-svn: 317779
* Remove shared_pointer from NativeThreadProtocolPavel Labath2017-10-171-1/+1
| | | | | | | | | | | | | | | | | | | 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
* Remove shared pointer from NativeProcessProtocolPavel Labath2017-07-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The usage of shared_from_this forces us to separate construction and initialization phases, because shared_from_this() is not available in the constructor (or destructor). The shared semantics are not necessary, as we always have a clear owner of the native process class (GDBRemoteCommunicationServerLLDB object). Even if we need shared semantics in the future (which I think we should strongly avoid), reverting this will not be necessary -- the owners can still easily store the native process object in a shared pointer if they really want to -- this just prevents the knowledge of that from leaking into the class implementation. After this a NativeThread object will hold a reference to the parent process (instead of a weak_ptr) -- having a process instance always available allows us to simplify some logic in this class (some of it was already simplified because we were asserting that the process is available, but this makes it obvious). Reviewers: krytarowski, eugene, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D35123 llvm-svn: 308282
* Add a NativeProcessProtocol Factory classPavel Labath2017-07-071-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This replaces the static functions used for creating NativeProcessProtocol instances with a factory pattern, and modernizes the interface of the new class in the process -- I use llvm::Expected instead of the Status+value combo. I also move some of the common code (like the Delegate registration into the base class). The new arrangement has multiple benefits: - it removes the NativeProcess*** dependency from Process/gdb-remote (which for example means that liblldb no longer pulls in this code). - it enables unit testing of the GDBRemoteCommunicationServerLLGS class (by providing a mock Native Process). - serves as another example on how to use the llvm::Expected class (I couldn't get rid of the Initialize-type functions completely here because of the use of shared_from_this, but that's the next thing on my list here) Tests still pass on Linux and I've made sure NetBSD compiles after this. Reviewers: zturner, eugene, krytarowski Subscribers: srhines, lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D33778 llvm-svn: 307390
* Add pretty-printer for wait(2) statuses and modernize the code handling themPavel Labath2017-06-191-1/+1
| | | | | | | | | | | | | | | Summary: A number of places were trying to decode the result of wait(). Add a simple utility function that does that and a struct that encapsulates the decoded result. Then also provide a pretty-printer for that class. Reviewers: zturner, krytarowski, eugene Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D33998 llvm-svn: 305689
* Correct compiler warnings and Debug build of the NetBSD targetKamil Rytarowski2017-05-241-0/+2
| | | | | | Correct files present only in the NetBSD build. llvm-svn: 303823
* Rename Error -> Status.Zachary Turner2017-05-121-33/+34
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* Battery of NetBSD support improvementsKamil Rytarowski2017-03-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Include initial support for: - single step mode (PT_STEP) - single step trap handling (TRAP_TRACE) - exec() trap (TRAP_EXEC) - add placeholder interfaces for FPR - initial code for NetBSD core(5) files - minor tweaks While there improve style of altered elf-core/ files. This code raises the number of passing tests on NetBSD to around 50% (600+/1200+). The introduced code is subject to improve afterwards for additional features and bug fixes. Sponsored by <The NetBSD Foundation> Reviewers: labath, joerg, emaste, kettenis Reviewed By: labath Subscribers: srhines, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D31450 llvm-svn: 299109
* Add support for tracing hello-world application on NetBSDKamil Rytarowski2017-03-281-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is a stripped down from features a NetBSD process code (patch is kept under 2k LOC). This code has assumption that there is only one thread within a debugged process. The only debugger trap supported is software breakpoint (TRAP_BRKPT). The generic platform code requires to add dummy function for watchpoints etc. These functions are currently empty. This code is not the final platform support as is and it's treated as a base to extend, refactor and address issues afterwards. Supported features: - handle software breakpoints, - correctly attach to a tracee, - support NetBSD specific ptrace(2), - monitor process termination, - monitor SIGTRAP events, - monitor SIGSTOP events, - monitor other signals events, - resume the whole process, - get memory region info perms, - read memory from tracee, - write memory to tracee, - read ELF AUXV, - x86_64 GPR read and write code For the generic framework include: - halt, - detach, - signal, - kill, - allocatememory, - deallocatememory, - update threads, - getarchitecture, - getfileloadaddress, - and others. This code has preliminary AddThread code. Out of interest in this patch: - exec() traps, - hardware debug register traps, - single step trap, - thread creation/termination trap, - process fork(2), vfork(2) and vfork(2) done traps, - syscall entry and exit trap, - threads, - FPR registers, - retrieving tracee's thread name, - non x86_64 support. This code can be used to start a hello world application and trace it. This code can be used by other BSD systems as a starting point to get similar capabilities. Sponsored by <The NetBSD Foundation> Reviewers: emaste, joerg, kettenis, labath Subscribers: mgorny, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D31374 llvm-svn: 298953
* Move FileSpec from Host -> Utility.Zachary Turner2017-03-221-1/+1
| | | | llvm-svn: 298536
* Add stub for PluginProcessNetBSDKamil Rytarowski2017-03-211-0/+49
Summary: This is the base for introduction of further features to support Process Tracing on NetBSD, in local and remote setup. This code is also a starting point to synchronize the development with other BSDs. Currently NetBSD is ahead and other systems can catch up. Sponsored by <The NetBSD Foundation> Reviewers: emaste, joerg, kettenis, labath Reviewed By: labath Subscribers: mgorny, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D31138 llvm-svn: 298408
OpenPOWER on IntegriCloud