Commit Graph

10198 Commits

Author SHA1 Message Date
Jason Molenda e589e7e336 The lldb unwinder can now use the unwind information from the compact-unwind
section for x86_64 and i386 targets on Darwin systems.  Currently only the
compact unwind encoding for normal frame-using functions is supported but it
will be easy handle frameless functions when I have a bit more free time to
test it.  The LSDA and personality routines for functions are also retrieved
correctly for functions from the compact unwind section.

This new code is very fresh -- it passes the lldb testsuite and I've done
by-hand inspection of many functions and am getting correct behavior for all
of them.  There may need to be some bug fixing over the next couple weeks as
I exercise and test it further.  But I think it's fine right now so I'm
committing it.

<rdar://problem/13220837> 

llvm-svn: 223625
2014-12-08 03:09:00 +00:00
Sean Callanan 957a872cb1 Fixed an unfortunate reversed conditional that
resulted in hard-to-track-down crashes.  Sigh.

llvm-svn: 223575
2014-12-06 02:31:49 +00:00
Kate Stone 641e9f8c69 Improvements to FastDemangler to correct parsing of <local-name> encodings for string literal and parameter/entity cases. Patch courtesy of slydiman.
llvm-svn: 223569
2014-12-06 01:42:41 +00:00
Jim Ingham 4623b9d3e2 Reverting r223548 which broke running in the shell on OS X.
llvm-svn: 223568
2014-12-06 01:41:10 +00:00
Jim Ingham 33df7cd345 Add the ability to set breakpoints with conditions, commands, etc,
in the "dummy-target".  The dummy target breakpoints prime all future
targets.  Breakpoints set before any target is created (e.g. breakpoints
in ~/.lldbinit) automatically get set in the dummy target.  You can also
list, add & delete breakpoints from the dummy target using the "-D" flag,
which is supported by most of the breakpoint commands.

This removes a long-standing wart in lldb...

<rdar://problem/10881487>

llvm-svn: 223565
2014-12-06 01:28:03 +00:00
Sean Callanan ceeb74e606 Now that we get types from modules, we occasionally
encounter clang::ExternalASTSources that are not instances
of ClangExternalASTSourceCommon.  We used to blithely
assume that all are, and so we could use static_cast<>.
That's no longer the case, so we have to have these AST
sources register themselves.

llvm-svn: 223560
2014-12-06 01:03:30 +00:00
Jim Ingham 67d7af9c34 Fix a type (MAX_PATH instead of PATH_MAX) and remove an unused variable.
llvm-svn: 223559
2014-12-06 01:03:17 +00:00
Sean Callanan 498ff1c1b8 Add new-lines after module compiler errors so
they are readable.

llvm-svn: 223557
2014-12-06 00:56:43 +00:00
Jim Ingham 0ccb02c4e9 Add an initial description of the rules for constructing new SB API classes.
llvm-svn: 223550
2014-12-06 00:28:05 +00:00
Zachary Turner 00cdc98b7f Fix some posix assumptions related to running shell commands.
Differential Revision: http://reviews.llvm.org/D6553

Reviewed By: Greg Clayton

llvm-svn: 223548
2014-12-06 00:14:24 +00:00
Jim Ingham 4701521ba0 Add a list iterable helper and use it to make a Breakpoint
iterator in the BreakpointList class.

llvm-svn: 223544
2014-12-05 23:21:30 +00:00
Jim Ingham 15fe293460 First pass at a description of the lldb coding conventions.
llvm-svn: 223543
2014-12-05 23:18:01 +00:00
Zachary Turner 22ac8711a5 Fix some uninitialized variables in ClangExpressionParser.
Reviewed by: Sean Callanan

llvm-svn: 223541
2014-12-05 22:54:56 +00:00
Enrico Granata 2f02fe0bd3 Add commands
type format info
type summary info
type synthetic info

These commands all take an expression, evaluate it, and show which of the respective formatter (if any) applies to the result of the expression

Fixes rdar://12059317

llvm-svn: 223511
2014-12-05 20:59:08 +00:00
Eric Christopher 73d15f2127 Fix a bunch of [-Werror,-Winconsistent-missing-override] warnings.
llvm-svn: 223501
2014-12-05 19:21:49 +00:00
Eric Christopher 3a078aefb6 Fix a few default label in switch which covers all
enumeration values [-Werror,-Wcovered-switch-default]
warnings.

llvm-svn: 223499
2014-12-05 19:09:02 +00:00
Zachary Turner 0a526eb855 Subtract the size of the breakpoint opcode from the PC when getting the bp site.
llvm-svn: 223498
2014-12-05 18:46:14 +00:00
Zachary Turner 301d184784 Load / unload modules in the target when the OS events occur.
This causes all deferred breakpoints to be correctly resolved as
the modules that they reside in are loaded.

llvm-svn: 223497
2014-12-05 18:46:04 +00:00
Zachary Turner cfd3b1ae6f Implement an empty DynamicLoader plugin for Windows.
llvm-svn: 223496
2014-12-05 18:45:53 +00:00
Zachary Turner b88ec656b5 Fix compilation errors after clang modules checkin.
llvm-svn: 223484
2014-12-05 17:38:20 +00:00
Stephane Sezer 7a1d22a2af Fix a crash in dotest.py when the lldb executable is not built.
Summary: If lldb is not built, dotest.py throws an exception because we are using an unset variable.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 223446
2014-12-05 05:02:41 +00:00
Vince Harron 41b3f630d7 Reverting r223423, test timeout
Was causing dosep to hang in some cases.

llvm-svn: 223441
2014-12-05 02:06:03 +00:00
Sean Callanan 221262996a Added CMake support so all the Clang modules code
will at least be built by non-OS X builders. This
should head off some build breakage at the pass.

llvm-svn: 223437
2014-12-05 01:31:55 +00:00
Sean Callanan c8278afc9f Changes to the expression parser to actually use
the types that we find in Clang modules.

llvm-svn: 223436
2014-12-05 01:27:35 +00:00
Sean Callanan c631b64fab Additional changes required by r223433.
llvm-svn: 223435
2014-12-05 01:26:42 +00:00
Sean Callanan 9998acd004 This is the meat of the code to add Clang modules
support to LLDB.  It includes the following:

- Changed DeclVendor to TypeVendor.
- Made the ObjCLanguageRuntime provide a DeclVendor
  rather than a TypeVendor.
- Changed the consumers of TypeVendors to use
  DeclVendors instead.
- Provided a few convenience functions on
  ClangASTContext to make that easier.

llvm-svn: 223433
2014-12-05 01:21:59 +00:00
Sean Callanan 47aed6365f Added the LLDB enumeration necessary to find the
Clang headers directory.  Needed by r223430.

llvm-svn: 223432
2014-12-05 01:17:47 +00:00
Sean Callanan 5dc2981cf8 Added support to Platform to indicate (1) whether the
current platform supports Clang modules, and (2) what
options to pass to Clang so it can load those Clang
modules.

llvm-svn: 223431
2014-12-05 01:16:31 +00:00
Sean Callanan b1e1c62fac Add support for embedding Clang compiler headers
like tgmath.h and stdarg.h into the LLDB installation,
and then finding them through the Host infrastructure.

Also add a script to actually do this on Mac OS X.

llvm-svn: 223430
2014-12-05 01:15:04 +00:00
Vince Harron de0d41fb4d Kill any python test script that takes more than 5 minutes
There is at least one test that hangs on the Linux debian buildbot.

When that test hangs, the buildbot kills dosep which loses all test
results.  This change kills just the hung test and should let us see
which test is hanging.  This is useful for that test and any others
in the future which start hanging.

llvm-svn: 223423
2014-12-05 00:23:03 +00:00
Zachary Turner be5e1e5c9b Fix a minor error where I forgot to declare a variable.
llvm-svn: 223393
2014-12-04 22:07:02 +00:00
Zachary Turner 9b69327b43 Revert "Use timeout when reading debugserver's port from a named pipe."
This reverts commit 4a5ad2c077166cc3d6e7ab4cc6e3dcbbe922af86.

Windows doesn't support select() for pipe objects, and this also fails
to compile on Windows.  Reverting this until we can get it sorted out
to keep the windows build working.

llvm-svn: 223392
2014-12-04 22:06:42 +00:00
David Majnemer b313e46cc6 Revert "Fix a build breakage. Looks like the LLVM side of this change has been reverted"
This reverts commit r223375.  We need to use unique_ptr to build with
LLVM r223183.

