Commit Graph

9680 Commits

Author SHA1 Message Date
Jason Molenda d31c800ce0 Ah, accidentally committed a patch I didn't mean to.
llvm-svn: 219888
2014-10-16 01:27:31 +00:00
Jason Molenda 320e7b3897 It's possible for long_options[long_options_index].definition to be null
from the previous for() loop - check that it is non-null before trying
to deref it.
clang static analyzer fixit.

llvm-svn: 219887
2014-10-16 01:26:51 +00:00
Jason Molenda aee7eb5ed1 Check that process is non-null before calling a method in it.
clang static analyzer fixit.

llvm-svn: 219886
2014-10-16 01:23:06 +00:00
Jason Molenda 4c9bd87916 It's possible for this function to not be passed a CompUnit*; add
guards around a few additional uses of the cu local pointer.
clang static analyzer fixit.

llvm-svn: 219885
2014-10-16 01:21:25 +00:00
Jason Molenda 76513fd9bc Give old_state a default value so we won't try to restore
an uninitialized value.  In reality the code block that 
initializes it and the code block that restores it will always
match up - but the analyzer doesn't know that and I want to 
quiet it, so...
clang static analyzer fixit.

llvm-svn: 219869
2014-10-15 23:39:31 +00:00
Jason Molenda 900dbdc4d9 Give user_id a default invalid value so we don't
possibly use it uninitialized in a log message later.
clang static analyzer fixit.

llvm-svn: 219865
2014-10-15 23:27:12 +00:00
Jason Molenda aeb9a06ff5 Fix unused-variable warnings from the clang static analyzer.
llvm-svn: 219863
2014-10-15 23:13:51 +00:00
Jason Molenda 026aa4962a Mechanical change to FastDemangle to make it closer to the lldb
coding conventions.  Lots of whitespace et al changes but no
content changes.

llvm-svn: 219856
2014-10-15 22:11:15 +00:00
Enrico Granata de4de39c9d This should keep the non-Xcode-based builds happy
llvm-svn: 219853
2014-10-15 21:39:17 +00:00
Enrico Granata 5510a5762c Add synthetic children support for NSIndexPath
llvm-svn: 219852
2014-10-15 21:38:32 +00:00
Enrico Granata db2ecad3cd The NSDate formatter should use GMT instead of the local timezone. Fixes rdar://13416848
llvm-svn: 219841
2014-10-15 20:18:58 +00:00
Enrico Granata b0c5b8f228 Make this test case more resilient in the face of line-table and inlining changes
llvm-svn: 219828
2014-10-15 18:42:45 +00:00
Greg Clayton 807b6b326d Allow ThreadLauncher::LaunchThread() to specify a minimum stack byte size when launching threads.
This defaults to zero, which means to use the system default.

NOTE: Windows will need to implement this.

<rdar://problem/18644448>

llvm-svn: 219821
2014-10-15 18:03:59 +00:00
Zachary Turner cb37ddda0d Remove some unnecessary headers from Host.cpp
After the recent migration of code out of Host.cpp, many
unnecessary headers were still being included.  This prunes the
include list down to only what is still necessary.

llvm-svn: 219814
2014-10-15 17:27:11 +00:00
Matthew Gardiner 6e7b0a088e Improve the handling of kalimba ELF file section type recognition.
Recognise the SHT_NOBITS property in kalimba ELF, and determine this to be
of type zerofilled. Subsequently recognise this type to represent bytes
on the target's DATA address space, and therefore be sized accordingly.

llvm-svn: 219782
2014-10-15 08:21:54 +00:00
Jason Molenda 270c52c8dc Be more consistent about null checks for the Process and ABI
in GetFullUnwindPlanForFrame() - the code was mostly checking
that we had an active Process and ABI but not always.
clang static analyzer fixit.

llvm-svn: 219772
2014-10-15 03:11:37 +00:00
Jason Molenda d91a662a2e Make sure local var cu is non-NULL before dereferencing.
(it was checked for NULL-ness in some places, not in others)
clang static analyzer fixit.

llvm-svn: 219771
2014-10-15 03:07:39 +00:00
Jason Molenda 4d9f3b0e50 Remove unneeded local var initialization.
clang static analyzer fixit.

llvm-svn: 219770
2014-10-15 03:06:23 +00:00
Jason Molenda 9aae9fcbaf Make sure is_indirect local var is initialized; there
exists a code path where it could be used while uninitialized.
clang static analyzer fixit.

llvm-svn: 219769
2014-10-15 03:05:38 +00:00
Jason Molenda 68c8521e71 Ensure that m_syntax is initialized in all the FileSpec
constructors.
clang static analyzer fixit.

