Commit Graph

8658 Commits

Author SHA1 Message Date
Sagar Thakur 477eb42f85 [LLDB][MIPS] Setting appropriate ArchSpec::m_flags based on ABI
Patch by Nitesh Jain.

Summary: The ArchSpec::m_flags will be set based on ELF flag ABI.

Reviewers: ovyalov, clayborg
Subscribers: lldb-commits, mohit.bhakkad, sagar, jaydeep, bhushan
Differential: D18858
llvm-svn: 269181
2016-05-11 13:08:29 +00:00
Enrico Granata c3b0a5b099 In some cases, type lookup has to deal with situations where it cannot reconstruct a compile unit or a function, but it still has a valid symbol - and it can use that in order to figure out the preferential language for lookups
This is not the right thing for all clients (notably the expression parser), so put it in type lookup specific code

Fixes rdar://problem/22422313

llvm-svn: 269095
2016-05-10 18:16:33 +00:00
Pavel Labath 7189b0fdb2 Fix logging in Listener.cpp
Clear() log message was claiming it was the destructor, which had me very confused when looking
at the log messages. Fix the message, and add a log message to the real destructor.

Also noticed that the destructor was needlessly locking the broadcaster mutex (as Clear was
locking it again anyway), so remove that as well.

llvm-svn: 269058
2016-05-10 13:46:25 +00:00
Sean Callanan f52c40c57f Fixed multiline expressions, and removed some dead code.
IOHandlerLinesUpdated() does nothing, and IOHandlerIsInputComplete should be
implemented but isn't.  This means that multiline expressions don't work.  This
patch fixes that.  Test case to follow in the next commit.

llvm-svn: 268970
2016-05-09 21:13:27 +00:00
Pavel Labath b8d8c62b34 Fix assertion in SymbolFilePDB
llvm::Error requires all errors to be handled. Simply checking the whether there was an error is
not enough, you have to actuall call handle(All)Errors, in case there was an error.

llvm-svn: 268906
2016-05-09 11:07:43 +00:00
Jim Ingham 7fa7dc36fe Take the API lock in SBThread::IsValid & SBFrame::IsValid.
The IsValid calls can try to reconstruct the thread & frame, which can 
take various internal locks.  This can cause A/B locking issues with
the Target lock, so these calls need to that the Target lock.

llvm-svn: 268828
2016-05-07 00:54:56 +00:00
Jim Ingham 8bbfdcd181 Remove some lldbassert's from the packet checking code.
Greg says he doesn't need these asserts anymore and since they cause occasional test suite
crashes, out they go.

llvm-svn: 268827
2016-05-07 00:52:18 +00:00
Jim Ingham 9b8eb155d8 Fix the way the ShouldStopHere checker handles the general case of "stepping through line 0 code".
That's good 'cause it means all the different kinds of source line stepping won't leave user in the middle of
compiler implementation code or code inlined from odd places, etc.  But it turns out that the compiler
also marks functions it MIGHT inline as all being of line 0.  That would mean we single step through this code
instead of just stepping out.  That is both inefficient, and more error prone 'cause these little nuggets tend
to be bits of hand-written assembly and the like and are hard to step through.

This change just checks and if the entire function is marked with line 0, we step out rather than step through.

<rdar://problem/25966460>

llvm-svn: 268823
2016-05-06 23:44:10 +00:00
Zachary Turner 50c58c0d01 Fix LLDB after removal of PDB_ErrorCode
llvm-svn: 268802
2016-05-06 21:35:47 +00:00
Enrico Granata 5f57b6ee0f Revert r268591
"Allow LanguageRuntimes to return an error if they fail in the course of dynamic type discovery

This is not meant to report that a value doesn't have a dynamic type - it is only meant as a mechanism to propagate actual type discovery issues (e.g. malformed type metadata for languages that have such a notion)

This information is used by ValueObjectDynamic to set its own m_error, which is a fairly sharp and heavyweight tool to begin with

For the time being, this is an architectural improvement but a practical no-op as no existing runtimes are actually setting errors"

I need to think about what I want to do in this space more carefully - this attempt might be too heavy of a hammer for the nail I am trying to fix, and I don't want to leave it in while I ponder

llvm-svn: 268686
2016-05-05 21:10:28 +00:00
Tamas Berghammer 21c3fdeda8 Guard AddCXXSynthetic with LLDB_DISABLE_PYTHON
The function only avaibleble when python is enabled. Guard the new call
in the Java plugin with LLDB_DISABLE_PYTHON until we can change
AddCXXSynthetic to be available in all case to get the build bots green
again.

llvm-svn: 268626
2016-05-05 12:46:45 +00:00
Pavel Labath 0360c0f63d Bump up timeout in AdbClient
now that the timeout actually means something, we see that sometimes adb is just really slow in
replying to the DONE packet during file push. Give it more time to complete.

