Commit Graph

148 Commits

Author SHA1 Message Date
Johnny Chen bbc00939f2 Sanity check the return value from SBSCopyApplicationDisplayIdentifiers() before calling CFArrayGetCount() on it.
rdar://problem/11331867

llvm-svn: 156562
2012-05-10 19:24:41 +00:00
Greg Clayton 7051231709 <rdar://problem/11358639>
Switch over to the "*-apple-macosx" for desktop and "*-apple-ios" for iOS triples.

Also make the selection process for auto selecting platforms based off of an arch much better.

llvm-svn: 156354
2012-05-08 01:45:38 +00:00
Greg Clayton caca09b628 Patch from Filipe Cabecinhas.
llvm-svn: 155641
2012-04-26 17:11:01 +00:00
Greg Clayton 7afbe07a0d Patch from Filipe Cabecinhas.
llvm-svn: 155640
2012-04-26 17:09:38 +00:00
Jim Ingham 5d2735e502 Suspend program threads before sending the SIGSTOP & resuming, so other threads won't get into trouble while we are waiting for the SIGSTOP.
rdar://problem/11174834

llvm-svn: 155560
2012-04-25 17:45:26 +00:00
Greg Clayton 4463399b0d Added a new packet to our GDB remote protocol:
QListThreadsInStopReply
	
This GDB remote query command can enable added a "threads" key/value pair to all stop reply packets so that we always get a list of all threads in each stop reply packet. It increases performance if enabled (the reply to the "QListThreadsInStopReply" is "OK") by saving us from sending to command/reply pairs (the "qfThreadInfo" and "qsThreadInfo" packets), and also helps us keep the current process state up to date. 

llvm-svn: 154380
2012-04-10 03:22:03 +00:00
Greg Clayton 3c18cd3de1 Fixed the C++11 #defines that wrap std::weak_ptr to actually use std::weak_ptr.
llvm-svn: 154041
2012-04-04 20:03:33 +00:00
Johnny Chen 760c54e640 Fix a typo.
llvm-svn: 153301
2012-03-23 01:28:19 +00:00
Johnny Chen 3f8140a6d8 Make arm debugserver handle setting a watchpoint on, for example, (uint64_t)variable.
We do this by delegating to two available Watchpoint Register Pairs (wvr, wcr).  With
each pair handling the 4 bytes of (uint64_t)variable.

llvm-svn: 153300
2012-03-23 01:24:52 +00:00
Johnny Chen d45a9c32c2 Previous check-ins allow to hit the arm hardware watchpoint, with a workaound to handle the issue
that the inferior cannot execute past the watchpoint-triggering instruction.

The solution is disable the watchpoint before resuming the inferior and make it hardware single step;
when the inferior stops again due to single step, re-enable the watchpoint and disable the single step
to make the inferior able to continue again without obstacle.

rdar://problem/9667960

llvm-svn: 153273
2012-03-22 20:04:07 +00:00
Johnny Chen 8c9739eeda Fixed a bug with the r153228 check-in earlier today in that the cached watchpoint
member variables were not reset appropriately.

llvm-svn: 153239
2012-03-22 05:10:43 +00:00
Johnny Chen 7cb09b61b2 WIP snapshot of hardware watchpoints for arm. A simple watchpoint has triggered.
However, the debugserver cannot get past the instruction which triggered the watchpoint.
So a workaround is in place for the time being which disables the triggered watchpoint
before resuming.

Lots of commented out printf's remain in the source which needs to be cleaned up.

WIP rdar://problem/9667960

llvm-svn: 153228
2012-03-22 00:08:13 +00:00
Greg Clayton d64afba584 <rdar://problem/10434005>
Prepare LLDB to be built with C++11 by hiding all accesses to std::tr1 behind
macros that allows us to easily compile for either C++.

llvm-svn: 152698
2012-03-14 03:07:05 +00:00
Jason Molenda 08441ba45e Send an "OK" response to the "D" (detach) packet.
v. http://sourceware.org/gdb/current/onlinedocs/gdb/Packets.html#Packets

the detach packet is supposed to send a reply.

llvm-svn: 152671
2012-03-13 21:10:35 +00:00
Jason Molenda 16d7581fdb Pull in another plist from the old debugserver project.
Switch default compiler to clang.

llvm-svn: 152600
2012-03-13 01:23:54 +00:00
Greg Clayton 701a6b473d <rdar://problem/11030692>
SBProcess::PutSTDIN() was not working for a few builds on darwin when using debugserver. This is now fixed.

llvm-svn: 152569
2012-03-12 19:02:41 +00:00
Jim Ingham 329617a80a Make debugserver quieter about memory read errors.
<rdar://problem/10681220>

