Commit Graph

8375 Commits

Author SHA1 Message Date
Greg Clayton 7524e090e9 Implement ObjectFileMachO::SetLoadAddress().
llvm-svn: 200943
2014-02-06 20:10:16 +00:00
Steve Pucci 9e02dacddf Factor some methods that were in DynamicLoaderPOSIXDYLD.
Move some code that was in DynamicLoaderPOSIXDLYD into the
base class DynamicLoader.  In the case of UpdateLoadedSections(),
the test to see whether a file is loadable (its address is zero)
is not generally applicable so that test is changed to a more
universally applicable check for the SHF_ALLOC flag on the section.

Also make it explicit that the reading of the module_id in
DynamicLoaderPOSIXDYLD::GetThreadLocalData() is using a hardcoded
size (of module_id) of 4, which might not be appropriate on
big-endian 64-bit systems, leaving a FIXME comment in place.

llvm-svn: 200939
2014-02-06 19:02:19 +00:00
Greg Clayton 9c0b64c92d The "-n" and "-p" options to the lldb driver no longer worked after recent IOHandler changes, this is now fixed.
<rdar://problem/15962763>

llvm-svn: 200930
2014-02-06 18:22:44 +00:00
Greg Clayton 8ee673141b Don't print out "script" results twice.
We now properly detect when a result object has an immediate output stream and don't echo the results a second time.

<rdar://problem/15954906>

llvm-svn: 200882
2014-02-05 21:46:20 +00:00
Enrico Granata 9b55aa4e8f An example summary provider for PyObject and the LLDB wrapper PythonObject hierarchy - this would have probably helped track down those refcount bugs..
llvm-svn: 200879
2014-02-05 21:38:50 +00:00
Jim Ingham f0c63b97d6 Fix the --source-quietly option to the driver so that it actually works. Clean up the help
output a bit.

llvm-svn: 200878
2014-02-05 21:35:09 +00:00
Greg Clayton e4e462c42c Fixed output to display correctly for "command source" by fixing the correct flags being set.
Also emit the "Executing commands" message so it properly only comes out when desired and so it comes out in the right place.

<rdar://problem/15992208>

llvm-svn: 200875
2014-02-05 21:03:22 +00:00
Ed Maste f697a1ef94 Enable lldb-gdbserver for FreeBSD in the (g)make build
llvm-svn: 200871
2014-02-05 19:28:47 +00:00
Ed Maste fb29fa3e35 Enable lldb-gdbserver on Linux as well in the cmake build
llvm-svn: 200870
2014-02-05 19:03:18 +00:00
Ed Maste ba7cc706d9 Remove leftover debug printf
llvm-svn: 200866
2014-02-05 18:49:10 +00:00
Ed Maste 29e298a4ce Build lldb-gdbserver on FreeBSD
It passes basic sanity tests so we might as well enable it.

llvm-svn: 200865
2014-02-05 18:37:39 +00:00
Greg Clayton 340b0309b5 Fixed an issue where "command source" would not do the right thing:
- empty lines in init files would repeat previous command and cause errors to be displayed
- all options to control showing the command, its output, if it should stop on error or continue, weren't being obeyed.

llvm-svn: 200860
2014-02-05 17:57:57 +00:00
Greg Clayton 9b8aa38e45 Fixed indentation.
llvm-svn: 200859
2014-02-05 17:51:53 +00:00
Jason Molenda 2fd83355a8 Change the Mac OS X SystemRuntime plugin from using the placeholder
libldi library to collect extended backtrace information; switch
to the libBacktraceRecording library and its APIs.  Complete the
work of adding QueueItems to Queues and allow for the QueueItems
to be interrogated about their extended backtraces in turn.

There's still cleanup and documentation to do on this code but the
code is functional and I it's a good time to get the work-in-progress 
checked in.  
<rdar://problem/15314027> 

