Commit Graph

11206 Commits

Author SHA1 Message Date
Zachary Turner 8f7cfecfbf Try again to fix OSX compilation failure.
llvm-svn: 355536
2019-03-06 19:14:41 +00:00
Zachary Turner a313ec11fc Try to fix OSX compilation failure.
llvm-svn: 355531
2019-03-06 18:44:27 +00:00
Zachary Turner a89ce43cec Resubmit "Don't include UnixSignals.h from Host."
This was reverted because it breaks the GreenDragon bot, but
the reason for the breakage is lost, so I'm resubmitting this
now so we can find out what the problem is.

llvm-svn: 355528
2019-03-06 18:20:23 +00:00
Greg Clayton 6795eb3884 Fix core files for 32 bit architectures that are supported in ProcessELFCore.cpp
Core files need to know the size of the PRSTATUS header so that we can grab the register values that follow it. The code that figure out this size was using a hard coded list of architecture cores instead of relying on 32 or 64 bit for most cores.

The fix here fixes core files for 32 bit ARM. Prior to this the PRSTATUS header size was being returned as zero and the register values were being taken from the first bytes of the PRSTATUS struct (signo, etc).

Differential Revision: https://reviews.llvm.org/D58985

llvm-svn: 355526
2019-03-06 18:04:10 +00:00
Tatyana Krasnukha 1b6700eff4 Re-apply "Fix embedded Python initialization according to changes in version 3.7"
llvm-svn: 355523
2019-03-06 17:27:40 +00:00
Jonas Devlieghere 584f3a6d38 [Reproducers] Guard register macros that take lldb::thread_t on Windows
On Windows, lldb::thread_t is just a void*, so the we will try to
allocate an object of type void when deserializing. Undef this for now
until we support void* arguments.

llvm-svn: 355519
2019-03-06 16:42:33 +00:00
Jonas Devlieghere 9ebe71a4e1 [Reproducers] Don't use VLA in SBReproducer redirect
This should unbreak the Windows bot.

llvm-svn: 355518
2019-03-06 16:33:48 +00:00
Pavel Labath b8093314ef Move RangeMap.h into Utility
Summary:
This file implements some general purpose data structures, and so it
belongs to the Utility module.

Reviewers: zturner, jingham, JDevlieghere, clayborg, espindola

Subscribers: emaste, mgorny, javed.absar, arichardson, MaskRay, lldb-commits

Differential Revision: https://reviews.llvm.org/D58970

llvm-svn: 355509
2019-03-06 14:41:43 +00:00
Jason Molenda 4cc9ff1245 Change the scanning algorithm in DynamicLoaderDarwinKernel::SearchForKernelNearPC.
Currently when lldb might be doing a kernel debug session, it scans through
memory by taking the current pc value and looking for a kernel at megabyte
boundaries, up to 32MB behind $pc.  This adjusts the algorithm to
scan back at every 16k page boundary and to stop scanning as soon
as we hit a memory read error.  The addition of stopping at a memory read
error saves us from tons of unnecessary packet traffic on generic 
targets where lldb might look for a kernel binary.

I've been trying to think of how to construct a test for this; it's a bit
tricky.  A gdb-remote protocol test with the contents of a fake tiny kernel
mach-o binary would satisify part of it, but this kernel path also directly
calls over to dsymForUUID or DebugSymbols framework lookups to find the 
kernel binary as well.  I'll keep thinking about this one, but it's so
intertangled with these two external systems that it may be hard to do.

<rdar://problem/48578197> 

llvm-svn: 355476
2019-03-06 02:45:27 +00:00
Jason Molenda b459f182e8 Re-commit logging for SBCompileUnit::GetNumLineEntries.
llvm-svn: 355473
2019-03-06 02:32:45 +00:00
Alex Langford a4223f9e5f [ExpressionParser] Fix ComputeClangResourceDirectory for windows
The function signature of ComputeClangResourceDirectory for windows
wasn't updated when the others changed, causing the windows build to
fail. This should fix that.

llvm-svn: 355471
2019-03-06 01:57:04 +00:00
Jonas Devlieghere 2e3e65fb62 [Reproducers] Enable replay from SBRepro.
Now that the LLDB instrumentation macros are in place, we should use
that to test reproducer replay.

