Commit Graph

6633 Commits

Author SHA1 Message Date
Enrico Granata f2d44ca8e2 Silence warnings here by explicit cast.
llvm-svn: 232126
2015-03-13 00:31:45 +00:00
Enrico Granata ef238c1df2 This fixes the build I previously broke - and actually makes the test case work just like I promised
llvm-svn: 232115
2015-03-12 22:30:58 +00:00
Enrico Granata 495dccd67f Fix a bug in the data formatters where summary strings would not look into the non-synthetic value for child members if the ValueObject being formatted happened to have a synthetic value
rdar://15630776

llvm-svn: 232114
2015-03-12 22:17:07 +00:00
Enrico Granata 3fa6dc904a Fix an issue where values would be printed in one-line mode even if you asked to see locations and/or asked for flat output mode
llvm-svn: 232113
2015-03-12 22:16:20 +00:00
Oleksiy Vyalov eda270ee99 Make ModuleCache::Get to return instantiated ModuleSP instance so already created in-memory instance can be returned instead of creating a new one.
http://reviews.llvm.org/D8270

llvm-svn: 232075
2015-03-12 18:18:03 +00:00
Ilia K 520b0e45aa Remove unused FileSpec variable from Target::GetSharedModule
llvm-svn: 232060
2015-03-12 17:12:06 +00:00
Ilia K ed5e4a4b63 Clean up includes in source/lldb.cpp (1 was unused, 1 duplicated)
llvm-svn: 232059
2015-03-12 17:05:18 +00:00
Pavel Labath bbdb712765 Remove unused variable
llvm-svn: 232041
2015-03-12 14:41:40 +00:00
Pavel Labath 3f5df53fde Fix ProcessIO test failures
Summary:
There was a race condition regarding the output of the inferior process. The reading of the
output is performed on a separate thread, and there was no guarantee that the output will get
eventually consumed. Because of that, it was happening that calling Process::GetSTDOUT was not
returning anything even though the process was terminated and would definitely not produce any
further output. This was usually happening only under very heavy system load, but it can be
reproduced by placing an usleep in the stdio thread (Process::STDIOReadThreadBytesReceived).

This patch addresses this by adding synchronization capabilities to the Communication thread.
After calling Communication::SynchronizeWithReadThread one can be sure that all pending input has
been processed by the read thread. This function is then called after every public event which
stops the process to obtain the entire process output.

Test Plan: TestProcessIO.py should now succeed every time instead of flaking in and out.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 232023
2015-03-12 10:12:41 +00:00
Bhushan D. Attarde 9425b329c8 Test Commit: Spell correction
llvm-svn: 232022
2015-03-12 09:17:22 +00:00
Ilia K e4af28b7e9 Fix SDK selection using "platform select" when --sysroot/--version/--build options were specified
Summary:
This patch fixes SDK selection in the following case:
```
platform select remote-ios --sysroot "/Users/IliaK/Library/Developer/Xcode/iOS DeviceSupport/8.1.2 (12B440)" --build 12B440 --version 8.1.2
target create --arch arm64 "~/Project1.app"
```

Currently the lldb selects a first SDK version (in name order) in directory and then updates it after the device is connected. This approach ignores user's arguments and actually "platform select" command doesn't make sense.

After this patch, lldb takes a SDK which matches to user's arguments.

Reviewers: jasonmolenda, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, jasonmolenda, aemerson

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

llvm-svn: 232017
2015-03-12 07:21:25 +00:00
Greg Clayton 2463d982b4 Remove "virtual" and add "override" to all virtual functions.
llvm-svn: 231991
2015-03-12 00:17:08 +00:00
Greg Clayton 6d06d9050e Remove "virtual" and add "override" to all functions that are overridden to quiet warnings.
llvm-svn: 231990
2015-03-12 00:16:14 +00:00
Robert Flack 5f4b6c7c9e Initialize ProcessGDBRemoteLog for LLGS to fix remote platform logging
This was previously initialized by ProcessGDBRemote::Initialize but lldb-server does not contain ProcessGDBRemote anymore so this needs to be initialized directly.

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

llvm-svn: 231966
2015-03-11 21:14:22 +00:00
Robert Flack d6c9bd509e Reduce the number of components initialized for LLGS further.
In http://reviews.llvm.org/D7880 the initialization for LLGS was separated out so that LLGS could initialize only the components it needs to. This further reduces the set of components initialized for LLGS.

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

llvm-svn: 231964
2015-03-11 20:35:05 +00:00
Oleksiy Vyalov bac75698d4 Pass a process full executable path within "name" response field.
http://reviews.llvm.org/D8239

