Commit Graph

5578 Commits

Author SHA1 Message Date
Todd Fiala 6477ea87b7 Prevent ObjectFileELF::GetSectionHeaderInfo() from reparsing section headers.
If we have any section headers in the collection, we already parsed them.
Therefore, don't reparse the section headers when the section_headers collection
is not empty.

See this thread for more details:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140707/011721.html

Change by Matthew Gardiner

llvm-svn: 212822
2014-07-11 15:13:33 +00:00
Greg Clayton 205ca1e89f Enable the ability to enable debug info generation when evaluating expressions.
llvm-svn: 212792
2014-07-11 01:03:57 +00:00
Greg Clayton fb9756131e Remove code that was merged incorrectly.
llvm-svn: 212791
2014-07-11 00:51:53 +00:00
Zachary Turner 0ab4b48992 Get the python scripting interface working on Windows.
This patch fixes a number of issues with embedded Python on
Windows.  In particular:

1) The script that builds the python modules was normalizing the
   case of python filenames during copies.  The module name is
   the filename, and is case-sensitive, so this was breaking code.

2) Changes the build to not attempt to link against python27.lib
   (e.g. the release library) when linking against msvcrt debug
   library.  Doing a debug build of LLDB with embedded python
   support now requires you to provide your own self-compiled
   debug version of python.

3) Don't import termios when initializing the interpreter.  This
   is part of a larger effort to remove the dependency on termios
   since it is not available on Windows.  This particular instance
   was unnecessary and unused.

Reviewed by: Todd Fiala

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

llvm-svn: 212785
2014-07-10 23:47:42 +00:00
Greg Clayton 3f19ada88e Cleanup the iOS simulator code.
Fixes include:
- Don't say that "<arch>-apple-ios" is compatible with "<arch>-apple-macosx"
- Fixed DynamicLoaderMacOSXDYLD so specify an architecture that was converted solely from a cputype and subtype, just specify the file + UUID.
- Fixed PlatformiOSSimulator::GetSupportedArchitectureAtIndex() so it returns the correct archs
- Fixed SymbolFileDWARFDebugMap to load .o files correctly by just specifying the architecture without the vendor and OS now that "<arch>-apple-ios" is not compatible with "<arch>-apple-macosx" so we can load .o files correctly for DWARF with debug map
- Fixed the coded in TargetList::CreateTarget() so it does the right thing with an underspecified triple where just the arch is specified.

llvm-svn: 212783
2014-07-10 23:33:37 +00:00
Zachary Turner 026861b87d Move the post-build step that creates lldb.py.
Being in lldb\source, ${CMAKE_CURRENT_BINARY_DIR} would resolve to
the build\tools\lldb\source directory.  For correct operation, and
parity with the shell script, it needs to resolve to the
build\tools\lldb\scripts directory.

llvm-svn: 212760
2014-07-10 20:37:47 +00:00
Bruce Mitchener 350b78e5ea Reapply typo fix.
This was lost in the re-merging of command validation changes.

llvm-svn: 212721
2014-07-10 14:45:57 +00:00
Todd Fiala b35103ebb9 Fix a type mismatch in NativeProcessLinux that shows up in 32-bit builds.
http://llvm.org/bugs/show_bug.cgi?id=20255

llvm-svn: 212685
2014-07-10 05:25:39 +00:00
Todd Fiala 202ecd26da Fixes for broken Debian build - g++ 4.7 support.
These fix the broken debian lldb build, which is using g++ 4.7.2.

TypeFormat changes:
1. stopped using the C++11 "dtor = default;" construct.
The generated default destructor in the two derived classes wanted
them to have a different throws() semantic that was causing 4.7 to
fail to generate it.  I switched these to empty destructors defined
in the .cpp file.

2. Switched the m_types map from an ordered map to an unordered_map.
g++ 4.7's c++ library supports the C++11 emplace() used by TypeFormat
but the same c++ library's map impl does not.  Since TypeFormat didn't
look like it depended on ordering in the map, I just switched it to
a std::unordered_map.

NativeProcessLinux - g++ 4.7 chokes on lexing the "<::" in
static_cast<::pid_t>(wpid).  g++ 4.8+ and clang are fine with it.
I just put a space in between the "<" and the "::" and that cleared
it up.

llvm-svn: 212681
2014-07-10 04:39:13 +00:00
Greg Clayton 73d80faa78 Make sure the "command regex add" has a unique name for editline history purposes.
llvm-svn: 212644
2014-07-09 20:18:54 +00:00
Zachary Turner 3ddcd314f2 Dont' use a random probe & alloc strategy for the IRMemoryMap.
The current strategy for host allocation is to choose a random
address and attempt to allocate there, eventually failing if the
allocation cannot be satisfied.