llvm-svn: 223388
2014-12-04 21:26:25 +00:00
Enrico Granata 20675c8478 We should not pretend that an int is a valid ObjC pointer. If your number truly is a pointer, po (id)myNumber is a better alternative. Fixes rdar://16585032
llvm-svn: 223379
2014-12-04 19:31:51 +00:00
Greg Clayton 2e644415ba Remove dead code from SymbolFileDWARF:
lldb::TypeSP 
SymbolFileDWARF::FindDefinitionTypeForDIE (
    DWARFCompileUnit* dwarf_cu, 
    const DWARFDebugInfoEntry *die, 
    const lldb_private::ConstString &type_name);

This function isn't used as it has been replaced by:

lldb::TypeSP
SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext (
    const DWARFDeclContext &die_decl_ctx);

I am about to change the way we resolve C/C++ class/struct/union types and want to clean up SymbolFileDWARF before I start.

llvm-svn: 223376
2014-12-04 18:49:24 +00:00
Enrico Granata c5d32d751e Fix a build breakage. Looks like the LLVM side of this change has been reverted
llvm-svn: 223375
2014-12-04 18:39:40 +00:00
Hafiz Abid Qadeer ebbb8f3a41 Cleanup of the fix done recently for a lldb-mi hang on OSX.
It was observed that we dont need to set stdin to unbuffered and setting console
to non-canonical mode.

Patch originally came from "Ilia K <ki.stfu@gmail.com>"

llvm-svn: 223353
2014-12-04 11:05:31 +00:00
Zachary Turner 1ed7b87db3 Improve the comments on PutSTDIN, GetSTDOUT, and GetSTDERR.
Differential Revision: http://reviews.llvm.org/D6513

llvm-svn: 223308
2014-12-03 23:15:14 +00:00
Zachary Turner b3ff719b04 Manually call ModulesDidLoad when the executable is loaded.
This is a temporary workaround to get deferred breakpoint
resolution working until Bug 21720 is addressed.  Even with this
workaround, it will only resolve deferred breakpoints in the
executable module, and not in a shared library.

llvm-svn: 223273
2014-12-03 22:04:31 +00:00
Zachary Turner c6a6653ebb Correctly shutdown when DoDestroy is called with an active exception.
Previously if we got a DoDestroy while stopped at a breakpoint, we
would detach and then say the process had exited.  This is completely
wrong, as it resulted in the python script incorrectly assuming that
the process had actually exited and trying to delete the image, when
in fact it had done no such thing.

The fix employed here is that when we get a DoDestroy, we do 3 steps:

1) initiate a termination sequence on the process
2) If we were stopped handling an exception of any kind, mask it and
   let the program resume, causing the program to see the termination
   request and exit on its own.
3) Let the program exit normally, and close all of our handles before
   returning control back to DoDestroy.

This fixes Bug 21722 and Bug 21723.

llvm-svn: 223272
2014-12-03 22:04:18 +00:00
Oleksiy Vyalov e8fb6937ba Use timeout when reading debugserver's port from a named pipe.
http://reviews.llvm.org/D6490

llvm-svn: 223251
2014-12-03 18:19:16 +00:00
Hafiz Abid Qadeer afd188fee4 Remove unnecessary changes committed in r223222.
There were 2 different patches in discussion. One using ioctl
and other using select. We decided to use the ioctl but committed
code also have some changes which were only needed for 'select'.
This patch removes them.

llvm-svn: 223227
2014-12-03 12:48:19 +00:00
Hafiz Abid Qadeer 25383ac01b Fix a hang on OSX while executing -exec-run.
Now we wait for input to become available before blocking in fgets.
More details on problem can be found in 
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20141201/014290.html

Patch from dawn@burble.org.

llvm-svn: 223222
2014-12-03 10:23:06 +00:00
Jason Molenda 286fd1aaac Update setMCJITMemoryManager call to keep in line with llvm r223183.
Patch from Ryan Goodfellow.

llvm-svn: 223196
2014-12-03 04:02:03 +00:00
Jason Molenda 22f58dffeb Mark the armv7 q0-q3 and q8-q15 registers as volatile (not callee
preserved) in the ABI.

Realistically lldb isn't able to track register saves of any of
the neon regs right now so we should probably mark all of the 
regs as unavailable when you're not on stack frame 0...

<rdar://problem/19115127> 

llvm-svn: 223174
2014-12-02 23:21:05 +00:00
Zachary Turner be40b2f1b2 Fix broken test suite on Windows after r223091.
Differential Revision: http://reviews.llvm.org/D6484
Reviewed by: Oleksiy Vyalov

llvm-svn: 223155
2014-12-02 21:32:44 +00:00
Jason Molenda 98b3fde8ac Fix the behavior of ${current-pc-arrow} in the default disassembly
format for the not-current-stack-frame.  This was causing
test/functionalities/inferior-assert to fail.

Also document the new additions to the format specifications used
in the disassembly-format changes to formats.html.

<rdar://problem/19102757> 

llvm-svn: 223096
2014-12-02 00:26:21 +00:00
Oleksiy Vyalov a3ff6af484 Fix several test failures on Linux/FreeBSD caused by compiler configuration and invalid environment - make lldbtest.registerSharedLibrariesWithTarget to support multiple platforms.
http://reviews.llvm.org/D6392

llvm-svn: 223091
2014-12-01 23:21:18 +00:00
Zachary Turner e0d93f523b Enable enabling and disabling breakpoints on Windows.
llvm-svn: 223089
2014-12-01 23:13:52 +00:00
Zachary Turner e068d91824 Link test executables with LLD on Windows.
Clang generates DWARF debug info with section names longer
than 8 characters.  This is only supported by an extension
to PE/COFF which the MSVC linker doesn't implement.  So
trying to link DWARF-enabled object files with MSVC will
lead to corrupt debug information in the executable.

llvm-svn: 223088
2014-12-01 23:13:41 +00:00
Zachary Turner c7a17ed460 Only normalize FileSpec paths *after* resolving them.
Normalizing paths before resolving them can cause the path to
become denormalized after resolution.

llvm-svn: 223087
2014-12-01 23:13:32 +00:00
Enrico Granata e2068207be The register keyword is deprecated in C++11, so clang complains strongly about swig generating register declarations. Abuse the preprocessor to define the keyword away
llvm-svn: 223084
2014-12-01 22:51:03 +00:00
Greg Clayton afa91e339b lldb can deadlock when launched with an non-existing executable:
% lldb /bin/nonono
(lldb) target create "/bin/nonono"
error: unable to find executable for '/usr/bin/nonono'
<deadlock>

The problem was the initial commands 'target create "/bin/nonono"' were put into a pipe and the command interpreter was being run with:

void
CommandInterpreter::RunCommandInterpreter(bool auto_handle_events,
                                          bool spawn_thread,
                                          CommandInterpreterRunOptions &options)
{
    // Always re-create the command intepreter when we run it in case
    // any file handles have changed.
    bool force_create = true;
    m_debugger.PushIOHandler(GetIOHandler(force_create, &options));
    m_stopped_for_crash = false;
    
    if (auto_handle_events)
        m_debugger.StartEventHandlerThread();
    
    if (spawn_thread)
    {
        m_debugger.StartIOHandlerThread();
    }
    else
    {
        m_debugger.ExecuteIOHanders();
        
        if (auto_handle_events)
            m_debugger.StopEventHandlerThread();
    }
    
}

If "auto_handle_events" was set to true and "spawn_thread" was false, we would execute:

m_debugger.StartEventHandlerThread();
m_debugger.ExecuteIOHanders();
m_debugger.StopEventHandlerThread();


The problem was there was no synchonization in Debugger::StartEventHandlerThread() to ensure the event handler was listening to events and the the call to "m_debugger.StopEventHandlerThread()" would do:

void
Debugger::StopEventHandlerThread()
{
    if (m_event_handler_thread.IsJoinable())
    {
        GetCommandInterpreter().BroadcastEvent(CommandInterpreter::eBroadcastBitQuitCommandReceived);
        m_event_handler_thread.Join(nullptr);
    }
}

The problem was that the event thread might not be listening for the CommandInterpreter::eBroadcastBitQuitCommandReceived event yet.

The solution is to make sure the Debugger::DefaultEventHandler() is listening to events before we return from Debugger::StartEventHandlerThread(). Once we have this synchonization we remove the race condition.

This fixes radar:

<rdar://problem/19041192>