llvm-svn: 219768
2014-10-15 03:04:33 +00:00
Eric Christopher cba08bd9b2 Remove unused variable.
llvm-svn: 219751
2014-10-15 00:15:26 +00:00
Zachary Turner 172d37d3b9 Create a process launcher abstraction.
This implements Host::LaunchProcess for windows, and in doing so
does some minor refactor to move towards a more modular process
launching design.

The original motivation for this is that launching processes on
windows needs some very windows specific code, which would live
most appropriately in source/Host/windows somewhere.  However,
there is already some common code that all platforms use when
launching a process before delegating to the platform specific
stuff, which lives in source/Host/common/Host.cpp which would
be nice to reuse without duplicating.

This commonality has been abstracted into MonitoringProcessLauncher,
a class which abstracts out the notion of launching a process using
an arbitrary algorithm, and then monitoring it for state changes.

The windows specific launching code lives in ProcessLauncherWindows,
and the posix specific launching code lives in ProcessLauncherPosix.
When launching a process MonitoringProcessLauncher is created, and
then an appropriate delegate launcher is created and given to the
MonitoringProcessLauncher.

Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D5781

llvm-svn: 219731
2014-10-14 21:55:08 +00:00
Zachary Turner 756acbaa0e Fix a path concatenation issue related to windows paths.
llvm-svn: 219730
2014-10-14 21:54:14 +00:00
Jason Molenda 63ba883d4b When PlatformDarwinKernel::ExamineKextForMatchingUUID is given
a FileSpec, UUID, and ArchSpec, and it's opening all the kexts
with the same bundle id to see if they're a match, don't set
the Arch in the ModuleSpec.  If Module::GetObjectFile() sees
that the architecture of the kext is a mismatch for the arch
we're looking for, it'll spew a warning message to the dev (r217251).

Rely on the UUID match to get the correct file if we have
a UUID -- we'll get no warning if it's a mismatch.

<rdar://problem/18641477> 

llvm-svn: 219728
2014-10-14 21:47:45 +00:00
Greg Clayton b8e9b8b703 Fixed stdio redirection within LLDB to "do the right thing" in all cases.
The main issue was if you didn't specify all three (stdin/out/err), you would get file actions added to the launch that would always use the pseudo terminal. This is now fixed.

Also fixed the test suite test that handles IO to test redirecting things individually and all together and in other combinations to make sure we don't regress.

<rdar://problem/18638226>

llvm-svn: 219711
2014-10-14 20:18:05 +00:00
Ed Maste c08a563292 Skip asan test on FreeBSD
The build fails due to missing asan runtime in the FreeBSD base system.
Instead of marking it expected fail, just skip until we have the runtime
available.

llvm.org/pr21136

llvm-svn: 219701
2014-10-14 18:04:47 +00:00
Todd Fiala d7e27eac19 Fix dotest.py test runner exit code to return non-zero on failure/error.
This addresses this bug:
http://www.llvm.org/bugs/show_bug.cgi?id=21267

Which has been broken since svn r215256 on Aug 8 2014.

DO NOT REVERT THIS COMMIT EVEN IF IT CREATES TEST FAILURES.

The test failures are a result of accumulation of hidden failures
that were masked by the bug this change fixes.  Most of our test
runners as part of build testing rely on dotest.py returning non-zero to indicate
some kind of errant test run.  Thus, we have been flying blind
since Aug 8 2014.

llvm-svn: 219689
2014-10-14 16:17:02 +00:00
Eric Christopher 1b9eb1a13a Use PARALLEL_DIRS instead of DIRS in the Makefile
based build since the subdirectories all appear to
have no inter-directory dependencies. This speeds
up parallel makefile builds greatly.

llvm-svn: 219660
2014-10-14 06:26:33 +00:00
Jim Ingham ffc9f1de34 This adds a "batch mode" to lldb kinda like the gdb batch mode. It will quit the debugger
after all the commands have been executed except if one of the commands was an execution control
command that stopped because of a signal or exception.

Also adds a variant of SBCommandInterpreter::HandleCommand that takes an SBExecutionContext.  That
way you can run an lldb command targeted at a particular target, thread or process w/o having to 
select same before running the command.

Also exposes CommandInterpreter::HandleCommandsFromFile to the SBCommandInterpreter API, since that
seemed generally useful.

llvm-svn: 219654
2014-10-14 01:20:07 +00:00
Sean Callanan 0809b2ddc3 Resolve non-pointer isas for metaclasses.
Patch by Enrico Granata.
<rdar://problem/18618298>

llvm-svn: 219641
2014-10-13 23:03:49 +00:00
Greg Clayton e5bbe10d9e Don't lock the IOHandlerList::m_mutex in Debugger::RunIOHandler(...) since if a process is resumed or halted, it will try to push/pop the process IOHandler and it will deadlock.
<rdar://problem/18610852>

