Correctly classify code sections as code sections by using the S_ATTR_PURE_INSTRUCTIONS and S_ATTR_SOME_INSTRUCTIONS section flags.

Also correctly set the symbol type of symbols for S_REGULAR and other section types.

<rdar://problem/16896734>



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211073 91177308-0d34-0410-b5e6-96231b3b80d8
Don't hardcode path to codesign_allocate.

Building OS X debugserver assumes you have an Xcode installation at /Application/Xcode.app. Let's instead detect where Xcode is using xcrun.

See http://reviews.llvm.org/D4152





git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211074 91177308-0d34-0410-b5e6-96231b3b80d8
Avoid crashing on invalid or unreadable ELF core

Issue discovered during the GSoC 2014 project implementing FreeBSD
kernel support.  The existing elf-core Process plugin crashed trying
to read from /dev/mem (the kernel memory device).

Patch by Mike Ma.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211102 91177308-0d34-0410-b5e6-96231b3b80d8
Added gdb-remote auxv tests.

First batch of auxv-related tests from llgs branch.

Includes helpers for unescaping gdb-remote binary-escaped
data, converting binary data from inferior endian-ness to
integral values, etc.

Tests on debugserver are expected to be skipped since it
doesn't support auxv and the tests are geared to be skipped
on platforms that don't broadcast support for the feature
in qSupported.  (llgs is listed as XFAIL since qSupported
support in llgs upstream is not there, so the support check
cannot work in upstream llgs.)


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211105 91177308-0d34-0410-b5e6-96231b3b80d8
Fix up lldb cmake linker flags for MacOSX.

Change r210035 broke the Darwin cmake build.  The
initial change was intended to stop the --start-group/--end-group
linker flags from being passed to non-gcc/clang-looking compilers,
stopping MSVC from warning on linking.  That change, however,
caused MacOSX cmake-based builds to start using the --start-group/
--end-group flags, even though the MacOSX linker doesn't support
them.  That broke the MacOSX clang build.

The fix keeps the newer check for a gcc-compatible compiler, but
specifically excludes MacOSX.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211123 91177308-0d34-0410-b5e6-96231b3b80d8
Those were not the right defines for memory errors, and the right defines aren't
available.  So going back to a generic error instead.

<rdar://problem/17058708>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211124 91177308-0d34-0410-b5e6-96231b3b80d8
Added gdb-remote auxv test for chunked reads.

Verifies that a sum of offset,length auxv reads
matches a single large read, and that the auxv data
extracted from them match.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211127 91177308-0d34-0410-b5e6-96231b3b80d8
Add locking around the m_owners collection in the breakpoint site.  If we are in the middle of "BreakpointLocation::ShouldStop" we don't
want other commands (like "break disable") to mutate the owners of this breakpoint out from under us.

<rdar://problem/17255589>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211136 91177308-0d34-0410-b5e6-96231b3b80d8
Add an option for debugserver to propagate its environment to programs it launches using the --forward-env or -F:

% ./debugserver --forward-env localhost:1234 -- /bin/ls
% ./debugserver -F localhost:1234 -- /bin/ls

Also allow new environment variables to be set using the "--env" or "-e":

% ./debugserver --env FOO=1 --env BAR=2 localhost:1234 -- /bin/ls
% ./debugserver -e FOO=1 -e BAR=2 localhost:1234 -- /bin/ls

<rdar://problem/17350654> 



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211200 91177308-0d34-0410-b5e6-96231b3b80d8
Don't allow multiple line entries with the same address to exist sequentially.

The compiler, when JIT'ing code, can emit illegal DWARF line tables (address is line table sequences must increase). This changes fixes that issue by replacing previous line entries whose start address is the same with the new line entry to avoid having multiple line entries with the same address. Since the address range of lines entries is determined by the delta between the current and next line entry, this shouldn't cause any issues.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211212 91177308-0d34-0410-b5e6-96231b3b80d8
Add a lock in the UnwindTable class so two Targets won't try
to modify the same UnwindTable object simultaneously.  Fix
HistoryThread and HistoryUnwind's mutex lock acqusition to
retain the lock for the duration of the operation instead of
releasing the temporary immediately.
<rdar://problem/17055023>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211241 91177308-0d34-0410-b5e6-96231b3b80d8
Actually make a real scoped locker rather than constructing one that gets immediately thrown away... 


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211242 91177308-0d34-0410-b5e6-96231b3b80d8
Fixed up gdb-remote auxv regex issues with binary data.
Fixes two causes for https://github.com/tfiala/lldb/issues/7.

1. Ensures the inferior program has started executing, by printing
a message on output first thing (per the "message:" command line arg)
and waiting for that text to arrive before doing any checks related
to auxv support.

2. Fixes up auxv-related regex patterns to be compiled with the Python
re.MULTILINE and re.DOTALL options.  The multiline is needed because
the binary data can include what look like newlines when interpreted
as text, and the DOTALL is needed to have the (.*) content portion match
newlines.

Added interrupt packet helper methods to add interrupt test sequence
packets and parse the results from them.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211283 91177308-0d34-0410-b5e6-96231b3b80d8
Switch over to using object_getClass to get the class of an object.  Previously we were
directly accessing the isa pointer of a class object to get its meta-class, but the isa
pointers are not simple pointers on arm64, so this would cause the stepping to fail.
object_getClass does whatever magic needs doing in this case.

<rdar://problem/17239690>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211289 91177308-0d34-0410-b5e6-96231b3b80d8
Test commit: Correct type in two comments.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211296 91177308-0d34-0410-b5e6-96231b3b80d8
Command files that switch input handlers didn't work, now they do.

The issue was when we called Debugger::RunIOHandler(), it would run the current IOHandler by activating it, and running it and then try to pop it and exit regardless of wether it was on top or not.

The new code will push the IOHandler that was passed in, and run the IOHandlers until the one passed in is successfully popped. This allows files for the "command source" to switch input handlers:

% cat /tmp/commands
br s -S alignLeftEdges:
br command add
bt
frame var
po self
DONE
b s -n main
br command add
bt
frame var
DONE

Note above we set a breakpoint, then add commands do it. The "br command add" will push the breakpoint comment gatherer until it sees "DONE" and then pop itself off the stack. The a new breakpoint will be set and it does the same thing again.

Now this file can be sourced from the command line:

% lldb -s /tmp/commands /path/to/a.out

And your breakpoints will be correctly setup!

<rdar://problem/17081650>



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211329 91177308-0d34-0410-b5e6-96231b3b80d8
Added gdb-remote tests for Q{Save,Restore}RegisterState.

Tests for both thread suffix and no thread suffix execution.

Moved some bit-flipping helper methods from TestLldbGdbServer
into the base GdbRemoteTestCaseBase class.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211381 91177308-0d34-0410-b5e6-96231b3b80d8
Fixed the "log enable gdb-remote packets" to support dumping the binary memory read packet ('x') by printing out the binary data correctly using only printable characters and removing the 0x7d escapes so the memory is readable in the packet output.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211400 91177308-0d34-0410-b5e6-96231b3b80d8
Fix a gdbremote bug in _M/_m stub support detection.

When a stub reported $#00 (unsupported) for _M and _m
packets, the unsupported response was not handled and
the client then marked the _M/_m commands as definitely
supported.  However, they would always fail, preventing
lldb's fallback InferiorCallMmap-based allocation strategy
from being used to attempt to allocate memory in the inferior
process space.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211425 91177308-0d34-0410-b5e6-96231b3b80d8
Remove useless declaration

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@211451 91177308-0d34-0410-b5e6-96231b3b80d8