Commit Graph

7193 Commits

Author SHA1 Message Date
Bruce Mitchener 0b6ba7c668 Use string::find(char) for single character strings.
Summary: Use string::find(char) for single character strings.

Reviewers: abidh, ki.stfu, clayborg

Subscribers: lldb-commits

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

llvm-svn: 241390
2015-07-04 05:16:58 +00:00
Tamas Berghammer ff7fd90017 Fix aarch64 breakpoint PC offset
llvm-svn: 241347
2015-07-03 12:51:30 +00:00
Tamas Berghammer cec93c355a Fix 128bit register read and user register count on aarch64
llvm-svn: 241340
2015-07-03 11:17:07 +00:00
Tamas Berghammer 9383480524 Enable usage of eh_frame based unwind plan as a fallback
Previously if the instruction emulation based unwind plan failed then
we fall back to the arch default unwind plan. Change it to fall back
to the eh_frame based one even on non call sites if we have eh_frame
as that one tend to be more reliable.

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

llvm-svn: 241334
2015-07-03 09:30:22 +00:00
Tamas Berghammer 09839c33b6 Fix qMemoryRegionInfo packet to return current value for address after the last memory region
Differential revision: http://reviews.llvm.org/D10899

llvm-svn: 241333
2015-07-03 09:30:19 +00:00
Tamas Berghammer 623652a0fd Improve DWARF CFI CIE parsing and remove duplicated code
Previously we handled only a few opcode DWARF CFI opcode when we
were parsing the CIE. With this change we use mostly the same code
what we use for parsing the PDE which cover more opcode.

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

llvm-svn: 241332
2015-07-03 09:30:17 +00:00
Tamas Berghammer 49dd6d1556 Fix handling of DW_CFA_restore_state
The CFA offset shouldn't be irestored to the saved value in case
of a DW_CFA_restore_state opcode.

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

llvm-svn: 241331
2015-07-03 09:30:14 +00:00
Bruce Mitchener a868c13c51 Fix typos
Summary: Fixes more typos.

Reviewers: clayborg

Subscribers: lldb-commits-list

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

llvm-svn: 241289
2015-07-02 18:48:40 +00:00
Ed Maste ae9f2b9b24 Move PlatformFreeBSD to its own namespace
Based on r233679

llvm-svn: 241287
2015-07-02 17:35:22 +00:00
Greg Clayton d6171a74f0 Make sure we can lookup re-exported symbols after recent changes to lldb_private::Symbol.
Recently lldb_private::Symbol was changed so the old code:

Address &Symbol::GetAddress();

Is now:

Address Symbol::GetAddress();

And the Address object that is returned will be invalid for non-address based symbols. When we have re-exported symbols this code would now fail:

    const Address sym_address = sym_ctx.symbol->GetAddress();

    if (!sym_address.IsValid())
        continue;

    symbol_load_addr = sym_ctx.symbol->ResolveCallableAddress(*target_sp);

    if (symbol_load_addr == LLDB_INVALID_ADDRESS)
    {
        symbol_load_addr = sym_address.GetLoadAddress(target_sp.get());
    }

It used to return an Address reference to the value of the re-exported symbol that contained no section and a zero value for Address.m_offset (since the original symbol in the symbol table had a value of zero). When a reference was returned, this meant the "sym_address.IsValid()" would return true because the Address.m_offset was not LLDB_INVALID_ADDRESS, it was zero. This was working by mistake.

The Symbol::ResolveCallableAddress(...) actually checks for reexported symbols and whole bunch of other cases and resolves the address correctly, so we should let it do its thing and not cut it off before it can resolve the address with the "if (!sym_address.IsValid()) continue;".

llvm-svn: 241282
2015-07-02 16:43:49 +00:00
Leny Kholodov ca95120f05 Fix linking issue after r241271 (dbghelp.lib was removed from default dependencies on Windows)
llvm-svn: 241278
2015-07-02 15:54:13 +00:00
Tamas Berghammer 3937bc650c Add new bugreport command to lldb
The new command add functionality to print out domain specific
information for reporting a bug. Currently the only supported
domain is stack unwinding (with "bugreport unwind") but adding
new domains is fairly easy.

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

