Commit Graph

5099 Commits

Author SHA1 Message Date
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 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
Todd Fiala 8ce3dee45f Fix crash on Linux if sem_wait() is interrupted.
Patch by Andrew MacPherson.

llvm-svn: 200049
2014-01-24 22:59:22 +00:00
Jason Molenda ffa674e6d7 Terminate an unused char* buffer correctly so we don't try to open
it later in GDBRemoteCommunication::StartDebugserverProcess and report
an error.
<rdar://problem/15820813> 

llvm-svn: 200047
2014-01-24 22:49:32 +00:00
Todd Fiala 3e92a2b013 Added reaper for commandline-launched processes.
GDBRemoteCommunicationServer::LaunchProcess () now uses the built-up
ProcessLaunchArgs rather than clearing and setting items from the
function arguments. I added setters for the arguments and launch
flags, which lldb-gdbserver uses for its specification of the
commandline-specified startup app (if one is specified).

LaunchProcess () also adds a new reaper monitor that it applies to
the launched process if no process monitor has already been applied.

This addresses an issue where the 'k' command would generate (possibly
false) warnings about not being able to positively state whether a
killed process actually terminated. GDBRemoteCommunicationServer now
definitely knows the disposition of its children.

llvm-svn: 199959
2014-01-24 00:52:53 +00:00
Greg Clayton 1e3be5ba2c Don't copy entire value into m_data unless we need to. If we did this and the entire variable failed to be read, we wouldn't be able to display any actual values that were in good memory. This will also make things more efficient by not have every struct/union/class/array copy its entire value into a ValueObject.m_data even though no one was using it.
llvm-svn: 199953
2014-01-23 22:55:05 +00:00
Greg Clayton 146b7b1230 Updated to latest and greatest demangler sources.
<rdar://problem/15736085>

llvm-svn: 199946
2014-01-23 22:12:54 +00:00
Todd Fiala 403edc5c57 Move process launching into GDBRemoteCommunicationServer.
lldb-gdbserver was launching the commandline-specified launch process
directly, without GDBRemoteCommunicationServer knowing anything about
it.  As GDBRemoteCommunicationServer is the piece that manages and
knows about processes that the gdb remote protocol discusses with
the client end, it is important that it know about launched processes.

This change also implements the k gdb remote protocol message, having it
kill all known spawned processes when it is received.

(Note: in lldb-gdbserver, the spawned processes are not properly
monitored yet. The response to the k packet will complain that
spawned processes do not really appear to be getting killed even if
they are. This will get addressed soon.)

llvm-svn: 199945
2014-01-23 22:05:44 +00:00
Jim Ingham a786e53903 Don't need to figure out the frame's module if we don't have any libraries
in the step-avoid-libraries list.

llvm-svn: 199944
2014-01-23 21:57:53 +00:00
Jim Ingham 4da6206d75 Add a "step-avoid-libraries" setting to complement the "step-avoid-regexp" setting.
llvm-svn: 199943
2014-01-23 21:52:47 +00:00
Greg Clayton 1f4db7da8f Added the ability to get the type that a typedef points to via:
SBType SBType::GetTypedefedType();

Also added the ability to get a type by type ID from a SBModule:

SBType SBModule::GetTypeByID (lldb::user_id_t uid);

llvm-svn: 199939
2014-01-23 21:38:34 +00:00
Todd Fiala 571768caa6 Candidate fix for bug 18592.
This reverts Host.cpp LaunchProcess spawn behavior on FreeBSD to be
like Linux (and unlike OS X) with regards to how default signal
handlers and setup on the spawned process. FreeBSD does not reset
default signal handlers on the spawned process after this change.

llvm-svn: 199908
2014-01-23 17:07:54 +00:00
Enrico Granata 90890bba04 If a user specifies a format option to frame variable or expression, that format should prevail over whatever format(s) a summary specifies
(see test case for an example)

llvm-svn: 199857
2014-01-23 01:21:18 +00:00
Todd Fiala 76747120ca Unify OS X/POSIX/Linux Host spawn support.
This fixes a bug under Linux where spawning a process via
Host::LaunchProcess was disabling all blockable signals on the
launched process.  This caused strange behavior when attempting
to kill the lldb-gdbserver process, as the child generally would
not die unless killed with a non-blockable signal (e.g. 'kill -9').