llvm-svn: 200822
2014-02-05 05:44:54 +00:00
Enrico Granata 95a9df2c82 <rdar://problem/15936507>
ScriptInterpreterPython caches the lldb.embedded_interpreter module, and since it caches it in a refcounting-safe PythonObject, the refcount will appropriately go down 1 every time a ScriptInterpreterPython is deallocated
However, we were only importing the module once - in InitializePrivate(). In a handful of interpreter creations, the refcount on the run_one_line function would end up at 0, causing LLDB to crash
This fixes it by also importing the module for every interpreter, which ensures correct refcounting

llvm-svn: 200816
2014-02-05 03:19:01 +00:00
Ed Maste 611d8c4361 Update URL for OS X buildbot
llvm-svn: 200799
2014-02-04 21:59:03 +00:00
Ed Maste 441a1beaba If setgid fails for any reason, exit lldb.
This is SVN r191618 by Sylvestre Ledru applied to the FreeBSD
ProcessMonitor.

llvm-svn: 200791
2014-02-04 19:37:15 +00:00
Greg Clayton 0f86e6e711 LLDB exits the command interpreter and thus LLDB when using a pty or file as the input handle and a blank line is entered (like when running under emacs). This is now fixed.
<rdar://problem/15976187>

llvm-svn: 200790
2014-02-04 19:25:11 +00:00
Ed Maste aacfe09867 Avoid accessing an element of an empty vector in a log message
llvm-svn: 200784
2014-02-04 18:51:11 +00:00
Jim Ingham 1c6da87bc9 If we fail to attach, return an error rather than returning the success or failure
of sending the error packet.

llvm-svn: 200732
2014-02-04 01:28:36 +00:00
Jean-Daniel Dupas 36b5eea258 Fix UnwindAssembly memory leak by defining and using a shared UnwindAssemblySP type.
llvm-svn: 200725
2014-02-03 23:49:47 +00:00
Enrico Granata d8e4584cbd <rdar://problem/15154623>
Move a couple formatters from category AppKit to CoreFoundation

llvm-svn: 200713
2014-02-03 19:46:31 +00:00
Ed Maste cc8068f2ac Remove failure decorators for FreeBSD bug
The issue described in llvm.org/pr18065 is actually due to FreeBSD bug
theads/186309 [1], which is now fixed in FreeBSD SVN r261354 [2] and will
be merged to release branches shortly.

Diagnosed and fixed by John Wolfe.

[1] http://www.freebsd.org/cgi/query-pr.cgi?pr=186309
[2] http://svnweb.freebsd.org/base?view=revision&revision=261354

llvm-svn: 200648
2014-02-02 19:29:50 +00:00
Ed Maste 10c82017b6 Update header comment to match filename
llvm-svn: 200647
2014-02-02 19:25:11 +00:00
Ed Maste dbd5950b63 Use libc++ on FreeBSD as on Darwin
This could use some refinement still, but the previous behaviour of adding
-stdlib=libstc++ on FreeBSD w/ Clang is the least likely case to work.

llvm.org/pr17910

llvm-svn: 200646
2014-02-02 19:24:15 +00:00
Jean-Daniel Dupas 59999a32b3 Remove commented includes
llvm-svn: 200637
2014-02-02 14:06:07 +00:00
Todd Fiala 31cb474e2d Fix for failure to unwind Linux stack frames with call in final position.
Fixes http://llvm.org/bugs/show_bug.cgi?id=18656.

Note this exposes a failure on Linux of
TestInferiorAssert.test_inferior_asserting_disassemble, similar to how
it fails on FreeBSD. I'll file a bug for this next. We're now getting
another frame beyond where we used to prior to this fix, so the fix is
exposing failures in previosly not-reachable frames.

Much thanks to Jason Molenda, who had much to do with helping figure
out where unwinding was breaking.

llvm-svn: 200600
2014-02-01 00:48:34 +00:00
Deepak Panickal 914b8d989b Fixing the Windows build for the changes brought in from the iohandler merge.
llvm-svn: 200565
2014-01-31 18:48:46 +00:00
Ed Maste 829839259a Add libs needed by iohandler merge to Makefile for FreeBSD
Copied from the Linux case added in r200263.  Discovered by the FreeBSD
buildbot - I tested the branch with cmake.