llvm-svn: 241252
2015-07-02 10:03:37 +00:00
Greg Clayton 14cd13c513 Check to make sure we have a valid N_GSYM symbol name before we use it for anything.
llvm-svn: 241210
2015-07-01 23:29:06 +00:00
Greg Clayton e521457db3 Fix indentation.
llvm-svn: 241209
2015-07-01 23:28:31 +00:00
Enrico Granata d4cb1dddeb When I introduced hard-coded formatters, I made them non-cacheable
This is because - in theory - the formatter could match on not just the type, but also other properties of a ValueObject, so a per-type caching would not be a good thing
On the other hand, that is not always true - sometimes the matching truly is per-type

So, introduce a non-cacheable attribute on formatters that decides whether a formatter should or should not be cached. That way, the few formatters that don't want themselves cached can do so, but most formatters (including most hard-coded ones) can cache themselves just fine

llvm-svn: 241184
2015-07-01 20:06:40 +00:00
Dawn Perchik 508f040994 Fix typo in comment.
llvm-svn: 241173
2015-07-01 17:41:02 +00:00
Dawn Perchik 53f34c8736 Rename ClangUserExpression members to avoid confusion with language.
The new names clarify that the members have to do with the execution
context and not the language.  For example, m_cplusplus was renamed to
m_in_cplusplus_method.

llvm-svn: 241132
2015-07-01 00:54:02 +00:00
Pavel Labath 4a9babb26e [NativeProcessLinux] Refactor PtraceWrapper
Summary:
This changes PtraceWrapper to return an Error, while the actual result is in an pointer parameter
(instead of the other way around). Also made a couple of PtraceWrapper arguments default to zero.
This arrangement makes a lot of the code much simpler.

Test Plan: Tests pass on linux. It compiles on android arm64/mips64.

Reviewers: chaoren, mohit.bhakkad

Subscribers: tberghammer, aemerson, lldb-commits

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

llvm-svn: 241079
2015-06-30 17:04:49 +00:00
Ewan Crawford 184d4df4d7 Fix windows build.
Windows build was broken in either r240983 or r240978 in the changes to FileSpec.cpp

llvm-svn: 241071
2015-06-30 15:03:31 +00:00
Ewan Crawford 0c996a9a06 Change search order of target definition files.
Make the python target definition file have highest priority so that we can set 
the remote stub breakpoint pc offset using it.

Reviewers: clayborg
Subscribers: ted, deepak2427, lldb-commits 

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

llvm-svn: 241063
2015-06-30 13:08:44 +00:00
Tamas Berghammer f256184693 Fix [vdso] handling on Android (x86 and aarch64)
* Add in-memory object file handling to the core dynamic loader
* Fix in memory object file handling in ObjectFileELF (previously
  only part of the file was loaded before parsing)
* Fix load address setting in ObjectFileELF for 32-bit targets
  when the load bias is negative
* Change hack in DYLDRendezvous.cpp to be more specific and not to
  interfere with object files with fixed load address

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

llvm-svn: 241057
2015-06-30 10:41:23 +00:00
Pavel Labath cd4994e925 Add a missing header
llvm-svn: 241056
2015-06-30 10:20:52 +00:00
Tamas Berghammer f366af309a Ignore "push/pop {sp}" in emulation based unwinding
These instructions confusing the unwind code because in case of a
push it assumes that the original valu of a register is pushed to
the stack what is not neccessarily true in case of SP. The same is
true for the pop (in the opposite way).

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

llvm-svn: 241051
2015-06-30 09:35:46 +00:00
Tamas Berghammer 0b736f1ed0 Fix LLDB build after r241035
llvm-svn: 241050
2015-06-30 09:26:52 +00:00
Mohit K. Bhakkad e0d8c422a0 [LLDB][MIPS] Getting correct flags for MIPS
Patch by Nitesh Jain

Reviewers: clayborg, ovyalov, emaste.
Subscribers: jaydeep, bhushan, dsanders, mohit.bhakkad, sagar, labath, tberghammer, lldb-commits.
Differential Revision: http://reviews.llvm.org/D10685

llvm-svn: 241045
2015-06-30 06:29:12 +00:00
Greg Clayton 2e59d4fffe More packet reduction when debugging with GDB server.
- Avoid sending the qfThreadInfo, qsThreadInfo packets if we have a stop reply packet with the threads already (save 2 round trip packets)
- Include the qname, qserial and qkind in the JSON info
- Report the qname, qserial and qkind to the thread so it can cache it to avoid many packets on MacOSX and iOS
- Don't clear all discoverable settings when we exec, just the ones we need to saves 1-5 packets for each exec.