Differential revision: https://reviews.llvm.org/D58565

llvm-svn: 355470
2019-03-06 01:49:57 +00:00
Jonas Devlieghere 7e23df4437 [Reproducers] Don't intercept SBDebugger::SetInputFileHandle
With the reproducer logic in place for the command interpreter we no
longer need to make SBDebugger::SetInputFileHandle a no-op.

llvm-svn: 355469
2019-03-06 01:49:54 +00:00
Adrian Prantl 61f1b70a78 Replace debug-only assert with a plain old assert.
llvm-svn: 355466
2019-03-06 01:07:45 +00:00
Alex Langford 787fe33434 [ExpressionParser] Test GetClangResourceDir
Summary:
I'm doing this because I plan on implementing `ComputeClangResourceDirectory`
on windows so that `GetClangResourceDir` will work.  Additionally, I made
test_paths make sure that the directory member of the returned FileSpec is not
none. This will fail on windows since `ComputeClangResourceDirectory` isn't
implemented yet.

Differential Revision: https://reviews.llvm.org/D58748

llvm-svn: 355463
2019-03-06 00:45:16 +00:00
Jonas Devlieghere baf5664f50 [Reproducers] Add SBReproducer macros
This patch adds the SBReproducer macros needed to capture and reply the
corresponding calls. This patch was generated by running the lldb-instr
tool on the API source files.

Differential revision: https://reviews.llvm.org/D57475

llvm-svn: 355459
2019-03-06 00:06:00 +00:00
Jonas Devlieghere bd4bf82a48 [SBAPI] Don't check IsValid in constructor
When running the test suite with the instrumentation macros, I noticed
two lldb-mi tests regressed. The issue was the copy constructor of
SBLineEntry. Without the macros the returned value would be elided, but
with the macros the copy constructor was called. The latter using ::IsValid
to determine whether the underlying opaque pointer should be set. This
is likely a remnant of when ::IsValid would only check the validity of the
smart pointer. In SBLineEntry however, it actually forwards to
LineEntry::IsValid().

So what happened here was that because of the macros the copy
constructor was called. The opaque pointer was valid but the LineEntry
didn't consider itself valid. So the copied-to object ended up default
initialized.

This patch replaces all checks for IsValid in copy (assignment)
constructors with checks for the opaque pointer itself.

Differential revision: https://reviews.llvm.org/D58946

llvm-svn: 355458
2019-03-06 00:05:55 +00:00
Adrian Prantl d823020bac Remove tautological #ifdefs (NFC)
Differential Revision: https://reviews.llvm.org/D58838

llvm-svn: 355457
2019-03-05 23:51:25 +00:00
Jason Molenda f228b2c2ef Revert logging addition to SBCompileUnit::GetNumLineEntries,
causing lldb-mi testsuite failures?  

llvm-svn: 355449
2019-03-05 22:17:47 +00:00
Jason Molenda 14c1e08ff5 Add logging to SBCompileUnit::GetNumLineEntries.
llvm-svn: 355435
2019-03-05 19:43:56 +00:00
Shafik Yaghmour bb322e79c1 [DataFormatters] Fix regression in libc++ std::atomic formatter caused by https://reviews.llvm.org/D56913
rdar://problem/48568543

llvm-svn: 355422
2019-03-05 18:34:35 +00:00
Tatyana Krasnukha 622862987f Revert "Fix embedded Python initialization according to changes in version 3.7"
Testsuite hangs on Windows likely due to these changes.

llvm-svn: 355406
2019-03-05 15:27:33 +00:00
Yury Delendik bc6b225d42 Adds property to force enabling of GDB JIT loader for MacOS
Summary:
Based on https://gist.github.com/thlorenz/30bf0a3f67b1d97b2945#patching-and-rebuilding

The functionality was disabled at 521c2278ab

Reviewers: jingham

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D57689