llvm-svn: 268623
2016-05-05 11:25:57 +00:00
Tamas Berghammer 2ff833060c Add support for displaying Java array types on Andorid
Differential revision: http://reviews.llvm.org/D19540

llvm-svn: 268622
2016-05-05 11:18:21 +00:00
Pavel Labath c14e8ced85 Fix EOF handling in AdbClient (take 2)
Summary:
AdbClient would spin in a loop in ReadAllBytes in case the remote end was closed before reading
the requested number of bytes. Make sure we return an error in this case instead.

Reviewers: ovyalov

Subscribers: tberghammer, danalbert, lldb-commits

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

llvm-svn: 268617
2016-05-05 08:42:17 +00:00
Pavel Labath b9436bd493 Fix DW_AT_specification handling in DWO files
Summary:
We were trying to get a DWARFDIE from a CompileUnit belonging to a DWO file. However, this
function does not understand the die encoding used by the DWO files. Instead use GetDIE on the
SymbolFileDWARF, which is overriden in DWO to do the right thing.

Reviewers: clayborg, tberghammer

Subscribers: lldb-commits, ovyalov

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

llvm-svn: 268615
2016-05-05 08:21:44 +00:00
Enrico Granata 5ee5408625 Allow LanguageRuntimes to return an error if they fail in the course of dynamic type discovery
This is not meant to report that a value doesn't have a dynamic type - it is only meant as a mechanism to propagate actual type discovery issues (e.g. malformed type metadata for languages that have such a notion)

This information is used by ValueObjectDynamic to set its own m_error, which is a fairly sharp and heavyweight tool to begin with

For the time being, this is an architectural improvement but a practical no-op as no existing runtimes are actually setting errors

llvm-svn: 268591
2016-05-05 01:47:44 +00:00
Enrico Granata b86dc66e75 Make the functions that fetch data from the ObjC runtime choose whether or not to log depending on whether the types log is enabled
This can prove helpful in debugging issues with that retrieval even if LLDB wasn't compiled with the magic macros defined

llvm-svn: 268587
2016-05-05 01:15:57 +00:00
Adrian McCarthy 3f99810787 XFail TestLambdas.py on Windows after fixing some of the problems
1. Fixed semicolon placement in the lambda in the test itself.