llvm-svn: 240988
2015-06-29 20:08:51 +00:00
Chaoren Lin 0246b6ff2e Rewrite FileSpec::EnumerateDirectory to avoid code duplication.
Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 240983
2015-06-29 19:07:35 +00:00
Greg Clayton 58c65f0243 Avoid a recursive function call that could run LLDB out of file descriptors in FileSystem::DeleteDirectory(...).
Fixes include:
- use FileSystem::Unlink() instead of a direct call to ::unlink(...) when deleting files when iterating through the current directory
- save directories from current directory in a list and iterate through those _after_ the current directory has been iterated
- Use new FileSpec::ForEachItemInDirectory() instead of manually iterating across directories with opendir()/readdir()/closedir()

We should switch all code over to using FileSpec::ForEachItemInDirectory(...) in the near future and get rid of FileSpec::EnumerateDirectory().

This is a follow up patch to:

http://reviews.llvm.org/D10787

llvm-svn: 240978
2015-06-29 18:29:00 +00:00
Pavel Labath 33b51e87e1 [linux] Use cmake to detect support process_vm_readv (bug #23918)
Summary:
Some old linux versions do not have process_vm_readv function defined. Even older versions do not
have even the __NR_process_vm_readv syscall number. We use cmake to detect these situations and
fallback appropriately: in the first case, we can issue the syscall manually, while it the latter
case, we need to drop fast memory read support completely.

Test Plan: linux test suite passes

Reviewers: ovyalov, Eugene.Zelenko

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 240927
2015-06-29 09:18:17 +00:00
Chaoren Lin 226937eb15 Replace `rm -rf` with more portable implementation.
Reviewers: clayborg, vharron

Subscribers: lldb-commits

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

llvm-svn: 240895
2015-06-27 23:11:34 +00:00
Keno Fischer febe8f1f73 Add ABI/SysV-mips(64) to Makefile build
The Makefile build was broken without this.

llvm-svn: 240886
2015-06-27 17:31:28 +00:00
Greg Clayton 5d13e2c02e Fix some compiler warnings about not using override consistently.
llvm-svn: 240864
2015-06-27 00:12:59 +00:00
Pavel Labath c7512fdc1e [NativeProcessLinux] Use lambdas in DoOperation calls
Summary:
This removes a lot of boilerplate, which was needed to execute monitor operations. Previously one
needed do declare a separate class for each operation which would manually capture all needed
arguments, which was very verbose. In addition to less code, I believe this also makes the code
more readable, since now the implementation of the operation can be physically closer to the code
that invokes it.

Test Plan: Code compiles on x86, arm and mips, tests pass on x86 linux.

Reviewers: tberghammer, chaoren

Subscribers: aemerson, lldb-commits

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

llvm-svn: 240772
2015-06-26 10:14:12 +00:00
Tamas Berghammer 67ec5458a7 Add branch emulation to aarch64 instruction emulator
The emulation of the branches are required by the new stack
unwinding logic to reinstantiate the prologue at the right place.

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

llvm-svn: 240769
2015-06-26 09:41:32 +00:00
Ewan Crawford 682e842855 XML register info fix
There are a couple of bugs in the XML register info handling which this patch fixes:

+ conflicting variable names in lambda, both capture list and parameters contains a variable called 'name'.

+ prev_reg_num, which sets the register number, should be incremented after each register is processed.

+ Windows errors regarding empty strings and the 'xi:' prefix disappearing from 'xi:include' node name.

Reviewers: clayborg

Subscribers: lldb-commits, deepak2427

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

llvm-svn: 240768
2015-06-26 09:38:27 +00:00
Jason Molenda 25c910137a When the user specifies a corefile that is not readable,
give them a meaningful error message instead of 
"Unable to find process plug-in for core file ...".

<rdar://problem/21255759> 
<rdar://problem/21091522>
http://blog.ignoranthack.me/?p=204

llvm-svn: 240753
2015-06-26 02:16:48 +00:00
Jason Molenda 16dc86d923 Re-enable 'process save-core' for arm64 targets.
Whatever problem I saw that caused me to disable this
initially is not a problem today.
<rdar://problem/21173317>
<rdar://problem/20266253> 

llvm-svn: 240737
2015-06-25 23:58:25 +00:00
Jason Molenda d607afd148 Mark armv7em and armv7m as compatible architectures.
<rdar://problem/21244671> 

llvm-svn: 240713
2015-06-25 22:37:57 +00:00
Greg Clayton 6f997133b0 Unbreak the build.
llvm-svn: 240711
2015-06-25 22:20:02 +00:00
Greg Clayton 358cf1ea30 Resubmitting 240466 after fixing the linux test suite failures.
A few extras were fixed

- Symbol::GetAddress() now returns an Address object, not a reference. There were places where people were accessing the address of a symbol when the symbol's value wasn't an address symbol. On MacOSX, undefined symbols have a value zero and some places where using the symbol's address and getting an absolute address of zero (since an Address object with no section and an m_offset whose value isn't LLDB_INVALID_ADDRESS is considered an absolute address). So fixing this required some changes to make sure people were getting what they expected. 
- Since some places want to access the address as a reference, I added a few new functions to symbol:
    Address &Symbol::GetAddressRef();
    const Address &Symbol::GetAddressRef() const;

