Commit Graph

2723 Commits

Author SHA1 Message Date
Chaoren Lin f591f69fc3 Can't set watchpoints on launching threads on Linux LLGS.
Summary:
They'll be set anyway when the thread starts running, so the launching threads
should just ignore the set request.

Reviewers: ovyalov

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D7914

llvm-svn: 230671
2015-02-26 19:48:15 +00:00
Tamas Berghammer 2d52afd71c Increase default packet timeout for android to 20s
Differential revision: http://reviews.llvm.org/D7853

llvm-svn: 230626
2015-02-26 11:37:21 +00:00
Enrico Granata 99b0a9cdd7 If we are trying to load the scripting resource for a module whose name happens to be a Python keyword, then prefix the filename with an _ (e.g. a module named def will load _def.py)
Fixes rdar://13893506

llvm-svn: 230602
2015-02-26 01:37:26 +00:00
Greg Clayton bc63aaccf7 Optimize finding the Complete Definition of an ObjC class for debug with .o files with lots of .o files.
When we have a debug map we have an executable with a bunch of STAB symbols and each source file has a N_SO symbol which scopes a bunch of symbols inside of it. We can use this to our advantage here when looking for the complete definition of an objective C class by looking for a symbol whose name matches the class name and whose type is eSymbolTypeObjCClass. If we find one, that symbol will be contained within a N_SO symbol. This symbol gets turned into a symbol whose type is eSymbolTypeSourceFile and that symbol will contain the eSymbolTypeObjCClass which helps us to locate the correct .o file and allows us to only look in that file.

To further accelerate things, if we are looking for the implementation, we can avoid looking at all .o files if we don't find a matching symbol because we have a debug map, which means the objective C symbol for the class can't have been stripped, so we can safely not search all remaining .o files. This will save us lots of time when trying to look for "NSObject" and any other AppKit and Foundation classes that we never have implementation definitions for.

<rdar://problem/19234225>

llvm-svn: 230562
2015-02-25 22:41:34 +00:00
Oleksiy Vyalov 6801be3354 Add qModuleInfo request in order to get module information (uuid, triple,..) by module path from remote platform.
http://reviews.llvm.org/D7709

llvm-svn: 230556
2015-02-25 22:15:44 +00:00
Zachary Turner 49be160531 Revert "Fix warnings found with clang-cl."
SWIG doesn't like enum : unsigned.  Revert this until I can
fix this in a way that swig likes.

llvm-svn: 230531
2015-02-25 19:52:41 +00:00
Zachary Turner 00998f0beb Solve hang on Windows when lldb fails to launch the process.
The DebuggerThread was detecting the launch error, but it was
ignored by ProcessWindows::DoLaunch, causing LLDB to wait forever
in the debugger loop.

This fixes the test case that explicitly attempts to launch a
process from a non-existant path.

Patch by Adrian McCarthy
Differential Revision: http://reviews.llvm.org/D7874

llvm-svn: 230523
2015-02-25 18:56:47 +00:00
Zachary Turner 171d943ac5 Fix warnings found with clang-cl.
Earlier this week I was able to get clang-cl on Windows to be
able to self host.  This opened the door to being able to
get a whole new slew of warnings for the Windows build.

This patch fixes all of the warnings, many of which were real
bugs.

llvm-svn: 230522
2015-02-25 18:42:47 +00:00
Greg Clayton 1e28adfe75 MacOSX symbol table change to combine the N_GSYM debug map entry with the "_OBJC_CLASS_$_", "_OBJC_METACLASS_$_", and "_OBJC_IVAR_$_" non debug symbols. This allows the symbol that represents the object file to contain the eSymbolTypeObjCClass and eSymbolTypeObjCMetaClass and will help us to be able to efficiently lookup the real definition of an objective C class without loading all .o files linearly to find the .o file that contains the true definition.
llvm-svn: 230509
2015-02-25 17:25:02 +00:00
Tamas Berghammer 14f4476a88 Truncate target file for stdout and stderr
Add O_TRUNC when opening file for redirecting stdout and stderr of the
process. It is neccessary because if the file exists then on some
platform the original content is kept while it isn't overwritten by the
new data causing pollution of the saved stdout and stderr.

llvm-svn: 230492
2015-02-25 13:21:45 +00:00
Oleksiy Vyalov 946e39a8d1 Fix logging in GDBRemoteCommunicationServerPlatform.
llvm-svn: 230418
2015-02-25 01:11:38 +00:00
Oleksiy Vyalov c282ebd724 Fix qLaunchGDBServer packet parsing in GDBRemoteCommunicationServerPlatform.
llvm-svn: 230390
2015-02-24 22:23:39 +00:00
Tamas Berghammer 912800c400 Create ScopedTimeout class for GDBRemoteCommunication
This new class makes it easier to change the timeout of a
GDBRemoteCommunication instance for a short time and then restore it to
its original value.