llvm-svn: 219620
2014-10-13 16:54:26 +00:00
Todd Fiala 75f47c3a5d llgs: fixes to PTY/gdb-remote inferior stdout/stderr handling, logging addtions.
With this change, both local-process llgs and remote-target llgs stdout/stderr
handling from inferior work correctly.

Several log lines have been added around PTY and stdout/stderr redirection
logic on the lldb client side.

Regarding remote llgs execution, see the following:

With these changes, remote llgs with $O now works properly:

$ lldb
(lldb) platform select remote-linux
(lldb) target create ~/some/inferior/exe
(lldb) gdb-remote {some-target}:{port}
(lldb) run

The sequence above will correctly redirect stdout/stderr over gdb-remote $O,
as is needed for remote debugging.  That sequence assumes there is a lldb-gdbserver
exe running on the target with {some-host}:{port}.

You can replace the gdb-remote command with a '(lldb) platform connect
connect://{target-ip}:{target-port}'.  If you do this and have a
lldb-platform running on the remote end, it will go ahead and launch
llgs for lldb for each target instance that is run/attached.

For local debugging with llgs, the following sequence also works, and
uses local PTYs instead to avoid $O and extra gdb-remote messages:

$ lldb
(lldb) settings set platform.plugin.linux.use-llgs true
(lldb) target create ~/some/inferior/exe
(lldb) run

The above will run the inferior using llgs on the local host, and
will use PTYs rather than $O redirection.

This change also removes the logging that happened after the fork but
before the exec when llgs is launching a new inferior process.  Some
aspect of the file handling during that portion of code would not do
the right thing with log handling.  We might want to go back later
and have that communicate over a pipe from the child to parent to pass
along any messages that previously were logged in that section of code.

llvm-svn: 219578
2014-10-11 21:42:09 +00:00
Todd Fiala 41d96d2d03 Fix cmake build for PluginInstrumentationRuntimeAddressSanitizer.
llvm-svn: 219576
2014-10-11 20:11:18 +00:00
Kuba Brecka 6392754839 Add a IsInstrumentationRuntimePresent SB API
Reviewed at http://reviews.llvm.org/D5738

This adds an SB API into SBProcess:
  bool SBProcess::IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
which simply tells whether a particular InstrumentationRuntime (read "ASan") plugin is present and active.

llvm-svn: 219560
2014-10-11 01:59:32 +00:00
Kuba Brecka 9b7f36b521 include compiler-rt in build-llvm.pl
Reviewed at http://reviews.llvm.org/D5736

The new test cases for ASan fail if the llvm build that is used with LLDB doesn't have compiler-rt (because the resulting compiler then cannot build with -fsanitize=address). Let's include compiler-rt in build-llvm.pl script and make sure we actually *build* it by removing the NO_RUNTIME_LIBS=1 argument used in the make line. After this, the ASan tests pass on a fresh svn checkout.

llvm-svn: 219555
2014-10-11 00:53:32 +00:00
Eric Christopher e709821359 Fix the build after the recent plugin additions for
AddressSanitizer by adding dependencies and definitions.

llvm-svn: 219554
2014-10-11 00:38:55 +00:00
Jim Ingham 26c7bf9312 Rework the way we pass "run multiple command" options to the various API's that
do that (RunCommandInterpreter, HandleCommands, HandleCommandsFromFile) to gather
the options into an options class.  Also expose that to the SB API's.

Change the way the "-o" options to the lldb driver are processed so:
1) They are run synchronously - didn't really make any sense to run the asynchronously.
2) The stop on error
3) "quit" in one of the -o commands will not quit lldb - not the command interpreter
that was running the -o commands.

I added an entry to the run options to stop-on-crash, but I haven't implemented that yet.

llvm-svn: 219553
2014-10-11 00:38:27 +00:00
Eric Christopher fd1a9362be Reinstate setting addr_width to the result of the computation,
but in the conditional rather than at initialization time.

llvm-svn: 219549
2014-10-11 00:04:42 +00:00
Eric Christopher 53b293e447 Remove default case from a fully covered switch.
llvm-svn: 219548
2014-10-11 00:00:08 +00:00
Eric Christopher baaf079423 Fix unused variable warning from r219544.
llvm-svn: 219547
2014-10-10 23:58:30 +00:00
Kuba Brecka afdf842b3f LLDB AddressSanitizer instrumentation runtime plugin, breakpint on error and report data extraction
Reviewed at http://reviews.llvm.org/D5592

This patch gives LLDB some ability to interact with AddressSanitizer runtime library, on top of what we already have (historical memory stack traces provided by ASan). Namely, that's the ability to stop on an error caught by ASan, and access the report information that are associated with it. The report information is also exposed into SB API.

More precisely this patch...

