IsPointedCString has problems with ValueObjects of type eTypeHostAddress. We should
figure out the right thing to do in that case, but the test is silly here because we're
reading a type we've defined, so we know it is a const char *, and if the memory is good,
we won't be able to read any characters, when we do ReadPointedString.
<rdar://problem/26612812>
llvm-svn: 272087
Rules are as follows for internal code using lldb::DisassemblerSP and lldb::InstructionSP:
1 - The disassembler needs to stay around as long as instructions do as the Instruction subclass now has a weak pointer to the disassembler
2 - The public API has been fixed so that if you get a SBInstruction, it will hold onto a strong reference to the disassembler in a new InstructionImpl class
This will keep code like like:
inst = lldb.target.ReadInstructions(frame.GetPCAddress(), 1).GetInstructionAtIndex(0)
inst.GetMnemonic()
Working as expected (not the SBInstructionList() that was returned by SBTarget.ReadInstructions() is gone, but "inst" has a strong reference inside of it to the disassembler and the instruction.
All code inside the LLDB shared library was verified to correctly hold onto the disassembler instance in all places.
<rdar://problem/24585496>
llvm-svn: 272069
Summary:
Because PIE executables have an e_type of llvm::ELF::ET_DYN,
they are not of type eTypeExecutable, and were being removed
when svr4 packets were used.
Reviewers: clayborg, ADodds, tfiala, sas
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D20990
llvm-svn: 271899
return NULL for an invalid register.
The unwind logic asks for the "return address register" which doesn't exist
on x86/x86_64, returns -1 and calls this with -1 as a parameter, ends up
out of scope of the array bounds for g_register_infos and later SIGSEGVs
on accessing. This now matches the other GetRegisterInfoAtIndex for
other platforms.
llvm-svn: 271876
Summary: Fix missing return after checking that m_backend is not a pointer or reference type.
Reviewers: clayborg, tberghammer
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D20875
llvm-svn: 271453
For Thread Sanitizer reports, LLDB tries to find a global variable declaration
corresponding to the racy address in order to provide a filename and line
number. This commit changes the lookup of the variable to use the mangled
name for lookup and fall back to the demangled version if unavailable. This
is needed to report locations of races on Swift global variables.
I've also added a test to make sure we look up C++ globals correctly.
rdar://problem/26459401
Differential Revision: http://reviews.llvm.org/D20760
llvm-svn: 271433
We need to verify that consecutive bitfields have higher offsets and don't overlap. The issues was found by running a broken version of recent clangs where the bitfield offsets were being emitted incorrectly. To guard against this we now verify and toss out any invalid bitfields and print a message that indicates to file a bug against the compiler.
<rdar://problem/25737621>
llvm-svn: 271343
This change implements dumping the executable, triple,
args and environment when using ProcessInfo::Dump().
It also tweaks the way Args::Dump() works so that it prints
a configurable label rather than argv[{index}]={value}. By
default it behaves the same, but if the Dump() method with
the additional arg is provided, it can be overridden. The
environment variables dumped as part of ProcessInfo::Dump()
make use of that.
lldb-server has been modified to dump the gdb-remote stub's
ProcessInfo before launching if the "gdb-remote process" channel
is logged.
llvm-svn: 271312
"ClearDIEs()" was being called too soon, before everyone was done using the DIEs.
This fix delays the calls to ::ClearDIEs() until all compile units have been indexed.
1 - Call "::ExtractDIEsIfNeeded()" on all compile units on separate threads. See if each CU has the DIEs parsed and remember this.
2 - Index all compile units on separate threads.
3 - Clear any DIEs in any compile units that didn't have their DIEs parsed after all compile units have been indexed.
Patch by phlav
Differential Revision: http://reviews.llvm.org/D20738
llvm-svn: 271209
r259714 introduces the transport method into the
URL passed to the gdb-remote stub. On debugserver,
this is not supported and prevented debugserver from
being launched by lldb-server in platform mode.
This change skips the transport method addition from
r259714 when on Apple hosts.
llvm-svn: 270961
ClangASTContext::StartTagDeclarationDefinition(...) was starting definitions for any TagType instances that have TagDecl, but ClangASTContext::CompleteTagDeclarationDefinition(...) was getting the type to a CXXRecordDecl with:
clang::CXXRecordDecl *cxx_record_decl = qual_type->getAsCXXRecordDecl();
The problem is that getAsCXXRecordDecl() might dig a bit deeper into a type and dig out a different decl, which means we might call ClangASTContext::StartTagDeclarationDefinition(...), but it might not do anything, and then we might call ClangASTContext::CompleteTagDeclarationDefinition(...) and it might try to complete something that didn't have its definition started and this will crash.
This change fixes that, and also makes sure that starting a definition succeeds before any calls to ClangASTContext::CompleteTagDeclarationDefinition().
<rdar://problem/24091798>
llvm-svn: 270891
which looks for binaries missing an LC_FUNCTION_STARTS section because
it was stripped/not emitted. If we see a normal user process binary
(executable, dylib, framework, bundle) without LC_FUNCTION_STARTS, that
is unusual and we should disallow instruction emulation because that
binary has likely been stripped a lot.
If this is a non-user process binary -- a kernel, a standalone bare-board
binary, a kernel extension (kext) -- and there is no LC_FUNCTION_STARTS,
we should not assume anything about the binary and allow instruction
emulation as we would normally do.
<rdar://problem/26453952>
llvm-svn: 270818
T x;
U y;
doing
x = *((T*)y)
is undefined behavior, even if sizeof(T) == sizeof(U), due to pointer aliasing rules
Fix up a couple of places in LLDB that were doing this, and transform them into a defined and safe memcpy() operation
Also, add a test case to ensure we didn't regress by doing this w.r.t. tagged pointer NSDate instances
llvm-svn: 270793
missing an LC_FUNCTION_STARTS section, we assume it has been
aggressively stripped (it is *very* unusual for anyone to strip
LC_FUNCTION_STARTS) so we disable assembly instruction unwind plan
creation.
Kernel extensions (kexts) don't have LC_FUNCTION_STARTS, but we
almost always have good symbol bounds just with the linker symbols.
So add an exception to allow assembly instruction unwind plan
creation for kexts even though they lack LC_FUNCTION_STARTS.
<rdar://problem/26453952>
llvm-svn: 270618
some (I'm not sure why only some, actually) implementations of std::map require the value type to
be a fully specified type when declaring then. This make sure TypeAndOrName is.
llvm-svn: 270570
Patch by Nitesh Jain.
Summary: These patch fix thread step-out for hard and soft float.
Reviewers: jaydeep, bhushan, clayborg
Differential Revision: http://reviews.llvm.org/D20416
llvm-svn: 270564
One of the things slowing us down is that ItaniumABILanguageRuntime class doesn't cache vtable to types in a map. This causes us, on every step, for every variable, to read the first pointer in a C++ type that could be dynamic and lookup the symbol, possibly in every symbol file (some symbols files on Darwin can end up having thousands of .o files when using DWARF in .o files, so thousands of .o files are searched each time).
This fix caches lldb_private::Address (the resolved vtable symbol address in section + offset format) to TypeAndOrName instances inside the one ItaniumABILanguageRuntime in a process. This allows caching of dynamic types and stops us from always doing deep searches in each file.
<rdar://problem/18890778>
llvm-svn: 270488
m_decl_objects is problematic because it assumes that each VarDecl has a unique
variable associated with it. This is not the case in inline contexts.
Also the information in this map can be reconstructed very easily without
maintaining the map. The rest of the testsuite passes with this cange, and I've
added a testcase covering the inline contexts affected by this.
<rdar://problem/26278502>
llvm-svn: 270474
The CL causes a build breakage on platforms where sizeof(double) == sizeof(long double)
and it incorrectly assumes that sizeof(double) and sizeof(long double) is the same
on the host and the target.
llvm-svn: 270214
Patch by Nitesh Jain.
Summary: Currently floating point regsiters has eEncodingUint encoding. Hence register write '1.25' will failed. This patch add eEncodingIEEE754 encoding for floating point registers( - ). This patch will fix test_fp_register_write in TestRegisters.py
Reviewers: clayborg, sagar
Subscribers: mohit.bhakkad, jaydeep, bhushan, sdardis, lldb-commits
Differential: D18853
llvm-svn: 270208
values for the pc or return address register.
On ios with arm64 and a binary that has multiple functions without
individual symbol boundaries, we end up with an assembly profile
unwind plan that says lr=<same> - that is, the link register contents
are unmodified from the caller's value. This gets the unwinder in
a loop.
When we're off the 0th frame, we never want to look to a caller for
a pc or return-address register value.
Add checks to ReadGPRValue and ReadRegister to prevent both the pc
and ra register values from recursing.
If this causes problems with backtraces on android, let me know or
back it out and I'll look into it -- but I think these are
straightforward and don't expect problems.
<rdar://problem/24610365>
llvm-svn: 270162
The error was not getting propagated to the caller, so the higher layers thought the breakpoint
was successfully set & resolved.
I added a testcase, but it assumes 0x0 is not a valid place to set a breakpoint. On most systems
that is true, but if it isn't true of your system, either find another good place and add it to the
test, or x-fail the test.
<rdar://problem/26345962>
llvm-svn: 270014
This is a pretty straightforward first pass over removing a number of uses of
Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there
are interfaces which take Mutex::Locker & to lock internal locks. This patch
cleans up most of the easy cases. The only non-trivial change is in
CommandObjectTarget.cpp where a Mutex::Locker was split into two.
llvm-svn: 269877
NPL now assumes it is running from a single thread now, so its thread-safety is untested
anyway (and if that assumption is broken, we'll have bigger problems (due to ptrace restrictions)
than a couple of missing mutexes).
llvm-svn: 269640
This is a fix due to the addition of the new DiagnosticSeverity in
LLVMContext.h. This may warrant a change in name to be LLDB specific
but I leave that to the LLDB experts to refactor.
llvm-svn: 269562
Remove XFAIL from some tests that now pass.
Add XFAIL to some tests that now fail.
Fix a crasher where a null pointer check isn't guarded.
Properly handle all types of errors in SymbolFilePDB.
llvm-svn: 269454