llvm-svn: 200548
2014-01-31 14:30:11 +00:00
Jim Ingham 4046a30c73 Check curr_thread is not empty before accessing it.
<rdar://problem/15953271>

llvm-svn: 200504
2014-01-31 01:01:23 +00:00
Greg Clayton 10c0ef7b8a Pressing ^D in a non-empty input terminates LLDB. This was due to the fact that we stack more than one editline instance on top of each other and we still expect CTRL+D to exit the editline instance, but it should only do so when the line is empty. Otherwise it should (and does) delete the character at the cursor.
<rdar://problem/15944703>

llvm-svn: 200489
2014-01-30 20:59:18 +00:00
Todd Fiala 3452df6723 Fixed b18655: cleaned up script interpreter file reference handling.
This change addresses shutdown crashes in the python lldb module when
the script interpreter was hanging on to saved file references after
leaving a session.  It also gets rid of extra references to the
stdin/stdout/stderr python file objects that are created when entering
the session.

This change also moves the bundled pyexpect 2.4 library to the front
of the python library path so that a python distribution default
pyexpect (2.3 in Ubuntu 12.04) is not picked up first.

llvm-svn: 200486
2014-01-30 20:19:22 +00:00
Greg Clayton 590426029b Missing files for previous checkin that fixed: "script help (lldb.SBThread)" output stops after 2048 bytes are printed.
<rdar://problem/15942977>

llvm-svn: 200478
2014-01-30 18:52:57 +00:00
Greg Clayton 31480e64ee "script help (lldb.SBThread)" output stops before all output is displayed. Fixed now.
<rdar://problem/15942977>

llvm-svn: 200476
2014-01-30 18:17:31 +00:00
Enrico Granata 1ba7305974 <rdar://problem/15936507>
PyTuple_SetItem steals a reference to the item it inserts in the tuple
This, plus the Py_XDECREF of the tuple a few lines below, causes our session dictionary to go away after the first time a SWIG layer function is called - with disastrous effects for the first subsequent attempt to use any functionality in ScriptInterpreterPython
This fixes it

llvm-svn: 200429
2014-01-29 23:18:58 +00:00
Greg Clayton 99dcbe1e50 Don't crash when trying to auto complete 'breakpoint set -n "_'
<rdar://problem/15921898>

llvm-svn: 200402
2014-01-29 18:25:07 +00:00
Greg Clayton 5fdb09bb76 Show help dialog the first time the "gui" is run to help users find their way.
llvm-svn: 200326
2014-01-28 18:41:35 +00:00
Greg Clayton c809cbcf4d Fixed a crasher when handling process events that is due to a translation from the public API to the private API.
llvm-svn: 200267
2014-01-28 00:36:31 +00:00
Todd Fiala b8b49ec92b Modified GDBProcessCommunicationServer to launch via the platform.
GDBProcessCommunicationServer now optionally takes a PlatformSP that
defaults to the default platform for the host.
GDBProcessCommunicationServer::LaunchProcess () now uses the platform
to launch the process.

lldb-gdbserver now takes an optional --platform={platform_plugin_name}
or -p {platform_plugin_name} command line option. If no platform is
specified, the default platform for the host is used; otherwise, if
the platform_plugin_name matches a registered platform plugin or
matches the default platform's name (which is not necessarily
registered by name in the case of 'host'), that platform is used. If
the platform name cannot be resolved, lldb-gdbserver exits after
printing all the available platform plugin names and the default
platform plugin name.

llvm-svn: 200266
2014-01-28 00:34:23 +00:00
Greg Clayton 44d937820b Merging the iohandler branch back into main.
The many many benefits include:
1 - Input/Output/Error streams are now handled as real streams not a push style input
2 - auto completion in python embedded interpreter
3 - multi-line input for "script" and "expression" commands now allow you to edit previous/next lines using up and down arrow keys and this makes multi-line input actually a viable thing to use
4 - it is now possible to use curses to drive LLDB (please try the "gui" command)