adds a new plugin type, InstrumentationRuntime, which should serve as a generic superclass for other instrumentation runtime libraries, these plugins get notified when modules are loaded, so they get a chance to "activate" when a specific dynamic library is loaded
an instance of this plugin type, AddressSanitizerRuntime, which activates itself when it sees the ASan dynamic library or founds ASan statically linked in the executable
adds a collection of these plugins into the Process class
AddressSanitizerRuntime sets an internal breakpoint on __asan::AsanDie(), and when this breakpoint gets hit, it retrieves the report information from ASan
this breakpoint is then exposed as a new StopReason, eStopReasonInstrumentation, with a new StopInfo subclass, InstrumentationRuntimeStopInfo
the StopInfo superclass is extended with a m_extended_info field (it's a StructuredData::ObjectSP), that can hold arbitrary JSON-like data, which is the way the new plugin provides the report data
the "thread info" command now accepts a "-s" flag that prints out the JSON data of a stop reason (same way the "-j" flag works now)
SBThread has a new API, GetStopReasonExtendedInfoAsJSON, which dumps the JSON string into a SBStream
adds a test case for all of this
I plan to also get rid of the original ASan plugin (memory history stack traces) and use an instance of AddressSanitizerRuntime for that purpose.

Kuba

llvm-svn: 219546
2014-10-10 23:43:03 +00:00
Jason Molenda aff1b357b0 Add a new disassembly-format specification so that the disassembler
output style can be customized.  Change the built-in default to be
more similar to gdb's disassembly formatting.

The disassembly-format for a gdb-like output is

${addr-file-or-load} <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>: 

The disassembly-format for the lldb style output is

{${function.initial-function}{${module.file.basename}`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name-without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}: 

The two backticks in the lldb style formatter triggers the sub-expression evaluation in
CommandInterpreter::PreprocessCommand() so you can't use that one as-is ... changing to
use ' characters instead of ` would work around that.

<rdar://problem/9885398> 

llvm-svn: 219544
2014-10-10 23:07:36 +00:00
Enrico Granata 0aa6926d0b When parsing ObjC types from encoded strings (and disallowing any-type), the ^? combination gets resolved to no type, while we could resolve it to void*
I don't think on any of the platforms where ObjC matters sizeof(T*) depends on T, so even if we never figured out the pointee type, the pointer type should still be sane
This might also allow some limited inspection where previously none was possible, so a win

llvm-svn: 219540
2014-10-10 22:45:38 +00:00
Andrew MacPherson 1d33e8d38f Update assertion in DYLDRendezvous.
This accounts for the case where a dlopen() call fails when loading a library with a missing dependency.

llvm-svn: 219520
2014-10-10 17:47:00 +00:00
Todd Fiala 2c77a427ab Reverse out r219169 related to quote handling.
Addresses pr/21190 (http://llvm.org/bugs/show_bug.cgi?id=21190).

r219169 implemented this change list:
http://reviews.llvm.org/D5472 for more details.

llvm-svn: 219461
2014-10-10 01:11:39 +00:00
Todd Fiala 348fb385d5 Enable local llgs debugging on Linux when the use-llgs-for-local setting is enabled.
See http://reviews.llvm.org/D5695 for details.

This change does the following:

Enable lldb-gdbserver (llgs) usage for local-process Linux debugging.
To turn on local llgs debugging support, which is disabled by default, enable this setting:

(lldb) settings set platform.plugin.linux.use-llgs-for-local true
Adds a stream-based Dump() function to FileAction.
Pushes some platform methods that Linux (and FreeBSD) will want to share with MacOSX from PlatformDarwin into PlatformPOSIX.

Reviewed by Greg Clayton.

llvm-svn: 219457
2014-10-10 00:09:16 +00:00
Enrico Granata ca0e5ad3d3 In cases where you'd use an expression to get a value to insert in a command, be ready to use synthetic children if they are there. Those are now a source of values, so worth checking for
llvm-svn: 219452
2014-10-09 23:09:40 +00:00
Enrico Granata 6030e04591 Enhance the libc++ list data formatter so that it does not start looking for loops until asked to actually fetch children. Also, if you're going to read child X, only look for a loop in the first X nodes. Loops further down the road won't really matter. This should speed things up for large lists and fix rdar://18583790
llvm-svn: 219447
2014-10-09 21:56:30 +00:00
Zachary Turner 8ada0b9713 Correctly fix ScriptInterpreterPython::ExecuteOneLine for windows.
llvm-svn: 219435
2014-10-09 20:17:53 +00:00
Enrico Granata ddac7611ee If a ValueObject has a child that vends synthetic children, but only does so to generate a value for itself, that's not a disqualifier from one-line printing. Also, fetch synthetic values if available and requested for children as well while printing them
llvm-svn: 219427
2014-10-09 18:47:36 +00:00