Differential revision: http://reviews.llvm.org/D7826

llvm-svn: 230319
2015-02-24 10:23:39 +00:00
Enrico Granata 4ae3dda605 Update LLDB to read a newer format of Objective-C class information from the dyld shared cache
Also, since most of the time the lack of such information is a serious problem that hinders productive debugging, emit an actual user visible warning when this occurs (once per process)

Fixes rdar://19898507

llvm-svn: 230299
2015-02-24 02:11:06 +00:00
Greg Clayton 736888c84b Avoid crashing by not mmap'ing files on network mounted file systems.
This is implemented by making a new FileSystem function:

bool
FileSystem::IsLocal(const FileSpec &spec)

Then using this in a new function:

DataBufferSP
FileSpec::MemoryMapFileContentsIfLocal(off_t file_offset, size_t file_size) const;

This function only mmaps data if the file is a local file since that means we can reliably page in data. We were experiencing crashes where people would use debug info files on network mounted file systems and that mount would go away and cause the next access to a page that wasn't paged in to crash LLDB. 

We now avoid this by just copying the data into a heap buffer and keeping a permanent copy to avoid the crash. Updated all previous users of FileSpec::MemoryMapFileContentsIfLocal() in ObjectFile subclasses over to use the new FileSpec::MemoryMapFileContentsIfLocal() function.

<rdar://problem/19470249>

llvm-svn: 230283
2015-02-23 23:47:09 +00:00
Ed Maste 56c7a19d41 Remove EOL whitespace from PlatformLinux
This reduces the noise when diffing PlatformFreeBSD and PlatformLinux.

llvm-svn: 230251
2015-02-23 20:18:37 +00:00
Ed Maste 3a8ab6ee2a Exit early from DumpELFProgramHeaders if parse fails
This matches the way DumpELFSectionHeaders is implemented and is
recommended by the LLVM coding conventions.

llvm-svn: 230228
2015-02-23 15:33:11 +00:00
Ed Maste aec140380f elf-core: correct "no sections" to "no segments."
The error reported here is that there are no phdr entries, so it's
referring to segments, not sections.

llvm-svn: 230227
2015-02-23 15:28:42 +00:00
Tamas Berghammer 0f86b74304 Fix the communication in qPlatform_[mkdir,chmod]
With the previous implementation the protocol used by the client and the
server for the response was different and worked only by an accident.
With this change the communication is fixed and the return code from
mkdir and chmod correctly captured by lldb. The change also add
documentation for the qPlatform__[mkdir,chmod] packages.

Differential revision: http://reviews.llvm.org/D7786

llvm-svn: 230213
2015-02-23 11:03:08 +00:00
Pavel Labath dbb41cf418 Support evaluation of DWARF expressions setting CFA
Summary:
This patch enables evaluation of DWARF expressions setting the CFA during stack unwinding.

This makes TestSigtrampUnwind "almost" pass on linux. I am not enabling the test yet since the
symbol name for the signal trampoline does not get resolved properly due to a different bug, but
apart from that, the backtrace is sane.

I am unsure how this change affects Mac. I think it makes the unwinder prefer the DWARF unwind
plan instead of some custom platform-dependant plan. However, it does not affect the end result
- the stack unwinding works as expected.

Reviewers: jasonmolenda

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D7792

llvm-svn: 230211
2015-02-23 10:29:01 +00:00
Pavel Labath ab970f5e08 UnwindPlan::Row refactor -- add support for CFA set by a DWARF expression
Summary:
This change refactors UnwindPlan::Row to be able to store the fact that the CFA is value is set
by evaluating a dwarf expression (DW_CFA_def_cfa_expression). This is achieved by creating a new
class CFAValue and moving all CFA setting/getting code there. Note that code using the new
CFAValue::isDWARFExpression is not yet present and will be added in a follow-up patch. Therefore,
this patch should not change the functionality in any way.

Test Plan: Ran tests on Mac and Linux. No regressions detected.

Reviewers: jasonmolenda, clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D7755

llvm-svn: 230210
2015-02-23 10:19:16 +00:00
Chandler Carruth 43edccdfe1 Update for Clang API change in r230123 -- lookup_result was always
const, there was never a need for lookup_const_result. Now that vestigal
type is gone, so switch LLDB to lookup_result and to use the
DeclContextLookupResult rather than the Const variant.