The C standard only guarantees that RAND_MAX >= 32767, so for
platforms that use a very small RAND_MAX allocations will fail
with very high probability.  On such platforms (Windows is one),
you can reproduce this trivially by running lldb, typing "expr (3)"
and then hitting enter you see a failure.  Failures generally
happen with a frequency of about 1 failure every 5 evaluations.

There is no good reason that allocations need to look like "real"
pointers, so this patch changes the allocation scheme to simply
jump straight to the end and grab a free chunk of memory.

Reviewed By: Sean Callanan

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

llvm-svn: 212630
2014-07-09 16:42:27 +00:00
Zachary Turner df734cdd39 Fix tests broken by the OptionValidator changes.
The getopt library has a structure called option (lowercase).  We
have a structure called Option (uppercase).  previously the two
structures had exactly the same definitions, and we were doing a
C-style cast of an Option* to an option*.  C-style casts don't
bother to warn you when you cast to unrelated types, but in the
original OptionValidator patch I modified the definition of Option.

This patch fixes the errors by building an array of option
structures and filling it out the correct way before passing it to
the getopt library.

This also fixes one other source of test failures: an uninitialized
read that occurs due to not initializing a field of the
OptionDefinition.

Reviewed By: Todd Fiala

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

llvm-svn: 212628
2014-07-09 16:32:07 +00:00
Zachary Turner d37221dc5d Revert "Fix broken tests due to new error output."
This reverts commit ec7c94f8e6860968d384b578e5564a9c55c80b4a and
re-enables OptionValidators.

llvm-svn: 212627
2014-07-09 16:31:49 +00:00
Todd Fiala 013434e547 __arm64__ and __aarch64__ #ifdef adjustments
Change by Paul Osmialowski

See http://reviews.llvm.org/D4379 for details.

llvm-svn: 212583
2014-07-09 01:29:05 +00:00
Jason Molenda 52d760399c Correct indentation level for one line.
llvm-svn: 212582
2014-07-09 01:10:37 +00:00
Jason Molenda 45938b96ee Tweak for lldb coding style consistency.
llvm-svn: 212575
2014-07-08 23:46:39 +00:00
Jim Ingham 7a88ec9ac0 Add the ability to provide a "count" option to the various "thread step-*" operations. Only
step-inst and step-inst are currently supported, the rest just warn that they are not supported
if you try to provide a count.

llvm-svn: 212559
2014-07-08 19:28:57 +00:00
Jim Ingham c60b6eadec Document the "thread.completed-expression" feature in the "expression" command help.
llvm-svn: 212558
2014-07-08 19:27:35 +00:00
Bruce Mitchener aaa0ba31a9 Fix typos.
llvm-svn: 212553
2014-07-08 18:05:41 +00:00
Jean-Daniel Dupas c3aba6aafa Simplify Host::GetOSVersion() on macosx.
It removes usage of the deprecated function CFURLCreateDataAndPropertiesFromResource().

llvm-svn: 212552
2014-07-08 17:42:17 +00:00
Todd Fiala 9734280f33 Fix broken tests due to new error output.
This reverses out the options validators changes.  We'll get these
back in once the changes to the output can be resolved.

Restores broken tests on FreeBSD, Linux, MacOSX.

Changes reverted: r212500, r212317, r212290.

llvm-svn: 212543
2014-07-08 15:55:32 +00:00
Zachary Turner 310035a4f9 Implment "platform process list" for Windows.
This patch implements basic functionality of the "platform process
list" command for Windows.  Currently this has the following
limitations.

* Certain types of filtering are not enabled (e.g. filtering by
  architecture with -a), although most filters work.
* The username of the process is not yet obtained.
* Using -v to list verbose information generates an error.
* The architecture column displays the entire triple, leading to
  misaligned formatting of the printed table.

Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D4413

llvm-svn: 212510
2014-07-08 04:52:15 +00:00
Zachary Turner 24f3dee6ca Fix a compilation failure caused by a non-const reference.
llvm-svn: 212509
2014-07-08 04:28:07 +00:00
Jim Ingham 30fadafefe If a hand-called function is interrupted by hitting a breakpoint, then
when you continue to finish off the function call, the expression result
will be included as part of the thread stop info.

llvm-svn: 212506
2014-07-08 01:07:32 +00:00
Zachary Turner 28638911cd Invalidate process UID/GID-related command options on Windows.
Windows uses a different process security model and does not have
a concept of process UID or GID.  This patch makes these options
invalid on Windows.  Attempting to specify these options when the
current platform is Windows will generate an error.