llvm-svn: 231949
2015-03-11 18:13:37 +00:00
Pavel Labath a55a953a29 Fix bug in ProcessGDBRemote
Summary:
ProcessGDBRemote::AsyncThread nuked its own thread handle upon exiting. This prevented the main
thread from joining it correctly in StopAsyncThread. I address this by moving the Reset() call to
StopAsyncThread, after the join.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 231915
2015-03-11 09:53:42 +00:00
Jason Molenda 4897583344 If the user specifies a kernel binary that isn't correct for the current
kernel debug session, instead of issuing a warning (which on one ever
sees), drop the user-specified kernel binary Module from the target and
try to discover the correct one dynamically.
<rdar://problem/19450329> 

llvm-svn: 231885
2015-03-10 23:34:52 +00:00
Ilia K eb2c19a549 Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}

All tests pass on OS X.

Reviewers: abidh, zturner, jingham, clayborg

Reviewed By: clayborg

Subscribers: jingham, zturner, lldb-commits, clayborg, abidh

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

llvm-svn: 231858
2015-03-10 21:59:55 +00:00
Ilia K e912e3e3f9 Add SymbolVendor::GetMainFileSpec and simplify CommandObjectTargetModulesList::PrintModule
Summary:
Add SymbolVendor::GetMainFileSpec and simplify CommandObjectTargetModulesList::PrintModule.

All tests pass on OS X.

Reviewers: abidh, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, abidh

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

llvm-svn: 231849
2015-03-10 21:18:59 +00:00
Robert Flack f196c93172 Add Debugger::InitializeForLLGS to allow ref counted LLGS initialization.
After http://reviews.llvm.org/D8133 landed as r231550 process launch on remote platform stopped working.

This adds Debugger::InitializeForLLGS and tracks whether one or both of Initialize and InitializeForLLGS have been called, calling only the corresponding lldb_private::Terminate* methods as necessary. Since lldb_private::Terminate calls lldb_private::TerminateForLLGS, the latter method may be called twice if Initialize was called for both however the terminate methods ensure they are only called once after being initialized.

This still maintains the reduced binary size, though it does now technically link in lldb_private::Terminate on lldb-server even though this should never be called.

This should resolve the issue raised in http://reviews.llvm.org/D8133 where Debugger::Terminate assumed that there were 0 references to debugger and terminated early.

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

llvm-svn: 231808
2015-03-10 18:07:47 +00:00
Oleksiy Vyalov 63acdfdeb2 Add Utility/ModuleCache class and integrate it with PlatformGDBRemoteServer - in order to allow modules caching from remote targets.
http://reviews.llvm.org/D8037

llvm-svn: 231734
2015-03-10 01:15:28 +00:00
Greg Clayton 58ea3e35d0 Fixed a bug where the expression parser relied on having symbols for things even if they were in the debug info.
The issue can happen if you strip your main executable and then run an expression and it would fail to find the stripped symbol and it would then not be able to make the function call. The issue was fixed by doing our normal FindFunctions call.

<rdar://problem/20072750>

llvm-svn: 231667
2015-03-09 16:46:57 +00:00
Tamas Berghammer 8fa23b8ebf Report the actual user register count from NativeRegisterContextLinux_x86_64
Thic change have effect wehn the AVX registers aren't available with
reporting the count of user registers without them.

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

llvm-svn: 231638
2015-03-09 10:48:23 +00:00
Vince Harron b3237de6e4 Move Python Init from InitializeForLLGS to Initialize
Linux configure+make builds have ~175 tests failing that aren't
failing in cmake builds.  The tests have error messages like
"'a.out' doesn't contain the architecture x86-64"  ObjectFileELF
plugin wasn't loaded when this message was output.
    
I found ScriptInterpreterPython::InitializePrivate() is calling
Debugger::Terminate(), which terminates ObjectFileELF (and lots
of other stuff) setup earlier in the InitializeForLLGS.
    
So I moved python Init/Term from Init/TermForLLGS to Init/Term

llvm-svn: 231550
2015-03-07 03:37:15 +00:00
Greg Clayton 910db5c520 Help for _regexp-break wasn't very clear. Added more detailed explanations of all things that can be typed by the _regexp-break command.
<rdar://problem/12281058>

llvm-svn: 231537
2015-03-07 00:01:46 +00:00
Greg Clayton 39fb1389b4 Make sure to re-read the file data you can get from OptionValueFileSpec::GetFileContents(...) when the file has changed.
This means you can set an expression prefix file with:
(lldb) settings set target.expr-prefix /tmp/to/prefix.txt

And you can run an expression and modify your expression prefix file in another editor without having to type:

(lldb) settings set target.expr-prefix /tmp/to/prefix.txt

again...

<rdar://problem/12155942> 

llvm-svn: 231535
2015-03-06 23:46:54 +00:00
Jim Ingham ed1d079377 Remember to set m_loaded_objc_opt once you've loaded the ObjC data
from the shared cache so you don't update it over & over.