llvm-svn: 223083
2014-12-01 22:41:27 +00:00
Greg Clayton d90ac932d9 Added a new regular expression to the "_regexp-break" command ("b" by default):
(lldb) b /break here/

This will set a source level regular expression breakpoint on any text between the first '/' and the last '/'. The equivalent command will be:

(lldb) breakpoint set --source-pattern-regexp 'break here'

llvm-svn: 223082
2014-12-01 22:34:03 +00:00
Vince Harron 6eddf8df2a Added StringExtractor::DecodeHexU8 && GetHexBytesAvail
DecodeHexU8 returns a decoded hex character pair, returns -1 if a
valid hex pair is not available.

GetHexBytesAvail decodes all available hex pairs.

llvm-svn: 223081
2014-12-01 22:19:33 +00:00
Vince Harron e5a9eaaaed StringExtractor unit tests
Unit tests to cover StringExtractor in advance of minor new
functionality & minor refactor

llvm-svn: 223080
2014-12-01 22:10:15 +00:00
Jason Molenda 5197ba5b01 Add support for 32-bit i386 binaries.
llvm-svn: 222952
2014-11-29 09:17:40 +00:00
Jason Molenda c9acfeb55b The finishing touches on getting the compact unwind dumping completed
for x86_64.  i386, arm, arm64 aren't handled yet but those are minor
variations on this format.

This commit also adds code to read the symbol table out of the
binary and read the LC_FUNCTION_STARTS to augment the symbol table
with the start addresses of all the functions - and print the
function names when showing the unwind info.

llvm-svn: 222951
2014-11-29 07:05:07 +00:00
Jason Molenda a6f75467da Add support for UNWIND_X86_64_MODE_STACK_IND entries.
Correct the function offset computations in UNWIND_SECOND_LEVEL_REGULAR
tables.  A few other small fixes.

llvm-svn: 222910
2014-11-28 03:54:13 +00:00
Oleksiy Vyalov 2f206d6ee4 Make LLGS to open a named pipe and write a listening port to it only when a proper port value is received.
llvm-svn: 222902
2014-11-27 20:51:24 +00:00
Jason Molenda 671001cc66 A little more work on the compact unwind dumper.
UNWIND_X86_64_MODE_STACK_IND mode is almost correct; extra stack
space allocated before the reg saves isn't handled right.  Still a
little wobbily on the file addresses of functions.  Finally understand
how the 6 registers that may be saved are ordered in just 10 its
of space -- the Lehmer code for the registers is derived and then
the sequence is encoded in a variable base number.  Added some
comments with references to what the code is doing so it'll be
easier for others to track down.

llvm-svn: 222884
2014-11-27 13:21:38 +00:00
Hafiz Abid Qadeer e7914cfb0e Add test for MI tokens.
This file tests the sequence of digits that can come before
an MI command.

Patch from dawn@burble.org.

llvm-svn: 222873
2014-11-27 09:19:46 +00:00
Oleksiy Vyalov e13d71c57c Refactor SocketAddress::getaddrinfo - avoid calling IsValid if ::getaddrinfo has failed.
Otherwise, IsValid crashes on assertation in GetFamilyLength.

llvm-svn: 222862
2014-11-27 00:32:54 +00:00
Oleksiy Vyalov dc4067c852 Fix several test failures on Linux/FreeBSD caused by compiler configuration and invalid environment.
http://reviews.llvm.org/D6392

llvm-svn: 222845
2014-11-26 18:30:04 +00:00
Hafiz Abid Qadeer be6992c7d3 Improve lldb-mi tests.
summary of changes:
  Cleanup: Use "line_number" API instead of hardcoded source lines
  Combine child.sendline with previous child.send command.
  test_lldbmi_tokens: Add test for MI tokens.
  test_lldbmi_badpathexe: Remove check for prompt so test for bad path can be enabled.

Patch from dawn@burble.org.

llvm-svn: 222838
2014-11-26 16:37:51 +00:00
Hafiz Abid Qadeer 05200e3b19 Re-order the base classes to prevent a crash in Linux.
In the initialization list of IOHandlerConfirm, *this is basically casting
IOHandlerConfirm to its base IOHandlerDelegate and passing it to constructor of
IOHandlerEditline which uses it and crashes as constructor of IOHandlerDelegate
is still not called. Re-ordering the base classes makes sure that constructor of
IOHandlerDelegate runs first.

It would be good to have a test case for this case too.

llvm-svn: 222816
2014-11-26 10:19:32 +00:00
Zachary Turner 807eb55b08 When a process stops, set the StopInfo object on Windows.
llvm-svn: 222776
2014-11-25 19:03:19 +00:00
Zachary Turner 82da55fe57 Disable GetSTDOUT, GetSTDERR, and PutSTDIN on Windows.
These methods are difficult / impossible to implement in a way
that is semantically equivalent to the expectations set by LLDB
for using them.  In the future, we should find an alternative
strategy (for example, i/o redirection) for achieving similar
functionality, and hopefully deprecate these APIs someday.

llvm-svn: 222775
2014-11-25 19:03:08 +00:00
Zachary Turner 9f877de2e6 Add some more comments explaining the purpose of some Register classes.
llvm-svn: 222774
2014-11-25 19:02:47 +00:00
Hafiz Abid Qadeer 1cbac4e94f Add initial lldb-mi tests.
Test 'test_lldbmi_interrupt' is only enabled for Darwin as
it seems to cause a timeout error on Linux.
Patch from dawn@burble.org.

llvm-svn: 222750
2014-11-25 10:41:57 +00:00
Ed Maste ef43413593 Fix lldb(1) man page formatting
- Use canonical date order (per groff & mandoc)
- Fix capitalization on one .Nm
- Remove EOL whitespace

Patch by Baptiste Daroussin in FreeBSD svn r274927.

llvm-svn: 222655
2014-11-24 15:01:11 +00:00
Siva Chandra 51aba6ffa9 Mark 9 lldb unit tests for ubuntu as XFAIL.
The following lldb unit tests fail check-lldb on ubuntu:

TestDataFormatterStdMap.py
TestDataFormatterStdVBool.py
TestDataFormatterStdVector.py
TestDataFormatterSynthVal.py
TestEvents.py
TestInitializerList.py
TestMemoryHistory.py
TestReportData.py
TestValueVarUpdate.py

These unit test failures are for non-core functionality. The intent is to
reduce the check-lldb FAILS to core functionality FAILS and then circle
back later and fix these FAILS at a later date.

llvm-svn: 222608
2014-11-22 05:55:00 +00:00
Greg Clayton 54166af611 Fixed an issue where a DW_FORM_ref{2,4,8} might be extracted incorrectly because the wrong compile unit was being used to calculate the compile unit relative offset.
This was fixed by making the DWARFFormValue contain the compile unit that it needs so it can decode its form value correctly. Any form value that requires a compile unit will now assert. If any of the assertions that were added are triggered, then code that led to the extraction of the form value without properly setting the compile unit must be fixed immediately. 

<rdar://problem/19035440>

llvm-svn: 222602
2014-11-22 01:58:59 +00:00
Jason Molenda cea6d634a5 When a RegisterContext produces an invalid CFA address, change
UnwindLLDB::AddOneMoreFrame to try the fallback unwind plan on
that same stack frame before it tries the fallback unwind plan
on the "next" or callee frame.

In RegisterContextLLDB::TryFallbackUnwindPlan, when we're
trying the fallback unwind plan to see if it is valid, make
sure we change all of the object ivars that might be used in
the process of fetching the CFA & caller's saved pc value 
and restore those if we decide not to use the fallback 
unwindplan.

<rdar://problem/19035079> 

llvm-svn: 222601
2014-11-22 01:52:03 +00:00
Jim Ingham 893c932acf This is the first step of making lldb able to create target-specific things
(e.g. breakpoints, stop-hooks) before we have any targets - for instance in 
your ~/.lldbinit file.  These will then get copied over to any new targets 
that get created.  So far, you can only make stop-hooks.

Breakpoints will have to learn to move themselves from target to target for
us to get them from no-target to new-target.

We should also make a command & SB API way to prime this ur-target.

llvm-svn: 222600
2014-11-22 01:42:44 +00:00
Jim Ingham 0f17c5570d Make the sourcing of the local .lldbinit file quiet.
<rdar://problem/19065278>