llvm-svn: 355402
2019-03-05 14:23:53 +00:00
Pavel Labath a55999301e One more UserIDResolver fix
The intention in r355323 has been to implement a no-op resolver in the
HostInfoBase class, which will then be shadowed a an implementation in
the HostInfoPosix class. However, I add the shadowing declaration in
HostInfoPosix.h, and instead had implemented the HostInfoBase function
in HostInfoPosix.cpp. This has lead to undefined symbols on windows, and
a subsequent implementation of a no-op resolver in HostInfoWindows
(r355329).

Since now there is no point on having a no-op resolver in the base
class, I just remove the base declaration altogether, and have
HostInfoPosix implement the (newly-declared) HostInfoPosix version of
that function.

llvm-svn: 355398
2019-03-05 12:51:20 +00:00
Alexander Kornienko 7523f743b4 [lldb] Fix linux host build after r355342
llvm-svn: 355392
2019-03-05 12:05:35 +00:00
Tatyana Krasnukha b30c1d571b Fix embedded Python initialization according to changes in version 3.7
Differential Revision: https://reviews.llvm.org/D58833

llvm-svn: 355388
2019-03-05 11:18:45 +00:00
Alex Langford 81dbc02671 [Expression] Remove unused parameter from Evaluate
llvm-svn: 355375
2019-03-05 03:33:34 +00:00
Davide Italiano e94add2f64 [Host] Fix the build (and the modules build).
-> Add a missing include to find the base class.
-> Add a missing out-of-line declaration for a member function.

llvm-svn: 355353
2019-03-05 00:37:40 +00:00
Shafik Yaghmour 6ed191093d Revert "[DataFormatters] Fix regression in libc++ std::atomic formatter caused by https://reviews.llvm.org/D56913"
This reverts commit r355351.

llvm-svn: 355352
2019-03-05 00:29:58 +00:00
Shafik Yaghmour d38e41ec60 [DataFormatters] Fix regression in libc++ std::atomic formatter caused by https://reviews.llvm.org/D56913
rdar://problem/48568543

llvm-svn: 355351
2019-03-05 00:17:18 +00:00
Zachary Turner 805e71060e Move ProcessInfo from Host to Utility.
There are set of classes in Target that describe the parameters of a
process - e.g. it's PID, name, user id, and similar. However, since it
is a bare description of a process and contains no actual functionality,
there's nothing specifically that makes this appropriate for being in
Target -- it could just as well be describing a process on the host, or
some hypothetical virtual process that doesn't even exist.

To cement this, I'm moving these classes to Utility. It's possible that
we can find a better place for it in the future, but as it is neither
Host specific nor Target specific, Utility seems like the most appropriate
place for the time being.

After this there is only 2 remaining references to Target from Host,
which I'll address in a followup.

Differential Revision: https://reviews.llvm.org/D58842

llvm-svn: 355342
2019-03-04 21:51:03 +00:00
Shoaib Meenai 5be71faf4b [build] Rename clang-headers to clang-resource-headers
Summary:
The current install-clang-headers target installs clang's resource
directory headers. This is different from the install-llvm-headers
target, which installs LLVM's API headers. We want to introduce the
corresponding target to clang, and the natural name for that new target
would be install-clang-headers. Rename the existing target to
install-clang-resource-headers to free up the install-clang-headers name
for the new target, following the discussion on cfe-dev [1].

I didn't find any bots on zorg referencing install-clang-headers. I'll
send out another PSA to cfe-dev to accompany this rename.