This change moves several functions out of macosx/Host.mm into
common/Host.cpp.  In addition, two functions that needed to work
across common/Host.cpp and macosx/Host.mm were moved into the Host.h
header file.

llvm-svn: 199856
2014-01-23 00:52:28 +00:00
Greg Clayton a86dc43371 Add support for Haswell on x86_64.
<rdar://problem/15312873>

llvm-svn: 199854
2014-01-22 23:42:03 +00:00
Sean Callanan 4f2c198617 Better logging for the IRExecutionUnit so that
we can see exactly what data was put where.

llvm-svn: 199701
2014-01-21 00:54:48 +00:00
Alp Toker f747ff1f54 Build fix following clang r199686
llvm-svn: 199689
2014-01-20 21:14:57 +00:00
Todd Fiala 5000e28a5e Make lldb build with Makefiles on OS X.
This change does the following:

* Adds Makefile build scripts to debug server.

* Fixes a few small mistakes in the other makefiles.

* Modifies generate-vers.pl slightly to also work for debugserver.

* Changes the OS X, non-framework python search path from libdir to
  libdir/python2.X/site-packages where it is installed by the build
  system (also where it is installed on other operating systems).

Patch by Keno Fischer.

llvm-svn: 199543
2014-01-18 08:05:32 +00:00
Todd Fiala a9ddb0e14f Added distribution info to ArchSpec and qHostInfo message.
ArchSpec now contains an optional distribution_id, with getters and
setters. Host::GetArchitecture () sets it on non-Apple platforms using
Host::GetDistributionId (). The distribution_id is ignored during
ArchSpec comparisons.

The gdb remote qHostInfo message transmits it, if set, via the
distribution_id={id-value} key/value pair. Updated gdb remote docs to
reflect this change.

As before, GetDistributionId () returns nothing on non-Linux platforms
at this time. On Linux, it is returned only if the lsb_platform
command is installed (in /bin or /usr/bin), and only if the
distributor id key is returned by 'lsb_platform -i'. This id is
lowercased, and whitespace is replaced with underscores.

llvm-svn: 199539
2014-01-18 03:02:39 +00:00
Sean Callanan 6826d22784 Made sure that ValueObjectVariable actually
updates itself before it tries to set its own
data.  Otherwise it has no idea where to put the
data value.

<rdar://problem/15846476>

llvm-svn: 199533
2014-01-18 01:13:50 +00:00
Todd Fiala e28f1d7f07 Undo change to triple behavior from r199510.
The Linux distribution will be added to the ArchSpec class in an
upcoming change. This change only undoes the change to the triple. The
distribution retrieval logic and enabling of lldb-gdbserver for linux
x86_64 builds is still in place.

llvm-svn: 199520
2014-01-17 22:21:22 +00:00
Todd Fiala f3d61de532 Enable Linux distribution in vendor portion of host triple.
This change does the following:

* enables building lldb-gdbserver on linux_x86-64 platforms.

  Note - it builds but it has several run-time issues where many gdb
  remote protocol features are not properly implemented yet. I'm
  working on these one at a time.

* lldb-gdbserver: does not enable the eLaunchFlagDebug launch flag on
  Linux. Currently the POSIX launch routine will assert if that flag
  is passed in, presumably because that launch mode is not yet
  available.  This prevents lldb-gdbserver from asserting the moment
  it launches the debuggee process.

* Adds ConstString& Host::GetDistributionId ()

  This method is defined to return an empty result on all platforms
  except for Linux.  On Linux, it makes one attempt to execute
  'lsb_release -i' (both /usr/bin/lsb_release, where it appears
  on ubuntu, and /bin/lsb_release, where it appears on fedora
  if the redhat-lsb package is installed).  If lsb_release is not
  found in either of those locations, or if 'lsb_release -i' does
  not return the first line starting with "Distributor ID:\t",
  then the distribution id is empty.  The method will lower-case
  the id and replace whitespace with underscores.