llvm-svn: 222599
2014-11-22 01:33:22 +00:00
Zachary Turner e5bd103621 [ProcessWindows] Clean up the register definitions array.
llvm-svn: 222597
2014-11-22 00:37:14 +00:00
Enrico Granata e8eb47037c Just a few words to introduce the extra optional argument to Python summaries
llvm-svn: 222594
2014-11-22 00:06:30 +00:00
Enrico Granata 7e4df56aae Enable Python summaries to use custom SBTypeSummaryOptions if the user is so inclined. Updates to the webdoc will follow
llvm-svn: 222593
2014-11-22 00:02:47 +00:00
Jason Molenda 4104b908cc Fix mispelled 'ling' Python property to be 'line' in
SBLineEntry and SBDeclaration.  Patch from Chris Willmore.
<rdar://problem/19054323> 

llvm-svn: 222592
2014-11-22 00:00:17 +00:00
Greg Clayton 39766d9eda Remove print statement that was accidentally left in.
llvm-svn: 222589
2014-11-21 23:34:35 +00:00
Enrico Granata 49a6746942 Per off-list feedback, this API returns the *first* value with a given name, not the *only* one. Rename it to reflect that
llvm-svn: 222582
2014-11-21 22:23:08 +00:00
Enrico Granata e9a09c74fa Add an API on SBValueList to find the first value with a given name stored in the list
llvm-svn: 222576
2014-11-21 21:45:03 +00:00
Enrico Granata a126e462c2 Do some cleanup of DumpValueObjectOptions. The whole concept of raw printing was split between feature-specific flags, and an m_be_raw flag, which then drove some other changes in printing behavior. Clean that up, so that each functionality has its own flag .. oh, and make the bools all go in a bitfield since I may want to add more of those over time
llvm-svn: 222548
2014-11-21 18:47:26 +00:00
Oleksiy Vyalov ff9a07203e Extend PipePosix with child_processes_inherit support - to control whether pipe handles should be inherited by a child process.
http://reviews.llvm.org/D6348

llvm-svn: 222541
2014-11-21 16:18:57 +00:00
Shawn Best d64bc4bee6 fix Bug21211 : reworked test/api/multithreaded/test_listener_event_description.cpp to work properly on Linux/FreeBSD
Issue D5632 fixed an issue where linux would dump spurious output to tty on startup (due to a broadcast stop event). After the checkin, it was noticed on FreeBSD a unit test was now failing. On closer investigation I found the test was using the C++ API to launch an inferior while using an SBListener to monitor the public state changes. As on OSx, it was expecting to see:

eStateRunning
eStateStopped

On Linux/FreeBSD, there is an extra state change

eStateLaunching
eStateRunning
eStateStopped

I reworked the test to work for both cases and re-enabled the test of FreeBSD.

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

llvm-svn: 222511
2014-11-21 06:49:39 +00:00
Ed Maste cec2a5b270 Rework parallel test process count logic
The default value for opt.thread_count was multiprocessing.cpu_count(),
which meant the LLDB_TEST_THREADS environment variable was never used.
It's not easy to pass the -t option to the test run when invoking it
from e.g. 'ninja check-lldb', so having the environment variable as an
option is useful.

Change the logic so that the thread count is set by the first one of:

  1. The -t option to test/dosep.py
  2. The LLDB_TEST_THREADS environment variable
  3. The machine's CPU count from multiprocessing.cpu_count()

llvm-svn: 222501
2014-11-21 02:41:25 +00:00
Jason Molenda c6127dd653 Change CommandObjectTargetModulesLoad so that the filename argument
is treated as a string instead of a FileSpec.

OptionValueFileSpec::SetValueFromCString() passes the c string to
FileSpec::SetFile(str, true /* resolve */) - and with Zachary's
changes to FileSpec we're using llvm::sys::fs::make_absolute() to
do that "resolve" action now, where we used to use realpath().

One important difference between llvm::sys::fs::make_absolute and
realpath is that when they're handed a filename (no directory),
realpath prepends the current working directory *and if the file exists*,
returns that full path.  If that file doesn't exist, the caller 
uses the basename only.

llvm::sys::fs::make_absolute prepends the current working directory
regardless of whether it exists or not. 

I considered having FileSpec::SetFile save the initial pathname,
call FileSpec::Resolve, and then check to see if the Resolve return
path exists - and if not, go back to the original one.

But instead I just went with changing 'target modules load' to treat its 
filename argument as a string instead of a FileSpec.  This brings it
in line with how 'target modules list' works.

<rdar://problem/18955416> 

llvm-svn: 222498
2014-11-21 02:25:15 +00:00
Zachary Turner 7f013bcd60 Rename lldb registers to contain lldb_ prefix.
LLDB supports many different register numbering schemes, and these
are typically prefixed with an indicator that lets the user know
what numbering scheme is used.  The gcc numbering scheme is
prefixed with gcc, and there are similar ones for dwarf, gdb,
and gcc_dwarf.

LLDB also contains its own internal numbering scheme, but the enum
for LLDB's numbering scheme was prefixed differently.  This patch
changes the names of these enums to use the same naming scheme for
the enum values as the rest of the register kinds by removing gpr_
and fpu_ prefixes, and instead using lldb_ prefixes for all enum
values.

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

llvm-svn: 222495
2014-11-21 02:00:21 +00:00
Jim Ingham c57059059d Add a test for the driver's "-k" option.
llvm-svn: 222484
2014-11-21 00:14:57 +00:00
Jim Ingham 661f29dde4 Make the option parsing of -k & -K match the help strings.
llvm-svn: 222479
2014-11-20 23:37:13 +00:00
Zachary Turner 7b1534e452 Remove duplicated enum, use the authoritative one.
Running a diff against lldb-x86-register-enums.h and the file
modified in this patch, the two enums were completely identical.

Deleting one of them to reduce code noise.

llvm-svn: 222478
2014-11-20 23:19:40 +00:00
Zachary Turner 17f383d498 [ProcessWindows] Implement a RegisterContextWindows for x86.
This implements the skeleton of a RegisterContext for Windows.
In particular, this implements support only for x86 general purpose
registers.

After this patch, LLDB on Windows can perform basic debugging
operations in a single-threaded inferior process (breakpoint,
register inspection, frame select, unwinding, etc).

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

llvm-svn: 222474
2014-11-20 22:47:32 +00:00
Jim Ingham c0b4d5a1f6 "nexti" should not step over inlined functions.
<rdar://problem/16705325>

llvm-svn: 222459
2014-11-20 22:04:45 +00:00
Ed Maste 365eb05c70 Remove decorator for FreeBSD test that now passes
llvm-svn: 222449
2014-11-20 19:43:33 +00:00
Ed Maste 55f410bf16 Add decorator for FreeBSD failure
llvm.org/pr21620

llvm-svn: 222442
2014-11-20 18:56:11 +00:00
Stephane Sezer b6e8192a85 Properly specify a few checksum values for llgs tests.
Summary: In noack mode, these checksums are ignored by llgs, but some implementations need them still. Specify these checksums to ease integration.

Test Plan: Run the tests before and after the change and make sure nothing breaks.

Reviewers: clayborg, tfiala

Subscribers: lldb-commits

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

llvm-svn: 222441
2014-11-20 18:50:46 +00:00
Stephane Sezer e5f27decf9 Fix a typo in lldb-gdb-remote.txt.
Test Plan: None.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 222440
2014-11-20 18:50:16 +00:00
Oleksiy Vyalov 5d06474b29 Add test for denied process attach by pid and fix found bugs in Process/ProcessPOSIX.cpp
and FreeBSD/ProcessMonitor.

http://reviews.llvm.org/D6240

llvm-svn: 222372
2014-11-19 18:27:45 +00:00
Oleksiy Vyalov b92935b444 Fix broken build after removing StringMap::GetOrCreateValue in favor of StringMap::insert.
llvm-svn: 222370
2014-11-19 17:24:58 +00:00
Jason Molenda 51a4511b72 Add additional checks to the SavedLocationForRegister method
where it is retrieving the Return Address register contents
on a target where that's a thing.  If we fail to get a valid
RA, we force a switch to the fallback unwind plan.  This patch
adds a sanity check for that fallback unwind plan -- it must
get a valid CFA for this frame in addition to being able to
retrieve the caller's PC -- and it correctly marks the unwind
rules as failing if the fallback unwind plan fails.

<rdar://problem/19010211> 

llvm-svn: 222301
2014-11-19 02:29:52 +00:00
Jim Ingham 4add3b13f0 Add "-k" and "-K" options to the driver, that allow you to register
some commands that will get run if the target crashes.