llvm-svn: 230126
2015-02-21 04:31:13 +00:00
Greg Clayton b65c6299d4 Make sure things build for iOS after recent changes.
llvm-svn: 230076
2015-02-20 22:20:05 +00:00
Pavel Labath 2a056d8f86 Factor out common URL handling code in PlatformRemoteGDBServer
Summary:
this also gets rid of a compiler warning in release builds by using a dynamically allocated
buffer. Therefore, a size assertion is not necessary (and probably should have been an error in
the first place).

Reviewers: tberghammer

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D7751

llvm-svn: 229878
2015-02-19 18:10:55 +00:00
Oleksiy Vyalov 8bc34f4d96 Prevent LLGS from crashing when exiting - make NativeProcessLinux to wait until ThreadStateCoordinator is fully stopped before entering ~NativeProcessLinux.
http://reviews.llvm.org/D7692

llvm-svn: 229875
2015-02-19 17:58:04 +00:00
Pavel Labath b81e653dce Silence unused variable warnings in release builds
llvm-svn: 229843
2015-02-19 11:41:12 +00:00
Zachary Turner 568b0de170 Fix warning that not all control-paths return from function.
llvm-svn: 229718
2015-02-18 18:44:03 +00:00
Zachary Turner 39cc7d4437 Don't use AVX/XSTATE API on Windows.
CopyContext is necessary to safely get the XState, but LLDB doesn't currently
use the XState. CopyContext is available as of Windows 7 SP1, so it can't be
used on Vista.  Furthermore, it requires the Windows 8 SDK it compile,
making the baseline for compiling and running LLDB higher than necessary.

Patch by: Adrian McCarthy
Reviewed by: Zachary Turner
Differential Revision: http://reviews.llvm.org/D7572

llvm-svn: 229710
2015-02-18 18:04:50 +00:00
Tamas Berghammer c2c3d7185d Merge lldb-platform and lldb-gdbserver into a single binary
This commit merges lldb-platform and lldb-gdbserver into a single binary
of the same size as each of the previous individual binaries. Execution
mode is controlled by the first argument being either platform or
gdbserver.

Patch from: flackr <flackr@google.com>

Differential revision: http://reviews.llvm.org/D7545

llvm-svn: 229683
2015-02-18 15:39:41 +00:00
Tamas Berghammer 81e9239e07 Remove alias template from GDBRemoteCommunicationServerCommon
It is required because MSVC 2013 doesn't generate correct code for
template aliases.

llvm-svn: 229666
2015-02-18 11:37:46 +00:00
Oleksiy Vyalov 09daa881ea Make PlatformPOSIX::KillProcess to delegate to a remote platform if connected.
http://reviews.llvm.org/D7660

llvm-svn: 229577
2015-02-17 22:57:56 +00:00
Chaoren Lin caf3114245 Send default register number instead of GDB register number in StopReplyPacket.
Summary:
Using GDB register numbers confuses ProcessGDBRemote since the rest of
LLGS (qRegisterInfo, p, P) uses the default register numbers instead.

Test Plan: dosep.py --options --arch x86 ...

Reviewers: ovyalov, vharron, sivachandra

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D7635

llvm-svn: 229505
2015-02-17 15:41:28 +00:00
Chaoren Lin 6a504f6ea8 Watchpoint debug registers should work in i386 as well.
llvm-svn: 229504
2015-02-17 15:41:26 +00:00
Chaoren Lin e0c6ab5947 Fix small assignment mistake.
llvm-svn: 229503
2015-02-17 15:41:23 +00:00
Tamas Berghammer c6ec76e38f Disable LaunchNativeProcess in PlatformLinux for non Linux hosts
llvm-svn: 229379
2015-02-16 12:59:49 +00:00
Tamas Berghammer 1c6a1ea9b2 Enable process launching on android from lldb-gdbserver
Currently it is uses the same code used on linux. Will be replaced with
android specific code if needed.

Differential Revision: http://reviews.llvm.org/D7613

llvm-svn: 229371
2015-02-16 10:34:30 +00:00
Greg Clayton 60038bebf1 Correctly handle N_INDR nlist entries and don't rely on the trie information in order to reproduce them since this dyld trie info can be missing.
<rdar://problem/19749670>

llvm-svn: 229201
2015-02-14 00:51:13 +00:00
Jason Molenda c980fa92eb Change the default disassembly format again. First attempt at
changing it was in r219544 - after living on that for a few 
months, I wanted to take another crack at this.

The disassembly-format setting still exists and the old format
can be user specified with a setting like

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

This patch was discussed in http://reviews.llvm.org/D7578

<rdar://problem/19726421>