Reviewed by: Jim Ingham
Differential Revision: http://reviews.llvm.org/D4373

llvm-svn: 212500
2014-07-07 23:54:51 +00:00
Todd Fiala 6d1fbc9c56 Allow specification of no source display on stop.
See http://llvm.org/bugs/show_bug.cgi?id=20149 for details.

Change by Randy Smith.

llvm-svn: 212485
2014-07-07 20:47:24 +00:00
Sylvestre Ledru ceab3ac375 remove trailing whitespace + remove some useless comments
llvm-svn: 212411
2014-07-06 17:54:58 +00:00
Sylvestre Ledru 3cc9d63031 Update lldb code to match the change in clang r212386
llvm-svn: 212410
2014-07-06 17:50:36 +00:00
Alp Toker 5f83864b7c Track changes from clang r212388
llvm-svn: 212391
2014-07-06 05:36:57 +00:00
Alp Toker edc902f3bb Track IntrusiveRefCntPtr::get() changes from LLVM r212366
llvm-svn: 212368
2014-07-05 03:06:05 +00:00
Todd Fiala 1b67c66c9c Windows build fixes and removal of endlessly recursive termination function.
This change removes the ScriptInterpreter::TerminateInterpreter() call which
ended up endlessly calling itself as things currently stand.  It also cleans
up some other Windows-related cmake changes.

See http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140630/011544.html
for more details.

Change by Zachary Turner

llvm-svn: 212320
2014-07-04 06:58:01 +00:00
Todd Fiala 859aff501b Fix OptionDefinition break from r212290.
Fixes some structure definitions in CommandObjectType
that needed to be adjusted for a new OptionDefinition
field.

llvm-svn: 212317
2014-07-04 06:09:04 +00:00
Zachary Turner 35974065fe Fix -Wnull-conversion warning.
llvm-svn: 212304
2014-07-03 23:44:14 +00:00
Zachary Turner de963e9a09 Adds the notion of an OptionValidator.
The purpose of the OptionValidator is to determine, based on some
arbitrary set of conditions, whether or not a command option is
valid for a given debugger state.  An example of this might be
to selectively disable or enable certain command options that
don't apply to a particular platform.

This patch contains no functional change, and does not actually
make use of an OptionValidator for any purpose yet.  A follow-up
patch will begin to add the logic and users of OptionValidator.

Reviewed by: Greg Clayton, Jim Ingham

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

llvm-svn: 212290
2014-07-03 20:34:18 +00:00
Zachary Turner 78b84f5454 Fix compilation errors introduced by host Pipe abstraction
on Windows.

llvm-svn: 212255
2014-07-03 05:20:28 +00:00
Bruce Mitchener 1d0089fa5c Add enumerations for additional languages from DWARF spec updates.
llvm-svn: 212246
2014-07-03 00:49:08 +00:00
Todd Fiala dda6194399 lldb - problem with some PTRACE_* constants in NativeProcessLinux.cpp file
See http://reviews.llvm.org/D4366 for details.

Change by Paul Paul Osmialowski

Today this is the only problem that I'm facing trying to cross-compile lldb for AArch64 using Linaro's toolchain.

PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS are not defined for AArch64
These things can be defined different ways for other architectures, e.g. for x86_64 Linux, asm/ptrace-abi.h defines them as preprocessor constants while sys/ptrace.h defines them in enum along with corresponding PT_* preprocessor constants
NativeProcessLinux.cpp includes sys/ptrace.h
To avoid accidental redefinition of enums with preprocessor constants, I'm proposing this patch which first checks for PT_* preprocessor constants then checks for PTRACE_* constants then when it still can not find them, it defines preprocessor constants.
Similar approach was already used for PTRACE_GETREGSET and PTRACE_SETREGSET constants; in this case however it was easier, since enum values in sys/ptrace.h and preprocessor constants shared all exactly the same names (e.g. there's no additional PT_GETREGSET name defined).

llvm-svn: 212225
2014-07-02 21:34:04 +00:00
Greg Clayton 100eb93f89 Add host layer support for pipes.
Windows does support pipes, but they do so in a slightly different way. Added a Host layer which abstracts the use of pipes into a new Pipe class that everyone can use.

Windows benefits include:
- Being able to interrupt running processes when IO is directly hooked up 
- being able to interrupt long running python scripts
- being able to interrupt anything based on ConnectionFileDescriptor

llvm-svn: 212220
2014-07-02 21:10:39 +00:00
Jean-Daniel Dupas 2ab92cf8f0 Removing Carbon dependency by removing obsolete code.
The only part using Carbon is a function in Host.mm used to open a file in Xcode.
That code is broken and it is no longer useful as Xcode supports LLDB natively.

llvm-svn: 212208
2014-07-02 19:37:25 +00:00
Jim Ingham e029fa5781 If a breakpoint gets deleted, any SBBreakpoints representing that
breakpoint should return false from IsValid.

llvm-svn: 212206
2014-07-02 18:44:43 +00:00
Zachary Turner a746e8e58a Start converting usages of off_t to other types.
off_t is a type which is used for file offsets.  Even more
specifically, it is only used by a limited number of C APIs that
deal with files.  Any usage of off_t where the variable is not
intended to be used with one of these APIs is a bug, by definition.

This patch corrects some easy mis-uses of off_t, generally by
converting them to lldb::offset_t, but sometimes by using other
types such as size_t, when appropriate.

The use of off_t to represent these offsets has worked fine in
practice on linux-y platforms, since we used _FILE_OFFSET_64 to
guarantee that off_t was a uint64.  On Windows, however,
_FILE_OFFSET_64 is unrecognized, and off_t will always be 32-bit.
So the usage of off_t on Windows actually leads to legitimate bugs.

Reviewed by: Greg Clayton

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

llvm-svn: 212192
2014-07-02 17:24:07 +00:00
Jean-Daniel Dupas e7c7c3de93 Replace uint32_t by lldb::RegisterKing in register context API.
llvm-svn: 212172
2014-07-02 09:51:28 +00:00
Todd Fiala 14bbef5ac7 Add Kalimba support to ArchSpec.
See http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140630/011508.html
for more details.

Change by Matthew Gardiner.

llvm-svn: 212145
2014-07-01 23:33:32 +00:00
Bruce Mitchener d93c4a3339 Fix typos.
llvm-svn: 212132
2014-07-01 21:22:11 +00:00
Bruce Mitchener 4d1a26dcc2 Minumum -> Minimum.
llvm-svn: 212129
2014-07-01 21:18:35 +00:00
Deepak Panickal 9b35cf52d2 This creates a valid Python API for Windows, pending some issues. The changes included are -
- Ported the SWIG wrapper shell scripts to Python so that they would work on Windows too along with other platforms
 - Updated CMake handling to fix SWIG errors and manage sym-linking on Windows to liblldb.dll
 - More build fixes for Windows

The pending issues are that two Python modules, termios and pexpect are not available on Windows.
These are currently required for the Python command interpreter to be used from within LLDB.

llvm-svn: 212111
2014-07-01 17:57:19 +00:00
Todd Fiala 9be5049a01 Use native ::pid_t in Linux ProcessMonitor (local debugging).
There were a few places where we were not catching the possibility of negative
error codes in waitpid() calls.  This change fixes those remaining after
the llgs branch fixes to ProcessMonitor.

Change by Shawn Best.

llvm-svn: 212107
2014-07-01 16:30:53 +00:00
Zachary Turner 0ec7baa9f4 Fix Windows build after llgs upstream.
With _HAS_EXCEPTIONS=0, Windows' version of <thread> will fail to
compile because it calls __uncaught_exception(), which is compiled
out due to _HAS_EXCEPTIONS=0.  This just creates a stub version
of __uncaught_exception() which always fails.

llvm-svn: 212076
2014-07-01 00:18:46 +00:00
Todd Fiala 2850b1be2e Fixup Windows build breaks for the llgs upstream.
Also moves NativeRegisterContextLinux* files into the Linux directory.
These, like NativeProcessLinux, should only be built on Linux or a cross
compiler with proper headers.

llvm-svn: 212074
2014-06-30 23:51:35 +00:00
Todd Fiala af245d115b Add lldb-gdbserver support for Linux x86_64.
This change brings in lldb-gdbserver (llgs) specifically for Linux x86_64.
(More architectures coming soon).

Not every debugserver option is covered yet.  Currently
the lldb-gdbserver command line can start unattached,
start attached to a pid (process-name attach not supported yet),
or accept lldb attaching and launching a process or connecting
by process id.

The history of this large change can be found here:
https://github.com/tfiala/lldb/tree/dev-tfiala-native-protocol-linux-x86_64

Until mid/late April, I was not sharing the work and continued
to rebase it off of head (developed via id tfiala@google.com).  I switched over to
user todd.fiala@gmail.com in the middle, and once I went to github, I did
merges rather than rebasing so I could share with others.

llvm-svn: 212069
2014-06-30 21:05:18 +00:00