Also fix the bug where the local .lldbinit file was not getting
sourced before not after the target was created from the file options on the
driver command line.

<rdar://problem/19019843>

llvm-svn: 222295
2014-11-19 01:28:13 +00:00
Enrico Granata 49bfafb510 Shuffle APIs around a little bit, so that if you pass custom summary options, we don't end up caching the summary hence obtained. You may want to obtain an uncapped summary, but this should not be reflected in the summary we cache. The drawback is that we don't cache as aggressively as we could, but at least you get to have different summaries with different options without having to reset formatters or the SBValue at each step
llvm-svn: 222280
2014-11-18 23:36:25 +00:00
Enrico Granata 34042212b2 Add the ability for the NSString and libc++ std::string formatters to retrieve uncapped data
llvm-svn: 222277
2014-11-18 22:54:45 +00:00
Enrico Granata 489af08f67 Allow dsymutil to exists in a path with spaces in it
llvm-svn: 222276
2014-11-18 22:47:33 +00:00
Ismail Pazarbasi 526223319c Revert "git-svn test commit"
This reverts commit aa8d370ee798f75bc05a1ae9a240bc3e5b6870ac.

llvm-svn: 222275
2014-11-18 22:45:59 +00:00
Ismail Pazarbasi d98f7558bf git-svn test commit
llvm-svn: 222273
2014-11-18 22:44:51 +00:00
Eric Christopher b0a1814ff3 More override warning cleanup.
llvm-svn: 222271
2014-11-18 22:40:27 +00:00
Ismail Pazarbasi cc7d7f5e01 Find SWIG with CMake
SWIG is searched under certain paths within python script. CMake can
detect SWIG with find_package(SWIG). This is used iff user checks
LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION. If
buildSwigWrapperClasses.py does not receive swigExecutable argument,
then the script will use its current search implementation.

llvm-svn: 222262
2014-11-18 21:46:06 +00:00
Greg Clayton 306baae3c4 Fixed the stop hook test after recent editline changes.
llvm-svn: 222246
2014-11-18 19:45:23 +00:00
Ed Maste 2aff396080 Add decorator for test that fails on FreeBSD after editline rework
llvm.org/21599

llvm-svn: 222245
2014-11-18 19:30:13 +00:00
Jim Ingham 7d8555c413 Patch from dawn@burble.org to make the --silent-run do what it says, not the opposite of what it says.
llvm-svn: 222243
2014-11-18 19:12:13 +00:00
Jason Molenda ae3e40dd61 Fix up the code in the FuncUnwinders class that
retrieves the personality routine addr and the
LSDA addr.  Don't bother checking with the
"non-call site" unwind plan - this kind of
information is only going to come from the 
call site unwind plan.

llvm-svn: 222226
2014-11-18 05:57:42 +00:00
Jason Molenda b2115cf81a Add documentation for the SBTarget::ReadInstructions and
SBTarget::GetInstructions APIs so it's a little clearer to 
understand which should be used.

<rdar://problem/18787018>

llvm-svn: 222225
2014-11-18 05:43:11 +00:00
Jason Molenda 9211ec4fcc Make the mutex ivar in Unwind recursive so we don't have a thread
deadlocking when we have the base Unwind class and the HistoryUnwind
subclass both trying to acquire the lock on the same thread to clear
their respective ivar state.
<rdar://problem/18986350> 

llvm-svn: 222221
2014-11-18 04:57:28 +00:00
Jason Molenda e9c7ecf66e Read the LSDA and Personality Routine function address out of the
eh_frame data.  These two pieces of information are used in the
process of exception handler unwinding on SysV ABI systems.

This patch reads the data from the eh_frame section 
(DWARFCallFrameInfo.cpp), allows for it to be saved & read out
of a given UnwindPlan (UnwindPlan.h, UnwindPlan.cpp) - as well
as printing the information in the UnwindPlan::Dump method - and
adds methods to the FuncUnwinders object so that higher levels
can query if a given function has an LSDA / personality routine
defined.

It's only lightly tested, but seems to be working correctly as long
as your have this information in eh_frame.  Does not address getting
this information from compact unwind yet on Darwin systems.

<rdar://problem/18742797> 

llvm-svn: 222214
2014-11-18 02:27:42 +00:00
Greg Clayton ea508635de Have CommandObjectCommandsAddRegex inherit from IOHandlerDelegateMultiline so it will not immediately terminate after the first regular expression in "command regex <name>" commands.
Fixed the prompt to not include non-printable characters as it was hosing up the prompt when you ran "command regex foo" and entered multi-line editing mode.

Fixed error strings to include more complete descriptions when bad regular expressions are entered.

Removed the old IOHandlerLinesUpdated function as it is no longer needed (inheriting from IOHandlerDelegateMultiline takes care of what this function used to do).

llvm-svn: 222207
2014-11-18 00:43:17 +00:00
Greg Clayton dacf689a34 Fixed a broken test suite test after recent editline merges.
The problem is that editline currently is trying to be smart when we paste things into a terminal window. It detects that input is pending and multi-line input is accepted as long as there is anything pending.

So if you open lldb and paste the text between the quotes:

"command regex carp
s/^$/help/

carp
"

We still still be stuck in the "command regex" multi-line input reader as it will have all three lines:

"s/^$/help/

carp
"

The true fix for this is something Kate Stone will soon work on:

