summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
Commit message (Collapse)AuthorAgeFilesLines
...
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-296-60/+60
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* <rdar://problem/12723044> For 'process plugin packet send…', we just send ↵Han Ming Ong2012-11-261-25/+13
| | | | | | | | it async by default There is no good reason not to use async. llvm-svn: 168606
* <rdar://problem/12720514> Sub-TLF: Provide service to profile the inferiorHan Ming Ong2012-11-171-0/+10
| | | | | | This allows client to query profiling states on the inferior. llvm-svn: 168228
* Add support for libdispatch version 4 structure layout for findingJason Molenda2012-11-101-7/+24
| | | | | | | | | | GCD queue names of threads to ProcessGDBRemote::GetDispatchQueueNameForThread() May need tweaking once this version is rolled out but visual inspection looks fine. <rdar://problem/12333100> llvm-svn: 167667
* Remove a debugging printf that was left in the code.Greg Clayton2012-11-091-1/+0
| | | | llvm-svn: 167637
* Removed use of non-standard escape character '\%'Filipe Cabecinhas2012-11-091-1/+1
| | | | llvm-svn: 167636
* There seems to be some odd corner case where we shut down the ↵Jim Ingham2012-11-012-12/+60
| | | | | | | | ProcessGDBRemote, but we haven't managed to shut down the async thread. That causes the ProcessGDBRemote::AsyncThread to crash when it wakes up. So I changed StartAsyncThread and StopAsyncThread to be callable multiple times (only the first one does anything) so that we can just shut it down unequivocally in the ProcessGDBRemote destructor. <rdar://problem/12602981> llvm-svn: 167197
* If we got what looks like a single step exception but we weren't single ↵Jim Ingham2012-10-271-3/+7
| | | | | | | | stepping then just report the raw exception. llvm-svn: 166859
* <rdar://problem/12491387>Greg Clayton2012-10-191-2/+2
| | | | | | | | | | 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
* Patch from Matt Kopec <matt.kopec@intel.com> to fix the problem that if two ↵Jim Ingham2012-10-161-0/+3
| | | | | | | | breakpoints were set on consecutive addresses, the continue from the first breakpoint would skip the second. llvm-svn: 166000
* Added "process plugin packet send" and "process plugin packet history" for ↵Greg Clayton2012-10-151-8/+106
| | | | | | GDB remote. "process plugin packet send" will send a packet and receive a response. "process plugin packet history" will dump the packet history buffer. llvm-svn: 165991
* Make sure we always use lldb::tid_t for thread IDs so we don't truncate a 64 ↵Greg Clayton2012-10-132-3/+3
| | | | | | bit thread ID. llvm-svn: 165862
* <rdar://problem/12491387>Greg Clayton2012-10-132-3/+60
| | | | | | | | | | | I added the ability for a process plug-in to implement custom commands. All the lldb_private::Process plug-in has to do is override: virtual CommandObject * GetPluginCommandObject(); This object returned should be a multi-word command that vends LLDB commands. There is a sample implementation in ProcessGDBRemote that is hollowed out. It is intended to be used for sending a custom packet, though the body of the command execute function has yet to be implemented! llvm-svn: 165861
* Change the Thread constructor over to take a Process& rather than a ↵Jim Ingham2012-10-103-6/+6
| | | | | | | | | | | | | ProcessSP. We can't create Threads with a NULL ProcessSP, so it makes no sense to use the SP. Then make the Thread a Broadcaster, and get it to broadcast when the selected frame is changed (but only from the Command Line) and when Thread::ReturnFromFrame changes the stack. Made the Driver use this notification to print the new thread status rather than doing it in the command. Fixed a few places where people were setting their broadcaster class by hand rather than using the static broadcaster class call. <rdar://problem/12383087> llvm-svn: 165640
* In ↵Jason Molenda2012-10-061-0/+5
| | | | | | | | | | | | | | | | | | DynamicLoaderDarwinKernel::OSKextLoadedKextSummary::LoadImageUsingMemoryModule(), if we have a kernel binary, set the target's architecture to match. Include the target's architecture in the ModuleSpec when we're searching for the kext binaries on the local system -- otherwise we won't get a specific slice of a fat file picked out for us and we won't use the returned Module correctly. Remove the redundant attempt to find a file on the local filesystem from this method. In ProcessGDBRemote::CheckForKernel(), if we have a kernel binary in memory, mark the canJIT as false. There is no jitting code in kernel debug sessions. llvm-svn: 165357
* Don't turn on the debugserver log by default.Jim Ingham2012-10-031-2/+2
| | | | llvm-svn: 165176
* The kernel loading code is now isolated in the DynamicLoaderDarwinKernel;Jason Molenda2012-10-032-107/+36
| | | | | | | | | | remove the duplicates of this code in ProcessGDBRemote and ProcessKDP. These two Process plugins will hardcode their DynamicLoader name to be the DynamicLoaderDarwinKernel so the correct DynamicLoader is picked, and return the kernel load address as the ImageInfosAddress. <rdar://problem/12417038> llvm-svn: 165080
* Add the RelocateOrLoadKernel and LoadKernel methods to ↵Jason Molenda2012-09-292-18/+198
| | | | | | | | | | | | | | ProcessGDBRemote::DoRemoteConnect(). When attaching to a remote system that does not look like a typical vendor system, and no executable binary was specified to lldb, check a couple of fixed locations where kernels running in ASLR mode (slid in memory to a random address) store their load addr when booted in debug mode, and relocate the symbols or load the kernel wholesale from the host computer if we can find it. <rdar://problem/7714201> llvm-svn: 164888
* Add support for debugging KASLR kernels via kdp (the kernel beingJason Molenda2012-09-292-2/+21
| | | | | | | | | | | | | | | | | | 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/11752499>Greg Clayton2012-09-191-6/+6
| | | | | | Improve error messages when memory read/write fails. llvm-svn: 164188
* Stop using the "%z" size_t modifier and cast all size_t values to uint64_t. ↵Greg Clayton2012-09-183-6/+7
| | | | | | Some platforms don't support this modification. llvm-svn: 164148
* Typed too fast adding lockers. Actually put them in a locker.Jim Ingham2012-09-111-2/+2
| | | | llvm-svn: 163575
* Initial check-in of "fancy" inlined stepping. Doesn't do anything useful ↵Jim Ingham2012-09-011-2/+7
| | | | | | | | | unless you switch LLDB_FANCY_INLINED_STEPPING to true. With that on, basic inlined stepping works, including step-over of inlined functions. But for some as yet mysterious reason i386 debugging gets an assert and dies immediately. So for now its off. llvm-svn: 163044
* <rdar://problem/11757916>Greg Clayton2012-08-291-0/+1
| | | | | | | | | | | | Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes: - Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". - modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly - Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was. - modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile() Cleaned up header includes a bit as well. llvm-svn: 162860
* Added Args::StringForEncoding(), Args::StringToGenericRegister() and ↵Greg Clayton2012-08-241-36/+8
| | | | | | | | centralized the parsing of the string to encoding and string to generic register. Added code the initialize the register context in the OperatingSystemPython plug-in with the new PythonData classes, and added a test OperatingSystemPython module in lldb/examples/python/operating_system.py that we can use for testing. llvm-svn: 162530
* Cope with the case where the user-supplied callbacks want the watchpoint ↵Johnny Chen2012-08-231-0/+4
| | | | | | | | | | | | itself to be disabled! Previously we put a WatchpointSentry object within StopInfo.cpp to disable-and-then-enable the watchpoint itself while we are performing the actions associated with the triggered watchpoint, which can cause the user-initiated watchpoint disabling action to be negated. Add a test case to verify that a watchpoint can be disabled during the callbacks. llvm-svn: 162483
* Added a test for the Python part of SBInputReader callbacks.Filipe Cabecinhas2012-08-221-2/+6
| | | | llvm-svn: 162357
* Added an lldb_private & equivalent SB API to send an AsyncInterrupt to the ↵Jim Ingham2012-07-271-1/+1
| | | | | | | | | | | | | | event loop. Convert from calling Halt in the lldb Driver.cpp's input reader's sigint handler to sending this AsyncInterrupt so it can be handled in the event loop. If you are attaching and get an async interrupt, abort the attach attempt. Also remember to destroy the process if get interrupted while attaching. Getting this to work also required handing the eBroadcastBitInterrupt in a few more places in Process WaitForEvent & friends. <rdar://problem/10792425> llvm-svn: 160903
* Add a call to "sync" a thread state before checkpointing registers in ↵Jim Ingham2012-07-254-1/+55
| | | | | | | | | | | preparation for calling functions. This is necessary on Mac OS X, since bad things can happen if you set the registers of a thread that's sitting in a kernel trap. <rdar://problem/11145013> llvm-svn: 160756
* Provide subdir of StopInfoMachException.h in #include.Jason Molenda2012-07-251-1/+1
| | | | llvm-svn: 160704
* Add "vAttachOrWait" to debugserver, so you can implement "attach to the ↵Jim Ingham2012-07-203-2/+40
| | | | | | process if it exists OR wait for it" without race conditions. Use that in lldb. llvm-svn: 160578
* Changed ProcessGDBRemote to avoid the reservedSean Callanan2012-07-191-1/+14
| | | | | | | | | port range. Also added a comment indicating that more work is needed. <rdar://problem/11580051> llvm-svn: 160514
* Ran the static analyzer on the codebase and found a few things.Greg Clayton2012-07-172-12/+4
| | | | llvm-svn: 160338
* Fixing a buildbot issue in GDBRemoteCommunicationServer due to an undefined ↵Enrico Granata2012-07-131-1/+1
| | | | | | constant in latest commit llvm-svn: 160208
* <rdar://problem/11782789> Changes to the watchpoint implementation on ARM so ↵Enrico Granata2012-07-135-0/+58
| | | | | | that we single-step before stopping at the WP. This is necessary because on ARM the WP triggers before the opcode is actually executed, so we would be unable to continue since we would keep hitting the WP. We work around this by disabling the WP, single stepping and then putting the WP back in place. llvm-svn: 160199
* If we hit a breakpoint but there's a thread specifier which doesn't match ↵Jim Ingham2012-07-111-8/+14
| | | | | | this thread, return no stop reason. llvm-svn: 160080
* Work around some problems destroying a process with older debugservers.Jim Ingham2012-07-042-1/+109
| | | | | | rdar://problem/11359989 llvm-svn: 159697
* <rdar://problem/11744001>Greg Clayton2012-07-021-0/+1
| | | | | | Fixed an issue where GDB servers that don't support the thread suffix could get registers states incorrectly due to an incorrect assumption that the current register thread (set using the "Hg%x" packet) will always be cached between runs. Now we clear the cached register thred when the process is resumed. llvm-svn: 159603
* Add an "extra-startup-commands" process setting so we can send some command ↵Jim Ingham2012-07-021-0/+8
| | | | | | strings to the actual process plugin to interpret as it wishes. llvm-svn: 159511
* Make the error message when we time out waiting for debugserver to reply to ↵Jim Ingham2012-06-281-1/+1
| | | | | | | | the qLaunchSuccess packet less cryptic. <rdar://problem/11754744> llvm-svn: 159373
* Change the Mutex::Locker class so that it takes the Mutex object and locks ↵Jim Ingham2012-06-085-32/+16
| | | | | | | | | | | | | | it, rather than being given the pthread_mutex_t from the Mutex and locks that. That allows us to track ownership of the Mutex better. Used this to switch the LLDB_CONFIGURATION_DEBUG enabled assert when we can't get the gdb-remote sequence mutex to assert when the thread that had the mutex releases it. This is generally more useful information than saying just who failed to get it (since the code that had it locked often had released it by the time the assert fired.) llvm-svn: 158240
* rdar://problem/11487457Johnny Chen2012-06-081-1/+2
| | | | | | | Previous fix to add convenience registers for x86_64 did not take the 'process attach' scenario into account. This patch fixes that. llvm-svn: 158222
* Fix a place in ↵Jim Ingham2012-06-062-8/+37
| | | | | | | | | | | GDBRemoteCommunicationClient::SendContinuePacketAndWaitForReply where we weren't taking m_interrupt_sent into account. Also don't reset m_interrupt_sent in SendInterrupt but do so in SendPacketAndWaitForResponse when we know we've handled the interrupt. Fix a code path through ProcessGDBRemote::DoDestroy where we were tearing down the debug session but not setting the exit status. llvm-svn: 158043
* Use Log::Printf() instead of printf().Johnny Chen2012-06-021-1/+2
| | | | llvm-svn: 157869
* <rdar://problem/11486302>Greg Clayton2012-05-311-51/+59
| | | | | | Improve logging a bit. llvm-svn: 157771
* <rdar://problem/11486302>Greg Clayton2012-05-311-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed a case where multiple threads can be asking to send a packet to the GDB server and one of three things will happen: 1 - everything works 2 - one thread will fail to send the packet due to not being able to get the sequence mutex 3 - one thread will try and interrupt the other packet sending and fail and not send the packet Now the flow is a bit different. Prior to this fix we did: if (try_get_sequence_mutex()) { send_packet() return success; } else { if (async_ok) { interrupt() send_packet() resume() return success; } } return fail The issue is that the call to "try_get_sequence_mutex()" could fail if another thread was sending a packet and could cause us to just not send the packet and an error would be returned. What we really want is to try and get the sequence mutex, and if this succeeds, send the packet. Else check if we are running and if we are, do what we used to do. The big difference is when we aren't running, we wait for the sequence mutex so we don't drop packets. Pseudo code is: if (try_get_sequence_mutex()) { // Safe to send the packet right away send_packet() return success; } else { if (running) { // We are running, interrupt and send async packet if ok to do so, // else it is ok to fail if (async_ok) { interrupt() send_packet() resume() return success; } } else { // Not running, wait for the sequence mutex so we don't drop packets get_sequence_mutex() send_packet() return success; } } return fail llvm-svn: 157751
* <rdar://problem/11529853>Greg Clayton2012-05-241-1/+10
| | | | | | | | | | | | | | Sending async packets can deadlock a program on darwin. We currently allow breakpoint packets and memory read/write packets (for software breakpoints) to be sent while a program is running. In the GDB remote plug-in, we will interrupt the run, send the async packet and resume (currently with the continue packet that caused the program to resume). If the GDB server supports the "vCont" packet, we might have initially continued with each thread stating it should continue. If new threads show up while we are stopped, which happend when running GCD, we can end up with new threads that we aren't mentioning in the continue list. So we start with a thread list of 1,2,3 and continue: continue thread 1, continue thread 2, continue thread 3 Now we interrupt and set a breakpoint and we actually have threads 1,2,3,4 now when we are about to resume, yet we send: continue thread 1, continue thread 2, continue thread 3 Any thread that isn't mentioned is currently going to stay suspended. This causes the deadlock. llvm-svn: 157439
* Add the capability to display the number of supported hardware watchpoints ↵Johnny Chen2012-05-234-0/+65
| | | | | | | | | to the "watchpoint list" command. Add default Process::GetWatchpointSupportInfo() impl which returns an error of "not supported". Add "qWatchpointSupportInfo" packet to the gdb communication layer to support this, and modify TestWatchpointCommands.py to test it. llvm-svn: 157345
* extra ';' outside of a function [-pedantic,-Wextra-semi]Filipe Cabecinhas2012-05-231-1/+1
| | | | llvm-svn: 157330
* Add more convenience registers to x86_64 and a simple test scenario:Johnny Chen2012-05-221-10/+26
| | | | | | | self.expect("expr -- $ax == (($ah << 8) | $al)", substrs = ['true']) llvm-svn: 157302
OpenPOWER on IntegriCloud