Commit Graph

10198 Commits

Author SHA1 Message Date
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
Rafael Espindola 97ae14e166 Use llvm::StringRefMemoryObject NFC.
llvm-svn: 221509
2014-11-07 04:24:12 +00:00
Greg Clayton 860fac5338 Fixes so tests compile and run remotely.
Fixes include:
- dont set or change LDFLAGS, but set LD_EXTRAS instead
- fix compilation errors for iOS based builds with objective C code
    - fix test cases to create classes instead of relying on classes from AppKit 
    - rename things where it makes sense

llvm-svn: 221496
2014-11-06 22:59:28 +00:00
Greg Clayton ef95321229 Changed program to go along with the previous commit to allow this test to be run remotely via lldb-platform.
llvm-svn: 221494
2014-11-06 22:56:56 +00:00
Greg Clayton f324020b7c Fix the test to not have to run the binary separately first to get the golden output, use the process STDOUT instead.
This helps this test be able to be run remotely.

llvm-svn: 221493
2014-11-06 22:56:15 +00:00
Greg Clayton 2dd4365038 Make sure stderr is filtered out in case xcodebuild or xcrun print errors when getting the SDK path and use xcrun to find the SDK path.
llvm-svn: 221492
2014-11-06 22:55:09 +00:00
Enrico Granata f35bc63220 This is a large, but clearical, commit that enables the C++ formatters to take on the additional TypeSummaryOptions argument. It is still not used for anything, but it is now there. Adding support for this extra argument to Python formatters will follow suit
llvm-svn: 221486
2014-11-06 21:55:30 +00:00
Enrico Granata c1247f5596 Introduce the notion of "type summary options" as flags that can be passed down to individual summary formatters to alter their behavior in a formatter-dependent way
Two flags are introduced:
- preferred display language (as in, ObjC vs. C++)
- summary capping (as in, should a limit be put to the amount of data retrieved)

The meaning - if any - of these options is for individual formatters to establish
The topic of a subsequent commit will be to actually wire these through to individual data formatters

llvm-svn: 221482
2014-11-06 21:23:20 +00:00
Sean Callanan 4c508df925 Handle types from the runtime that conform to
protocols.

<rdar://problem/18883778>

llvm-svn: 221476
2014-11-06 19:26:10 +00:00
Greg Clayton e6352e4797 Pick better floating point numbers (ones that can be exactly represented) in floating point instead of something that can't to avoid test suite failures on different devices and architectures.
<rdar://problem/18826900>

llvm-svn: 221468
2014-11-06 18:39:39 +00:00
Shawn Best eb3e905027 fixed minor code indenting http://reviews.llvm.org/D6127
llvm-svn: 221467
2014-11-06 17:52:15 +00:00
Deepak Panickal bc8c68ec02 Fix lldb-mi warnings so that it builds when --enable-werror is set.
llvm-svn: 221452
2014-11-06 13:42:49 +00:00
Greg Clayton 81eed943a3 Fixed the C++ method name class to be a bit more picky about what it identifies as a C++ method.
This was done by using regular expressions on any basename we find to ensure it is valid.

This fixed setting breakpoints by name with values like '[J]com.robovm.debug.server.apps.SleepLoop.startingUp()V'. This was previously triggering the C++ method name class to identify the string as C++ with a basename of '[J]com.robovm.debug.server.apps.SleepLoop.startingUp' which was obviously incorrect. 

The changes also fixed errors in templated function names like "void foo<int>(...)" where "void foo<int>" was being identified incorrectly as the basename. We also handle more C++ operators correctly now.

llvm-svn: 221416
2014-11-05 23:56:37 +00:00
Reid Kleckner ee3c175e6b cmake: Make the LLDB standalone build work for me
This allows me to generate a Visual Studio solution that builds LLDB if
you have standalone builds of LLVM and Clang lying around.
Unfortunately, you have to pass *four* CMake variables in, but it means
you don't have to take the extra step of installing Clang and LLVM to
some package prefix.