- multi-line input readers must opt into this paste/pending input feature ("expr" will opt into it, all other commands won't)
- If we are in a multi-line input reader that requests this and stuff is pasted, then it will do what it does today
- if we start in a IOHandler that doesn't need/want pending input and text is pasted, and we transistion to a IOHandler that does want this functionality, then disable the pending input. Example text would be:

"frame variable
thread backtrace
expr
for (int i=0;i<10;++i)
  (int)printf("i = %i\n", i);

frame select 0
"

When we push the expression multi-line reader we would disable the pending input because we had pending input _before_ we entered "expr".

If we did this first:

(lldb) expr

Then we pasted:

"void foo()
{
}

void bar()
{
}
"

Then we would allow the pending input to not look for an empty line to terminate the expression. We filed radar 19008425 to track fixing this issue.

llvm-svn: 222206
2014-11-18 00:39:31 +00:00
Enrico Granata 099263b487 Fix a problem where the StringPrinter could be mistaking an empty string for a read error, and reporting spurious 'unable to read data' messages. rdar://19007243
llvm-svn: 222190
2014-11-17 23:14:11 +00:00
Enrico Granata 6cd8e0c9b0 Add APIs on SBFunction and SBCompileUnit to inquire about the language type that the function/compile unit is defined in
llvm-svn: 222189
2014-11-17 23:06:20 +00:00
Eric Christopher e0569982db Fix override/virtual warnings.
llvm-svn: 222186
2014-11-17 22:55:13 +00:00
Zachary Turner c30189921e Change HostThread::GetNativeThread() to return a derived reference.
Previously using HostThread::GetNativeThread() required an ugly
cast to most-derived type.  This solves the issue by simply returning
the derived type directly.

llvm-svn: 222185
2014-11-17 22:42:57 +00:00
Oleksiy Vyalov 5453933867 Fix broken NativeProcessLinux.cpp after signature change of ResolveExecutable.
llvm-svn: 222184
2014-11-17 22:42:28 +00:00
Oleksiy Vyalov 6edef20405 Fix broken Linux build after signature change of ResolveExecutable.
llvm-svn: 222182
2014-11-17 22:16:42 +00:00
Zachary Turner 1019695b38 Move the thread logic around to fit better into LLDB's process model.
Previously we were directly updating the thread list and stopping
and restarting the process every time threads were created.  With
this patch, we queue up thread launches and thread exits, resolve
these all internally, and only update the threads when we get an
UpdateThreadList call.  We now only update the private state on
an actual stop (i.e. breakpoint).

llvm-svn: 222178
2014-11-17 21:31:30 +00:00
Zachary Turner d553d00c79 Disable Editline on Windows.
Editline does not work correctly on Windows.  This goes back at
least to r208369, and as a result r210105 was submitted to disable
libedit at runtime on Windows.

More recently, r222163 was submitted which re-writes editline
entirely, but makes the situation even worse on Windows, to the
point that it doesn't even compile.  While it would be easy to
fix the compilation failure, this patch simply stops compiling
Editline entirely on Windows, as the simple compilation fix would
still result in a broken use of select on Windows, and as such a
broken implementation of Editline.

Since Editline was already disabled to begin with on Windows, we
don't attempt to fix the compilation failure or the underlying
issues, and instead just disable it "even more".

llvm-svn: 222177
2014-11-17 21:31:18 +00:00
Zachary Turner 05d77c8b71 Fix broken build after signature change of ResolveExecutable.
llvm-svn: 222176
2014-11-17 21:30:58 +00:00
Jason Molenda 557109377d Small tweaks to make the editline sources match the lldb
source layout.

llvm-svn: 222171
2014-11-17 20:10:15 +00:00
Greg Clayton 8012cadbf3 Fixed more fallout from running the test suite remotely on iOS devices.
Fixed include:
- Change Platform::ResolveExecutable(...) to take a ModuleSpec instead of a FileSpec + ArchSpec to help resolve executables correctly when we have just a path + UUID (no arch).
- Add the ability to set the listener in SBLaunchInfo and SBAttachInfo in case you don't want to use the debugger as the default listener. 
- Modified all places that use the SBLaunchInfo/SBAttachInfo and the internal ProcessLaunchInfo/ProcessAttachInfo to not take a listener as a parameter since it is in the launch/attach info now
- Load a module's sections by default when removing a module from a target. Since we create JIT modules for expressions and helper functions, we could end up with stale data in the section load list if a module was removed from the target as the section load list would still have entries for the unloaded module. Target now has the following functions to help unload all sections a single or multiple modules:

    size_t
    Target::UnloadModuleSections (const ModuleList &module_list);

    size_t
    Target::UnloadModuleSections (const lldb::ModuleSP &module_sp);

llvm-svn: 222167
2014-11-17 19:39:20 +00:00
Kate Stone e30f11d9ee Complete rewrite of interactive editing support for single- and multi-line input.
Improvements include:
* Use of libedit's wide character support, which is imperfect but a distinct improvement over ASCII-only
* Fallback for ASCII editing path
* Support for a "faint" prompt clearly distinguished from input
* Breaking lines and insert new lines in the middle of a batch by simply pressing return
* Joining lines with forward and backward character deletion
* Detection of paste to suppress automatic formatting and statement completion tests
* Correctly reformatting when lines grow or shrink to occupy different numbers of rows
* Saving multi-line history, and correctly preserving the "tip" of history during editing
* Displaying visible ^C and ^D indications when interrupting input or sending EOF
* Fledgling VI support for multi-line editing
* General correctness and reliability improvements

llvm-svn: 222163
2014-11-17 19:06:59 +00:00
Enrico Granata 6e0566c6d9 Not all things callable have an im_self, so harden the test logic against that. getattr(,,None) is the closest to ?. we have in Python, so use that
llvm-svn: 222160
2014-11-17 19:00:20 +00:00
Greg Clayton 35c91347e6 Fixes for remote test suite execution of the "lldb/test/lang" directory.
Fixes include:
- Add a new lldbtest.TestBase function named registerSharedLibrariesWithTarget. This function can be called using the shared libraries for your test suite either as shared library basename ("foo"), path basename ("libfoo.dylib") or full path ("/tmp/lldb/test/lang/c/carp/libfoo.dylib"). These shared libraries are then registered with the target so they will be downloaded when the test is run remotely. 
- Changed a lot of tests over to use SBDebugger::CreateTarget(...) calls instead of using "file a.out" commands.
- Cleaned up some tests to add new locations for breakpoints that all compilers should be able to abide by. Some tests and constants being loaded into values of structs and some compilers like arm64 will often combine two constant data loads into a single source line so some breakpoint locations were not being set correctly. Adding lines like 'puts("")' allow us to lock onto a source line that will have code.

llvm-svn: 222156
2014-11-17 18:40:27 +00:00
Zachary Turner ca0c84cade Fix buildSwigWrapperClasses.py after recent break.
A re-ordering of some enum values exposed a lingering bug where an
invalid key was indexing a dictionary.

llvm-svn: 222154
2014-11-17 18:38:22 +00:00
Greg Clayton ce0b8e0fc9 Fix some issue with running the test suite remotely on iOS.
- Added a new "--apple-sdk" flag that can be specified on Darwin only so the correct cross compilers can be auto-selected without having to specify the "--compiler" flag.
- Set SDKROOT if needed

llvm-svn: 222153
2014-11-17 18:32:17 +00:00
Zachary Turner 1d6af02e2d Reformat lldb-mi using clang-format.
Courtesy of dawn@burble.org.

llvm-svn: 222150
2014-11-17 18:06:21 +00:00
Zachary Turner 119767db85 [ProcessWindows] Create a TargetThreadWindows class.
This creates a TargetThreadWindows class and updates the thread
list of the Process with the main thread.  Additionally, we
fill out a few more overrides of Process base class methods.  We
do not yet update the thread list as threads are created and/or
destroyed, and we do not yet propagate stop reasons to threads as
their states change.

llvm-svn: 222148
2014-11-17 17:46:43 +00:00
Zachary Turner a2fc3a4090 [ProcessWindows] Implement read / write process memory.
llvm-svn: 222147
2014-11-17 17:46:27 +00:00
Ed Maste 9dfcaf4854 Fix Darwin and FreeBSD OS type detection
Obtained in part from http://reviews.llvm.org/D6290

llvm-svn: 222136
2014-11-17 15:40:18 +00:00
Ed Maste 0178e7587e Whitespace cleanup and remove non-canonical headers
llvm-svn: 222135
2014-11-17 15:37:59 +00:00
Ed Maste 9251e2e61c Add decorator for intermittently failing test on FreeBSD
This test has intermittently failed on FreeBSD for quite some time when
run as part of the full test suite.  It generally passes when run by
itself.  Mark as expected failure for now to reduce buildbot noise.

llvm.org/pr15039 test fails intermittently on FreeBSD

llvm-svn: 222134
2014-11-17 15:27:09 +00:00
Jason Molenda b412e529e2 Add a little sketch of a program that can extract unwind
information from the compact unwind section used on darwin
for exception handling, and dump that information..

The UNWIND_X86_64_MODE_RBP_FRAME and UNWIND_X86_64_MODE_DWARF
entries look to be handled correctly.

UNWIND_X86_64_MODE_STACK_IMMD and UNWIND_X86_64_MODE_STACK_IND 
are still a work in progress.

Only x86_64 is supported right now.  Given that this is an
experiment in parsing the section contents, I don't expect to
add other architectures; they are trivial variations on this
arch.  There exists a real dumper included in the Xcode tools, 
unwinddump.

llvm-svn: 222127
2014-11-17 11:43:37 +00:00
Jim Ingham 96a1596a7a For some reason, sometimes the directory paths that clang emits have internal
relative paths, like:

/whatever/llvm/lib/Sema/../../include/llvm/Sema/

That causes problems with our type uniquing, since we use the declaration file
and line as one component of the uniquing, and different ways of getting to the
same file will have different directory spellings, though they are functionally
equivalent.  We end up with two copies of the exact same type because of this, 
and that makes the expression parser give "duplicate type" errors.

I added a method to resolve paths with ../ in them and used that in the FileSpec::Equals,
for comparing Declarations and for doing Breakpoint compares as well, since they also
suffer from this if you specify breakpoints by full path (since nobody knows what
../'s to insert...)

<rdar://problem/18765814>

llvm-svn: 222075
2014-11-15 01:54:26 +00:00
Enrico Granata e63de11a1a I don't need this ivar. It was probably there from the olden days where dynamic type support was flakey. Remove and save space
llvm-svn: 222063
2014-11-14 23:38:23 +00:00
Jim Ingham 90556aa757 Fix examine-threads to build for arm64.
llvm-svn: 222059
2014-11-14 22:58:25 +00:00
Enrico Granata e65a28f36f Removed a couple of static helpers in the data formatters, replaced with new general logic in StringLexer
llvm-svn: 222058
2014-11-14 22:58:11 +00:00
Shawn Best 954eae0ed4 add Makefile rule for test program CREATE_STD_THREADS
Effectively removes -lpthreads from linux/gcc build of test programs in test/api/multithreaded. This was done due to that combination causing a test program to hang due, likely due to an issue with gcc linker and libstdc++ conflicting pthreads code in test program and pthread used by lldb.  Issue has been documented at:
http://llvm.org/bugs/show_bug.cgi?id=21553

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

llvm-svn: 222031
2014-11-14 19:41:33 +00:00
Oleksiy Vyalov 477e42a6fb Apply SOCK_CLOEXEC flag to socket API functions in order to avoid handle leakage to a forked child process.
http://reviews.llvm.org/D6204

llvm-svn: 222004
2014-11-14 16:25:18 +00:00
Stephane Sezer 5109a7938d Properly specify the regex used to match register indexes.
Summary: Something like "core:1" would match and try to be interpreted by the following code otherwise.

Test Plan: Run tests and make sure the ones failing previously now pass.

Reviewers: tfiala, clayborg

Subscribers: lldb-commits

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

llvm-svn: 221980
2014-11-14 09:46:21 +00:00
Vince Harron 01e87d3fe2 fix minor comment typo
llvm-svn: 221950
2014-11-13 23:45:59 +00:00
Stephane Sezer 22ed42e4c8 Specify checksums properly for llgs test suite packets.
Summary: These checksums are ignored by llgs but some implementations require them to be specified properly.

Test Plan: Re-run llgs tests with the checksums and make sure we don't break anything.

Reviewers: tfiala, clayborg

Subscribers: lldb-commits

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

llvm-svn: 221927
2014-11-13 21:39:24 +00:00
Greg Clayton bf702ceed1 Fixed "SBTarget SBDebugger::CreateTarget (const char *filename)" to use the same semantics as other SBDebugger::CreateTarget() functions.
The issues were:
- If you called this function with any arch other than the default target architecture, creating the target would fail because the Target::GetDefaultArchitecture() would not match the single architecture in the file specified. This caused running the test suite remotely with lldb-platform to fail many many tests due to the bad target.
- It would specify the currently selected platform which might not work for the specified platform

All other SBDebugger::CreateTarget calls do not assume an architecture or platform and if they aren't specified, they don't auto select the wrong one for you.

With this fix, SBTarget SBDebugger::CreateTarget (const char *filename) now behaves like the other SBDebugger::CreateTarget() variants.

llvm-svn: 221908
2014-11-13 18:30:06 +00:00
Greg Clayton 14418e0409 Remove extra "/" character from paths resolved in iOS SDKs and also be sure to update the SDK directory infos if needed before we start using m_sdk_directory_infos.
llvm-svn: 221907
2014-11-13 18:25:33 +00:00
Oleksiy Vyalov 1339b5e8ae Refactor NativeProcessLinux::AttachToProcess in order to avoid reinterpret_cast from NativeProcessProtocol* to NativeProcessLinux*.
llvm-svn: 221906
2014-11-13 18:22:16 +00:00
Jason Molenda 22975a28ac A pretty big overhaul of the TryFallbackUnwindPlan method in
RegisterContextLLDB.  I have core files of half a dozen tricky
unwind situations on x86/arm and they're all working pretty much
correctly at this point, but we'll need to keep an eye out for
unwinder regressions for a little while; it's tricky to get these
heuristics completely correct in all unwind situations.

<rdar://problem/18937193> 

llvm-svn: 221866
2014-11-13 07:31:45 +00:00
Vince Harron fa08e6a3aa TestConcurrentEvents - delay threads not working
Part of TestConcurrentEvents starts threads that are supposed to be
delayed by one second.

Test was adding "delay" threads to the "actions" thread list instead
of the "delay_actions" list, which caused them to be started without
delay.

llvm-svn: 221859
2014-11-13 04:00:23 +00:00
Enrico Granata d72ffc661d Do not override the existing definition of addr_size when adding new properties to SBTarget. Fixes rdar://18963842
llvm-svn: 221850
2014-11-13 01:38:38 +00:00
Greg Clayton e8356339cd Fix so this test runs successfully on armv7 devices.
llvm-svn: 221830
2014-11-12 23:17:47 +00:00
Greg Clayton 5de3d9c031 Add a makefile even though it isn't used by the test in case we need to debug it when it fails.
llvm-svn: 221828
2014-11-12 23:13:23 +00:00
Ed Maste 6e494780c5 Add decorator for failing null dereference test on FreeBSD
llvm.org/pr21550

llvm-svn: 221815
2014-11-12 20:53:04 +00:00
Jason Molenda d8cc6bc325 Use PRIx64 when printing addr_t's. Don't need to force full-width 0 padding
with addresses that aren't designed to be column-aligned across multiple lines.

llvm-svn: 221810
2014-11-12 19:51:43 +00:00
Jason Molenda 043109ee21 Update comments to reflect how the new methods ended up being written.
llvm-svn: 221809
2014-11-12 19:49:58 +00:00
Zachary Turner a32d2cecba [ProcessWindows] Improve support for launching processes.
This sends notifications for module load / unload to the process
plugin, and also manages the state more accurately during the
loading sequence.

Similar work by Virgile Bello was referenced during the
implementation of this patch.

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

llvm-svn: 221807
2014-11-12 19:31:56 +00:00
Zachary Turner d6a7b63f26 [ProcessWindows] Simplify the DebugDelegate interface.
Due to a previous multi-threaded design involving message
passing, we used message classes to pass event information
to the delegate.  Since the multi-threaded design has gone
away, we simplify this by passing event arguments as direct
function parameters, which is more clear and easier to
understand.

llvm-svn: 221806
2014-11-12 19:31:39 +00:00
Ed Maste b5363110c7 Avoid crash in InitializeNonZerothFrame if no module found
After r221575 TestCallStopAndContinue and TestCallThatRestarts started
crashing on FreeBSD with a null temporary_module_sp in
RegisterContextLLDB::InitializeNonZerothFrame().

llvm-svn: 221805
2014-11-12 18:49:54 +00:00
Greg Clayton e3a73eb30f Fix the iOS build after recent inherited OTHER_LDFLAGS.
llvm-svn: 221797
2014-11-12 18:05:32 +00:00
Justin Hibbits 62cf35b8a3 FIx a bug with PC-register handling in a RA register.
The addition of RegisterNumber introduced a bug where if the PC is stored in a
return address register, such as on ARM and PowerPC, this register number is
retrieved and used, but never checked in the row if it's saved.  Correct this by
setting the variable that's used to the new register number.

Patch by Jason Molenda.

llvm-svn: 221790
2014-11-12 15:14:12 +00:00
Justin Hibbits 89e6f3851e Improve PowerPC unwind support
Summary:
Taking advantage of the new 'CFAIsRegisterDereferenced' CFA register type, add
full stack unwind support to the PowerPC/PowerPC64 ABI.  Also, add a new
register set for powerpc32-on-64, so the register sizes are correct.  This also
requires modifying the ProcessMonitor to add support for non-uintptr_t-sized
register values.

Reviewers: jasonmolenda, emaste

Subscribers: emaste, lldb-commits

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

llvm-svn: 221789
2014-11-12 15:14:08 +00:00
Justin Hibbits 43bcdbde4a Add an alternative CFA type.
Summary:
PowerPC handles the stack chain with the current stack pointer being a pointer
to the backchain (CFA).  LLDB currently has no way of handling this, so this
adds a "CFA is dereferenced from a register" type.

Discussed with Jason Molenda, who also provided the initial patch for this.

Reviewers: jasonmolenda

Reviewed By: jasonmolenda

Subscribers: emaste, lldb-commits

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

llvm-svn: 221788
2014-11-12 15:14:03 +00:00
Justin Hibbits 3cba1c267d Add powerpc support for the test suite.
Reviewed by Ed Maste at MeetBSD.

llvm-svn: 221787
2014-11-12 15:13:58 +00:00
Jason Molenda 4b0c118713 Enable armv7 core file writing for Mach-O binaries.
The problems with the dyld all image infos struct 
seems to be specific to arm64.

llvm-svn: 221760
2014-11-12 02:39:14 +00:00
Rafael Espindola 434df0a18c Update for llvm API change.
llvm-svn: 221752
2014-11-12 02:04:31 +00:00
Duncan P. N. Exon Smith 68caa7d34d Revert "Update for LLVM API change in r221024"
This reverts commit r221073 to match upstream revert in r221711.

llvm-svn: 221749
2014-11-12 01:59:53 +00:00
Jason Molenda 229525848a Sketch out the armv7 and arm64 core file writing support in
ObjectFileMachO.  It's close but we seem to be missing some
of the memory region segments - not exactly sure how that's
happening.  The register context writing into the LC_THREAD
load commands is working correctly though.

Slightly reordered the arm64 definitions in ArchSpec.cpp so
when we look for an arm64 core file definiton we're getting
a cpu subtype of CPU_ANY which we can't put in the mach
header of a core file.  Make the first definition we find by
linear search have the currently correct '1' cpu subtype.

llvm-svn: 221743
2014-11-12 01:11:36 +00:00
Enrico Granata 944547deab Move a bunch of summary formatters to oneliner mode. This makes more cases eligible for oneline printing, and fixes rdar://18120906
llvm-svn: 221701
2014-11-11 19:52:12 +00:00
Shawn Best 590e943a81 Add -std=c99 for building the test case of TestValueVarUpdate - for Siva Chandra : http://reviews.llvm.org/D6201
llvm-svn: 221694
2014-11-11 17:45:00 +00:00
Shawn Best 1ecb68d5ce Substitute cc with c++ when compiling c++ test files for Siva Chandra : http://reviews.llvm.org/D6199
llvm-svn: 221692
2014-11-11 17:34:58 +00:00
Jason Molenda d20359d810 Add support for 32-bit core file dumping. Add support for i386 process core file dumping.
llvm-svn: 221683
2014-11-11 10:59:15 +00:00
Jason Molenda 466ffa5676 Put the current pc arrow back into the default disassembly format.
I went back and forth on removing this - and tried dropping it for
a few weeks.  But when you're working at an assembly language, it
really is helpful to have this displayed to show where the current
pc is.

llvm-svn: 221682
2014-11-11 10:32:04 +00:00
Jason Molenda d158db0f63 Add an operator== to the RegisterNumber class; it simplifies
RegisterContextLLDB a bit more in a few places.

llvm-svn: 221677
2014-11-11 08:26:44 +00:00
Sean Callanan a0d5643610 Made the expression parser more resilient against
being asked about symbols it doesn't know about.  If
it's asked about a symbol by mangled name and it finds
nothing, then it will try again with the demangled
base name.

llvm-svn: 221660
2014-11-11 02:49:44 +00:00
Sean Callanan 7db93f70fb Ignore templated aggregates in the Objective-C
runtime.  This eliminates potential confusion
when the compiler has to deal with these weird
types later on.

One day I'd like to actually generate the proper
templates, but this is not the day that I write
the parser code to do that.

<rdar://problem/18887634>

llvm-svn: 221658
2014-11-11 02:27:22 +00:00
Sean Callanan f37ccc181d Fixed two issues in the type encoding parser:
- A correctness issue: with assertions disabled,
  ReadQuotedString would misbehave; and

- A performance issue: BuildType used a long
  chain of if()s; I changed that to two switch
  statements.  That also makes the code much
  nicer to step through when debugging it.

llvm-svn: 221651
2014-11-11 00:50:10 +00:00
Shawn Best 50d60be3ce Fix error handling in NativeProcessLinux::AttachToInferior: http://reviews.llvm.org/D6158
llvm-svn: 221647
2014-11-11 00:28:52 +00:00
Sean Callanan 7eb9091e42 Added a testcase that checks that fairly complicated
structures are parsed safely by the Objective-C runtime.

Also made some modifications to the way we parse structs
in the runtime to avoid mis-parsing @ followed by the name
of the next field.

<rdar://problem/18887634>

llvm-svn: 221643
2014-11-11 00:14:00 +00:00
Zachary Turner dcd80377f3 [ProcessWindows] Implement breakpoint stop / resume on Windows.
This patch implements basic support for stopping at breakpoints
and resuming later.  While a breakpoint is stopped at, LLDB will
cease to process events in the debug loop, effectively suspending
the process, and then resume later when ProcessWindows::DoResume
is called.

As a side effect, this also correctly handles the loader breakpoint
(i.e. the initial stop) so that LLDB goes through the correct state
sequence during the initial process launch.

llvm-svn: 221642
2014-11-11 00:00:14 +00:00
Sean Callanan 5c35f7cfd1 Cleaned up the StringLexer a little bit. It turns
out we only want to roll back text that was in the
buffer to begin with, so it's not necessary to
provide a pushback stack.

I'm going to use this slightly cleaner API to perform
lookahead for the Objective-C runtime type parser.

llvm-svn: 221640
2014-11-10 23:20:52 +00:00
Zachary Turner 3985f891a3 [ProcessWindows] Notify process plugin when the launch succeeds.
llvm-svn: 221637
2014-11-10 22:32:18 +00:00
Zachary Turner ba80da60c8 Fix some compiler warnings, one of which was a legit bug.
MSVC warns that not all control paths return a value when a switch
doesn't have a default case handler.  Changed explicit value checks
to a default check.

Also, it caught a case where bitwise AND was being used instead of
logical AND.  I'm not sure what this fixes, but presumably it is
not covered by any kind of test case.

llvm-svn: 221636
2014-11-10 22:31:51 +00:00
Greg Clayton 45f4f8bd7e Fix comments to match the current reality.
llvm-svn: 221633
2014-11-10 21:48:12 +00:00
Greg Clayton bd549169d7 Fix selectors not being objc-uniquified in the expression parser after a recent renaming in clang (clang change for revision 221451). This broke all objective C expressions in LLDB.
llvm-svn: 221632
2014-11-10 21:45:59 +00:00
Enrico Granata 4c67655b45 Fix a problem reported by Ed Maste where the test harness was failing to call bound methods as cleanup hooks
llvm-svn: 221624
2014-11-10 19:51:57 +00:00
Ed Maste 29a4584484 Fix new noreturn test on !darwin platforms
r221575 introduced a NoreturnUnwind test that did not skip the dsym
test on non-darwin platforms, and had the @dwarf_test case as an exact
copy of the dsym case (including the test name, test_with_dsym).

llvm-svn: 221611
2014-11-10 17:22:47 +00:00
Shawn Best e1a76dba0d LLGS Android target support (r221570) missed adding some files: http://reviews.llvm.org/D6166
llvm-svn: 221593
2014-11-10 15:06:15 +00:00
Jason Molenda bd07fd57f6 Add a RegisterNumber class to RegisterContextLLDB.h and start using
it in RegisterContext.cpp.

There's a lot of bookkeeping code in RegisterContextLLDB where it has
to convert between different register numbering schemes and it makes 
some methods like SavedLocationForRegister very hard to read or
maintain.  Abstract all of the details about different register numbering
systems for a given register into this new class to make it easier 
to understand what the method is doing.

Also add register name printing to all of the logging -- that's easy to
get now that I've got an object to represent the register numbers.

There were some gnarly corner cases of this method that I believe
I've translated correctly - initial testing looks good but it's
possible I missed a corner case, especially with architectures which
uses a link-register aka return address register like arm32/arm64.
Basic behavior is correct but there are a lot of corner casese that are
handled in this method ...

llvm-svn: 221577
2014-11-08 08:09:22 +00:00
Jason Molenda cf29675d95 Fix a corner case with the handling of noreturn functions.
If a noreturn function was the last function in a section,
we wouldn't correctly back up the saved-pc value into the
correct section leading to us showing the wrong function in
the backtrace.

Also add a backtrace test with an attempt to elicit this 
particular layout.  It happens to work out with clang -Os
but other compilers may not quite get the same layout I'm
getting at that opt setting.  We'll still be exercising the
basic noreturn handling in the unwinder even if we don't get
one function at the very end of a section.

<rdar://problem/16051613> 

llvm-svn: 221575
2014-11-08 05:38:17 +00:00
Shawn Best 8da0bf3b7c LLGS Android target support - for Andy Chien : http://reviews.llvm.org/D6166
llvm-svn: 221570
2014-11-08 01:41:49 +00:00
Shawn Best 181b09b7c3 fix for unit tests finding path to LLDB.h http://reviews.llvm.org/D6177
llvm-svn: 221566
2014-11-08 00:04:04 +00:00
Zachary Turner 02862bc83a Remove the top-level DebugDriverThread in ProcessWindows.
Originally the idea was that we would queue requests to a master
thread that would dispatch them to other slave threads each
responsible for debugging an individual process.  This might make
some scenarios more scalable and responsive, but for now it seems
to be unwarranted complexity for no observable benefit.

llvm-svn: 221561
2014-11-07 23:44:13 +00:00
Enrico Granata 52ab271878 This was meant to be count, not m_count
llvm-svn: 221541
2014-11-07 20:37:17 +00:00
Enrico Granata 03c9635199 SBValue::Cast is deprecated. This does not work as reliably as free-form casting via the expression evaluator. Some of our clients depend on it, so we can't remove it. But any new adopters should favor the expression parser as the way forward
llvm-svn: 221540
2014-11-07 20:22:18 +00:00