Linux test suite passes just fine now.

<rdar://problem/21494354>

llvm-svn: 240702
2015-06-25 21:46:34 +00:00
Enrico Granata 2d061e20f6 Fix a bug where we were trying to reconstruct ivars of ObjC types from the runtime in "expression parser mode"
The expression parser mode allows UnknownAnyTy to make it all the way through, but that is bad for ivars because it means type layout fails horribly (as in, clang crashes)

This patch fixes the issue by using the "variables view mode", which masks UnknownAnyTy as empty-type, and pointer-to UnknownAnyTy as void*

This, in turn, allows LLDB to properly reconstruct ivars of IMP type in ObjC type - as per accompanying test case

Fixes rdar://21471326

llvm-svn: 240677
2015-06-25 19:17:04 +00:00
Dawn Perchik 1f93e86768 Add const qualifier to Mangled::GuessLanguage
llvm-svn: 240676
2015-06-25 19:14:34 +00:00
Greg Clayton b289cba50e Submitting patch from Abhishek for:
http://reviews.llvm.org/D10309

llvm-svn: 240663
2015-06-25 17:50:15 +00:00
Dawn Perchik 6c506bdab2 Rename Mangled::GetLanguage to Mangled::GuessLanguage
The language can not be definitively determined from the mangling, so
this new name helps clarify that fact.  This addresses the concerns raised
in http://reviews.llvm.org/rL226962.
Reviewed by: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D10723

llvm-svn: 240662
2015-06-25 17:45:53 +00:00
Oleksiy Vyalov 05f75e9ffb Add const versions of SBFrame::GetFunctionName and SBFrame::IsInlined.
http://reviews.llvm.org/D10711

llvm-svn: 240660
2015-06-25 17:41:41 +00:00
Enrico Granata 5e1be09dab Handle (or at least don't crash) trying to get the encoding for a bunch of new builtin types in clang trunk
llvm-svn: 240606
2015-06-24 23:13:23 +00:00
Ed Maste a681ea25ed Reduce FreeBSD log spam
The values of four important registers are included in logs for ptrace
PT_GETREGS. Put all four on the same line for a more compact log. Also
use the proper 64-bit register names.

llvm-svn: 240581
2015-06-24 20:02:56 +00:00
Enrico Granata 989e213c18 Fix an issue where an SBValue could end up capturing a synthetic value and would then be unable to return the non-synthetic version thereof
This patch makes the backing ValueImpl always store the root-most value no matter the "flavor" that is initially passed into it

llvm-svn: 240578
2015-06-24 19:53:22 +00:00
Oleksiy Vyalov 6345fe3eb3 Revert rL240435: "Mark SBFrame::GetFunctionName and SBFrame::IsInlined as const.".
llvm-svn: 240565
2015-06-24 18:35:36 +00:00
Ed Maste 0ded6293c7 Remove SetResumeState from POSIXThread::RefreshStateAfterStop
With the removal of ProcessLinux in r240543 this code is used only on
FreeBSD. FreeBSD isn't affected by whichever issue originally prompted
the addition of SetResumeState, so just remove it.

As discussed on the mailing list (and mentioned in a FIXME comment)
it shouldn't be called there.

llvm-svn: 240550
2015-06-24 16:39:22 +00:00