Hopefully this will generate a more usable XCode project too.

llvm-svn: 221413
2014-11-05 23:23:18 +00:00
Zachary Turner 742346a22f Decouple ProcessWindows from the Windows debug driver thread.
In the llgs world, ProcessWindows will eventually go away and
we'll implement a different protocol.  This patch decouples
ProcessWindows from the core debug loop so that this transition
will not be more difficult than it needs to be.

llvm-svn: 221405
2014-11-05 22:16:28 +00:00
Enrico Granata ab0e831485 Allow inline test case to register actually useful teardown hooks by allowing a hook to be passed back the test instance, were it not to be already bound to self. Use this ability to make the reversal of escape-non-printables a teardown hook for added reliability of the testing logic
llvm-svn: 221402
2014-11-05 21:31:57 +00:00
Sean Callanan 43270c34d5 Fixed the Objective-C stripped ivar test to ensure
that we load debug information properly.  If we don't
explicitly add-dsym, sometimes Spotlight will help out
and tell us about the dSYM but we shouldn't be relying
on that.  Thanks to Jim for catching this.

<rdar://problem/16424661>

llvm-svn: 221400
2014-11-05 21:24:27 +00:00
Enrico Granata ebdc1ac014 Add a setting escape-non-printables that drives whether the StringPrinter should or should not escape sequences such as \t, \n, .. and generally any non-printing character
The recent StringPrinter changes made this behavior the default, and the setting defaults to yes
If you want to change this behavior and see non-printables unescaped (e.g. "a\tb" as "a    b"), set it to false

Fixes rdar://12969594

llvm-svn: 221399
2014-11-05 21:20:48 +00:00
Zachary Turner 0d594e136e Fix LLDB build as a result of upstream LLVM changes.
llvm-svn: 221378
2014-11-05 18:37:53 +00:00
Shawn Best 629680e499 for Oleksiy Vyalov - Redirect stdin, stdout and stderr to /dev/null when launching LLGS process. Differential Revision: http://reviews.llvm.org/D6105
llvm-svn: 221324
2014-11-05 00:58:55 +00:00
Zachary Turner ea66dac7cd Rename some classes in ProcessWindows.
Renamed monitor -> driver, to make clear that the implementation here
is in no way related to that of other process plugins which have also
implemented classes with similar names such as DebugMonitor.

Also created a DebugEventHandler interface, which will be used by
implementors to get notified when debugging events happen in the
inferiors.

llvm-svn: 221322
2014-11-05 00:33:28 +00:00
Eric Christopher 8b1bea8aee Avoid building lldb-mi when --enable-werror is set
as it doesn't build and is optional.

llvm-svn: 221315
2014-11-04 23:30:30 +00:00
Shawn Best fd13743f57 for Siva Chandra: Fix compilation of StringPrinter.cpp with GCC. Differential Revision: http://reviews.llvm.org/D6122
llvm-svn: 221310
2014-11-04 22:43:34 +00:00
Enrico Granata 0eb0ec298c Fix a problem where ValueObjectVariable was not correctly setting its 'has value changed' flag for scalar valued variables. This fixes rdar://17851144
llvm-svn: 221298
2014-11-04 21:28:50 +00:00
Enrico Granata 404ab37e8b Fix the build for LLVM changes
llvm-svn: 221286
2014-11-04 19:33:45 +00:00
Jason Molenda 8030ffda91 Add recognition for another x86 epilogue sequence (ret followed by
a nop).  Fixes an instruction stepping problem when trying to step
over the final instructions of an epilogue.
<rdar://problem/18068877> 

llvm-svn: 221241
2014-11-04 05:48:11 +00:00
Jason Molenda 9bb421d38b Add one extra sanity check to RegisterContextLLDB::TryFallbackUnwindPlan
so it doesn't try the arch default if a comiler-generated (eh_frame,
compact unwind info) based unwind plan has failed.