* Modify Host::GetArchitecture () so that linux replaces an unknown
  vendor portion with the results of GetDistributionId () if that
  is non-empty.  This shows up now in qHostInfo remote packet
  responses and on the lldb host side.  Tested with ubuntu and
  fedora (the latter both with the default of not having lsb_release
  installed, and with having lsb_release installed via the redhat-lsb
  package).

  Examples of triples on Linux after this change:

    # x86_64 Unbuntu 12.04 LTS:
    x86_64-ubuntu-linux-gnu

    # x86_64 Fedora 20 Desktop with redhat-lsb package installed
    x86_64-fedora-linux-gnu

    # x86_64 Fedora 20 Desktop without redhat-lsb-core installed
    # (i.e. no /bin/lsb_release available)
    # same as before the change
    x86_64--linux-gnu

  Note I intend to have Android respond with:

    {arch}-android-linux

  when I get to implementing Android lldb-gdbserver support.

llvm-svn: 199510
2014-01-17 20:18:59 +00:00
Jim Ingham 6f78f3869d The default timeout for EvaluateExpressionOptions is not 0, so if no timeout is provided, we have to set the option timeout to 0 by hand.
<rdar://problem/15846781>

llvm-svn: 199509
2014-01-17 20:09:23 +00:00
Steve Pucci 7489cc98f7 Fix gcc warnings about casting away constness
llvm-svn: 199506
2014-01-17 18:29:08 +00:00
Steve Pucci fc99572540 Rename Platform::GetFile (3-arg version) to GetFileWithUUID
This rename was suggested by gclayton as a way to silence gcc
warnings; the warning is emitted when there is an overloaded function
in a base class (Platform) for which a derived class redefines one of
the overloads but not the other (because doing so hides the other
overload from users of the derived class).  By giving the two methods
different names, the situation is avoided.

llvm-svn: 199504
2014-01-17 18:18:31 +00:00
Ed Maste 21afbe034e Correct logic checking for the first stop ID
llvm-svn: 199503
2014-01-17 17:31:06 +00:00
Steve Pucci 5ec012d4de Test new committer permission with one-line trailing whitespace removal.
llvm-svn: 199432
2014-01-16 22:18:14 +00:00
Todd Fiala a475693947 Fix bug in Linux remote dynamic loader setup and fix test.
Part 1 changes PlatformLinux::CreateInstance to always create with
is_host=false; that method is only used as the plug-in creator method
associated with the remote-linux platform plugin, and should therefore
always be remote.

Part 1 patch by Steve Pucci.

Part 2: fix a test break on linux.

In test/functionalities/thread/thread_specific_break, when using gcc,
either C99 mode would need to be enabled, or the code would need to
change.  I changed a couple loop variable definitions to conform
to pre-C99 to simplify testing the fix.  The second issue was
the necessity to include -lpthread as a linker option in the Makefile.

Any issues with that part are due to me (Todd Fiala).

llvm-svn: 199426
2014-01-16 21:22:11 +00:00
Sean Callanan 79fde96b6a Fixed some API drift by making "used" attributes
in a better way.

llvm-svn: 199408
2014-01-16 18:47:07 +00:00
Greg Clayton baf2c2211d If a library has no N_FUN symbols we don't succeed in finding resolver symbols, now we do.
<rdar://problem/15831334>

llvm-svn: 199345
2014-01-16 01:48:44 +00:00
Greg Clayton d81088c540 Make sure we correctly merge all N_FUN symbols with non-stab entries even if there are multiple symbols with the same name.
<rdar://problem/15831292>

llvm-svn: 199344
2014-01-16 01:38:29 +00:00
Jim Ingham 39fdae7f6a Fix a bug where if we stop but nobody says there was a reason for the stop, we would return
control to the user anyway.  This was put in to handle monitors that would say there was no
stop reason when you first attached to them.  But it broke the case where you hit a thread specific
breakpoint on many threads, but NOT the one specified in the breakpoint.  I work around this
by only doing the junky override when the StopID is 0 - i.e. on first attach.

This commit also adds a test for thread specific breakpoints.

llvm-svn: 199290
2014-01-15 03:32:42 +00:00
Jim Ingham a8b99ca4bb Add a little more logging to the StopInfoBreakpoint::PerformAction.
llvm-svn: 199289
2014-01-15 03:30:04 +00:00
Deepak Panickal 263fde068f Fix return type for Windows
llvm-svn: 199202
2014-01-14 11:34:44 +00:00
Sean Callanan 22ac610c4f Harden the Materializer logic against types that
don't know their bit alignment.