<rdar://problem/20074768>

llvm-svn: 231514
2015-03-06 20:57:17 +00:00
Zachary Turner a893d3014b Remove Host::Backtrace in favor of llvm::sys::PrintStackTrace()
This removes Host::Backtrace from the codebase, and changes all
call sites to use llvm::sys::PrintStackTrace().  This makes the
functionality available for all platforms, and even for platforms
which currently had a supported implementation of Host::Backtrace,
this patch should enable richer information in stack traces, such
as file and line number information, as well as giving it the
ability to unwind through inlined functions.

llvm-svn: 231511
2015-03-06 20:45:43 +00:00
Enrico Granata db595cdc17 A few improvements to our vector types formatting story:
- use a hardcoded formatter to match all vector types, and make it so that their element type is taken into account when doing default formatting
- special case a vector of char to display byte values instead of characters by default

Fixes the test failures Ilia was seeing

llvm-svn: 231504
2015-03-06 19:37:57 +00:00
Tamas Berghammer 6ad63744b3 Initialize ProcessPOSIXLog by NativeProcessLinux
Previously it was initialized by ProcessLinux but lldb-server don't
contain ProcessLinux anymore so it have to be initialized by
NativeProcessLinux also.

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

llvm-svn: 231482
2015-03-06 15:47:23 +00:00
Pavel Labath 78521ef545 Fix race condition with -o "process launch" on linux
Summary:
starting a debug session on linux with -o "process launch" lldb parameter was failing since
Target::Launch (in sychronous mode) is expecting to be able to receive public process events.
However, PlatformLinux did not set up event hijacking on process launch, which caused these
events to be processed elsewhere and left Target::Launch hanging. This patch enables event
interception in PlatformLinux (which was commented out).

Upon enabling event interception, I noticed an issue, which I traced back to the inconsistent
state of public run lock, which remained false even though public and private process states were
"stopped". I addressed this by making sure the run lock is "stopped" upon exit from
WaitForProcessToStop (which already had similar provisions for other return paths).

Test Plan: This should fix the intermittent TestFormats failure we have been experiencing on Linux.

Reviewers: jingham, clayborg, vharron

Subscribers: lldb-commits

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

llvm-svn: 231460
2015-03-06 10:52:47 +00:00
Enrico Granata 72146af68c Windows bot
llvm-svn: 231450
2015-03-06 03:37:33 +00:00
Enrico Granata 0ddbf3633c Provide synthetic children for some vector types
Unlike GDB, we tackle the problem of representing vector types in different styles by having a synthetic child provider that recognizes the format you're trying to apply to the variable, and coming up with the right type and number of child values to match that format

This makes for a more compact representation and less visual noise

Fixes rdar://5429347

llvm-svn: 231449
2015-03-06 03:32:20 +00:00
Jason Molenda 07e51cc72d Bump major vers # in xcode project file from 330 to 340.
llvm-svn: 231441
2015-03-06 00:45:01 +00:00
Greg Clayton 12ba733ce8 When we have a symbol, like "NSLog" that we try to call in an expression, make sure we prioritize the external symbols over the internal one.
This is a temporary fix until a more comprehensive fix can be made for finding functions that we call in expressions.

We find "NSLog" in ClangExpressionDeclMap::FindExternalVisibleDecls() in after a call to target->GetImages().FindFunctions(...). Note that there are two symbols: NSLog from CFNetwork which is not external, and NSLog from Foundation which _is_ external. We do something with the external symbol with:

                    if (extern_symbol)
                    {
                        AddOneFunction (context, NULL, extern_symbol, current_id);
                        context.m_found.function = true;
                    }

Then later we try to lookup the _Z5NSLogP8NSStringz name and we don't find it so we call ClangExpressionDeclMap::GetFunctionAddress() with "_Z5NSLogP8NSStringz" as the name and the sc_list_size is zero at the "if" statement at line 568 because we don't find the mangled name and we extract the basename "NSLog" and call:

            FindCodeSymbolInContext(ConstString(basename), m_parser_vars->m_sym_ctx, sc_list);
            sc_list_size = sc_list.GetSize();

and we get a list size of two again, and we proceed to search for the symbol again, this time ignoring the external vs non-external-ness of the symbols that we find. This fix ensures we prioritize the external symbol until we get a real fix from Sean Callanan when he gets back to make sure we don't do multiple lookups for the same symbol we already resolved.

<rdar://problem/19879282>

llvm-svn: 231420
2015-03-05 23:12:02 +00:00
Jason Molenda 9594459b21 Add support for the DWARFv3 (circa 2005) DW_OP_form_tls_address
operator in addition to the vendor-extension DW_OP_GNU_push_tls_address.
clang on PS4 and Darwin will be emitting the standard opcode 
as of r231286 via http://reviews.llvm.org/D8018