2. Fixed lldbinline tests in general so that we don't attempt tests on platforms that don't use the given type of debug info. (For example, no DWO tests on Windows.) This fixes one of the two failures on Windows. (TestLambdas.py was the only inline test that wasn't XFailed or skipped on Windows.)

3. Set the error string in IRInterpreter::CanInterpret so that the caller doesn't print (null) instead of an explanation. I don't entirely understand the error, so feel free to suggest a better wording.

4. XFailed the test on Windows. The interpreter won't evaluate the lambda because the module has multiple function bodies. I don't exactly understand why that's a problem for the interpreter nor why the problem arises only on Windows.

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

llvm-svn: 268573
2016-05-04 23:32:35 +00:00
Greg Clayton 4329fe4271 Don't let two threads call Debugger::Clear simultaneously.
We don't want a mutex in debugger as it will cause A/B locking issues with the lldb_private::Target's mutex, but we do need to stop two threads from doing Debugger::Clear at the same time. We have seen issues with this with the C++ global destructor chain where the global debugger list is being destroyed and the Debugger::~Debugger() is calling it while another thread was in the middle of running that function.

<rdar://problem/26098913>

llvm-svn: 268563
2016-05-04 22:26:42 +00:00
Greg Clayton 92a20a299f Fixed a missing break and fixed spacing.
llvm-svn: 268562
2016-05-04 22:14:55 +00:00
Sean Callanan f636fc2e66 Intentionally leak the ASTSourceMap instead of destroying it when LLDB quits.
<rdar://problem/25959792>

llvm-svn: 268559
2016-05-04 21:42:55 +00:00
Zachary Turner 54fd7ff6db Update for llvm change to add pdb namespace.
r268544 moves all PDB reading code into a pdb namespace,
so LLDB needs to be updated to take this into account.

llvm-svn: 268545
2016-05-04 20:33:53 +00:00
Bryan Chan c4abaefadb Fix a SIGSEGV caused by dereferencing a pointer without a null check
llvm-svn: 268520
2016-05-04 17:24:31 +00:00
Jason Molenda 955dcf2dbc Add a way for an ObjectFile to indicate that assembly emulation
should not be used for this module -- for use when an ObjectFile
knows that it does not have meaningful or accurate function start
addresses.  

More commonly, it is not clear that function start addresses are
missing in a module.  There are certain cases on Mac OS X where we
can tell that a Mach-O binary has been stripped of this essential
information, and the unwinder can end up emulating many megabytes
of instructions for a single "function" in the binary.

When a Mach-O binary is missing both an LC_FUNCTION_STARTS load 
command (very unusual) and an eh_frame section, then we will assume 
it has also been stripped of symbols and that instruction emulation
will not be useful on this module.

<rdar://problem/25988067> 

llvm-svn: 268475
2016-05-04 03:09:40 +00:00
Jim Ingham c44644d6e9 You have to call setHasLoadedFieldsFromExternalStorage AFTER calling
the field_begin that starts the copy or it won't do anything.

This causes failures, but only in complex apps, I haven't found
a reduced test case for this yet. 

<rdar://problem/21951798>

llvm-svn: 268467
2016-05-04 00:06:23 +00:00
Pavel Labath ef984e7dc0 Revert "Add a read_full_buffer argument to ConnectionFileDescriptor::Read"
This reverts commit r268380 as it breaks windows build (I forgot to make neccesary adjustments to
ConnectionGenericFileWindows).

llvm-svn: 268384
2016-05-03 14:07:41 +00:00
Pavel Labath 240760207e Add a read_full_buffer argument to ConnectionFileDescriptor::Read
Summary:
AdbClient was attempting to handle the case where the socket input arrived in pieces, but it was
failing to handle the case where the connection was closed before that happened. In this case, it
would just spin in an infinite loop calling Connection::Read. (This was also the cause of the
spurious timeouts on the darwin->android buildbot. The exact cause of the premature EOF remains
to be investigated, but is likely a server bug.)

Since this wait-for-a-certain-number-of-bytes seems like a useful functionality to have, I am
moving it (with the infinite loop fixed) to the Connection class, and adding an
appropriate test for it.

Reviewers: clayborg, zturner, ovyalov

Subscribers: tberghammer, danalbert, lldb-commits

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

llvm-svn: 268380
2016-05-03 13:55:53 +00:00
Enrico Granata 0a99485341 Fix an issue where the apropos command would not print fully qualified command names for nested command objects
rdar://problem/26020072

llvm-svn: 268309
2016-05-02 21:28:40 +00:00
Sean Callanan c530ba98a9 Import block pointers from DWARF as Clang block pointers, not as structs.
Also added a data formatter that presents them as structs if you use frame
variable to look at their contents.  Now the blocks testcase works.

<rdar://problem/15984431>

llvm-svn: 268307
2016-05-02 21:15:31 +00:00
Enrico Granata 1dccd9da01 Add more debug logging to g_get_shared_cache_class_info_body
llvm-svn: 268303
2016-05-02 20:58:15 +00:00
Enrico Granata fd4e5a8801 Add an argument to ValueObject::GetSyntheticBase that allows for name customization on the generated value
llvm-svn: 268274
2016-05-02 18:13:18 +00:00
Enrico Granata 6eec8d6c6f Add support for synthetic child providers to optionally return a customized typename for display
llvm-svn: 268208
2016-05-02 00:41:24 +00:00
Kuba Brecka 5c7b363534 Improve wording and capitalization of TSan thread names.
llvm-svn: 268193
2016-05-01 11:26:06 +00:00
Kuba Brecka 2ae442b916 Add thread numbers into ASan thread names.
llvm-svn: 268192
2016-05-01 11:23:04 +00:00
Greg Clayton d49a8f9b54 Watch out for compilers that generate bad bitfield info. If the bit size of a bitfield member doesn't lie within the bit bounds of the type itself, just leave it out so we don't get clang asserting and killing our IDE when it gets unhappy with the information.
https://llvm.org/bugs/show_bug.cgi?id=27515
<rdar://problem/21082998>

llvm-svn: 268110
2016-04-29 21:26:46 +00:00
Greg Clayton 349213f941 Fix TestGetVariables.py so it works correctly. We had duplicate static values showing up as we would find static variables in the Block and also in the compile unit. We now make sure a variable hasn't been added to the list before we add it.
llvm-svn: 268101
2016-04-29 21:00:38 +00:00
Greg Clayton 909b277845 Make sure LLDB can deal with forward declarations to enums without crashing or asserting.
<rdar://problem/23776428> 

llvm-svn: 268098
2016-04-29 20:48:39 +00:00
Sean Callanan 7736a208b8 [fix] Fixed a bug where const this would cause parser errors about $__lldb_expr.
In templated const functions, trying to run an expression would produce the
error

error: out-of-line definition of '$__lldb_expr' does not match any declaration
in 'foo' member declaration does not match because it is const qualified
error: 1 error parsing expression

which is no good.  It turned out we don't actually need to worry about "const,"
we just need to be consistent about the declaration of the expression and the
FunctionDecl we inject into the class for "this."

Also added a test case.

<rdar://problem/24985958>

llvm-svn: 268083
2016-04-29 18:09:03 +00:00
Adrian McCarthy 6cd5364556 Used llvm_unreached to quite a VC++ compiler warning.
Differential Revision: http://reviews.llvm.org/D19489

llvm-svn: 267931
2016-04-28 20:14:44 +00:00
Kuba Brecka bcdce3fd85 Provide location information (file name, line number) in TSan reports about global variables.
llvm-svn: 267894
2016-04-28 15:27:10 +00:00
Pavel Labath 35e9ea3812 Revert "Fixed a bug where const this would cause parser errors about $__lldb_expr."
This reverts commit r267833 as it breaks the build. It looks like some work in progress got
committed together with the actual fix, but I'm not sure which one is which, so I'll revert the
whole patch and let author resumbit it after fixing the build error.

llvm-svn: 267861
2016-04-28 08:16:19 +00:00
Jim Ingham deb384d103 Fix an inefficiency in the handling of $__lldb_local_vars in expressions.
The code in ClangExpressionDeclMap::FindExternalVisibleDecls figures out what the token 
means, and adds the namespace to the lookup context, but since it doesn't mark it as
special in the search context, we go on to pass the name $__lldb_local_vars to the ASTSource
for further lookup.  Unless we've done our job wrong, those lookups will always fail, but
the can be costly.

So I added a bit to m_found & use that to short-circuit the lookup.

<rdar://problem/25613384>

llvm-svn: 267842
2016-04-28 02:17:02 +00:00
Jim Ingham 76bb8d6719 Add the ability to limit "source regexp" breakpoints to a particular function
within a source file.

This isn't done, I need to make the name match smarter (right now it requires an
exact match which is annoying for methods of a class in a namespace.

Also, though we use it in tests all over the place, it doesn't look like we have
a test for Source Regexp breakpoints by themselves, I'll add that in a follow-on patch.

llvm-svn: 267834
2016-04-28 01:40:57 +00:00
Sean Callanan 8bdcd52251 Fixed a bug where const this would cause parser errors about $__lldb_expr.
In templated const functions, trying to run an expression would produce the
error

error: out-of-line definition of '$__lldb_expr' does not match any declaration in 'foo'
member declaration does not match because it is const qualified
error: 1 error parsing expression

which is no good.  It turned out we don't actually need to worry about "const,"
we just need to be consistent about the declaration of the expression and the
FunctionDecl we inject into the class for "this."

Also added a test case.

<rdar://problem/24985958>

llvm-svn: 267833
2016-04-28 01:36:21 +00:00
Kate Stone 2eabf2484f Renamed system plugin directory to address https://bugs.swift.org/browse/SR-1093
llvm-svn: 267749
2016-04-27 17:49:51 +00:00
Francis Ricci a030061c5b Use absolute module path when possible if sent in svr4 packets
Summary:
If the remote uses svr4 packets to communicate library info,
the LoadUnload tests will fail, as lldb only used the basename
for modules, causing problems when two modules have the same basename.

Using absolute path as sent by the remote will ensure that lldb
locates the module from the correct directory when there are overlapping
basenames. When debugging a remote process, LoadModuleAtAddress will still
fall back to using basename and module_search_paths, so we don't
need to worry about using absolute paths in this case.

Reviewers: ADodds, jasonmolenda, clayborg, ovyalov

Subscribers: lldb-commits, sas

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

llvm-svn: 267741
2016-04-27 17:10:15 +00:00
Jason Molenda d8f24a9c4f Committing patch from <Michael Woerister <michaelwoerister@posteo.net>
to use the default clang C/C++ expression parser when debugging
Rust programs.  Ideally there would be a rust language plugin to
support their language natively, but until then this will get simple
variable display to work.

http://reviews.llvm.org/D19545

llvm-svn: 267667
2016-04-27 04:50:51 +00:00
Jim Ingham dae50baf44 UtilityFunction::MakeFunctionCaller uses the Error to report failure,
but when there's was no process it was just returning an null pointer
and not setting the error.  I don't have a scenario where this might
go wrong, just code inspection...

llvm-svn: 267594
2016-04-26 19:46:39 +00:00
Omair Javaid e114a1711a rL267291: Architecture change to thumb on parsing arm.attributes causes regression.
Remove case handling elf arm attribute Tag_THUMB_ISA_use and setting architecture to thumb. 

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

llvm-svn: 267550
2016-04-26 11:26:00 +00:00
Omair Javaid 9a1699c0c6 Fix arm-linux-gnueabi regression due to rL267291
rL267291 introduces a lot regression on arm-linux LLDB testsuite.

This patch fixes half of them. I am merging it under already revied android counterpart.

Another patch fixing rest of the issue will follow this commit.

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

llvm-svn: 267508
2016-04-26 01:08:59 +00:00