llvm-svn: 199173
2014-01-14 01:14:40 +00:00
Deepak Panickal b36da43dc3 Fixed the Visual Studio Windows build
llvm-svn: 199111
2014-01-13 14:55:15 +00:00
Ed Maste 9344787636 Avoid LLDB crash upon DW_OP_deref* with empty stack
As done in other DW_OP_* cases, return an error if the stack is empty
rather than eventually crashing elsewhere.  Encountered on big-endian
MIPS, where LLVM bugs currently result in invalid .debug_loc data.

llvm-svn: 199110
2014-01-13 14:53:09 +00:00
Jim Ingham 55d3a0c3d4 Sometimes the trampoline refers directly to the indirect symbol. Handle that too.
llvm-svn: 198990
2014-01-11 01:21:50 +00:00
Jason Molenda 7f6d84b9c1 Add the offset for cfa+offset log messages in the unwind channel, to aid in debugging.
llvm-svn: 198977
2014-01-10 23:53:32 +00:00
Jim Ingham 1460e4bf0e Get the breakpoint setting, and the Mac OS X DYLD trampolines and expression evaluator to handle Indirect
symbols correctly.  There were a couple of pieces to this.

1) When a breakpoint location finds itself pointing to an Indirect symbol, when the site for it is created
   it needs to resolve the symbol and actually set the site at its target.
2) Not all breakpoints want to do this (i.e. a straight address breakpoint should always set itself on the
   specified address, so somem machinery was needed to specify that.
3) I added some info to the break list output for indirect symbols so you could see what was happening. 
   Also I made it clear when we re-route through re-exported symbols.
4) I moved ResolveIndirectFunction from ProcessPosix to Process since it works the exact same way on Mac OS X
   and the other posix systems.  If we find a platform that doesn't do it this way, they can override the
   call in Process.
5) Fixed one bug in RunThreadPlan, if you were trying to run a thread plan after a "running" event had
   been broadcast, the event coalescing would cause you to miss the ThreadPlan running event.  So I added
   a way to override the coalescing.
6) Made DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan handle Indirect & Re-exported symbols.

<rdar://problem/15280639>

llvm-svn: 198976
2014-01-10 23:46:59 +00:00
Jim Ingham ea3ac27029 The actual indirect symbol is not the one at the address of the Trie entry marked with the EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER, it is given in the address in the “other” field in that entry.
llvm-svn: 198967
2014-01-10 22:55:37 +00:00
Greg Clayton fda4fab505 Revert to getting a random port and sending that down to debugserver for iOS. The sandboxing is not letting debugserver reverse connect back to lldb.
<rdar://problem/15789865>

llvm-svn: 198963
2014-01-10 22:24:11 +00:00
Jason Molenda 5f36c4beec Update the lldb version number in the xcode project files from 310.99.0 to 320.99.0.
llvm-svn: 198917
2014-01-10 06:12:10 +00:00
Greg Clayton 99e384c85f Fixed an issue with the byte order of ports in KDP packets.
I previously fixed a bug in the SocketAddress class where SocketAddress::GetPort() wasn't using ntohs() on the port number in the structures.

After fixing this, it broke places where we weren't using ntohs() and htons() correctly.

<rdar://problem/15767514>

llvm-svn: 198902
2014-01-10 00:31:10 +00:00
Jason Molenda 25f3961caf Roll back r198729; it seems to be causing two testsuite failures if llvm is built with asserts -
210: test_with_dsym_and_run_command (Test-rdar-10642615.Radar10642615DataFormatterTestCase)
     Test data formatter commands. ... Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/include/llvm/Support/Casting.h, line 239.

     226: test_with_dsym_and_run_command (Test-rdar-13338477.Radar13338477DataFormatterTestCase)
         Test that LLDB handles the clang typeclass Paren correctly. ... Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/include/llvm/Support/Casting.h, line 239.

llvm-svn: 198811
2014-01-09 00:02:17 +00:00
Jason Molenda 491caa14d5 Roll back my change to r198729; I'm going to revert it entirely.
llvm-svn: 198810
2014-01-09 00:00:53 +00:00
Jason Molenda 5005de4bac Revert the vector part of Enrico's change in r198729;
it is causing an llvm assert when run against
test/functionalities/data-formatter/rdar-10642615,

Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/include/llvm/Support/Casting.h, line 239.

llvm-svn: 198809
2014-01-08 23:35:54 +00:00