We will need to deal with and fix any buildbot failures and tests and arise now that input/output and error are correctly hooked up in all cases.

llvm-svn: 200263
2014-01-27 23:43:24 +00:00
Jason Molenda 89c37499dd Change DecodeProcessInfoResponse to set the ProcessInfo's architecture
if the remote stub provided enough information to identify it in the
qProcessInfo packet response.  (e.g. for an Apple device where we know 
it is Mach-O, the cpu type & cpu sub type).
<rdar://problem/15847901> 

llvm-svn: 200253
2014-01-27 22:23:20 +00:00
Enrico Granata 5000ee16f6 <rdar://problem/15776874>
ValueObjectPrinter could enter an infinite loop while trying to display an aptly formed ValueObject: a reference, with a child of some pointer type, such that the pointees chain ended up pointing back to some part of itself - a pointer to itself being the simplest such case

Fixed here by only setting a pointer depth when needed, and ensuring that we won't overflow and wrap the pointer depth when it's zero.

llvm-svn: 200247
2014-01-27 21:31:26 +00:00
Todd Fiala 9f37737311 convert gdb-remote 'A' launch to use LaunchProcess ()
This change modifies the 'A' command handler's launch code to launch
with LaunchProcess (). The net effect is that the default process
monitoring that LaunchProcess () adds will kick in, allowing the
GDBRemoteCommunicationServer to be able to reap processes started with
this facility correctly. Later, in the case of lldb-gdbserver, we'll
also have the proper process monitoring going on to really debug the
inferior process.

llvm-svn: 200246
2014-01-27 20:44:50 +00:00
Todd Fiala 1b0539c7f6 Fix group stop signal handling issue on Linux.
This patch addresses a bug where in a multi-threaded program a new
signal from the inferior may be received before all group-stop
messages from an earlier signal have been handled.

Patch by Andrew MacPherson

llvm-svn: 200226
2014-01-27 17:03:57 +00:00
Ed Maste 1e8f163709 Remove FIXME comments about tids on FreeBSD that no longer apply
Spotted by John Wolfe.

llvm-svn: 200092
2014-01-25 18:45:40 +00:00
Alp Toker 6a6ff05b57 Track clang changes from r200082
llvm-svn: 200085
2014-01-25 16:57:13 +00:00
Steve Pucci 5ae54ae6cd Support for debugging against a remote stock gdbserver.
There are a couple of pieces:
 * some lazy-evaluation members that store info listed in a qSupported response
 * new method SendPacketsAndConcatenateResponses which is used for
   fetching fixed-size objects from the remote gdbserver by using multiple
   packets if necessary (first use will be to fetch shared-library XML files).

llvm-svn: 200072
2014-01-25 05:46:51 +00:00
Jason Molenda bbef401896 Change DataExtractor's ReadInt* and ReadSwapInt* routines, as well as
GetU32 and GetU64, to use memcpy to copy bytes into a local buffer instead
of having a (uint64_t *) etc local variable, pointing to the address, and
dereferencing it.  If compiled on a CPU where data alignment is required 
(e.g. the LDM instruction on armv7) and we try to GetU64 out of a mmap'ed 
DWARF file, that 8 byte quantity may not be world aligned and the program
can get an unaligned memory access fault.

<rdar://problem/15849231> 

llvm-svn: 200069
2014-01-25 05:12:35 +00:00
Jason Molenda 4411528461 Note that qHostInfo prints the cputype and cpusubtype in base10;
qProcessInfo prints the cputype and cpusubtype in base16.

llvm-svn: 200068
2014-01-25 04:44:34 +00:00
Jason Molenda 6e20554ea8 Initialize the named_pipe_path in GDBRemoteCommunication::StartDebugserverProcess
right after the space for it is allocated on the stack, instead of trying
to initialize it in all the different places in this method.  It's too easy
for another uninitialized code path to sneak in as it is written right now.

llvm-svn: 200066
2014-01-25 03:57:13 +00:00