Commit Graph

386 Commits

Author SHA1 Message Date
Jim Ingham d84641c1ac r189295 inadvertently set the codesigning identity for the debugserver Debug configuration
to "", which causes debugging to fail for that configuration.  Setting it back to lldb_codesign.

llvm-svn: 190172
2013-09-06 16:54:45 +00:00
Daniel Malea e0f8f574c7 merge lldb-platform-work branch (and assorted fixes) into trunk
Summary:
    This merge brings in the improved 'platform' command that knows how to
    interface with remote machines; that is, query OS/kernel information, push
    and pull files, run shell commands, etc... and implementation for the new
    communication packets that back that interface, at least on Darwin based
    operating systems via the POSIXPlatform class. Linux support is coming soon.

    Verified the test suite runs cleanly on Linux (x86_64), build OK on Mac OS
    X Mountain Lion.

    Additional improvements (not in the source SVN branch 'lldb-platform-work'):
    - cmake build scripts for lldb-platform
    - cleanup test suite
    - documentation stub for qPlatform_RunCommand
    - use log class instead of printf() directly
    - reverted work-in-progress-looking changes from test/types/TestAbstract.py that work towards running the test suite remotely.
    - add new logging category 'platform'

    Reviewers: Matt Kopec, Greg Clayton

    Review: http://llvm-reviews.chandlerc.com/D1493

llvm-svn: 189295
2013-08-26 23:57:52 +00:00
Daniel Malea ec2f90c025 Add support for building debugserver with CMake (on Mac OS X)
- updated RNBDefs.h to allow version numbers to be passed in via preprocessor defines
- update libdebugserver.cpp to compile against latest DNBProcessKill signature

Review: http://llvm-reviews.chandlerc.com/D1331
llvm-svn: 188078
2013-08-09 16:29:10 +00:00
Jim Ingham 2d512bcae6 Use the correct call to close down the lockdown connection.
<rdar://problem/14460024>

llvm-svn: 186597
2013-07-18 18:48:57 +00:00
Jim Ingham 83cc25dc18 Didn't get the right version of these files in the checkin for r186132.
llvm-svn: 186596
2013-07-18 18:42:57 +00:00
Jason Molenda 17da171f1a Bump version number to 310.99.0.
llvm-svn: 186304
2013-07-15 04:47:33 +00:00
Jim Ingham f1715ab270 Get debugserver to call task_set_state to prime the control registers so that watchpoints
take for threads created while the program is running.  Remove the testcase skips from TestConcurrentEvents.py,
since they all pass now, and fix TestWatchpointMultipleThreads.py - which should have caught this problem -
so it doesn't artificially break on new thread creation before the watchpoint triggers.

llvm.org/pr16566
<rdar://problem/14383244>

llvm-svn: 186132
2013-07-11 23:20:35 +00:00
Greg Clayton 6467ff9aea <rdar://problem/14195566>
Found a race condition when killing an application where the state could be set to exited by the waitpid_thread() _before_ we call task resume (via MachProcess::PrivateResume()) in MachProcess::Kill().

llvm-svn: 185048
2013-06-27 00:23:57 +00:00
Han Ming Ong b4e1d4c630 <rdar://problem/14281898>
Much faster way to get dirty size.

llvm-svn: 185033
2013-06-26 22:52:37 +00:00
Han Ming Ong 6db14a9965 <rdar://problem/14262854>
Match up with top’s implementation on recent Cab as API has changed a bit.
Tested the same binary running on Zin as well. Tested ARM binary on iOS as well.

llvm-svn: 185017
2013-06-26 20:46:27 +00:00
Jason Molenda 7a32393bcf If debugserver fails to interrogate the inferior process CPU type
for any reason, use debugserver own's cputype as a best guess when
we reply to the debugger's qProcessInfo packet or when initializing
our register tables.
<rdar://problem/13406879> 

llvm-svn: 184829
2013-06-25 06:42:09 +00:00
Jason Molenda 829713c258 Remove some unnecessary uses of nub_break_t in the arm specific
support files for debugserver to fix a build failure for arm.  Also
remove some of the code used for software-driven single instruction
stepping; this is slowly being yanked out and these particular bits
overlap with the nub_break_t going away.

llvm-svn: 184828
2013-06-25 06:01:20 +00:00
Greg Clayton d8cf1a119d Huge performance improvements when one breakpoint contains many locations.
325,000 breakpoints for running "breakpoint set --func-regex ." on lldb itself (after hitting a breakpoint at main so that LLDB.framework is loaded) used to take up to an hour to set, now we are down under a minute. With warm file caches, we are at 40 seconds, and that is with setting 325,000 breakpoint through the GDB remote API. Linux and the native debuggers might be faster. I haven't timed what how much is debug info parsing and how much is the protocol traffic to/from GDB remote.

That there were many performance issues. Most of them were due to storing breakpoints in the wrong data structures, or using the wrong iterators to traverse the lists, traversing the lists in inefficient ways, and not optimizing certain function name lookups/symbol merges correctly.

Debugging after that is also now very efficient. There were issues with replacing the breakpoint opcodes in memory that was read, and those routines were also fixed.