[1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html

Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille

Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits

Tags: #clang, #sanitizers, #lldb, #openmp, #llvm

Differential Revision: https://reviews.llvm.org/D58791

llvm-svn: 355340
2019-03-04 21:19:53 +00:00
Zachary Turner bb4d4e2d76 Fix Windows build after UserIDResolver patch.
That patch added a function to HostInfo that returns an instance
of UserIDResolver, but this function was unimplemented on Windows,
leading to linker errors.  For now, just return a dummy implementation
that doesn't resolve user ids to get the build green.

llvm-svn: 355329
2019-03-04 19:57:04 +00:00
Pavel Labath aa51e6a683 Refactor user/group name resolving code
Summary:
This creates an abstract base class called "UserIDResolver", which can
be implemented to provide user/group ID resolution capabilities for
various objects. Posix host implement a PosixUserIDResolver, which does
that using posix apis (getpwuid and friends).  PlatformGDBRemote
forwards queries over the gdb-remote link, etc. ProcessInstanceInfo
class is refactored to make use of this interface instead of taking a
platform pointer as an argument. The base resolver class already
implements caching and thread-safety, so implementations don't have to
worry about that.

The main motivating factor for this was to remove external dependencies
from the ProcessInstanceInfo class (so it can be put next to
ProcessLaunchInfo and friends), but it has other benefits too:
- ability to test the user name caching code
- ability to test ProcessInstanceInfo dumping code
- consistent interface for user/group resolution between Platform and
  Host classes.

Reviewers: zturner, clayborg, jingham

Subscribers: mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D58167

llvm-svn: 355323
2019-03-04 18:48:00 +00:00
Michal Gorny e39ec43be7 [lldb] [Process/gdb-remote] Use '127.0.0.1' in ConnectLocally()
Use '127.0.0.1' instead of 'localhost' in ConnectLocally() function
as this is the specific address the server is bound to.  Using
'localhost' may involve trying IPv6 first which may accidentally be used
by another service.

While technically it might be interesting to support IPv6 here, it would
need to be supported properly, with the connection copying family
and address from the listening socket, and possibly without relying
on existence of 'localhost' at all.

Differential Revision: https://reviews.llvm.org/D58883

llvm-svn: 355285
2019-03-03 12:42:43 +00:00
Pavel Labath 113c4c108d Fix gcc build for r355249
automatic move should not fire when returning type T in a function with
result type Expected<T>. Some compilers seem to allow that nonetheless.

llvm-svn: 355270
2019-03-02 16:23:07 +00:00
Jonas Devlieghere d77c2e0926 [Reproducers] Capture and replay interpreter commands.
This patch adds the necessary logic to capture and replay commands
entered into the command interpreter. A DataRecorder shadows the input
and writes its data to a know file. During replay this file is used as
the command interpreter's input.

It's possible to the command interpreter more than once, with a
different input source. We support this scenario by using multiple
buffers. The synchronization for this takes place at the SB layer, where
we create a new recorder every time the debugger input is changed.
During replay we use the corresponding buffer as input.

Differential revision: https://reviews.llvm.org/D58564

llvm-svn: 355249
2019-03-02 00:20:26 +00:00
Adrian Prantl 25f718e9f8 Delete commented-out code.
llvm-svn: 355238
2019-03-01 22:30:31 +00:00
Jim Ingham 3139fc9767 Resubmit r354706 with a fix for process launch.
When the debugger is run in sync mode, you need to
be able to tell whether a hijacked resume is for some
special purpose (like waiting for the SIGSTOP on attach)
or just to perform a synchronous resume.  Target::Launch was doing
that wrong, and that caused stop-hooks on process launch
in source files to behave incorrectly.

<rdar://problem/48115661>

Differential Revision: https://reviews.llvm.org/D58727

llvm-svn: 355213
2019-03-01 18:13:38 +00:00
Jason Molenda e772052edf Increase timeout in Symbols::DownloadObjectAndSymbolFile
from 30 seconds to 120 seconds.  We've seen cases where
this symbol lookup can exceed 30 seconds for people
working remotely.

<rdar://problem/48460476> 

llvm-svn: 355169
2019-03-01 03:24:59 +00:00
Alex Langford 55056424d8 [CMake] Make liblldb depend on clang-headers
Summary:
The clang headers are useful when dealing with clang modules. There is also a
way to get to the clang headers from the SB API so it would be nice if they were
also available when we just build lldb.

Differential Revision: https://reviews.llvm.org/D58793

llvm-svn: 355149
2019-02-28 22:24:18 +00:00
Adrian McCarthy 34f2bee0fb Improve process launch comments for Windows
The existing comment about over-allocating the command line was incorrect.  The
contents of the command line may be changed, but it's not necessary to over
allocate.  The changes will be limited to the existing contents of the string
(e.g., by replacing spaces with L'\0' to tokenize the command line).

Also added a comment explaining a possible cause of failure to save the next
programmer some time when they try to debug a 64-bit process from a 32-bit
LLDB.

llvm-svn: 355121
2019-02-28 19:14:02 +00:00
Jonas Devlieghere 95bb3c3cc3 [Reprodicuers] Check initialization
If the reproducer is not initialzied, the call to ::Instance() will
result in an assertion.

llvm-svn: 355055
2019-02-28 00:49:57 +00:00
Adrian Prantl 7feefe8664 Remove unnecessary demangling operation (NFC)
This extra call to the demangler doesn't affect the performance of C++
because the result is being cached anyway; but I'm working on a patch
to the Swift branch that uses extra contextual information to provide
a more accurate demangling result. In that case this call would be
extra and unnecessary work.

Differential Revision: https://reviews.llvm.org/D58720

llvm-svn: 355042
2019-02-27 22:54:47 +00:00
Zachary Turner 2d525d472c Remove dependency from Host -> Core.
I wasn't actually trying to eliminate this one, but looks like
it happened as a side effect of moving Symbols out of Host.

llvm-svn: 355037
2019-02-27 21:53:08 +00:00
Zachary Turner 80552918a9 Move Host/Symbols.cpp to Symbols/LocateSymbolFile.cpp
Given that we have a target named Symbols, one wonders why a
file named Symbols.cpp is not in this target.  To be clear,
the functions exposed from this file are really focused on
*locating* a symbol file on a given host, which is where the
ambiguity comes in.  However, it makes more sense conceptually
to be in the Symbols target. While some of the specific places
to search for symbol files might change depending on the Host,
this is not inherently true in the same way that, for example,
"accessing the file system" or "starting threads" is
fundamentally dependent on the Host.

PDBs, for example, recently became a reality on non-Windows platforms,
and it's theoretically possible that DSYMs could become a thing on non
MacOSX platforms (maybe in a remote debugging scenario). Other types of
symbol files, such as DWO, DWP, etc have never been tied to any Host
platform anyway.

After this patch, there is only one remaining dependency from
Host to Target.

Differential Revision: https://reviews.llvm.org/D58730

llvm-svn: 355032
2019-02-27 21:42:10 +00:00
Jim Ingham b12ac2b689 Pass arguments correctly to the objc object checker on arm64
Traditionally objc had two entry points, objc_msgSend for scalar
return methods, and objc_msgSend_stret for struct return convention
methods.  But on arm64 the second was not needed (since arm64 doesn't
use an argument register for the struct return pointer) so it was removed.

The code that dispatches to the objc object checker when it sees some
flavor of objc_msgSend was not aware of this change so was sending the
wrong arguments to the checker.

<rdar://problem/48315890>

Differential Revision: https://reviews.llvm.org/D58699

llvm-svn: 355026
2019-02-27 20:27:25 +00:00
Jonas Devlieghere 2dca65388c [Reproducer] Make 'reproducer generate' a NOOP during replay.
Instead of filtering out the 'reproducer generate' command during
replay, just make the operation a NOOP.

llvm-svn: 355009
2019-02-27 17:47:06 +00:00
Jonas Devlieghere 8c436ce3a1 [Reproducers] Add more logging to reproducer instrumentation
Debugging issues with instrumentation capture and replay can be
particularly tricky, especially because part of the process takes places
even before the debugger is initialized. This patch adds more logging
capabilities to these classes, hidden behind a macro define.

Differential revision: https://reviews.llvm.org/D58566

llvm-svn: 355002
2019-02-27 16:40:08 +00:00
Alex Langford 6d6288ae97 [Utility] Fix ArchSpec.MergeFrom to correctly merge environments
Summary:
This behavior was originally added in rL252264 (git commit 76a7f365da)
in order to be extra careful with handling platforms like watchos and tvos.
However, as far as triples go, those two (and others) are treated as OSes and
not environments, so that should not really apply here.

Additionally, this behavior is incorrect and can lead to incorrect ArchSpecs.
Because android is specified as an environment and not an OS, not propogating
the environment can lead to modules and targets being misidentified.

Differential Revision: https://reviews.llvm.org/D58664

llvm-svn: 354938
2019-02-27 00:47:39 +00:00