llvm-svn: 221239
2014-11-04 05:35:32 +00:00
Jason Molenda 4b00893243 Back out r221229 -- instead of trying to identify the end of the unwind,
let's let lldb try the arch default unwind every time but not destructively --
it doesn't permanently replace the main unwind method for that function from
now on.

This fix is for <rdar://problem/18683658>.  

I tested it against Ryan Brown's go program test case and also a
collection of core files of tricky unwind scenarios 
<rdar://problem/15664282> <rdar://problem/15835846>
<rdar://problem/15982682> <rdar://problem/16099440>
<rdar://problem/17364005> <rdar://problem/18556719> 
that I've fixed over the last 6-9 months.

llvm-svn: 221238
2014-11-04 05:28:40 +00:00
Eric Christopher 0010b202ba Fix one more [-Werror,-Winconsistent-missing-override] error.
llvm-svn: 221232
2014-11-04 03:14:57 +00:00
Eric Christopher 7ab81b9149 Fix a bunch of [-Werror,-Winconsistent-missing-override] errors.
llvm-svn: 221231
2014-11-04 03:13:17 +00:00
Jason Molenda d98c3abf9f After we've completed a full backtrace, we'll have one frame which
is "invalid" -- it is past the end of the stack trace.  Add a new
method IsCompletedStackWalk() so we can tell if an invalid stack
frame is from a complete backtrace or if it might be worth re-trying
the last unwind with a different method.

This fixes the unwinder problems Ryan Brown was having with go
programs.  The unwinder can (under the right circumstances) still
destructively replace unwind plans permanently - I'll work on
that in a different patch.  

<rdar://problem/18683658> 

llvm-svn: 221229
2014-11-04 02:31:50 +00:00
Greg Clayton 8691dc5b75 Fixed SBTarget::ReadMemory() to work correctly and the TestTargetAPI.py test case that was reading target memory in TargetAPITestCase.test_read_memory_with_dsym and TargetAPITestCase.test_read_memory_with_dwarf.
The problem was that SBTarget::ReadMemory() was making a new section offset lldb_private::Address by doing:


size_t
SBTarget::ReadMemory (const SBAddress addr,
                      void *buf,
                      size_t size,
                      lldb::SBError &error)
{
        ...
        lldb_private::Address addr_priv(addr.GetFileAddress(), NULL);
        bytes_read = target_sp->ReadMemory(addr_priv, false, buf, size, err_priv);


This is wrong. If you get the file addresss from the "addr" argument and try to read memory using that, it will think the file address is a load address and it will try to resolve it accordingly. This will work fine if your executable is loaded at the same address (no slide), but it won't work if there is a slide.

The fix is to just pass along the "addr.ref()" instead of making a new addr_priv as this will pass along the lldb_private::Address that is inside the SBAddress (which is what we want), and not always change it into something that becomes a load address (if we are running), or abmigious file address (think address zero when you have 150 shared libraries that have sections that start at zero, which one would you pick). The main reason for passing a section offset address to SBTarget::ReadMemory() is so you _can_ read from the actual section + offset that is specified in the SBAddress. 

llvm-svn: 221213
2014-11-04 00:56:30 +00:00
Sean Callanan 11533184d7 Added a test case for reading ivars from the
Objective-C runtime.  We'll need to do more
(subclasses, partially-defined classes, etc.)
but this tests that at least the basics work.

llvm-svn: 221208
2014-11-04 00:06:34 +00:00
Zachary Turner 8f21174700 Implement a framework for live debugging on Windows.
When processes are launched for debugging on Windows now, LLDB
will detect changes such as DLL loads and unloads, breakpoints,
thread creation and deletion, etc.

These notifications are not yet propagated to LLDB in a way that
LLDB understands what is happening with the process.  This only
picks up the notifications from the OS in a way that they can be
sent to LLDB with subsequent patches.

Reviewed by: Scott Graham

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

llvm-svn: 221207
2014-11-04 00:00:12 +00:00
Greg Clayton a3f3fd35ae Fix this test to set a breakpoint at the correct location that will always get hit so it doesn't intermittently fail on MacOSX.
llvm-svn: 221201
2014-11-03 23:10:56 +00:00
Greg Clayton ed59d756d8 Fixed a test suite error on MacOSX where people were using ".data" as the data section name for all file formats. Instead fix the test by finding the section by section type so the test is agnostic to the file format (and passes on MacOSX).
llvm-svn: 221197
2014-11-03 23:02:08 +00:00
Greg Clayton c91d49b505 Fixed a test suite error on MacOSX where people were using ".data" as the data section name for all file formats. Instead fix the test by finding the section by section type so the test is agnostic to the file format (and passes on MacOSX).
llvm-svn: 221196
2014-11-03 22:58:38 +00:00
Greg Clayton 118593a3af The change previously committed as 220983 broke large binary memory reads. I kept the "idx - 1" fix from 220983, but reverted the while loop that was incorrectly added.
The details are: large packets (like large memory reads (m packets) or large binary memory reads (x packet)) can get responses that come in across multiple read() calls. The while loop that was added meant that if only a partial packet came in (like only "$abc" coming for a response) GDBRemoteCommunication::CheckForPacket() was called, it would deadlock in the while loop because no more data is going to come in as this function needs to be called again with more data from another read. So the original fix will need to be corrected and resubmitted.

<rdar://problem/18853744>

llvm-svn: 221181
2014-11-03 21:02:54 +00:00
Filipe Cabecinhas dfa8688082 Fix the Makefile build by actually building ABI/SysV-ppc
llvm-svn: 221111
2014-11-02 22:03:15 +00:00
Ed Maste d455a1ecb8 Update for LLVM API change in r221024
llvm-svn: 221073
2014-11-02 00:24:22 +00:00
Justin Hibbits 3411c3ea53 Use kern.proc.auxv to get the aux data
Summary:
Instead of using a homegrown solution to get the auxv from a process, instead
use the OS-provided sysctl to get the needed data.  This allows the same code to
be used for both 32-bit and 64-bit processes on a 64-bit host.

Reviewers: emaste

Reviewed By: emaste

Subscribers: emaste, lldb-commits

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

llvm-svn: 221063
2014-11-01 21:27:08 +00:00
Sean Callanan ada6d1693e Complete the superclass type when completing an
Objective-C class type.

llvm-svn: 221022
2014-10-31 23:55:36 +00:00
Shawn Best 3ab672d7ef TOT broken by R220956 - Differential Revision: http://reviews/llvm.org/D6066
llvm-svn: 221018
2014-10-31 23:20:13 +00:00
Stephane Sezer 15d810fa29 Always transmit SIGPROF back to the inferior.
Summary:
SIGPROF is used for profiling processes (with google-perftools for
instance), which results in the inferior receiving a SIGPROF from the
kernel every few milliseconds. Instead of stopping the debugging session
and notifying the user of this, we should just pass the signal and keep
running.

This follows the behavior we have in UnixSignals.cpp.

Test Plan: Run LLDB on linux with a binary using google-perftools, see that execution gets interrupted all the time because we receive SIGPROF. Apply the patch, everything works fine.

Subscribers: lldb-commits

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

llvm-svn: 221011
2014-10-31 22:37:24 +00:00
Jason Molenda fca26da446 SBAddress currently *may* have an Address object or it may not.
If it has an Address object, it is assumed to be Valid.
Change SBAddress to always have an Address object and check
whether it is valid or not in those case.

This is fixing a subtle problem where we ended up with
a SBAddress with an Address of LLDB_INVALID_ADDRESS could
run through a copy constructor and turn into an SBAddress
with no Address object being backed (because it wasn't
distinguishing between invalid-Address versus no-Address.)

The cost of an Address object is not high and this will be
an easy mistake for someone else to make; I'm fixing
SBAddress so it doesn't come up again.
<rdar://problem/18069407> 

llvm-svn: 221002
2014-10-31 21:30:59 +00:00
Shawn Best 396f80a1ea commit on behalf of Oleksiy Vyalov Fix junk content handling within GDBRemoteCOmmunication::CheckForPacket 1. Avoid removing of an extra symbol from m_bytes. 2. iterate over m_bytes until useful content is found. Differential Revision: http://reviews.llvm.org/D6042
llvm-svn: 220983
2014-10-31 18:18:23 +00:00
Sean Callanan acff5e60b5 In ValueObjectDynamicValue, trust what comes from
the runtime rather than trying to fix it up,
because now those types have ivars regardless of
whether they come from "frame variable" or from
expressions.

Patch by Enrico Granata.

llvm-svn: 220982
2014-10-31 18:07:44 +00:00
Sean Callanan 9dfe45ff1c Updated the Objective-C runtime type vendor to
load ivars into classes that are reported to the
Objective-C runtime.

llvm-svn: 220981
2014-10-31 18:06:26 +00:00
Sean Callanan b678b90749 - Fixed a bug where ::Describe for class descriptors
would fail if the class had no ivars.

- Updated use of the RealizeType API by the class
  descriptors to use "for_expression" rather than
  the misnamed "allow_unknownanytype."

llvm-svn: 220980
2014-10-31 18:05:26 +00:00
Sean Callanan a330933f15 - Use "for_expression" rather than "allow_unknownanytype"
to indicate that we're doing stuff for the expression
  parser.

- When for_expression is true, look through @s and find
  the actual class rather than just returning id. 

- Rename BuildObjCObjectType to BuildObjCObjectPointerType
  since it's actually returning an object *pointer* type.

llvm-svn: 220979
2014-10-31 18:02:30 +00:00
Justin Hibbits db39cdfbb7 Fix some bugs from D5988
Summary:
Ed Maste found some problems with the commit in D5988.  Address most of these.
While here, also add floating point return handling.  This doesn't handle
128-bit long double yet.  Since I don't have any system that uses it, I don't
currently have plans to implement it.

Reviewers: emaste

Reviewed By: emaste

Subscribers: emaste, lldb-commits

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

llvm-svn: 220963
2014-10-31 15:57:52 +00:00
Jason Molenda 0abae879ad Update default disassembly format string so we get
better output when we don't have any symbol name.
It looked like this:

0x1097fd029 <ud2    
0x1097fd02b <addb   %al, (%rax)

now, like this:

0x10cdd3064: ud2    
0x10cdd3066: addb   %al, (%rax)

<rdar://problem/18833391> 

llvm-svn: 220948
2014-10-31 03:40:06 +00:00
Jason Molenda 968abb448a Update xcode project file to build new ppc files.
llvm-svn: 220947
2014-10-31 03:39:11 +00:00
Justin Hibbits 6256a0ea8f First cut of PowerPC(64) support in LLDB.
Summary:
This adds preliminary support for PowerPC/PowerPC64, for FreeBSD.  There are
some issues still:

 * Breakpoints don't work well on powerpc64.
 * Shared libraries don't yet get loaded for a 32-bit process on powerpc64 host.
 * Backtraces don't work.  This is due to PowerPC ABI using a backchain pointer
   in memory, instead of a dedicated frame pointer register for the backchain.
 * Breakpoints on functions without debug info may not work correctly for 32-bit
   powerpc.

Reviewers: emaste, tfiala, jingham, clayborg

Reviewed By: clayborg

Subscribers: emaste, lldb-commits

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

llvm-svn: 220944
2014-10-31 02:34:28 +00:00
Greg Clayton c3eefa39cc Get the correct process architecture in ProcessKDP::DidAttach().
<rdar://problem/18806212>

llvm-svn: 220938
2014-10-31 00:06:52 +00:00
Zachary Turner c19cf1d424 Remove #include <codecvt>. It isn't supported on all compilers.
Also it wasn't being used anyway, so it appears to be a dead include.

llvm-svn: 220921
2014-10-30 19:42:08 +00:00
Enrico Granata 2206b48d6d Also port the C string reading code in ValueObject over to using StringPrinter API
llvm-svn: 220917
2014-10-30 18:27:31 +00:00
Ed Maste 98b6546dde Remove hex character number from wchar_t test
After r220894 (StringPrinter change) it is no longer emitted. Update the
test rather than considering it a bug as the new format is preferred.

llvm-svn: 220914
2014-10-30 17:41:11 +00:00
Ed Maste 236a5bc619 Fix CMake build, adding StringPrinter.cpp from r220894
llvm-svn: 220909
2014-10-30 14:50:42 +00:00
Enrico Granata ca6c8ee23b Start adopting the StringPrinter API. The StringPrinter API is the new blessed way of printing strings that supports escaping non-printables, and has better handling of different UTF encodings
llvm-svn: 220894
2014-10-30 01:45:39 +00:00
Jason Molenda f4c87d69b0 Remove unused service plist.
llvm-svn: 220892
2014-10-30 01:04:59 +00:00
Enrico Granata a449e8642f Add the ability for a ClangASTType to be marked as 'packed' when constructed
llvm-svn: 220891
2014-10-30 00:53:28 +00:00
Enrico Granata 76b08d584b Fix the NSPathStore2 data formatter to actually handle the explicit length stored inside the object. The meat of this commit, however, is a nice little API for easily adding new __lldb_autogen_ helper types to an AST context
llvm-svn: 220881
2014-10-29 23:08:02 +00:00
Ed Maste 2ec8e1bd20 Temporarily disable test on FreeBSD that is asserting
llvm.org/pr21325

llvm-svn: 220871
2014-10-29 20:02:54 +00:00
Ed Maste e95d9d2c04 Skip test that's hanging on FreeBSD until it can be investigated
llvm.org/pr21411

llvm-svn: 220856
2014-10-29 15:09:27 +00:00
Enrico Granata b6d7cba141 Shuffle a couple of formatters around. This should fix the bug that never dies, aka rdar://15154623
llvm-svn: 220836
2014-10-29 01:03:09 +00:00
Enrico Granata e0afce767a Add a few functions to SBType to handle arrays and typedefs. Fixes rdar://12675166
llvm-svn: 220824
2014-10-28 21:44:06 +00:00
Enrico Granata 90ff6428c9 Add a few words of documentation for the the $\{var.script:\} feature
llvm-svn: 220823
2014-10-28 21:13:31 +00:00
Enrico Granata 88282c69f3 Add a feature where a string data formatter can now be partially composed of Python summary functions
This works similarly to the {thread/frame/process/target.script:...} feature - you write a summary string, part of which is

${var.script:someFuncName}
someFuncName is expected to be declared as
def someFuncName(SBValue,otherArgument) - essentially the same as a summary function

Since . -> [] are the only allowed separators, and % is used for custom formatting, .script: would not be a legitimate symbol anyway, which makes this non-ambiguous

llvm-svn: 220821
2014-10-28 21:07:00 +00:00
Sean Callanan e17428acfa Added the ability to add attributes to inline
testcases.  Also fixed one of the testcases to
not run on the platforms that don't support
Objective-C.

We want to do better with the Objective-C attribute
but we'll do that in a future commit.

llvm-svn: 220820
2014-10-28 20:23:20 +00:00
Enrico Granata 4f2fe82b6d When trying to get the element type of an array type, do not go to the canonical type, since that will strip typedefs where we want them to be preserved. Fixes rdar://15453076
llvm-svn: 220810
2014-10-28 18:25:50 +00:00
Jason Molenda 2586e94bfb Add breakpoint instruction byte sequences for arm to
PlatformLinux::GetSoftwareBreakpointTrapOpcode.

Patch by Stephane Sezer.
http://reviews.llvm.org/D5923

llvm-svn: 220762
2014-10-28 03:43:54 +00:00
Jason Molenda 0f7828cf6d Clarify the launch style for debugserver to use.
<rdar://problem/18786645> 

llvm-svn: 220761
2014-10-28 03:15:33 +00:00
Jim Ingham c891d86349 Add a test for setting and hitting the C++ Exception throw breakpoint.
llvm-svn: 220743
2014-10-28 00:53:20 +00:00
Greg Clayton dc574df04f Make sure OTHER_CFLAGS and OTHER_LDFLAGS are inherited from the Xcode project so you can easily add to the flags of all targets.
llvm-svn: 220720
2014-10-27 21:14:34 +00:00
Enrico Granata e9afaf71f7 This looks like the actual path under which the builder looks for LLDB headers, so use this path instead
llvm-svn: 220718
2014-10-27 20:31:12 +00:00
Hafiz Abid Qadeer f289628178 Stub out 'close' call on m_master_fd for Windows.
PseudoTerminal.cpp uses a dummy implementation of posix_openpt for Windows. This
implementation just returns 0. So m_master_fd is 0. But destructor calls 'close'
on m_master_fd. This 'close' calls seems un-necessary as m_master_fd was never
opened in first place and calling 'close' on 0 can have other un-intended 
consequences.

I am committing it as obvious as it is only a one-liner. Long term, we may want
to refactor this class.

llvm-svn: 220705
2014-10-27 19:27:00 +00:00
Ed Maste 49e4068781 Skip ObjC test on FreeBSD that does not build
llvm-svn: 220681
2014-10-27 15:01:59 +00:00
Todd Fiala 479f230032 Fix the TestCreateAfterAttach test for llgs-local on ptracer lock-down.
llvm-svn: 220661
2014-10-27 00:58:27 +00:00
Todd Fiala 0135e236b6 Fix TestProcessAttach for Linux ptracer lock-down and llgs-local.
llvm-svn: 220660
2014-10-27 00:31:05 +00:00
Todd Fiala 789d29df34 Fix up TestRegisters for Linux ptracer lock-down.
All of these test fixups are prep work for when llgs is
running with llgs for local process debugging, where these
tests fail without the ptracer lock-down suppression.

llvm-svn: 220656
2014-10-26 22:25:33 +00:00
Todd Fiala 25a0ad9707 Fix TestAttachResume test so it doesn't hang on Linux with ptrace lockdown.
Similar to previous fix, this augments the test inferior to
immediately indicate it may be ptraced by any Linux process
when the appropriate symbols are defined.

This seems to indicate we need to fix our lldb attach logic to
catch when an attach fails, and trigger an appropriate error
instead of the current behavior of hanging indefinitely.

llvm-svn: 220654
2014-10-26 22:08:56 +00:00
Hafiz Abid Qadeer 01db53848e Added a missing call to 'Reset'.
HostThreadWindows::Join() did not call the Reset as is done by
the HostThreadPosix::Join(). As a result, future call to 
IsJoinable() can fail.

Committed as obvious.
 

llvm-svn: 220651
2014-10-26 21:38:43 +00:00
Todd Fiala f183754779 Fix HelloWorld attach test for Linux kernels with ptrace ancestor lockdown.
Similar to a recent test I fixed for gdb-remote attach scenarios, this
fix is for Linux kernels, such as Ubuntu's stock setup on 11.04-ish and
later, where ptrace starts requiring a ptracer to be an ancestor of the
inferior to be ptraced.  This change checks for Linux and the ptrace-related
flags.  If they're found, it tries to switch on the "allow any ptracer" mode
for the inferior as the first statements in the program.  It's a best-effort
solution - if the prctl call fails, the failure is ignored, and probably will
lead to the test failing.

The ptrace security behavior can be modified system-wide, but is outside the
scope of the test to address.  Hence I went with this particular solution.

llvm-svn: 220650
2014-10-26 21:37:46 +00:00
Jim Ingham fa39bb4a56 Setting breakpoints with name mask eFunctionNameTypeBase was broken for straight C names by 220432. Get
that working again.

llvm-svn: 220602
2014-10-25 00:33:55 +00:00
Zachary Turner 7c2896a234 Implement explicit thread stack size specification on Windows.
llvm-svn: 220596
2014-10-24 22:06:29 +00:00
Ed Maste 40dc7eb150 Remove duplicated new file content
llvm-svn: 220591
2014-10-24 20:49:50 +00:00
Jim Ingham 65b3f547cd Patch from ovyalov@google.com:
Handle pexpect exceptions correctly so that processes spawned with 
pexpect are always reaped.

llvm-svn: 220583
2014-10-24 18:51:57 +00:00
Zachary Turner 047a070f7c Make ProcessWindows just use Host::LaunchProcess.
llvm-svn: 220574
2014-10-24 17:51:56 +00:00
Enrico Granata ecbe7c03a0 This test case should not rely on stepping behavior because that might chance due to inlining. Set breakpoints where you want them instead. Fixes rdar://18724175
llvm-svn: 220513
2014-10-23 21:35:18 +00:00
Enrico Granata 249d639786 Fix a problem where an SBType was advertising its static type class even though a dynamic type was available. Solves rdar://18744420
llvm-svn: 220511
2014-10-23 21:15:20 +00:00
Ed Maste e1b25368f0 Disable dsym tests on !Darwin hosts
This was missing from r219984

llvm.org/pr21324

llvm-svn: 220485
2014-10-23 15:21:45 +00:00
Hafiz Abid Qadeer ae9446088b Fix code where goto jumped over local variable initialization.
llvm-svn: 220473
2014-10-23 10:36:53 +00:00
Enrico Granata 2809b98c0e Reverting r220435. Jim Ingham and I discussed this for a bit, and we came up with a better command model for this feature
llvm-svn: 220437
2014-10-22 22:33:08 +00:00
Enrico Granata 83f231854a Add a 'type info' command, which can be fed one or more local variables - and it will spew out the list of formatters that apply to each of those variables, if any
llvm-svn: 220435
2014-10-22 22:04:40 +00:00
Enrico Granata 6714a0fd09 More cleanup of the CXXFormatterFunctions header
llvm-svn: 220433
2014-10-22 21:47:27 +00:00
Greg Clayton c3795409c9 Fixed name lookups for names that contain "::" but aren't actually C++ qualified C++ names.
To do this, I fixed the  CPPLanguageRuntime::StripNamespacesFromVariableName() function to use a regular expression that correctly determines if the name passed to it is a qualfied C++ name like "a:🅱️:c" or "b::c". The old version of this function was treating '__54-[NSUserScriptTask executeWithInterpreter:arguments::]_block_invoke' as a match with a basename of ']_block_invoke'.

Also fixed a case in the by name lookup of functions where we wouldn't look for the full name if we actually tried to call CPPLanguageRuntime::StripNamespacesFromVariableName() and got an empty basename back.

<rdar://problem/18527866>

llvm-svn: 220432
2014-10-22 21:47:13 +00:00
Greg Clayton fa226b74d1 Re-use the GetMatchAtIndex() that uses the StringRef to avoid code duplication and properly detect when a capture is invalid and return false.
llvm-svn: 220431
2014-10-22 21:43:15 +00:00
Zachary Turner b5c4971a4c Fix CMake build broken after r220421.
llvm-svn: 220430
2014-10-22 21:18:29 +00:00
Enrico Granata e85fe3a4d1 Reorganize some of the data formatters code to simplify CXXFormattersFunction.h. Also, add a synthetic child provider for libc++'s version of std::initializer_list<T>
llvm-svn: 220421
2014-10-22 20:34:38 +00:00
Enrico Granata 4bd54a1544 Fixed a problem in the lldbinline logic where C++ files could not be validly compiled
llvm-svn: 220420
2014-10-22 20:33:34 +00:00