llvm-svn: 183820
2013-06-12 00:46:38 +00:00
Greg Clayton fd23889e53 Remove the debugserver "--open-connection" option and obey the hostname that is passed into debugserver.
you can now specify:

debugserver host:port
debugserver port
debugserver /path/to/file

When "host" is specified, we will only accept connections from that host. If host is not specified, we default to "localhost".

llvm-svn: 183457
2013-06-06 22:44:19 +00:00
Han Ming Ong e86321865a <rdar://problem/13963648>
Changes after feedback:
Directly use function pointer, just to be safer on 10.8.

llvm-svn: 182529
2013-05-22 23:00:47 +00:00
Han Ming Ong b153c2f749 <rdar://problem/13963648>
Collect 'anonymous memory' info, if possible

llvm-svn: 182523
2013-05-22 21:32:42 +00:00
Greg Clayton 15fc2be75b <rdar://problem/13892516>
LLDB can now debug across calls to exec when the architecture changes from say i386 to x86_64 (on darwin).

llvm-svn: 182345
2013-05-21 01:00:52 +00:00
Greg Clayton 8b2a1d69cb <rdar://problem/13891604>
Fixed a 2 second delay when sending the 'k' (kill) packet that happened due to a race condition.

llvm-svn: 182025
2013-05-16 16:56:02 +00:00
Greg Clayton ff1596c2a1 Removed unused code and an unused event.
llvm-svn: 181948
2013-05-16 00:15:36 +00:00
Jason Molenda fe806906d4 fix a couple of clang static analyzer warnings.
Most important was a new[] + delete mismatch in ScanFormatDescriptor()
and a couple of possible memory leaks in FileSpec::EnumerateDirectory().

llvm-svn: 181080
2013-05-04 00:39:52 +00:00
Greg Clayton 7b0992d9cd After discussing with Chris Lattner, we require C++11, so lets get rid of the macros and just use C++11.
llvm-svn: 179805
2013-04-18 22:45:39 +00:00
Greg Clayton e01e07b6e7 Since we use C++11, we should switch over to using std::unique_ptr when C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++.
Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro.

llvm-svn: 179779
2013-04-18 18:10:51 +00:00
Jason Molenda 63742f1379 Cache the VM page size that we get from task_vm_info so we don't
re-fetch the value.

llvm-svn: 178962
2013-04-06 20:30:59 +00:00
Jason Molenda bef3f8619f Add optional LOG_TASK logging for MachVMMemory::PageSize when the call succeeds, too.
llvm-svn: 178955
2013-04-06 07:28:38 +00:00
Jason Molenda 272ee619f2 Add optional LOG_TASK logging for MachVMMemory::PageSize() task_info call failure.
llvm-svn: 178954
2013-04-06 07:26:59 +00:00
Jason Molenda becd639c0e Update MachVMMemory::PageSize to get the page size of a specific process
if we have an updated task_info call available; else fall back to getting
the default host-wide page size.

Update all uses of the vm page size to get it via MachVMMemory::PageSize().

<rdar://problem/13477763>, <rdar://problem/13498504> 

llvm-svn: 178953
2013-04-06 07:16:15 +00:00
Greg Clayton b7ad58a0df <rdar://problem/13457391>
LLDB now can use a single dash for all long options for all commands form the command line and from the command interpreter. This involved just switching all calls from getopt_long() to getopt_long_only().

llvm-svn: 178789
2013-04-04 20:35:24 +00:00
Greg Clayton 24daef515a <rdar://problem/13198919>
Try and reap process when sending the "k" packet to avoid a race condition. We now wait for at most 1 second to reap the child process that we are killing.

llvm-svn: 178726
2013-04-04 01:01:35 +00:00
Greg Clayton de3d01e2c4 <rdar://problem/12789467>
Fixed an attach case for ARM that was imporperly detecting an application bundle when there wasn't one.

llvm-svn: 178704
2013-04-03 21:49:00 +00:00
Jason Molenda 69535e0072 Remove a bit of code duplication in RNBRemote::HandlePacket_qProcessInfo -
call DNBProcessGetCPUType() to get the cputype of the process we're debugging.

llvm-svn: 178620
2013-04-03 04:31:59 +00:00
Jason Molenda d5318c0c35 Fix another old usage of GetCurrentThread() to get a mach port
number in RNBRemote::HandlePacket_qProcessInfo -- add a new
GetCurrentThreadMachPort() so callers who need to make a mach
thred_get_state() call at the RNBRemote level will have a way to
get the port number.

llvm-svn: 178619
2013-04-03 04:18:47 +00:00
Jim Ingham 24eea5d003 Remove some unused code.
llvm-svn: 178512
2013-04-02 00:26:03 +00:00
Jason Molenda d37a8a9e2e Debugserver fix for launching iOS apps who are named "com.apple.something"
- the ".app" would be treated as the app bundle final characters
and the SpringBoard launch would fail.
<rdar://problem/13258935> 

