This helps ensure that the launched debugserver is ready and listening for a connection. Prior to this we had a race condition.
Consolidate the launching of debugserver into a single place: a static function in GDBRemoteCommunication.
llvm-svn: 196401
This will get the temporary directory on the current system.
Removed a call to tmpnam() and replaced it with a call to mktemp() using a template that will be in the temp directory.
llvm-svn: 196397
Fix use of std::lower_bound to check for equality if a match is found to ensure we don't return the next breakpoint with an ID greater than the break_id that was asked for.
llvm-svn: 196298
the build being broken for people using the public Mac OS X 10.9 SDK,
which does not have the Python framework any longer. The Xcode project
file already sets the -I and -L flags correctly so that <Python.h> and
-lpython will work correctly with the system's installed Python.
llvm-svn: 196259
indications that the UnwindPlan is invalid -- for instance, a
complete lack of rows, or a row that fails to define a register to
base the CFA off of.
<rdar://problem/15246247>
llvm-svn: 196201
This should probably be replaced with build infrastructure support for
a platform-specific canonical Python include path, but for now it should
restore the FreeBSD buildbot.
llvm-svn: 196167
lldb_private::Debugger was #including some "lldb/API" header files which causes tools (lldb-platform and lldb-gdbserver) that link against the internals only (no API layer) to fail to link depending on which calls were being used.
Also fixed the current working directory so that it gets set correctly for remote test suite runs. Now the remote working directory is set to: "ARCH/TESTNUM/..." where ARCH is the current architecture name and "TESTNUM" is the current test number.
Fixed the "lldb-platform" and "lldb-gdbserver" to not warn about mismatched visibility settings by having each have their own exports file which contains nothing. This forces all symbols to not be exported, and also quiets the linker warnings.
llvm-svn: 196141
Summary:
- Stop to try to rebuild llvm on each invocation by removing the invalid library entry libLLVMArchive.a which no longer exists.
- Remove the useless ranlib invocation. "libtools -static" automatically takes care of the archive table of content.
CC: lldb-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2296
llvm-svn: 196128
Separate ELF note implementations were introduced for core files and
GNU build-id. Move the more general one from elf-core to ObjectFileELF
and use it for build-id as well.
Review: http://llvm-reviews.chandlerc.com/D1902
llvm-svn: 196125
A number of tests fail to build on FreeBSD because the test build script
defaults to libstdc++ for clang. On FreeBSD the libstdc++ is rather old
and libc++ should be used instead.
(These tests previously had an @expectedFailureFreeBSD decorator for
pr16696, the umbrella PR for the lack of threaded inferior support on
FreeBSD. The work to add that support will be committed soon.)
llvm-svn: 196101
Added _WIN32 guards to new platform features. Using correct SetErrorStringWithFormat within Host when LLDB_DISABLE_POSIX is defined. Also fixed an if defined block.
llvm-svn: 195766
From Jim Ingham's email:
It does look like ThreadPlanStepInRange test is some kind of thinko.
In practice, in this case it is probably safe to run only one thread
when doing the "step through" since that generally involved running
from a shared library stub to its target. That could deadlock if the
dynamic loader has to fix up the symbol, and another thread is in the
middle of doing that. But that doesn't seem to be very common, or at
least the code is clearly wrong but I haven't had any reports of this
causing deadlocks...
llvm-svn: 195657
Although ptrace() can be passed a PID or TID for PT_CONTINUE and PT_STEP,
the kernel operates on all threads in the process in both cases. (See
the FOREACH_THREAD_IN_PROC in FreeBSD's sys_process.c:kern_ptrace.)
Make this clear by using the PID from the ProcessMonitor instance.
llvm-svn: 195656
the installed SDK to using the current OS installed headers/libraries.
This change is to address the removal of the Python framework
from the Mac OS X 10.9 (Mavericks) SDK, and is the recommended
workaround via https://developer.apple.com/library/mac/technotes/tn2328/_index.html
llvm-svn: 195557
SmallPtrSet.cpp use different methods if SmallPtrSet.h is included
in C++11 mode. Building llvm in C++03 mode and lldb in C++11 mode
resulted in a link-time failure with the C++11-mode-specific method
not being found in the llvm build.
llvm-svn: 195544
Improved the detection of a valid GDB server where we actually can connect to a socket, but then it doesn't read or write anything (which happens with some USB mux software).
Host::MakeDirectory() now can make as many intermediate directories as needed.
The testsuite now has very initial support for remote test suite running. When running on a remote platform, the setUp function for the test will make a new directory and select it as the working directory on the remote host.
Added a common function that can be used to create the short option string for getopt_long calls.
llvm-svn: 195541
Mainly patched to stop LLDB from crashing. This can easily happen if you debug to a remote gdbserver that doesn't have any dynamic register info and you don't have a target definition file specified.
llvm-svn: 195499
Fixed a bunch of issues with many functions that were added for the platform host IO calls where they might not reply to the packet if the packet was malformed.
Cleaned up error codes.
Added a port offset to allow for connections across a USB mux.
llvm-svn: 195485
0 as CPU subtype never matches anything (at least, it doesn't match x86_64 windows binaries, of which there are correct arch definitions for). It should be created with LLDB_INVALID_CPUTYPE.
llvm-svn: 195435
Rework data formatters matching algorithm
What happens now is that, for each category, the FormatNavigator generates all possible matches, and checks them one by one
Since the possible matches do not actually depend on the category (whether a match is accepted or not does, but that check can be shifted at a more convenient time),
it is actually feasible to generate every possible match upfront and then let individual categories just scan through those
This commit changes things by introducing a notion of formatters match candidate, and shifting responsibility for generating all of them given a (ValueObject,DynamicValueType) pair
from the FormatNavigator back to the FormatManager
A list of these candidates is then passed down to each category for matching
Candidates also need to remember whether they were generated by stripping pointers, references, typedefs, since this is something that individual formatters can choose to reject
This check, however, is conveniently only done once a "textual" match has been found, so that the list of candidates is truly category-independent
While the performance benefit is small (mostly, due to caching), this is much cleaner from a design perspective
llvm-svn: 195395
Added a new "Host/Debug.h" which contains the pure virtual class definitions for NativeProcessProtocol and NativeThreadProtocol. These classes are host layer classes that, over time, every host that supports debugging will implement once.
Then the new "lldb-gdbserver" binary in the tools directory will be able to make a remote debugging binary from these native classes, and we will also be able to have a new lldb_private::Process class that implements native debugging using these classes.
So as soon as linux and MacOSX switch over to using this layer, everyone will get native and remote debugging.
This check-in is primarily to get the needed code in so that poeple can start trying to implement the NativeProcessProtocol and NativeThreadProtocol and use it in the GDBRemoteCommunicationServer class to implement a GDB server for remote debugging.
llvm-svn: 195369
--gdbserver-port PORT
--min-gdbserver-port PORT
--max-gdbserver-port PORT
The --gdbserver-port option can be specified multiple times to tell lldb-platform which ports it can use when launching child GDB server processes.
The --min-gdbserver-port and --max-gdbserver-port options allow a range of ports to be specified for use when launching child GDB server processes.
Fixed the code to manage these ports correctly in GDBRemoteCommunicationServer.
Also changed GDBRemoteCommunicationClient to not set a port when sending the "qLaunchGDBServer" packet so that the remote lldb-platform can decide which ports to use. If the lldb-platform was launched with no --gdbserver-port or --min-gdbserver-port/--max-gdbserver-port options, then port 0 is always used and a unix socket is used between the lldb-platform and child GDB server process to coordinate the use of valid port.
llvm-svn: 195300
Change the NSSet data formatter to not use the expression parser to produce synthetic children
In small-scale experimentation with lldb-perf, this improves our performance by around 25%
llvm-svn: 195294
Example code:
remote_platform = lldb.SBPlatform("remote-macosx");
remote_platform.SetWorkingDirectory("/private/tmp")
debugger.SetSelectedPlatform(remote_platform)
connect_options = lldb.SBPlatformConnectOptions("connect://localhost:1111");
err = remote_platform.ConnectRemote(connect_options)
if err.Success():
print >> result, 'Connected to remote platform:'
print >> result, 'hostname: %s' % (remote_platform.GetHostname())
src = lldb.SBFileSpec("/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework", False)
dst = lldb.SBFileSpec()
# copy src to platform working directory since "dst" is empty
err = remote_platform.Install(src, dst);
if err.Success():
print >> result, '%s installed successfully' % (src)
else:
print >> result, 'error: failed to install "%s": %s' % (src, err)
Implemented many calls needed in lldb-platform to be able to install a directory that contains symlinks, file and directories.
The remote lldb-platform can now launch GDB servers on the remote system so that remote debugging can be spawned through the remote platform when connected to a remote platform.
The API in SBPlatform is subject to change and will be getting many new functions.
llvm-svn: 195273
The demangler added in r193708 from cxa_demangle.cpp uses language features which are not supported by the latest visual studio. In order to preserve the msvc build, this patch restores the previous (non)functionality in windows under msvc by disabling the demangler.
llvm-svn: 195254
(and same thing to Thread base class) which can be used when looking
at an ExtendedBacktrace thread; it will try to find the IndexID() of
the original thread that was executing this backtrace when it was
recorded. If lldb can't find a record of that thread, it will return
the same value as IndexID() for the ExtendedBacktrace thread.
llvm-svn: 194912
The failure to demangle 'anonymous namespace' on FreeBSD is fixed (twice)
- the failure in FreeBSD's in-tree __cxa_demangle has been addressed
- FreeBSD now uses the copy of the demangler built into lldb, due to other
remaining limitations in the in-tree __cxa_demangle
llvm.org/pr15302
llvm-svn: 194855
do anything right now. Add a few new methods to the Thread base
class which HistoryThread needs. I think I updated all the
CMakeLists files correctly for the new plugin.
llvm-svn: 194756
Added two new GDB server packets to debugserver: "QSaveRegisterState" and "QRestoreRegiterState".
"QSaveRegisterState" makes the remote GDB server save all register values and it returns a save identifier as an unsigned integer. This packet can be used prior to running expressions to save all registers.
All registers can them we later restored with "QRestoreRegiterState:SAVEID" what SAVEID is the integer identifier that was returned from the call to QSaveRegisterState.
Cleaned up redundant code in lldb_private::Thread, lldb_private::ThreadPlanCallFunction.
Moved the lldb_private::Thread::RegisterCheckpoint into its own header file and it is now in the lldb_private namespace. Trimmed down the RegisterCheckpoint class to omit stuff that wasn't used (the stack ID).
Added a few new virtual methods to lldb_private::RegisterContext that allow subclasses to efficiently save/restore register states and changed the RegisterContextGDBRemote to take advantage of these new calls.
llvm-svn: 194621
Remove the --do-read option, and always provide a small dump of memory at each match spot
Add a --dump-offset (-o) option, to specify a byte offset from which to start dumping relative to the matching address
The real solution is to actually provide the format options found on "memory read" and use those as the key to actually printing memory upon each find
That, however, requires a little refactoring work, so put this in for now until I get a chance to do the required shuffling around of moving parts
llvm-svn: 194600
Implement a "memory find" command for LLDB
This is still fairly rough around the edges but works well enough for simple scenarios where a chunk of text or a number are to be found within a certain range of memory, as in
mem find `buffer` `buffer+0x1000` -s "me" -c 5 -r
llvm-svn: 194544
something; add a new ExtendedThreadList to Process where they can be retained
for the duration of a public stop.
<rdar://problem/15314068>
llvm-svn: 194367
something; add a new ExtendedThreadList to Process where they can be retained
for the duration of a public stop.
<rdar://problem/15314068>
llvm-svn: 194366
- removed all gaps from the g/G packets
- optimized registers for x86_64 to not send/receive xmm0-xmm15 as well as ymm0-ymm15, now we only send ymm0-15 and xmm0-15 are now pseudo regs
- Fixed x86_64 floating point register gaps
- Fixed x86_64 so that xmm8-xmm15 don't overlap with ymm0-ymm3. This could lead to bad values showing in the debugger and was due to bad register info structure contents
- Fixed i386 so we only send ymm0-ymm7 and xmm0-xmm7 are now pseudo regs.
- Fixed ARM register definitions to not have any gaps
- Fixed it so value registers and invalidation registers are specified using register names which avoid games we had to play with register numbering in the ARM plugin.
llvm-svn: 194302
Still working out some of the details of these classes but
I wanted to get the overall structure checked in.
<rdar://problem/15314068>
llvm-svn: 194245
llvm::ArrayRef of arguments rather than taking
a fixed number of possibly-NULL pointers to
arguments.
Also changed ClangFunction::GetThreadPlanToCallFunction
to take the address of the argument struct by value
instead of by reference, since it doesn't actually
modify the value passed into it.
llvm-svn: 194232
It completes the job of using EvaluateExpressionOptions consistently throughout
the inferior function calling mechanism in lldb begun in Greg's patch r194009.
It removes a handful of alternate calls into the ClangUserExpression/ClangFunction/ThreadPlanCallFunction which
were there for convenience. Using the EvaluateExpressionOptions removes the need for them.
Using that it gets the --debug option from Greg's patch to work cleanly.
It also adds another EvaluateExpressionOption to not trap exceptions when running expressions. You shouldn't
use this option unless you KNOW your expression can't throw beyond itself. This is:
<rdar://problem/15374885>
At present this is only available through the SB API's or python.
It fixes a bug where function calls would unset the ObjC & C++ exception breakpoints without checking whether
they were set by somebody else already.
llvm-svn: 194182
iterators for LLDB's container data structures.
Iterable abstracts over the backing data structure,
ignoring keys for maps for example. It also provides
locking as a service so that the code
for (ThreadSP thread_sp : process->Threads())
{
// ... use thread_sp
}
takes the appropriate locks once, without having to
do anything else.
The salient advantages of this system are:
- Much simpler and idiomatic loop code
- Lock once instead of each time an element is fetched
- Less boilerplate to produce the iterators
The intent is that Iterable will replace Get...AtIndex
in most places, and that ForEach(), which solves the
same problem in a less-idiomatic way, be phased out in
favor of this approach.
I've added Iterables to ThreadList, TypeList, and
Process (which is really just forwarding to ThreadList).
llvm-svn: 194159