llvm-svn: 152438
2012-03-09 21:09:42 +00:00
Greg Clayton 85f3fa5411 <rdar://problem/11007934>
On darwin, if child process of process being debugged dies due to mach exception, the debugged process will die.

debugserver now only handles the mach exceptions for the task being debugged.

llvm-svn: 152291
2012-03-08 03:27:27 +00:00
Greg Clayton 9845a8d54d <rdar://problem/10840355>
Fixed STDERR to not be opened as readable. Also cleaned up some of the code that implemented the file actions as some of the code was using the wrong variables, they now use the right ones (in for stdin, out for stdout, err for stderr).

llvm-svn: 152102
2012-03-06 04:01:04 +00:00
Greg Clayton e16e2d02ea <rdar://problem/10986692>
Safeguard against building on next OS and run on current OS.

llvm-svn: 152077
2012-03-06 00:24:17 +00:00
Greg Clayton 3442d46eac <rdar://problem/10963899>
Allow debugserver to be built on a newer kernel and still allow debugging on
older kernels.

llvm-svn: 151827
2012-03-01 19:35:09 +00:00
Johnny Chen 2120e2bd73 Newly created threads are to inherit from the global debug state of the process.
llvm-svn: 151393
2012-02-24 21:13:45 +00:00
Johnny Chen 840305f1fd Add a class method HasWatchpointOccurred() to inspect the "method of debug entry" field
of the DSCR to check whether it was because of watchpoint occurred.

llvm-svn: 151333
2012-02-24 01:50:42 +00:00
Johnny Chen 6476fad669 Add comments about address word offset and the calculation of byte address select mask for WCR.
llvm-svn: 151305
2012-02-23 23:40:58 +00:00
Jason Molenda 42999a48f9 Change #ifdef markers around lockdown and SpringBoard
calls to dpeend on WITH_SPRINGBOARD and WITH_LOCKDOWN
instead of __arm__.  Add an RNBSocket::useFD method.

llvm-svn: 151119
2012-02-22 02:18:59 +00:00
Benjamin Kramer ff461fcf07 Remove a ton of implicit narrowing conversions for C++11 compatibility.
llvm-svn: 151071
2012-02-21 18:37:14 +00:00
Charles Davis b786e7d099 Pull side effects out of asserts. Fixes debugserver with NDEBUG defined.
llvm-svn: 151013
2012-02-21 00:53:12 +00:00
Greg Clayton 23a17953e7 Fixed an error with the 'G' packet on ARM when using the default GDB
register set where it could get an error when trying to restore the
fake "f0" - "f7" 12 byte float regs.

llvm-svn: 150781
2012-02-17 02:13:09 +00:00
Greg Clayton fb640c2d4c Kill our child process that we launch when we can't get the task_for_pid()
otherwise we will have a launched process stopped at the entry point and
it will get reparented when debugserver goes away and we won't be able to
kill the process later.

llvm-svn: 149622
2012-02-02 19:23:22 +00:00
Johnny Chen 17b4ea54bf Snapshot of initial work for ARM watchpoint support on the debugserver.
It is incomplete and untested; passes the compilation only.

llvm-svn: 147901
2012-01-11 00:35:13 +00:00
Greg Clayton 8ffc4f11ce Disable ARMDisassembler.framework support which was used for software single stepping.
llvm-svn: 147886
2012-01-10 22:33:56 +00:00
Jim Ingham 82283e8e91 Check the return value of GetBasicInfo before dereferencing it. <rdar://problem/10568492>
llvm-svn: 147883
2012-01-10 22:21:42 +00:00
Johnny Chen e7526b7daf http://llvm.org/bugs/show_bug.cgi?id=11715
comma at end of enumerator list

llvm-svn: 147633
2012-01-06 00:05:01 +00:00
Greg Clayton fc5dd29ef7 Always return a valid answer for qMemoryRegionInfo if the packet is supported.
We will return a valid range when possible and omit the "permissions" key
when the memory is not readable, writeable or executeable. This will help us
know the difference between an error back from this packet and unsupported,
from just "this address isn't in a valid region".

llvm-svn: 146394
2011-12-12 18:51:14 +00:00
Jim Ingham 703588540e Don't spam warnings about not being able to read memory at 0x0.
llvm-svn: 146271
2011-12-09 19:48:22 +00:00
Jason Molenda 10c480a461 Move CPUHasAVX() prototype out of an #ifdef block of code.
llvm-svn: 146198
2011-12-08 22:36:41 +00:00
Greg Clayton a64e446e4c <rdar://problem/10544202>
Fixed detection of AVX on darwin now that our kernel supports it.

llvm-svn: 146135
2011-12-08 03:19:36 +00:00
Jason Molenda a86588c4b0 Expose the DNBArchMachARM::DBG typedef, specify the type with the
class scoping in DumpDBGState()'s definiton.

