summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add -Wimplicit-fallthrough command line option to clang inJason Molenda2016-02-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | the xcode project file to catch switch statements that have a case that falls through unintentionally. Define LLVM_FALLTHROUGH to indicate instances where a case has code and intends to fall through. This should be in llvm/Support/Compiler.h; Peter Collingbourne originally checked in there (r237766), then reverted (r237941) because he didn't have time to mark up all the 'case' statements that were intended to fall through. I put together a patch to get this back in llvm http://reviews.llvm.org/D17063 but it hasn't been approved in the past week. I added a new lldb-private-defines.h to hold the definition for now. Every place in lldb where there is a comment that the fall-through is intentional, I added LLVM_FALLTHROUGH to silence the warning. I haven't tried to identify whether the fallthrough is a bug or not in the other places. I haven't tried to add this to the cmake option build flags. This warning will only work for clang. This build cleanly (with some new warnings) on macosx with clang under xcodebuild, but if this causes problems for people on other configurations, I'll back it out. llvm-svn: 260930
* Fixed CTRL+C related issues:Greg Clayton2014-05-021-0/+1
| | | | | | | | | | | | - CTRL+C wasn't clearing the command in lldb - CTRL+C doesn't work in python macros in lldb - Ctrl+C no longer interrupts the running process that you attach to <rdar://problem/15949205> <rdar://problem/16778652> <rdar://problem/16774411> llvm-svn: 207816
* Workaround for collision between enum members in LLVM's MachO.h and system ↵Jim Ingham2014-04-021-1/+0
| | | | | | | | | | headers on Mac OS X (in particular mach/machine.h). <rdar://problem/16494607> llvm-svn: 205480
* Fixed an issue with the byte order of ports in KDP packets. Greg Clayton2014-01-101-6/+6
| | | | | | | | | | I previously fixed a bug in the SocketAddress class where SocketAddress::GetPort() wasn't using ntohs() on the port number in the structures. After fixing this, it broke places where we weren't using ntohs() and htons() correctly. <rdar://problem/15767514> llvm-svn: 198902
* Fixed an issue introduced with my last fix where the command and sequence ID ↵Greg Clayton2013-07-101-1/+1
| | | | | | extraction were moved causing them to be reversed. llvm-svn: 186020
* Fixed the CommunicationKDP::SendRequestAndGetReply() to correctly be able to ↵Greg Clayton2013-07-101-8/+37
| | | | | | deal with getting a reply from a previous packet without resending the packet again. llvm-svn: 185988
* Change the default timeout for KDP communications to be 5 seconds.Jason Molenda2013-07-021-1/+1
| | | | | | <rdar://problem/13793059> llvm-svn: 185400
* Add an explicit check for a darwin kernel KDP_VERSIONSTRING whenJason Molenda2013-05-091-0/+11
| | | | | | | | starting a kdp communication session, instead of assuming darwin kernel for any "non-EFI" kdp session. <rdar://problem/13854098> llvm-svn: 181566
* <rdar://problem/13521159>Greg Clayton2013-03-271-4/+4
| | | | | | | | LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down. All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down. llvm-svn: 178191
* Patch from Andrew Fish to add recognition of some additionalJason Molenda2013-03-011-2/+146
| | | | | | KDP packets. llvm-svn: 176319
* <rdar://problem/13064893>Greg Clayton2013-02-141-42/+32
| | | | | | Poor network connections aren't handled well; commands fail instead of retrying. llvm-svn: 175198
* <rdar://problem/13069948>Greg Clayton2013-01-251-12/+12
| | | | | | | | | | | | Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary. So I defined a new "lldb::offset_t" which should be used for all file offsets. After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed. Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections. llvm-svn: 173463
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-6/+6
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* Identify a kdp session that is connecting to an EFI monitor,Jason Molenda2012-10-251-0/+11
| | | | | | | use a DynamicLoaderStatic dynamic loader for the session instead of a kernel or user dynamic loader. llvm-svn: 166652
* <rdar://problem/12491387>Greg Clayton2012-10-191-1/+52
| | | | | | | | | | Added commands to the KDP plug-in that allow sending raw commands through the KDP protocol. You specify a command byte and a payload as ASCII hex bytes, and the packet is created with a valid header/sequenceID/length and sent. The command responds with a raw ASCII hex string that contains all bytes in the reply including the header. An example of sending a read register packet for the GPR on x86_64: (lldb) process plugin packet send --command 0x07 --payload 0100000004000000 llvm-svn: 166346
* Change CommunicationKDP::SendRequestWriteMemory to append data as binaryJason Molenda2012-10-191-1/+1
| | | | | | instead of asciified bytes. <rdar://problem/12522978> llvm-svn: 166258
* <rdar://problem/12489931>Greg Clayton2012-10-121-1/+1
| | | | | | Memory write wasn't working (assert was firing) when writing memory. llvm-svn: 165848
* Add support for debugging KASLR kernels via kdp (the kernel beingJason Molenda2012-09-291-0/+47
| | | | | | | | | | | | | | | | | | loaded at a random offset). To get the kernel's UUID and load address I need to send a kdp packet so I had to implement the kernel relocation (and attempt to find the kernel if none was provided to lldb already) in ProcessKDP -- but this code really properly belongs in DynamicLoaderDarwinKernel. I also had to add an optional Stream to ConnectRemote so ProcessKDP::DoConnectRemote can print feedback about the remote kernel's UUID, load address, and notify the user if we auto-loaded the kernel via the UUID. <rdar://problem/7714201> llvm-svn: 164881
* <rdar://problem/9959501>Greg Clayton2012-09-251-14/+33
| | | | | | More KDP debugging process. We can not set breakpoints, hit them, resume, step and detach while running. llvm-svn: 164584
* <rdar://problem/9959501>Greg Clayton2012-09-211-4/+44
| | | | | | KDP -- now with rudimentary process control (continue only) and read + write registers (which means we can see stack frames) for x86_64, i386 and ARM. llvm-svn: 164352
* Stop using the "%z" size_t modifier and cast all size_t values to uint64_t. ↵Greg Clayton2012-09-181-3/+3
| | | | | | Some platforms don't support this modification. llvm-svn: 164148
* Don't expose the pthread_mutex_t underlying the Mutex & Mutex::Locker classes. Jim Ingham2012-05-041-1/+1
| | | | | | | | | | | | | No one was using it and Locker(pthread_mutex_t *) immediately asserts for pthread_mutex_t's that don't come from a Mutex anyway. Rather than try to make that work, we should maintain the Mutex abstraction and not pass around the platform implementation... Make Mutex::Locker::Lock take a Mutex & or a Mutex *, and remove the constructor taking a pthread_mutex_t *. You no longer need to call Mutex::GetMutex to pass your mutex to a Locker (you can't in fact, since I made it private.) llvm-svn: 156221
* No functionality changes, mostly cleanup.Greg Clayton2012-04-111-1/+1
| | | | | | | | Cleaned up the Mutex::Locker and the ReadWriteLock classes a bit. Also cleaned up the GDBRemoteCommunication class to not have so many packet functions. Used the "NoLock" versions of send/receive packet functions when possible for a bit of performance. llvm-svn: 154458
* Trying to solve our disappearing thread issues by making thread list updates ↵Greg Clayton2012-04-101-1/+1
| | | | | | | | | | | | | | | | safer. The current ProcessGDBRemote function that updates the threads could end up with an empty list if any other thread had the sequence mutex. We now don't clear the thread list when we can't access it, and we also have changed how lldb_private::Process handles the return code from the: virtual bool Process::UpdateThreadList (lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list) = 0; A bool is now returned to indicate if the list was actually updated or not and the lldb_private::Process class will only update the stop ID of the validity of the thread list if "true" is returned. The ProcessGDBRemote also got an extra assertion that will hopefully assert when running debug builds so we can find the source of this issue. llvm-svn: 154365
* Fixed the Xcode project building of LLVM to be a bit more user friendly:Greg Clayton2011-11-041-2/+0
| | | | | | | | | | | | | | | | | | | - If you download and build the sources in the Xcode project, x86_64 builds by default using the "llvm.zip" checkpointed LLVM. - If you delete the "lldb/llvm.zip" and the "lldb/llvm" folder, and build the Xcode project will download the right LLVM sources and build them from scratch - If you have a "lldb/llvm" folder already that contains a "lldb/llvm/lib" directory, we will use the sources you have placed in the LLDB directory. Python can now be disabled for platforms that don't support it. Changed the way the libllvmclang.a files get used. They now all get built into arch specific directories and never get merged into universal binaries as this was causing issues where you would have to go and delete the file if you wanted to build an extra architecture slice. llvm-svn: 143678
* Update declarations for all functions/methods that accept printf-styleJason Molenda2011-09-201-1/+1
| | | | | | | | stdarg formats to use __attribute__ format so the compiler can flag incorrect uses. Fix all incorrect uses. Most of these are innocuous, a few were resulting in crashes. llvm-svn: 140185
* Logging and return code fixes.Greg Clayton2011-07-291-11/+16
| | | | llvm-svn: 136530
* Initialize the all important automatic variable 'lldb::ConnectionStatus ↵Johnny Chen2011-07-211-1/+1
| | | | | | | | status' before invoking the Read(...) method to read in bytes. Similar to r135461. llvm-svn: 135695
* More KDP fixes and logging cleanup.Greg Clayton2011-07-211-114/+142
| | | | llvm-svn: 135652
* Added KDP resume, suspend, set/remove breakpoint, and kernel version support.Greg Clayton2011-07-201-14/+181
| | | | | | Also we now display a live update of the kexts that we are loading. llvm-svn: 135563
* Added register reading support for ARM, i386 and x86_64.Greg Clayton2011-07-201-21/+108
| | | | llvm-svn: 135557
* Modified the LocateMacOSXFilesUsingDebugSymbols(...) function to locateGreg Clayton2011-07-191-26/+353
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | an executable file if it is right next to a dSYM file that is found using DebugSymbols. The code also looks into a bundle if the dSYM file is right next to a bundle. Modified the MacOSX kernel dynamic loader plug-in to correctly set the load address for kext sections. This is a tad tricky because of how LLDB chooses to treat mach-o segments with no name. Also modified the loader to properly handle the older version 1 kext summary info. Fixed a crasher in the Mach-o object file parser when it is trying to set the section size correctly for dSYM sections. Added packet dumpers to the CommunicationKDP class. We now also properly detect address byte sizes based on the cpu type and subtype that is provided. Added a read memory and read register support to CommunicationKDP. Added a ThreadKDP class that now uses subclasses of the RegisterContextDarwin_XXX for arm, i386 and x86_64. Fixed some register numbering issues in the RegisterContextDarwin_arm class and added ARM GDB numbers to the ARM_GCC_Registers.h file. Change the RegisterContextMach_XXX classes over to subclassing their RegisterContextDarwin_XXX counterparts so we can share the mach register contexts between the user and kernel plug-ins. llvm-svn: 135466
* Added a boolean to the pure virtual lldb_private::Process::CanDebug(...)Greg Clayton2011-07-171-14/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | method so process plug-ins that are requested by name can answer yes when asked if they can debug a target that might not have any file in the target. Modified the ConnectionFileDescriptor to have both a read and a write file descriptor. This allows us to support UDP, and eventually will allow us to support pipes. The ConnectionFileDescriptor class also has a file descriptor type for each of the read and write file decriptors so we can use the correct read/recv/recvfrom call when reading, or write/send/sendto for writing. Finished up an initial implementation of UDP where you can use the "udp://" URL to specify a host and port to connect to: (lldb) process connect --plugin kdp-remote udp://host:41139 This will cause a ConnectionFileDescriptor to be created that can send UDP packets to "host:41139", and it will also bind to a localhost port that can be given out to receive the connectionless UDP reply. Added the ability to get to the IPv4/IPv6 socket port number from a ConnectionFileDescriptor instance if either file descriptor is a socket. The ProcessKDP can now successfully connect to a remote kernel and detach using the above "processs connect" command!!! So far we have the following packets working: KDP_CONNECT KDP_DISCONNECT KDP_HOSTINFO KDP_VERSION KDP_REATTACH Now that the packets are working, adding new packets will go very quickly. llvm-svn: 135363
* Completed more work on the KDP darwin kernel debugging Process plug-in.Greg Clayton2011-07-161-48/+262
| | | | | | | | | | | | | | | Implemented connect, disconnect, reattach, version, and hostinfo. Modified the ConnectionFileDescriptor class to be able to handle UDP. Added a new Stream subclass called StreamBuffer that is backed by a llvm::SmallVector for better efficiency. Modified the DataExtractor class to have a static function that can dump hex bytes into a stream. This is currently being used to dump incoming binary packet data in the KDP plug-in. llvm-svn: 135338
* Fixed the comment lines in the file comment headers.Greg Clayton2011-07-151-1/+1
| | | | llvm-svn: 135284
* Added the ability to connect using "tcp://<host>:<port>" which is theGreg Clayton2011-07-151-222/+71
| | | | | | | | | | | | | | | | | | | | | same as the old "connect://<host>:<port>". Also added the ability to connect using "udp://<host>:<port>" which will open a connected datagram socket. I need to find a way to specify a non connected datagram socket as well. We might need to start setting some settings in the URL itself, maybe something like: udp://<host>:<port>?connected=yes udp://<host>:<port>?connected=no I am open to suggestions for URL settings. Also did more work on the KDP darwin kernel plug-in. llvm-svn: 135277
* Hollowed out process plug-in to do KDP darwin kernel debugging.Greg Clayton2011-07-151-0/+403
llvm-svn: 135240
OpenPOWER on IntegriCloud