Behavior of this standard  opcode is the same as 
DW_OP_GNU_push_tls_address.

<rdar://problem/20043195>

llvm-svn: 231342
2015-03-05 02:42:06 +00:00
Enrico Granata 61f7928376 Appease the Windows bot
llvm-svn: 231315
2015-03-04 23:19:36 +00:00
Enrico Granata 53ed89c6da Introduce lldbassert(x)
We would like it if LLDB never crashed, especially if we never caused LLDB to crash
On the other hand, having assertions can sometimes be useful

lldbassert(x) is the best of both worlds:
- in debug builds, it turns into a regular assert, which is fine because we don't mind debug LLDB to crash on development machines
- in non-debug builds, it emits a message formatted just like assert(x) would, but then instead of crashing, it dumps a backtrace, suggests filing a bug, and keeps running

llvm-svn: 231310
2015-03-04 22:59:20 +00:00
Enrico Granata b10e003015 Add a required #include
llvm-svn: 231288
2015-03-04 21:33:45 +00:00
Zachary Turner fc8588136c Don't #include clang headers from BreakpointLocation.h
llvm-svn: 231263
2015-03-04 17:43:00 +00:00
Ilia K 41204d0960 Fix build on OS X after r231202
llvm-svn: 231235
2015-03-04 12:05:24 +00:00
Tamas Berghammer ac83982906 Set the signals based on the OS in the qHostInfo packet
Setting it from the Target architecture cause problems when the target
archiutecture is filled just by examining the executable because in that
case the OS isn't set.

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

llvm-svn: 231234
2015-03-04 11:34:10 +00:00
Tamas Berghammer ccd28a147b Fix expectation for TestPlatformCommand.test_shell
* Create expectation based on target platform
* Add custom expectation for remote android target

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

llvm-svn: 231232
2015-03-04 11:18:34 +00:00
Tamas Berghammer 43f2d97191 Fix deadlock in operation thread in NativeProcessLinux
The deadlock occurred when the Attach or the Launch operation failed for
any reason.

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

llvm-svn: 231231
2015-03-04 11:10:03 +00:00
Pavel Labath 783cbdcd89 Use the unified section list when generating a symbol table
Summary:
Symbol table generation code was failing to take into account the debug symbols because
the object file was looking only into its own section list when doing the generation, even though
the debug symbols from another object file were correctly detected and loaded by the
SymbolVendor. This changes the code to use the unified section list, which fixes this problem.

Test Plan:
I do not intend do submit this yet since it causes (or more like, exposes) the issue
in D7884, but I wanted to put this out here, so that anyone who wants to take a look at it can do
so. (And I also wanted to know if this is the right approach to the problem :).

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 231229
2015-03-04 10:28:15 +00:00
Pavel Labath c6ae7eaa7b Correctly resolve symbol names containing linker annotations
Summary:
Symbols in ELF files can be versioned, but LLDB currently does not understand these. This problem
becomes apparent once one loads glibc with debug info. Here (in the .symtab section) the versions
are embedded in the name (name@VERSION), which causes issues when evaluating expressions
referencing memcpy for example (current glibc contains memcpy@@GLIBC_2.14 and
memcpy@GLIBC_2.2.5).

This problem was not evident without debug symbols as the .dynsym section
stores the bare names and the actual versions are present in a separate section (.gnu.version_d),
which LLDB ignores. This resulted in two definitions of memcpy in the symbol table.

This patch adds support for storing annotated names to the Symbol class. If
Symbol.m_contains_linker_annotations is true then this symbol is annotated. Unannotated name can
be obtained by calling StripLinkerAnnotations on the corresponding ObjectFile. ObjectFileELF
implements this to strip @VERSION suffixes when requested. Symtab uses this function to add the
bare name as well as the annotated name to the name lookup table.

To preserve the size of the Symbol class, I had to steal one bit from the m_type field.

Test Plan:
This fixes TestExprHelpExamples.py when run with a glibc with debug symbols. Writing
an environment agnostic test case would require building a custom shared library with symbol
versions and testing symbol resolution against that, which is somewhat challenging.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 231228
2015-03-04 10:25:22 +00:00
Zachary Turner 633a29cffb Further reduce header footprint of Debugger.h.
llvm-svn: 231202
2015-03-04 01:58:01 +00:00
Ed Maste 151315f471 Restore accidental deletion of header comment character
llvm-svn: 231197
2015-03-04 01:29:18 +00:00
Ed Maste 2ac86d6fee Another configure+make fix for r230963
llvm-svn: 231188
2015-03-04 01:05:52 +00:00