llvm-svn: 146128
2011-12-08 01:59:17 +00:00
Johnny Chen 5700922945 Add a typedef for arm_debug_state_t as DBG. Plus some minor comment changes.
llvm-svn: 145978
2011-12-06 22:19:09 +00:00
Greg Clayton 46fb558df1 Added optional calls to lldb_private::Process for getting memory region info
from a process and hooked it up to the new packet that was recently added
to our GDB remote executable named debugserver. Now Process has the following
new calls:

virtual Error
Process::GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info);

virtual uint32_t
GetLoadAddressPermissions (lldb::addr_t load_addr);

Only the first one needs to be implemented by subclasses that can add this
support.

Cleaned up the way the new packet was implemented in debugserver to be more
useful as an API inside debugserver. Also found an error where finding a region
for an address actually will pick up the next region that follows the address
in the query so we also need ot make sure that the address we requested the
region for falls into the region that gets returned.

llvm-svn: 144976
2011-11-18 07:03:08 +00:00
Jason Molenda 3dc8583c96 Remove the QAddressIsExecutable packet I added last night.
Add a more general purpose qMemoryRegionInfo packet which can
describe various attributes about a memory region.  Currently it
will return the start address, size, and permissions (read, write,
executable) for the memory region.  It may be possible to add
additional attributes in the future such as whether the region is
designated as stack memory or jitted code a la vmmap.

I still haven't implemented the lldb side of the code to use this
packet yet so there may be unexpected behavior - but the basic implementation looks
about right.  I'll hook it up to lldb soon and fix any problems that crop up.

llvm-svn: 144175
2011-11-09 08:03:56 +00:00
Jason Molenda 1f3966bebd Add "QAddressIsExecutable" packet to debugserver. Used to test
whether a given address is in an executable region of memory or
not.  I haven't written the lldb side that will use this packet it
hasn't been tested yet but it's a simple enough bit of code.

I want to have this feature available for the unwinder code.  When
we're stopped at an address with no valid symbol context, there are
a number of questions I'd like to ask --

  is the current pc value in an executable region (e.g. did they
  jump to unallocated/unexecutable memory?  we know how to unwind
  from here if so.)

  Is the stack pointer or the frame pointer the correct register
  to use to find the caller's saved pc value?

Once we're past the first frame we can trust things like eh_frame
and ABI unwind schemes but the first frame is challenging and having
a way to check potential addresses to see if they're executable or
not would help narrow down the possibilities a lot.

llvm-svn: 144074
2011-11-08 04:28:12 +00:00
Greg Clayton dce502ede0 Fixed the Xcode project building of LLVM to be a bit more user friendly:
- 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
2011-11-04 03:34:56 +00:00
Greg Clayton 490fbbe270 Enabled the "printf" attribute on all debugserver logging functions and fixed
the ensuing mayhem.

llvm-svn: 143244
2011-10-28 22:59:14 +00:00
Greg Clayton 708c1ab6f5 Python does some bad things to the signal masks in the current process and
then we spawn child processes (debugserver, etc) and those bad settings get 
inherited. We stop this from happening by correctly mucking with the posix
spawn attributes.

llvm-svn: 143176
2011-10-28 01:24:12 +00:00
Benjamin Kramer d34a329c68 Remove unused include of deprecated header.
llvm-svn: 142753
2011-10-23 16:31:38 +00:00
Johnny Chen a9b68f4dd6 Modify the delegation chain from MachThreadList -> MachThread -> DNBArchProtocol so that when
the watchpoint state is changed, not only does the change propagate to all the thread instances,
it also updates a global debug state, if chosen by the DNBArchProtocol derivative.

Once implemented, the DNBArchProtocol derivative, also makes sure that when new thread comes along,
it tries to inherit from the global debug state, if it is valid.

Modify TestWatchpointMultipleThreads.py to test this functionality.

llvm-svn: 140811
2011-09-29 21:48:52 +00:00
Johnny Chen 825ea37835 Fix a bug in the current MacOSX MachThreadList::EnableHardwareWatchpoint() impl so that
it enables the hardware watchpoint for all existing threads.  Add a test file for that.
Also fix MachThreadList::DisableHardwareWatchpoint().

llvm-svn: 140757
2011-09-29 01:20:42 +00:00
Johnny Chen 870f4f4213 The r139982 patch has a bug by using the constant "x86_AVX_STATE64".
Patch by Filipe.

llvm-svn: 140037
2011-09-19 18:54:01 +00:00
Greg Clayton 747bcb03d2 Convert lldb::ModuleSP to use an instrusive ref counted pointer.
We had some cases where getting the shared pointer for a module from
the global module list was causing a performance issue when debugging
with DWARF in .o files. Now that the module uses intrusive ref counts,
we can easily convert any pointer to a shared pointer.

llvm-svn: 139983
2011-09-17 06:21:20 +00:00