llvm-svn: 178209
2013-03-28 01:48:21 +00:00
Greg Clayton 5160ce5c72 <rdar://problem/13521159>
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
2013-03-27 23:08:40 +00:00
Greg Clayton 6c75d19ba0 Remove FunctionProfiler and ProfileObjectiveC action classes as they are not used.
llvm-svn: 178035
2013-03-26 16:47:22 +00:00
Han Ming Ong 6f7237d1f1 <rdar://problem/13498504>
Don't hard code vm page size in profiling code

llvm-svn: 177907
2013-03-25 20:44:40 +00:00
Jason Molenda 6566d43207 Add two additional DNBLog's in places where we're about to kill
off the inferior process so we stand a better chance of understanding
what caused us to send a PT_KILL.
<rdar://problem/12720340> 

llvm-svn: 177817
2013-03-23 05:35:57 +00:00
Jason Molenda 45461571e7 Change debugserver to open the socket it listens
to in INADDR_LOOPBACK mode by default ("localhost only")
instead of INADDR_ANY ("accept connections from any system").

Add a new command line argument to debugserver, --open-connection
or -H which will enable the previous behavior.  It would be used
if you were doing two-system debugging, with lldb running on one
system and debugserver running on the other.  But it is a less
common workflow and should not be the default.

<rdar://problem/12583284> 

llvm-svn: 177790
2013-03-23 00:44:22 +00:00
Greg Clayton c25e21c10e Simplify the logic for DNBDataRef::ValidOffsetForDataOfSize() and DNBDataRef::ValidOffset() functions.
llvm-svn: 177615
2013-03-21 00:24:59 +00:00
Greg Clayton e0b924e3bf More cleanup on the lldb-perf code:
- TestCase.m_thread is now filled in with the first thread that has a valid
  stop reason. This eliminates the need for the SelectMyThread() functions.
- The first thread that stops for a reason is also set as the selected thread
  in the process in case any command line commands are run.
- Changed launch over to take a SBLaunchInfo parameter so that the launch
  function doesn't keep getting new arguments as they are needed.
- TestCase::Setup() and TestCase::Launch(SBLaunchInfo) now return bool to 
  indicate success of setup and launch.
- ActionWanted::Next(SBThread) was renamed to ActionWanted::StepOver(SBThread)
- ActionWanted::Finish(SBThread) was renamed to ActionWanted::StepOut(SBThread)

llvm-svn: 177376
2013-03-19 04:41:22 +00:00
Han Ming Ong 7b641e97ed <rdar://problem/13100435>
Don't discount regions that vmmap is not discounting.

llvm-svn: 177202
2013-03-15 23:19:44 +00:00
Han Ming Ong 0c27cb7fa1 <rdar://problem/13415471>
Don't get dirty page size if we are not going to send it back

llvm-svn: 176992
2013-03-13 22:51:04 +00:00
Greg Clayton 682b60e4b4 <rdar://problem/13396207>
Added logging that will show up in the system console when we try to resume a process that is already running, or has an unexpected state.

llvm-svn: 176960
2013-03-13 18:23:44 +00:00
Jason Molenda 1ad66dbae4 Various fixes for armv7 floating point/vector register support.
Drop the old f registers from debugserver's register list.  Add the
NEON 128-bit q registers to debugserver, support reading and writing.
Add the new contains / invalidates mappings for the s, d, and q 
registers so lldb will know what registers overlay what other registers.
Change the default format of s and d registers to be floating point
instead of hex.  Remove some UTF-8 hyphen chars in comments in the ARM
register number definition headers.  
<rdar://problem/13121797> 

llvm-svn: 176915
2013-03-13 00:14:30 +00:00
Jason Molenda 252d6a385c Remove use of the ARMDisassembler framework from
DNBArchImplARM.  This framework is no longer around;
all armv7 devices support using hardware breakpoints
to instruction single step.

llvm-svn: 176761
2013-03-09 07:03:32 +00:00
Jason Molenda 03a00faae4 Also remove actual link against the ARMDisassembler framework from
debugserver's build settings.

llvm-svn: 176760
2013-03-09 06:19:31 +00:00
Jason Molenda cc526b797a We don't need to specify the VALID_ARCHS in the xcode project file.
Also, don't build debugserver with -DUSE_ARM_DISASSEMBLER_FRAMEWORK -
that framework isn't around at this point.

llvm-svn: 176759
2013-03-09 06:15:46 +00:00
Sean Callanan 3d27e6603a Updated Apple LLDB version to lldb-300.99.0. Also
updated the build system to support the new Apple
LLDB versioning scheme.

llvm-svn: 176662
2013-03-07 22:29:06 +00:00
Han Ming Ong 8764fe7d9a <rdar://problem/13338758>
Make it configurable what to profile.
For Mac, we don't use the dirty page size yet and hence there is no need to gather that. This should be way better in not draining the battery since we are operating between 0% to 0.1% on the Mac after this change.

llvm-svn: 176451
2013-03-04 21:25:51 +00:00
Jason Molenda bd2d88d60f Add the standard LLVM copyright notice to the top of
these two new files.

llvm-svn: 176312
2013-03-01 00:11:36 +00:00