llvm-svn: 229186
2015-02-13 23:24:21 +00:00
Vince Harron 4a8abd3f94 Fix TestProcessIO.py when run against a remote target
Fixed test case to copy redirected stdout/stderr files from remote
target to host

llgs wasn't bothering to put the pty master file handle in the right
place if stdout/stderr were redirected to a file. It is still needed
for stdin.

Corrected some log message text

llvm-svn: 229141
2015-02-13 19:15:24 +00:00
Tamas Berghammer e3c3135463 Fix configure+make build broken by r228943
llvm-svn: 229098
2015-02-13 10:39:23 +00:00
Chandler Carruth d066d3a7b4 Fix the last two warnings I see on Linx building 'lldb': mismatched
signed and unsigned types in comparisons.

For the text offset, use the addr_t type that is used elsewhere to get
these kinds of offsets, and which it is being compared against. This
seems to make things more consistent.

For the other, the numbers are clearly small and uninteresting, so just
cast them to the most boring 'int' type.

llvm-svn: 229085
2015-02-13 08:16:15 +00:00
Chandler Carruth 40927d0dcd Fix four missing 'override' specifiers found with the Clang
'-Winconsistent-missing-override' warning. I suggest folks use this to
ensure that override is consistently used to mark virtual function
overrides.

llvm-svn: 229084
2015-02-13 08:07:00 +00:00
Tamas Berghammer 3c4f89d702 Add Initialize/Terminate method to Platform base plugin
Platform holds a smart pointer to each platform object created in a
static variable what cause the platform destructors called only on
program exit when other static variables are not availables. With this
change the destructors are called on lldb_private::Terminate()

+ Fix DebuggerRefCount handling in ScriptInterpreterPython

Differential Revision: http://reviews.llvm.org/D7590

llvm-svn: 228944
2015-02-12 18:18:27 +00:00
Tamas Berghammer 00e305d281 Create new platform: remote-android
* Create new platform plugin for lldb
* Create HostInfo class for android
* Create ProcessLauncher for android

Differential Revision: http://reviews.llvm.org/D7584

llvm-svn: 228943
2015-02-12 18:13:44 +00:00
Jason Molenda 92ee75c0b2 Search through all memory regions of the core file for
both a user process dyld and for a kernel binary -- we
will decide which to prefer after one or both have been
located.

It would be faster to stop the search thorugh the core
segments one we've found a dyld/kernel binary - but that
may trick us into missing the one we would prefer.

<rdar://problem/19806413> 

llvm-svn: 228910
2015-02-12 06:14:23 +00:00
Justin Hibbits 6cfc85a067 Quiet Coverity
Summary: Coverity warns that unsigned >= 0 is always true, and k_first_gpr_powerpc happens to be 0.  Quiet Coverity by changing that comparison instead to a static_assert(), in case things change in the future.

Reviewers: emaste

Reviewed By: emaste

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D7576

llvm-svn: 228908
2015-02-12 05:31:31 +00:00
Greg Clayton 526ae040ba Make a more complete fix for always supplying an execution context when getting byte sizes from types.
There was a test in the test suite that was triggering the backtrace logging output that requested that the client pass an execution context. Sometimes we need the process for Objective C types because our static notion of the type might not align with the reality when being run in a live runtime.

Switched from an "ExecutionContext *" to an "ExecutionContextScope *" for greater ease of use.

llvm-svn: 228892
2015-02-12 00:34:25 +00:00
Tamas Berghammer cb527a7fcd Fix windows build (broken by r228823)
llvm-svn: 228828
2015-02-11 12:52:55 +00:00
Tamas Berghammer e13c2731ba Separate monolithic GDBRemoteCommunicationServer class into 4 part
GDBRemoteCommunicationServer: Basic packet handling, handler registration
LLDBCommonPacketHandler: Common packet handling for lldb-platform and lldb-gdbserver
LLDBPlatformPacketHandler: lldb-platform specific packet handling
LLGSPacketHandler: lldb-gdbserver specific packet handling

Differential Revision: http://reviews.llvm.org/D7538

llvm-svn: 228823
2015-02-11 10:29:30 +00:00
Vince Harron df3f00f30a Fix 'process launch -i' for remote processes
We want to forward stdin when stdio is not disabled and when we're not
redirecting stdin from a file.

renamed m_stdio_disable to m_stdin_forward and inverted value because
that's what we want to remember.

There was previously a bug that if you redirected stdin from a file,
stdout and stderr would also be redirected to /dev/null

Adds support for remote target to TestProcessIO.py

Fixes ProcessIOTestCase.test_stdin_redirection_with_dwarf for remote
Linux targets

llvm-svn: 228744
2015-02-10 21:09:04 +00:00