Commit Graph

7193 Commits

Author SHA1 Message Date
Chaoren Lin 7f9511409b Resubmitting r238459 and r238460 with fix for Linux.
llvm-svn: 238499
2015-05-28 21:19:31 +00:00
Ying Chen b6762734f0 Revert "Move inlined cxa_demangle.cpp to a separate file."
This reverts commit 8cb47a2140f3e93a34597fc9f11c8cd96130076d.

llvm-svn: 238497
2015-05-28 21:06:36 +00:00
Ying Chen fd6c7ad3ce Revert "Allow both MSVC and Itanium mangling schemes."
Cause build break.

This reverts commit 6d986061393f2863fec739e04412281148acc1f3.

llvm-svn: 238496
2015-05-28 21:06:33 +00:00
Sean Callanan 8ebc973133 If we see an external function in the symbols, make
it an extern "C" function instead of a C++ function
so that Clang doesn't emit a mangled function reference.

Also removed the hack in ClangExpressionDeclMap that
works around this.

llvm-svn: 238476
2015-05-28 20:07:44 +00:00
Sean Callanan 235de0aed3 Don't crash if we don't have a process and need
to check for alternate manglings.

llvm-svn: 238475
2015-05-28 20:06:40 +00:00
Zachary Turner 386aafa6e3 Remove unused #includes of ScriptInterpreterPython.h
llvm-svn: 238470
2015-05-28 19:57:03 +00:00
Chaoren Lin fd13d97dfd Allow both MSVC and Itanium mangling schemes.
Summary:
LLDB on Windows should now be able to demangle Linux/Android symbols.

Also updated CxaDemangle.cpp to be compatible with MSVC.

Depends on D9949, D9954, D10048.

Reviewers: zturner, emaste, clayborg

Reviewed By: clayborg

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 238460
2015-05-28 19:15:31 +00:00
Chaoren Lin b41354c9d0 Move inlined cxa_demangle.cpp to a separate file.
Summary: In preparation for some changes to make this compatible with MSVC.

Reviewers: emaste, zturner, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 238459
2015-05-28 19:15:15 +00:00
Oleksiy Vyalov 0b5ebef7cd Refactor AdbClient and make PlatformAndroid::GetFile to use "adb pull".
http://reviews.llvm.org/D10082

llvm-svn: 238442
2015-05-28 17:42:48 +00:00
Chaoren Lin 1c614fedf9 Make FileSpec::Dump use FileSpec::GetPath(), not the other way around.
Summary:
Fix FileSpec::Dump() to output denormalized path.

See D9942 for previous discussions.

Reviewers: zturner

Reviewed By: zturner

Subscribers: lldb-commits

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

llvm-svn: 238440
2015-05-28 17:02:45 +00:00
Aidan Dodds 5f2d0c3c23 Fix THUMB function detection when function name is not prefixed.
Differential Revision: http://reviews.llvm.org/D10062

llvm-svn: 238433
2015-05-28 15:37:01 +00:00
Tamas Berghammer 034980681d Fix write register context in EmulateInstructionARM::EmulateMOVRdRm
llvm-svn: 238431
2015-05-28 15:09:45 +00:00
Pavel Labath fb7d5b8384 Fix race in IOHandlerProcessSTDIO
Summary:
IOHandlerProcessSTDIO::Run() was opening the pipe for interrupt requests lazily. This was racing
with another thread executing IOHandlerProcessSTDIO::Cancel() simultaneously. I fix this by
opening the pipe in the object constructor. The pipe will be automatically closed when the object
is destroyed.

Test Plan: Tests pass on linux.

Reviewers: clayborg, ribrdb

Subscribers: lldb-commits

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

llvm-svn: 238423
2015-05-28 13:41:08 +00:00
Ed Maste 3d3c60117f Add thumb breakpoint for FreeBSD (currently disabled)
Patch by Tom Rix, with additional changes to sync whitespace/style with
PlatformLinux.cpp.

It is currently disabled pending kernel support.

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

llvm-svn: 238420
2015-05-28 13:06:09 +00:00
Tamas Berghammer 64d807e95d Fix write register context in EmulateInstructionARM::EmulateADDRdSPImm
llvm-svn: 238410
2015-05-28 10:38:32 +00:00
Pavel Labath 05a1f2ac4c [NativeProcessLinux] Support inferiors which change their process group
Summary:
Previously, we wait()ed for events from the inferiors process group. This is resulted in a
failure if the inferior changed its process group in the middle of execution. To avoid this, I
pass -1 to the wait() call. The flag __WNOTHREAD makes sure we don't actually wait for events
from any process, but only the processes(threads) which are our children (or traced by us). Since
this happens on the monitor thread, which is dedicated to monitoring a single inferior, we will
be getting events only from this inferior.

Test Plan: All tests pass on linux. I have added a test to check the new functionality.

Reviewers: chaoren, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 238405
2015-05-28 08:59:21 +00:00
Greg Clayton 424a5dbc73 Added a new API to SBFrame:
lldb::addr_t SBFrame::GetCFA();

This gets the CFA (call frame address) of the frame so it allows us to take an address that is on the stack and figure out which thread it comes from.

Also modified the heap.py module to be able to find out which variable in a frame's stack frame contains an address. This way when ptr_refs finds a match on the stack, it get then report which variable contains the pointer.

llvm-svn: 238393
2015-05-28 03:27:22 +00:00
Greg Clayton 08765fac3f I finally found the strong reference that was keeping all lldb_private::Process instances from ever destroying themselves: ProcessModID.m_mod_id was holding onto the last stop event with ProcessModID::SetStopEventForLastNaturalStopID(EventSP). This is a bad idea because ProcessEventData contains a strong refereence to the process. This is now fixed by calling ProcessModID::SetStopEventForLastNaturalStopID(EventSP()) to clear this event in Process::SetExitStatus() and in Process::Finalize().
This was the original cause of the file descriptor leaks that would cause the test suite to die after running a few hundred processes since no process would ever get destroyed and the communication channel in ProcessGDBRemote and the ProcessIOHandler would never close their pipes. 

This process leak was previously worked around by closing the pipes when the communication channel was disconnected.

This was found by using "ptr_refs" from the heap.py in the lldb.macosx.heap module. It was able to find all strong references to the Process and helped me to figure out who was holding this extra reference.

llvm-svn: 238392
2015-05-28 03:24:30 +00:00
Greg Clayton 4e1042e1bf Allow expresions to have unique expression prefixes:
expr_options = lldb.SBExpressionOptions()
expr_options.SetPrefix('''
struct Foo {
   int a;
   int b;
   int c;
}
'''
expr_result = frame.EvaluateExpression ("Foo foo = { 1, 2, 3}; foo", expr_options)

This fixed a current issue with ptr_refs, cstr_refs and malloc_info so that they can work. If expressions define their own types and then return expression results that use those types, those types get copied into the target's AST context so they persist and the expression results can be still printed and used in future expressions. Code was added to the expression parser to copy the context in which types are defined if they are used as the expression results. So in the case of types defined by expressions, they get defined in a lldb_expr function and that function and _all_ of its statements get copied. Many types of statements are not supported in this copy (array subscript, lambdas, etc) so this causes expressions to fail as they can't copy the result types. To work around this issue I have added code that allows expressions to specify an expression specific prefix. Then when you evaluate the expression you can pass the "expr_options" and have types that can be correctly copied out into the target. I added this as a way to work around an issue, but I also think it is nice to be allowed to specify an expression prefix that can be reused by many expressions, so this feature is very useful.

<rdar://problem/21130675>

llvm-svn: 238365
2015-05-27 22:32:39 +00:00
Greg Clayton dead71a829 Make sure we print timestamps correctly to 9 places since we are printing nanoseconds.
<rdar://problem/21090231>

llvm-svn: 238334
2015-05-27 16:25:01 +00:00
Ewan Crawford 9aa2da0025 Change ProcessGDBRemote last stop packet to a container.
In ProcessGDBRemote we currently have a single packet, m_last_stop_packet, used to set the thread stop info.
However in non-stop mode we can receive several stop reply packets in a sequence for different threads. As a result we need to use a container to hold them before they are processed.

This patch also changes the return type of CheckPacket() so we can detect async notification packets.

Reviewers: clayborg

Subscribers: labath, ted, deepak2427, lldb-commits

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

llvm-svn: 238323
2015-05-27 14:12:34 +00:00
Tamas Berghammer 9c9ecce077 Make log options uniform betwwen lldb-platform and lldb-gdbserver
This change also get rid of an unused Debugger instance in
GDBRemoteCommunicationServerLLGS and the command interpreter from
lldb-platform what was used only for enabling logging.

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

llvm-svn: 238319
2015-05-27 13:34:04 +00:00
Ed Maste efa25c2836 Add real time signals support to FreeBSDSignals
Apply r238009 to FreeBSD as well.

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

llvm-svn: 238316
2015-05-27 13:19:46 +00:00
Colin Riley d6aa9bab21 Add a language log category.
Differential Revision: http://reviews.llvm.org/D9994

llvm-svn: 238314
2015-05-27 12:48:14 +00:00
Pavel Labath 4446487d71 Improve LLDB prompt handling
Summary:
There is an issue in lldb where the command prompt can appear at the wrong time. The partial fix
we have in for this is not working all the time and is introducing unnecessary delays. This
change does:
- Change Process:SyncIOHandler to use integer start id's for synchronization to avoid it being
  confused by quick start-stop cycles. I picked this up from a suggested patch by Greg to
  lldb-dev.
- coordinates printing of asynchronous text with the iohandlers. This is also based on a
  (different) Greg's patch, but I have added stronger synchronization to it to avoid races.

Together, these changes solve the prompt problem for me on linux (both with and without libedit).
I think they should behave similarly on Mac and FreeBSD and I think they will not make matters
worse for windows.

Test Plan: Prompt comes out alright. All tests still pass on linux.

Reviewers: clayborg, emaste, zturner

Subscribers: lldb-commits

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

llvm-svn: 238313
2015-05-27 12:40:32 +00:00
Tamas Berghammer bed77de002 Fix write register context in EmulateInstructionARM::EmulateMOVRdRm
llvm-svn: 238312
2015-05-27 12:32:28 +00:00
Tamas Berghammer 729dcfb7ee Fix BreakpointLocationCollection::ShouldStop to handle breakpoint removal
Differential revision: http://reviews.llvm.org/D9886

llvm-svn: 238308
2015-05-27 09:46:47 +00:00
Tamas Berghammer 3afb2527ce Parse function name from DWARF DW_AT_abstract_origin
A DW_TAG_subprogram entry can contain a reference to a
DW_AT_abstract_origin entry instead of duplicating the information
from it (e.g.: name) when the same function is inlined in some case
and not inlined in other cases.

This CL fixes name parsing for the case when the DW_TAG_subprogram
for the non inlined version contains just a reference to the
DW_AT_abstract_origin entry instead of the full information.

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

llvm-svn: 238307
2015-05-27 09:43:44 +00:00
Enrico Granata e87764f247 Add support for custom commands to set flags on themselves
This works for Python commands defined via a class (implement get_flags on your class) and C++ plugin commands (which can call SBCommand::GetFlags()/SetFlags())

Flags allow features such as not letting the command run if there's no target, or if the process is not stopped, ...
Commands could always check for these things themselves, but having these accessible via flags makes custom commands more consistent with built-in ones

llvm-svn: 238286
2015-05-27 05:04:35 +00:00
Greg Clayton 2a2949cf47 Allow clients to get parsing errors and also fix the ApplePropertyList so it parses the structured data correctly.
llvm-svn: 238280
2015-05-27 03:24:17 +00:00
Greg Clayton 66b8294cae Make StructureData objects dump themselves with correct indentation.
llvm-svn: 238279
2015-05-27 03:23:26 +00:00
Robert Flack 62efb1f6d0 Implement and use adb push for PlatformAndroid::PutFile
Using the adb push protocol is significantly faster than the current method of
sending the hex encoded file data for the remote to write to the file.

Test Plan:
Tests continue to pass - and much faster (e.g. TestSBValuePersist.py takes 10s
down from 4m51s on mac -> android)

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

llvm-svn: 238274
2015-05-27 02:18:50 +00:00
Greg Clayton ee8f994077 Modify the ApplePropertyList to be able to create StructuredData objects from the plist XML.
llvm-svn: 238260
2015-05-26 22:49:19 +00:00
Ed Maste 6b414edbcb Sync PlatformFreeBSD::GetSupportedArchitectureAtIndex with PlatformLinux
Reviewed by Ted Woodward
Differential Revision:	http://reviews.llvm.org/D9764

llvm-svn: 238246
2015-05-26 20:23:20 +00:00
Greg Clayton df9f6364b2 Fix some logic where we used to have char arrays, but we now use std::string. Use the correctly API to detect if they are not empty.
<rdar://problem/21090173>

llvm-svn: 238231
2015-05-26 18:29:03 +00:00
Greg Clayton d04f0edad9 Added XML to the host layer.
We know have on API we should use for all XML within LLDB in XML.h. This API will be easy back the XML parsing by different libraries in case libxml2 doesn't work on all platforms. It also allows the only place for #ifdef ...XML... to be in XML.h and XML.cpp. The API is designed so it will still compile with or without XML support and there is a static function "bool XMLDocument::XMLEnabled()" that can be called to see if XML is currently supported. All APIs will return errors, false, or nothing when XML isn't enabled.

Converted all locations that used XML over to using the host XML implementation.

Added target.xml support to debugserver. Extended the XML register format to work for LLDB by including extra attributes and elements where needed. This allows the target.xml to replace the qRegisterInfo packets and allows us to fetch all register info in a single packet.

<rdar://problem/21090173>

llvm-svn: 238224
2015-05-26 18:00:51 +00:00
Tamas Berghammer 068f8a7e2d Move register reading form NativeProcessLinux to NativeRegisterContextLinux*
This change reorganize the register read/write code inside lldb-server on Linux
with moving the architecture independent code into a new class called
NativeRegisterContextLinux and all of the architecture dependent code into the
appropriate NativeRegisterContextLinux_* class. As part of it the compilation of
the architecture specific register contexts are only compiled on the specific
architecture because they can't be used in other cases.

The purpose of this change is to remove a lot of duplicated code from the different
register contexts and to remove the architecture dependent codes from the global
NativeProcessLinux class.

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

llvm-svn: 238196
2015-05-26 11:58:52 +00:00
Vince Harron ebf2b2a10b revert files unintentionally checked in
llvm-svn: 238174
2015-05-26 03:10:41 +00:00
Vince Harron 218353d847 Print port number that lldb-server binds to in platform mode
If binding to port 0 is selected, the actual port is printed.

This improves the reliability of platform startup by ensuring that
a free port can be found.

TEST PLAN
./lldb-server platform --listen *:0

Listening for a connection from <port-number>...

Will appear on stdout (with other stuff potentially)

llvm-svn: 238173
2015-05-26 03:08:05 +00:00
Greg Clayton 654e0ca650 Quiet compiler warnings about virtual and override not being consistent.
llvm-svn: 238128
2015-05-25 02:58:29 +00:00
Greg Clayton 5cf342d7aa Fix compiler warnings regarding size_t not always being 64 bit in the printf.
llvm-svn: 238127
2015-05-25 02:55:21 +00:00
Greg Clayton 5df78fa35b Did some cleanup to stop us from leaking Pipe file descriptors.
The main issue was the Communication::Disconnect() was calling its Connection::Disconnect() but this wouldn't release the pipes that the ConnectionFileDescriptor was using. We also have someone that is holding a strong reference to the Process so that when you re-run, target replaces its m_process_sp, but it doesn't get destructed because someone has a strong reference to it. I need to track that down. But, even if we have a strong reference to the a process that is outstanding, we need to call Process::Finalize() to have it release as much of its resources as possible to avoid memory bloat. 

Removed the ProcessGDBRemote::SetExitStatus() override and replaced it with ProcessGDBRemote::DidExit().

Now we aren't leaking file descriptors and the stand alone test suite should run much better.

llvm-svn: 238089
2015-05-23 03:54:53 +00:00
Oleksiy Vyalov 755d58a463 Use target's SIGSTOP and SIGINT when making decision about continue after async packet.
http://reviews.llvm.org/D9857

llvm-svn: 238068
2015-05-22 23:14:39 +00:00
Zachary Turner 279a2b7575 Implement PlatformWindows::GetEnvironment.
This fixes a couple of tests that rely on being able to get the
host's environment or spawn an inferior with specific arguments.

llvm-svn: 238042
2015-05-22 19:34:17 +00:00
Zachary Turner 4f2a9726d4 Fix use-after-free in OptionValueString.
We were assigning a temporary std::string to a StringRef.  Somehow
this worked on every platform but Windows.

llvm-svn: 238041
2015-05-22 19:33:54 +00:00
Pavel Labath b84141a6fe Add real time signals support to LinuxSignals
Summary: This enables correct handling of real time signals by lldb.

Test Plan: Added a test that verifies handling of SIGRTMIN

Reviewers: tberghammer, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 238009
2015-05-22 08:46:18 +00:00
Greg Clayton e034a04e4f Added a new command in ProcessGDBRemote that can figure out the performance characterisitics of your GDB remote server.
To addess this, attach to any GDB server and when stopped type:

(lldb) process plugin packet speed-test

The default will send a variety of packets with different amounts of data to send/receive and print the performance of each packet type:

Testing sending 1000 packets of various sizes:
qSpeedTest(send=0      , recv=0      ) in 0.057837000 sec for  17289.97 packets/sec (  0.057837 ms per packet) with standard deviation of   0.007705 ms
qSpeedTest(send=0      , recv=4      ) in 0.056162000 sec for  17805.63 packets/sec (  0.056162 ms per packet) with standard deviation of   0.004439 ms
qSpeedTest(send=0      , recv=8      ) in 0.057687000 sec for  17334.93 packets/sec (  0.057687 ms per packet) with standard deviation of   0.008135 ms
qSpeedTest(send=0      , recv=16     ) in 0.058547000 sec for  17080.29 packets/sec (  0.058547 ms per packet) with standard deviation of   0.005884 ms
qSpeedTest(send=0      , recv=32     ) in 0.058289000 sec for  17155.89 packets/sec (  0.058289 ms per packet) with standard deviation of   0.004057 ms
qSpeedTest(send=0      , recv=64     ) in 0.061324000 sec for  16306.83 packets/sec (  0.061324 ms per packet) with standard deviation of   0.010838 ms
qSpeedTest(send=0      , recv=128    ) in 0.065688000 sec for  15223.48 packets/sec (  0.065688 ms per packet) with standard deviation of   0.006997 ms
qSpeedTest(send=0      , recv=256    ) in 0.070621000 sec for  14160.09 packets/sec (  0.070621 ms per packet) with standard deviation of   0.006188 ms
qSpeedTest(send=0      , recv=512    ) in 0.086738000 sec for  11528.97 packets/sec (  0.086738 ms per packet) with standard deviation of   0.007867 ms
qSpeedTest(send=0      , recv=1024   ) in 0.146375000 sec for   6831.77 packets/sec (  0.146375 ms per packet) with standard deviation of   0.010313 ms
qSpeedTest(send=4      , recv=0      ) in 0.057807000 sec for  17298.94 packets/sec (  0.057807 ms per packet) with standard deviation of   0.009702 ms
....

It will then also use various sizes to receive 4MB of data from the GDB server and print out the stats:

Testing receiving 4.0MB of data using varying receive packet sizes:
qSpeedTest(send=0      , recv=32     ) 131072 packets needed to receive 4.0MB in 7.721290000 sec for 0.518048 MB/sec for  16975.40 packets/sec (  0.058909 ms per packet)
qSpeedTest(send=0      , recv=64     )  65536 packets needed to receive 4.0MB in 4.029236000 sec for 0.992744 MB/sec for  16265.12 packets/sec (  0.061481 ms per packet)
qSpeedTest(send=0      , recv=128    )  32768 packets needed to receive 4.0MB in 2.233854000 sec for 1.790627 MB/sec for  14668.82 packets/sec (  0.068172 ms per packet)
qSpeedTest(send=0      , recv=256    )  16384 packets needed to receive 4.0MB in 1.160024000 sec for 3.448204 MB/sec for  14123.84 packets/sec (  0.070802 ms per packet)
qSpeedTest(send=0      , recv=512    )   8192 packets needed to receive 4.0MB in 0.701603000 sec for 5.701230 MB/sec for  11676.12 packets/sec (  0.085645 ms per packet)
qSpeedTest(send=0      , recv=1024   )   4096 packets needed to receive 4.0MB in 0.596786000 sec for 6.702570 MB/sec for   6863.43 packets/sec (  0.145700 ms per packet)

There is a JSON mode so we can use this in the test suite to track GDB server performance for each platform:

(lldb) process plugin packet speed-test --json
{ "packet_speeds" : {
    "num_packets" : 1000,
    "results" : [
     {"send_size" :      0, "recv_size" :      0, "total_time_nsec" :     64516000, "standard_deviation_nsec" :     20566 },
     {"send_size" :      0, "recv_size" :      4, "total_time_nsec" :     59648000, "standard_deviation_nsec" :     10493 },
     {"send_size" :      0, "recv_size" :      8, "total_time_nsec" :     56894000, "standard_deviation_nsec" :      5480 },
     {"send_size" :      0, "recv_size" :     16, "total_time_nsec" :     59422000, "standard_deviation_nsec" :      6557 },
     {"send_size" :      0, "recv_size" :     32, "total_time_nsec" :     61159000, "standard_deviation_nsec" :     12384 },
     {"send_size" :      0, "recv_size" :     64, "total_time_nsec" :     61386000, "standard_deviation_nsec" :      9208 },
     {"send_size" :      0, "recv_size" :    128, "total_time_nsec" :     64768000, "standard_deviation_nsec" :      4737 },
     {"send_size" :      0, "recv_size" :    256, "total_time_nsec" :     71046000, "standard_deviation_nsec" :      5904 },
     {"send_size" :      0, "recv_size" :    512, "total_time_nsec" :     87233000, "standard_deviation_nsec" :      8967 },
     {"send_size" :      0, "recv_size" :   1024, "total_time_nsec" :    146629000, "standard_deviation_nsec" :      9526 },
     {"send_size" :      4, "recv_size" :      0, "total_time_nsec" :     57131000, "standard_deviation_nsec" :      7884 },
     {"send_size" :      4, "recv_size" :      4, "total_time_nsec" :     56772000, "standard_deviation_nsec" :      6064 },
     {"send_size" :      4, "recv_size" :      8, "total_time_nsec" :     57450000, "standard_deviation_nsec" :      6341 },
     {"send_size" :      4, "recv_size" :     16, "total_time_nsec" :     58279000, "standard_deviation_nsec" :      5998 },
     {"send_size" :      4, "recv_size" :     32, "total_time_nsec" :     59995000, "standard_deviation_nsec" :      6294 },
     {"send_size" :      4, "recv_size" :     64, "total_time_nsec" :     61632000, "standard_deviation_nsec" :      7838 },
     {"send_size" :      4, "recv_size" :    128, "total_time_nsec" :     66535000, "standard_deviation_nsec" :      8026 },
     {"send_size" :      4, "recv_size" :    256, "total_time_nsec" :     72754000, "standard_deviation_nsec" :      9519 },
     {"send_size" :      4, "recv_size" :    512, "total_time_nsec" :     87072000, "standard_deviation_nsec" :      9268 },
     {"send_size" :      4, "recv_size" :   1024, "total_time_nsec" :    147221000, "standard_deviation_nsec" :      9702 },
     {"send_size" :      8, "recv_size" :      0, "total_time_nsec" :     57900000, "standard_deviation_nsec" :      7356 },
     {"send_size" :      8, "recv_size" :      4, "total_time_nsec" :     58116000, "standard_deviation_nsec" :      7630 },
     {"send_size" :      8, "recv_size" :      8, "total_time_nsec" :     57745000, "standard_deviation_nsec" :      8541 },
     {"send_size" :      8, "recv_size" :     16, "total_time_nsec" :     59091000, "standard_deviation_nsec" :      7851 },
     {"send_size" :      8, "recv_size" :     32, "total_time_nsec" :     59943000, "standard_deviation_nsec" :      6761 },
     {"send_size" :      8, "recv_size" :     64, "total_time_nsec" :     62097000, "standard_deviation_nsec" :      8580 },
     {"send_size" :      8, "recv_size" :    128, "total_time_nsec" :     69942000, "standard_deviation_nsec" :     16645 },
     {"send_size" :      8, "recv_size" :    256, "total_time_nsec" :     72927000, "standard_deviation_nsec" :     11031 },
     {"send_size" :      8, "recv_size" :    512, "total_time_nsec" :     87221000, "standard_deviation_nsec" :      8002 },
     {"send_size" :      8, "recv_size" :   1024, "total_time_nsec" :    148696000, "standard_deviation_nsec" :     10383 },
     {"send_size" :     16, "recv_size" :      0, "total_time_nsec" :     59890000, "standard_deviation_nsec" :     15160 },
     {"send_size" :     16, "recv_size" :      4, "total_time_nsec" :     56664000, "standard_deviation_nsec" :      4650 },
     {"send_size" :     16, "recv_size" :      8, "total_time_nsec" :     57574000, "standard_deviation_nsec" :      7787 },
     {"send_size" :     16, "recv_size" :     16, "total_time_nsec" :     59312000, "standard_deviation_nsec" :      8104 },
     {"send_size" :     16, "recv_size" :     32, "total_time_nsec" :     59764000, "standard_deviation_nsec" :      7496 },
     {"send_size" :     16, "recv_size" :     64, "total_time_nsec" :     61644000, "standard_deviation_nsec" :      8331 },
     {"send_size" :     16, "recv_size" :    128, "total_time_nsec" :     66476000, "standard_deviation_nsec" :      9251 },
     {"send_size" :     16, "recv_size" :    256, "total_time_nsec" :     72386000, "standard_deviation_nsec" :      8627 },
     {"send_size" :     16, "recv_size" :    512, "total_time_nsec" :     87810000, "standard_deviation_nsec" :     12318 },
     {"send_size" :     16, "recv_size" :   1024, "total_time_nsec" :    146918000, "standard_deviation_nsec" :     11595 },
     {"send_size" :     32, "recv_size" :      0, "total_time_nsec" :     56493000, "standard_deviation_nsec" :      6577 },
     {"send_size" :     32, "recv_size" :      4, "total_time_nsec" :     57069000, "standard_deviation_nsec" :      5931 },
     {"send_size" :     32, "recv_size" :      8, "total_time_nsec" :     57563000, "standard_deviation_nsec" :      8157 },
     {"send_size" :     32, "recv_size" :     16, "total_time_nsec" :     59694000, "standard_deviation_nsec" :      6932 },
     {"send_size" :     32, "recv_size" :     32, "total_time_nsec" :     60852000, "standard_deviation_nsec" :      8010 },
     {"send_size" :     32, "recv_size" :     64, "total_time_nsec" :     61926000, "standard_deviation_nsec" :      8372 },
     {"send_size" :     32, "recv_size" :    128, "total_time_nsec" :     66734000, "standard_deviation_nsec" :      8047 },
     {"send_size" :     32, "recv_size" :    256, "total_time_nsec" :     72000000, "standard_deviation_nsec" :      8103 },
     {"send_size" :     32, "recv_size" :    512, "total_time_nsec" :     88268000, "standard_deviation_nsec" :     12289 },
     {"send_size" :     32, "recv_size" :   1024, "total_time_nsec" :    147946000, "standard_deviation_nsec" :     12122 },
     {"send_size" :     64, "recv_size" :      0, "total_time_nsec" :     58126000, "standard_deviation_nsec" :      5895 },
     {"send_size" :     64, "recv_size" :      4, "total_time_nsec" :     58927000, "standard_deviation_nsec" :      8933 },
     {"send_size" :     64, "recv_size" :      8, "total_time_nsec" :     58163000, "standard_deviation_nsec" :      6663 },
     {"send_size" :     64, "recv_size" :     16, "total_time_nsec" :     59901000, "standard_deviation_nsec" :      8340 },
     {"send_size" :     64, "recv_size" :     32, "total_time_nsec" :     60365000, "standard_deviation_nsec" :      6319 },
     {"send_size" :     64, "recv_size" :     64, "total_time_nsec" :     61776000, "standard_deviation_nsec" :      7461 },
     {"send_size" :     64, "recv_size" :    128, "total_time_nsec" :     66984000, "standard_deviation_nsec" :      6810 },
     {"send_size" :     64, "recv_size" :    256, "total_time_nsec" :     73913000, "standard_deviation_nsec" :      8826 },
     {"send_size" :     64, "recv_size" :    512, "total_time_nsec" :     88134000, "standard_deviation_nsec" :      8356 },
     {"send_size" :     64, "recv_size" :   1024, "total_time_nsec" :    146932000, "standard_deviation_nsec" :      7571 },
     {"send_size" :    128, "recv_size" :      0, "total_time_nsec" :     57616000, "standard_deviation_nsec" :      6158 },
     {"send_size" :    128, "recv_size" :      4, "total_time_nsec" :     59091000, "standard_deviation_nsec" :      7458 },
     {"send_size" :    128, "recv_size" :      8, "total_time_nsec" :     60263000, "standard_deviation_nsec" :     11999 },
     {"send_size" :    128, "recv_size" :     16, "total_time_nsec" :     59238000, "standard_deviation_nsec" :      6102 },
     {"send_size" :    128, "recv_size" :     32, "total_time_nsec" :     60783000, "standard_deviation_nsec" :      6244 },
     {"send_size" :    128, "recv_size" :     64, "total_time_nsec" :     62975000, "standard_deviation_nsec" :      8947 },
     {"send_size" :    128, "recv_size" :    128, "total_time_nsec" :     65742000, "standard_deviation_nsec" :      5907 },
     {"send_size" :    128, "recv_size" :    256, "total_time_nsec" :     72402000, "standard_deviation_nsec" :      6601 },
     {"send_size" :    128, "recv_size" :    512, "total_time_nsec" :     87457000, "standard_deviation_nsec" :      9004 },
     {"send_size" :    128, "recv_size" :   1024, "total_time_nsec" :    148412000, "standard_deviation_nsec" :     10532 },
     {"send_size" :    256, "recv_size" :      0, "total_time_nsec" :     58705000, "standard_deviation_nsec" :      7274 },
     {"send_size" :    256, "recv_size" :      4, "total_time_nsec" :     58818000, "standard_deviation_nsec" :      5453 },
     {"send_size" :    256, "recv_size" :      8, "total_time_nsec" :     59451000, "standard_deviation_nsec" :      6926 },
     {"send_size" :    256, "recv_size" :     16, "total_time_nsec" :     60237000, "standard_deviation_nsec" :      5781 },
     {"send_size" :    256, "recv_size" :     32, "total_time_nsec" :     61456000, "standard_deviation_nsec" :      5591 },
     {"send_size" :    256, "recv_size" :     64, "total_time_nsec" :     62615000, "standard_deviation_nsec" :      7588 },
     {"send_size" :    256, "recv_size" :    128, "total_time_nsec" :     68554000, "standard_deviation_nsec" :      7766 },
     {"send_size" :    256, "recv_size" :    256, "total_time_nsec" :     74557000, "standard_deviation_nsec" :      8748 },
     {"send_size" :    256, "recv_size" :    512, "total_time_nsec" :     87929000, "standard_deviation_nsec" :      9510 },
     {"send_size" :    256, "recv_size" :   1024, "total_time_nsec" :    148522000, "standard_deviation_nsec" :     11394 },
     {"send_size" :    512, "recv_size" :      0, "total_time_nsec" :     59697000, "standard_deviation_nsec" :      7825 },
     {"send_size" :    512, "recv_size" :      4, "total_time_nsec" :     59427000, "standard_deviation_nsec" :      5706 },
     {"send_size" :    512, "recv_size" :      8, "total_time_nsec" :     59538000, "standard_deviation_nsec" :      6863 },
     {"send_size" :    512, "recv_size" :     16, "total_time_nsec" :     61139000, "standard_deviation_nsec" :      7645 },
     {"send_size" :    512, "recv_size" :     32, "total_time_nsec" :     62203000, "standard_deviation_nsec" :      7985 },
     {"send_size" :    512, "recv_size" :     64, "total_time_nsec" :     62577000, "standard_deviation_nsec" :      8118 },
     {"send_size" :    512, "recv_size" :    128, "total_time_nsec" :     68722000, "standard_deviation_nsec" :     10581 },
     {"send_size" :    512, "recv_size" :    256, "total_time_nsec" :     74290000, "standard_deviation_nsec" :      8931 },
     {"send_size" :    512, "recv_size" :    512, "total_time_nsec" :     88635000, "standard_deviation_nsec" :      7771 },
     {"send_size" :    512, "recv_size" :   1024, "total_time_nsec" :    149589000, "standard_deviation_nsec" :     11456 },
     {"send_size" :   1024, "recv_size" :      0, "total_time_nsec" :     63243000, "standard_deviation_nsec" :      6331 },
     {"send_size" :   1024, "recv_size" :      4, "total_time_nsec" :     64381000, "standard_deviation_nsec" :      8372 },
     {"send_size" :   1024, "recv_size" :      8, "total_time_nsec" :     63481000, "standard_deviation_nsec" :      5608 },
     {"send_size" :   1024, "recv_size" :     16, "total_time_nsec" :     65549000, "standard_deviation_nsec" :      8826 },
     {"send_size" :   1024, "recv_size" :     32, "total_time_nsec" :     65485000, "standard_deviation_nsec" :      6822 },
     {"send_size" :   1024, "recv_size" :     64, "total_time_nsec" :     67125000, "standard_deviation_nsec" :      9829 },
     {"send_size" :   1024, "recv_size" :    128, "total_time_nsec" :     72680000, "standard_deviation_nsec" :      7641 },
     {"send_size" :   1024, "recv_size" :    256, "total_time_nsec" :     79206000, "standard_deviation_nsec" :      9854 },
     {"send_size" :   1024, "recv_size" :    512, "total_time_nsec" :     92418000, "standard_deviation_nsec" :      9107 },
     {"send_size" :   1024, "recv_size" :   1024, "total_time_nsec" :    152392000, "standard_deviation_nsec" :     11124 }
    ]
  },
  "download_speed" : {
    "byte_size" : 4194304,
    "results" : [
     {"send_size" :      0, "recv_size" :     32, "total_time_nsec" :   7735630000 },
     {"send_size" :      0, "recv_size" :     64, "total_time_nsec" :   3985169000 },
     {"send_size" :      0, "recv_size" :    128, "total_time_nsec" :   2128791000 },
     {"send_size" :      0, "recv_size" :    256, "total_time_nsec" :   1172077000 },
     {"send_size" :      0, "recv_size" :    512, "total_time_nsec" :    703833000 },
     {"send_size" :      0, "recv_size" :   1024, "total_time_nsec" :    594966000 }
    ]
  }
}

llvm-svn: 237953
2015-05-21 20:52:06 +00:00
Zachary Turner 3c1c5b9d88 Fix race condition when detaching/killing an inferior.
llvm-svn: 237945
2015-05-21 19:56:26 +00:00
Robert Flack ab78164ad8 Only check for matching arch and UUID when looking for dsym in vincinity of executable.
ModuleSpecs::FindMatchingModuleSpec looks for matching filenames but when
looking for the dSYM we should only be looking for a matching architecture and
and UUID. Jason pointed out this mistake in http://reviews.llvm.org/D9174 when
this function was incorrectly converted to not be Mac specific.

Test Plan:
Running LLDB on test/lang/c/shared_lib_stripped_symbols/a.out in a debugger I've
verified LocateDSYMInVincinityOfExecutable correctly locates the matching dSYM.

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

llvm-svn: 237907
2015-05-21 15:44:24 +00:00
Tamas Berghammer 9691518143 Handle aggregate return types in SysV-arm ABI
Differential revision: http://reviews.llvm.org/D9910

llvm-svn: 237901
2015-05-21 13:44:40 +00:00
Tamas Berghammer 350d8b311b Add float/double return value handling to SysV-arm ABI
This is neccessary for evaluating expressions with float/double return
value and for displaying float/double return values in case of a thread
step out.

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

llvm-svn: 237900
2015-05-21 13:34:46 +00:00
Pavel Labath 39036ac31d [NativeProcessLinux] Fix handling of SIGSTOP
Summary:
Previously, NPL tried to reinject SIGSTOP into the inferior in an attempt to get the process to
start in the group-stop state. This was:
a) wrong (reinjection should be controlled by "process handle" lldb setting)
b) racy (it should use Resume for transparent resuming instead of RequestResume)
c) broken (llgs crashed on inferior SIGSTOP)

With this change, SIGSTOP is handled just like any other signal delivered to the inferior: we
stop all threads and report signal reception to lldb. SIGSTOP reinjection does not behave the
same way as it would outside the debugger, but simulating this is a hard problem and is not
normally necessary.

Test Plan: I have added a test which verifies we get SIGSTOP reports and we do not crash.

Reviewers: ovyalov, chaoren

Subscribers: lldb-commits

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

llvm-svn: 237880
2015-05-21 08:32:18 +00:00
Jim Ingham 7ac5c86ba9 Fix the logic in DynamicLoaderMacOSXDYLD::Clear that would only remove the old dyld notification
breakpoint only  if the process it was for is still alive.  We need to always remove this because
it has a pointer to the old loader, and    if we ever hit it we will crash.  I also put in a sanity
check in the callback function to make sure we don't invoke it if the process is wrong.

<rdar://problem/21006189>

llvm-svn: 237866
2015-05-21 00:27:01 +00:00
Greg Clayton 07b5899367 Fixed an issue with expressions that define types in the expression. We must currently touch the members of the struct in the right order or our ClangASTImporter::DeportType() will copy the resulting type into the target AST incorrectly. This is a work around for <rdar://problem/21049838> which the copy type issue so that it doesn't happen.
<rdar://problem/20902950>

llvm-svn: 237865
2015-05-21 00:26:58 +00:00
Chaoren Lin 2bf454021c Default dst value for platform put-file.
Summary: It should default to working-dir/src-filename if dst is not specified.

Reviewers: clayborg, flackr

Reviewed By: flackr

Subscribers: lldb-commits

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

llvm-svn: 237831
2015-05-20 20:23:23 +00:00
Jim Ingham 40d66e6108 Since the asan report function doesn't gather bp or sp,
don't put those values in the Structured Data we make up
from the report.

<rdar://problem/21038887>

llvm-svn: 237824
2015-05-20 19:15:43 +00:00
Zachary Turner c62733b0de Implement attach to process on Windows.
Differential Revision: http://reviews.llvm.org/D9801
Reviewed by: Adrian McCarthy

llvm-svn: 237817
2015-05-20 18:31:17 +00:00
Ilia K 38810f430b Fix handling of hijacked events in synchronous mode
Summary:
This patch includes the following changes:
* Fix Target::Launch to handle hijacked event in synchronous mode
* Improve MiStartupOptionsTestCase tests to expect *stopped (MI)
* Add SBProcess::GetStopEventForStopID
* Add ProcessModID::SetStopEventForLastNaturalStopID/GetStopEventForStopID
* Add const qualifier to ProcessModID::GetLastNaturalStopID
* Add SBProcess::GetStopEventForStopID
* Don't broadcast hijacked event in Target::Launch
* Add CMICmnLLDBDebugger::CheckIfNeedToRebroadcastStopEvent/RebroadcastStopEvent

Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/startup_options/

Reviewers: zturner, jingham, clayborg, abidh

Reviewed By: clayborg

Subscribers: abidh, zturner, lldb-commits, clayborg, jingham

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

llvm-svn: 237781
2015-05-20 10:15:47 +00:00
Siva Chandra 8fd94c9e68 [GDBRemoteCommunicationClient] Increase timeout for qfProcessInfo packet.
Summary:
The test in TestPlatformCommand which runs "platform process list" has
been timing out for Android when running running dosep.py with
LLDB_TEST_THREADS=8. This patch increases the packet timeout to a large
value of 1min to accommodate the long time required for a response for
the qfProcessInfo packet on Android.

Test Plan: LLDB_TEST_THREADS=8 ./dosep.py on Android.

Reviewers: chaoren

Reviewed By: chaoren

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 237752
2015-05-20 00:30:31 +00:00
Chaoren Lin 70e0cbb3ed Remove trailing slash from dumping directory FileSpec.
Reviewers: domipheus, ovyalov

Reviewed By: ovyalov

Subscribers: lldb-commits

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

llvm-svn: 237741
2015-05-19 23:11:58 +00:00
Enrico Granata 4518586234 A previous patch made it so that ValueObjects could update themselves even in the face of an invalid execution context (which was required for the dynamic and synthetic values of const objects)
It turns out, child values also need similar provisions

This patch simplifies things a bit allowing ValueObject subclasses to just declare whether they can accept an invalid context at update time, and letting the update machinery in the EvaluationPoint to the rest
Also, this lets ValueObjectChild proclaim that its parent chooses whether such blank-slate updates are possible

llvm-svn: 237714
2015-05-19 18:53:13 +00:00
Oleksiy Vyalov 09e9079d5c Use ADB pull to download modules from android target.
http://reviews.llvm.org/D9816

llvm-svn: 237640
2015-05-18 23:44:06 +00:00
Adrian McCarthy 2f8e4c3bf9 Enable debugging of multithreaded programs on Windows.
llvm-svn: 237637
2015-05-18 23:24:32 +00:00
Tamas Berghammer f4553e014e Fix encoding of BX instrucion in EmulateInstructionARM
llvm-svn: 237570
2015-05-18 14:55:51 +00:00
Ilia K 055ad9beba Add --move-to-nearest-code / target.move-to-nearest-code options (attempt 2)
This patch initially was committed in r237460 but later it was reverted (r237479) due to 4 new failures:
* TestExitDuringStep.py
* TestNumThreads.py
* TestThreadExit.py
* TestThreadStates.py

This patch also fixes these tests.

llvm-svn: 237566
2015-05-18 13:41:01 +00:00
Enrico Granata bb642e5456 Constant result ValueObjects are - well - constant
And they also do not have a thread/frame attached to them

That makes dynamic and synthetic values attached to them impossible to update - which, among other things, makes it impossible to properly display persistent variables of types that could have such dynamic/persistent values

Fix this by making it so that a ValueObject can control its constantness (hint: dynamic and synthetic values cannot be constant) and whether it wants to let itself be updated when an invalid thread is around

llvm-svn: 237504
2015-05-16 01:27:00 +00:00
Vince Harron 341eda4ca7 Fixed arm64 build error
llvm-svn: 237493
2015-05-16 00:26:20 +00:00
Greg Clayton 898c1b2cfe Don't crash if we have bad debug info that has a DW_TAG_inheritance with a bad DW_AT_type reference. Emit an error with instructions to file a bug.
<rdar://problem/20944860>

llvm-svn: 237485
2015-05-15 22:31:18 +00:00
Greg Clayton 9438056b83 Don't crash if a function has no name by calling 'strcmp(name, "main")'.
<rdar://problem/20925061>

llvm-svn: 237484
2015-05-15 22:20:29 +00:00
Vince Harron a66c695340 Reverting r237460 to fix test failures introduced on OSX & Linux
TestExitDuringStep.py
TestNumThreads.py
TestThreadExit.py
TestThreadStates.py

llvm-svn: 237479
2015-05-15 21:43:26 +00:00
Greg Clayton 67d49488a7 Don't allow infininte recursion when trying to resolve re-exported symbols.
<rdar://problem/20821289>

llvm-svn: 237477
2015-05-15 21:27:16 +00:00
Robert Flack eb83fabfa0 Only check _ZN function prefix in Linux and FreeBSD targets in SymbolFileDWARF
In http://reviews.llvm.org/D9754 I enabled the mangled symbol name lookup
workaround used to find global and anonymous namespace symbols in linux binaries
for all platforms, however we should still only check for these symbols when
processing Linux or FreeBSD binaries where they are relevant. This patch makes
this change.

Test Plan: The tests from the original revision still pass:
TestCallCPPFunction.py
TestCallStopAndContinue.py
TestExprs.py
TestExprsChar.py
TestNamespace.py
TestOverloadedFunctions.py
TestRvalueReferences.py
TestThreadExit.py

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

llvm-svn: 237467
2015-05-15 18:59:59 +00:00
Greg Clayton 1548440c45 OperatingSystem plug-ins need to avoid running code when fetching thread lists. This patch helps with that by making all SBValue objects that are fetched not try to do dynamic type resolution. Objective C can end up running code to fetch a list of all ISA pointers so we can tell when something is dynamic and this running code could cause the OS plug-in to continue the target.
This fix disabled dynamic types, fetches the new threads from the OS plug-in, then restores the setting.

<rdar://problem/20768407> 

llvm-svn: 237465
2015-05-15 18:40:24 +00:00
Ilia K d9f1a78aa0 Add --move-to-nearest-code / target.move-to-nearest-code options
Summary:
This option forces to only set a source line breakpoint when there is an exact-match

This patch includes the following commits:
# Add the -m/--exact-match option in "breakpoint set" command
## Add exact_match arg in BreakpointResolverFileLine ctor
## Add m_exact_match field in BreakpointResolverFileLine
## Add exact_match arg in BreakpointResolverFileRegex ctor
## Add m_exact_match field in BreakpointResolverFileRegex
## Add exact_match arg in Target::CreateSourceRegexBreakpoint
## Add exact_match arg in Target::CreateBreakpoint
## Add -m/--exact-match option in "breakpoint set" command
# Add target.exact-match option to skip BP if source line doesn't match
## Add target.exact-match global option
## Add Target::GetExactMatch
## Refactor Target::CreateSourceRegexBreakpoint to accept LazyBool exact_match (was bool)
## Refactor Target::CreateBreakpoint to accept LazyBool exact_match (was bool)
# Add target.exact-match test in SettingsCommandTestCase
# Add BreakpointOptionsTestCase tests to test --skip-prologue/--exact-match options
# Fix a few typos in lldbutil.check_breakpoint_result func
# Rename --exact-match/m_exact_match/exact_match/GetExactMatch to --move-to-nearest-code/m_move_to_nearest_code/move_to_nearest_code/GetMoveToNearestCode
# Add exact_match field in BreakpointResolverFileLine::GetDescription and BreakpointResolverFileRegex::GetDescription, for example:
was:
```
1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, locations = 1, resolved = 1, hit count = 2
  1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2
```
now:
```
1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, exact_match = 0, locations = 1, resolved = 1, hit count = 2
  1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2
```

Test Plan:
./dotest.py -v --executable $BUILDDIR/bin/lldb functionalities/breakpoint/
./dotest.py -v --executable $BUILDDIR/bin/lldb settings/
./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/breakpoint/

Reviewers: jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, jingham

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

llvm-svn: 237460
2015-05-15 18:16:15 +00:00
Pavel Labath 9eb1ecb9af [NativeProcessLinux] Fix removal of temporary breakpoints
Summary:
There was an issue in NPL, where we attempted removal of temporary breakpoints (used to implement
software single stepping), while some threads of the process were running. This is a problem
since we currently always use the main thread's ID in the removal ptrace call. Therefore, if the
main thread was still running, the ptrace call would fail, and the software breakpoint would
remain, causing all kinds of problems. This change removes the breakpoints after all threads have
stopped. This fixes TestExitDuringStep on Android arm and can also potentially help in other
situations, as previously the breakpoint would not get removed if the thread stopped for another
reason.

Test Plan: TestExitDuringStep passes, other tests remain unchanged.

Reviewers: tberghammer

Subscribers: tberghammer, aemerson, lldb-commits

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

llvm-svn: 237448
2015-05-15 13:49:01 +00:00
Pavel Labath 6e35163cca [NativeProcessLinux] Fix potential race during thread exit
Summary:
This is the same issue as we had in D9145 for thread creation. Going through the full
ThreadDidStop/RequestResume cycle can cause a deferred notification to fire, which is not correct
when we are ignoring an event and resuming the thread. In this case it doesn't matter much since
the thread will die after that anyway, but for correctness, we should do the same thing here.
Also treating the SIGTRAP case the same way.

Test Plan: Tests continue to pass.

Reviewers: chaoren, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 237445
2015-05-15 13:30:59 +00:00
Pavel Labath 48fca3b982 Fix StopInfoWatchpoint handling after r237411
r237411 exposed the following issue: ProcessGDBRemote used the description field in the
stop-reply to set the description of the StopInfo. In the case of watchpoints, the packet
description contains the raw address that got hit, which is not exactly the information we want
to display to the user as the stop info. Therefore, I have changed the code to use the packet
description only if the StopInfo does not already have a description. This makes the behavior
equivalent to the pre-r237411 behavior as then the SetDecription call got ignored for
watchpoints.

llvm-svn: 237436
2015-05-15 10:14:51 +00:00
Tamas Berghammer 69fc298a94 Fix virtual step handling in ThreadPlanStepInRange
Differential revision: http://reviews.llvm.org/D9773

llvm-svn: 237435
2015-05-15 10:14:15 +00:00
Ilia K 06d2855fb3 Fix a reason of *stopped notifications due to SIGINT/SIGSTOP signals (MI)
# Add SBProcess::GetInterruptedFromEvent
# Add vrEvent arg in CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateStopped
  and CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal
# Refactor CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal
## Clean up and fix typos
## Remove vwrbShouldBrk arg
# Fix MiSignalTestCase.test_lldbmi_stopped_when_stopatentry_{local,remote}
  to expect SIGSTOP instead of SIGINT

llvm-svn: 237426
2015-05-15 09:29:09 +00:00
Ilia K d50ea2fc15 Fix a few compile warnings
llvm-svn: 237425
2015-05-15 09:15:27 +00:00
Omair Javaid cdad63b33d LLDB build broke after applying patch http://reviews.llvm.org/D9706
This patch fixes the issue.

llvm-svn: 237421
2015-05-15 08:30:29 +00:00
Bhushan D. Attarde 794a4d5a9f Assembly profiler for mips32
Summary:
Implementation of assembly profiler for MIPS32 using EmulateInstruction which currently scans only prologue/epilogue assembly instructions. It uses llvm::MCDisassembler to decode assembly instructions.

Reviewers: clayborg, jasonmolenda

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

llvm-svn: 237420
2015-05-15 06:53:30 +00:00
Omair Javaid ea8c25a802 This patch adds support for setting/clearing hardware watchpoints and breakpoints on AArch64 (Arm v8) 64-bit hardware.
http://reviews.llvm.org/D9706

llvm-svn: 237419
2015-05-15 06:29:58 +00:00
Oleksiy Vyalov 9953f0886b Reverting r237392 since it broke TestNumThreads on ubuntu builder.
llvm-svn: 237415
2015-05-15 02:05:10 +00:00
Jason Molenda 0453be9bd9 The StopInfo base class has an m_description std::string.
Remove the m_description ivar from the StopInfoBreakpoint
and StopInfoWatchpoint subclasses of StopInfo.  Also,
initialize the m_description ivar in the StopInfo ctor.
<rdar://problem/20902950> 

llvm-svn: 237411
2015-05-15 00:19:28 +00:00
Zachary Turner 275806f90b Don't bother dynamic loading the Windows Slim RW Lock API.
This API has been present since XP, and I think it's safe to
drop support for XP (since other things have been introduced long
ago which already don't work on XP anyway).

With this patch, we can statically bind against the exports and
not bother falling back to a CRITICAL_SECTION if we can't load
the API.

llvm-svn: 237402
2015-05-14 22:50:19 +00:00
Adrian McCarthy d26b0c4d31 Enable multithreaded debugging on Windows.
llvm-svn: 237392
2015-05-14 21:07:59 +00:00
Enrico Granata b2d643146f Implement an objc tagged-pointer info command that will provide information about what LLDB thinks an ObjC tagged pointer represents
llvm-svn: 237322
2015-05-14 00:46:47 +00:00
Ed Maste da04cb2643 Add mips64el trap opcode to PlatformFreeBSD as well
llvm-svn: 237315
2015-05-13 23:12:51 +00:00
Ed Maste af0494f158 Restore breaks lost in shuffling GetSoftwareBreakpointTrapOpcode
llvm-svn: 237313
2015-05-13 23:09:43 +00:00
Ed Maste dfef0cecd4 Add AArch64 and MIPS breakpoint opcodes and sort cases
New opcodes from PlatformLinux.cpp

llvm-svn: 237306
2015-05-13 22:40:01 +00:00
Ed Maste a157bc8539 Initial FreeBSD/arm live debugging support
Patch by Tom Rix, except using the RegisterContextFreeBSD_arm files
added in r235305 instead.

llvm-svn: 237303
2015-05-13 22:33:12 +00:00
Ed Maste a928d9550c Rearrange PlatformFreeBSD to match PlatformLinux
No functional change, but this simplifies diffs of the two.

llvm-svn: 237302
2015-05-13 22:26:24 +00:00
Zachary Turner ff33eefcc7 Fix an issue with finding python on Windows.
Someone must have changed the behavior of FileSpec slightly
relating to whether or not there is a trailing backslash when calling
GetPath() and GetDirectory().  This caused ScriptInterpreterPython
to find the wrong values when initializing sys.path, and as a result
we couldn't find the lldb module.

This patch fixes the issue, and also adds a test to make sure that
GetDirectory() does not return a string containing a trailing slash.

llvm-svn: 237282
2015-05-13 19:44:57 +00:00
Zachary Turner 1aa755ce77 Remove DoAttachToProcessWithId(lldb::pid_t).
There were two versions of DoAttachToprocessWithId.  One that takes
a pid_t, and the other which takes a pid_t and a ProcessAttachInfo.
There were no callers of the former version, and all of the
implementations of this version were simply forwarding calls to
one version or the other.

llvm-svn: 237281
2015-05-13 19:44:44 +00:00
Zachary Turner 7271bab3bb Have Platform::KillProcess try to use the process plugin first.
llvm-svn: 237280
2015-05-13 19:44:24 +00:00
Ted Woodward bb1e283cc5 Change Linux Platform to support non-host Linux architectures
Summary:
This was originally http://reviews.llvm.org/D8709 , but I didn't commit it correctly. 

Since then GetSupportedArchitectureAtIndex() has been changed. That change, http://reviews.llvm.org/D9511 , breaks non-x86 linux implementations, so this change goes back to the old implementation and adds remote linux support from D8709.

D8709 summary:

The Linux Platform currently will only say the Host architecture is supported. This patch retains that behavior for the Host Platform, but adds a list of architectures for the Remote Platform.


Reviewers: clayborg, flackr

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 237278
2015-05-13 18:52:56 +00:00
Robert Flack 5cbd3bfca1 Enable workaround for finding functions in global namespace on linux binaries on
all hosts.

We require a workaround to be able to locate global and anonymous namespace
functions in the dwarf symbols on linux binaries. This patch enables this code
on all platforms so that we can still find these symbols when debugging from a
different host platform.

Test Plan:
The following tests begin passing when running with a mac host to linux client:
TestCallCPPFunction.py
TestCallStopAndContinue.py
TestExprs.py
TestExprsChar.py
TestNamespace.py
TestOverloadedFunctions.py
TestRvalueReferences.py
TestThreadExit.py

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

llvm-svn: 237270
2015-05-13 18:20:02 +00:00
Tamas Berghammer 4276cb3a50 Fix arm instruction emulation of add (imm) and sub (imm)
Differential revision: http://reviews.llvm.org/D9704

llvm-svn: 237240
2015-05-13 09:25:06 +00:00
Ewan Crawford 78baa19781 Remote Non-Stop Support
Summary:
 
This patch is the beginnings of support for Non-stop mode in the remote protocol. Letting a user examine stopped threads, while other threads execute freely.

Non-stop mode is enabled using the setting target.non-stop-mode, which sends a QNonStop packet when establishing the remote connection.
Changes are also made to treat the '?' stop reply packet differently in non-stop mode, according to spec https://sourceware.org/gdb/current/onlinedocs/gdb/Remote-Non_002dStop.html#Remote-Non_002dStop.
A setting for querying the remote for default thread on setup is also included.

Handling of '%' async notification packets will be added next.

Reviewers: clayborg

Subscribers: lldb-commits, ADodds, ted, deepak2427

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

llvm-svn: 237239
2015-05-13 09:18:18 +00:00
Ilia K acf20fa233 Fix a few compile warnings
llvm-svn: 237238
2015-05-13 09:04:59 +00:00
Robert Flack 8ec55a53a7 Don't change the selected platform when creating the dummy target.
A dummy target is used by TargetList::CreateTargetInternal to prime newly
created targets. the first time this is done it creates the dummy target. The
dummy target is created with the host platform (See
TargetList::CreateDummyTarget) which results in switching the selected platform
back to the host platform even when creating a target for a different platform.
This change avoids changing the selected platform while creating the dummy
target to prevent this side effect.

Test Plan:
./dotest.py $DOTEST_OPTS -t -p TestCreateAfterAttach.py
Tests using process attach (e.g. TestCreateAfterAttach.py, TestHelloWorld.py)
now run successfully mac -> linux.

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

llvm-svn: 237221
2015-05-13 00:39:24 +00:00
Vince Harron d7e6a4f2f0 Fixed a ton of gcc compile warnings
Removed some unused variables, added some consts, changed some casts
to const_cast. I don't think any of these changes are very
controversial.

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

llvm-svn: 237218
2015-05-13 00:25:54 +00:00
Chaoren Lin 042ca39c01 Platform settings doesn't need permission options.
Summary:
Also removes conflict error message for '-w' between
--user-write and --working-dir.

Reviewers: flackr, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 237178
2015-05-12 21:06:48 +00:00
Ted Woodward 4744ec6da9 Windows: fix bug in getcwd() and add chdir().
Summary:
GetCurrentDirectory() returns the number of characters copied; 0 is a failure, not a success.

Add implementation for chdir().

Reviewers: zturner

Reviewed By: zturner

Subscribers: lldb-commits

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

llvm-svn: 237162
2015-05-12 18:47:33 +00:00
Robert Flack e49b8e065e Call remote platform GetSupportedArchitectureAtIndex if connected to remote.
Updated PlatformLinux::GetSupportedArchitectureAtIndex to call the
PlatformRemoteGdbServer::GetSupportedArchitectureAtIndex if connected remotely.
This should return the correct thing for android (to fix those failing tests),
and is also working for mac to linux.

Test Plan:
./dotest.py $DOTEST_OPTS -t -p TestCallStdStringFunction.py
The above still passes when running mac->linux indicating it successfully
identified PlatformLinux as the target platform and converted the mmap options
correctly.

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

llvm-svn: 237128
2015-05-12 13:22:37 +00:00
Tamas Berghammer 1f14920437 Return the correct user register count for arm from NativeRegisterContext
The defult implementation falls back to GetRegisterCount what
includes the debug registers also what shouldn't be displayed to
the user.

llvm-svn: 237111
2015-05-12 10:27:45 +00:00
Pavel Labath 108c325d6e Remove handling of eStateStopped from NativeProcessLinux::Resume
Summary:
NPL::Resume attempted to handle eStateStopped as a resume action. However:
- GDBRemoteCommunicationServerLLGS (the only user of NPL) never sets this action
- it could set this action in response to a vCont:t packet, but LLDB never produces this packet
- gdb-remote protocol documentation says vCont:t packet is used only in non-stop mode, but LLDB
  does not support non-stop mode
- even if LLDB supported non-stop mode, this implementation of eStateStopped does something
  different from what the spec says it should (according to spec, it should stop the specified
  thread, but this seems to want to stop all threads).

Given the facts above, I believe we should remove this unused and untested code, as it probably
doesn't even work and removing it makes the rest of the code noticably simpler.

Reviewers: ovyalov, chaoren

Subscribers: lldb-commits

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

llvm-svn: 237103
2015-05-12 09:03:18 +00:00
Pavel Labath 1dbc6c9cd6 [NativeProcessLinux] Remove event mutex and clean functions using it
Summary:
Since the former-TSC events are now processed synchronously, there is no need for to protect them
with a separate mutex - all the actions are now guarded by the big m_threads_mutex.

With the mutex gone, the following functions, no longer have any purpose and were removed:
NotifyThreadCreate: replaced by direct calls to ThreadWasCreated
NotifyThreadStop: replaced by direct calls to ThreadDidStop
NotifyThreadDeath: folded into StopTrackingThread
ResetForExec: inlined as it consisted of a single line of code
RequestThreadResume(AsNeeded): replaced by direct calls to ResumeThread
StopThreads: removed, as it was never called

Test Plan: tests continue to pass

Reviewers: ovyalov, chaoren

Subscribers: lldb-commits

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

llvm-svn: 237101
2015-05-12 08:35:33 +00:00
Vince Harron 8b33567189 Get lldb-server building on android-9
Build lldb-server with an android-9 sysroot.

llvm-svn: 237078
2015-05-12 01:10:56 +00:00
Ed Maste fefbdb82ae Remove Triple Vendor check when creating FreeBSD Platform
This is equivalent to r237052 in PlatformLinux.cpp.

llvm-svn: 237075
2015-05-12 00:43:45 +00:00
Ted Woodward 869e0c1c59 Fix selecting the Platform in TargetList::CreateTargetInternal()
Summary:
TargetList::CreateTargetInternal() will only select the current Platform. A previous patch always sets platform_sp to the current Platform, so a check later to see if platform_sp was not defined always failed, and the current Platform was used. This patch removes that check, so if the current Platform is not compatible with the target architecture, CreateTargetInternal() will call Platform::GetPlatformForArchitecture() to select a compatible Platform.

Vince, remote linux tests (Ubuntu -> remote Ubuntu) pass the same with and without this patch.

Reviewers: vharron, clayborg

Reviewed By: clayborg

Subscribers: jingham, lldb-commits

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

llvm-svn: 237053
2015-05-11 21:23:31 +00:00
Ted Woodward b1da257ad1 Remove Triple Vendor check when creating Linux Platform
Summary: The Linux Platform shouldn't care about the Vendor field in the Triple. Currently it allows a value of "PC", or "unknown" if LLDB was built on Linux. This patch removes that check, so the Vendor field isn't touched. This will allow the Linux Platform to be created when using a Triple of *-*-Linux.

Reviewers: vharron, clayborg, sas, tberghammer

Reviewed By: clayborg, sas, tberghammer

Subscribers: tberghammer, sas, lldb-commits

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

llvm-svn: 237052
2015-05-11 21:21:21 +00:00
Ted Woodward e76e7e9369 Add Hexagon packet support to ThreadPlanStepRange
Summary:
Hexagon is a VLIW processor. It can execute multiple instructions at once, called a packet. Breakpoints need to be alone in a packet. This patch will make sure that temporary breakpoints used for stepping are set at the start of a packet, which will put the breakpoint in a packet by itself.

Patch by Deepak Panickal of CodePlay and Ted Woodward of Qualcomm.

Reviewers: deepak2427, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 237047
2015-05-11 21:12:33 +00:00
Tamas Berghammer 3c1d572799 Fix thumb condition extraction in ARM instrcution emulator
llvm-svn: 236988
2015-05-11 12:50:56 +00:00
Pavel Labath 8c8ff7af28 [NativeProcessLinux] Remove double thread state accounting
Summary:
Now that all thread events are processed synchronously, there is no need to have separate records
of whether a thread is running. This changes the (ever-dwindling) remains of the TSC to use
NativeThreadLinux as the authoritative source of the state of threads. The rest of the
ThreadContext we need has been moved to a member of NTL.

Test Plan: ninja check-lldb continues to pass

Reviewers: chaoren, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 236983
2015-05-11 10:03:10 +00:00
Vince Harron 9753dd98b3 Add support for ./dotest.py --channel and --log-success
Summary:
New dotest options that allow arbitrary log channels and
categories to be enabled.  Also enables logging for locally run
debug servers.
    
Log messages are separated into separate files per test case.
(this makes it possible to log in dosep runs)
    
These new log files are stored side-by-side with trace files in the
session directory.
    
These files are deleted by default if the test run is successful.
    
If --log-success is specified, even successful logs are retained.
    
--log-success is useful for creating reference log files.
    
Test Plan:
add '--channel "lldb all" --channel "gdb-remote packets" --log-success'
to your dotest options

Tested on OSX and Linux
    
Differential Revision: http://reviews.llvm.org/D9594

llvm-svn: 236956
2015-05-10 15:22:09 +00:00
Vince Harron 4cc8d202d0 Fixed minor compile warnings
llvm-svn: 236945
2015-05-10 08:33:58 +00:00
Robert Flack 96ad3de54b Convert mmap options for target in InferiorCallMmap.
Converts the MAP_PRIVATE and MAP_ANON options to the target platform constants
(on which the call runs) rather than using those of the compiled host.

Test Plan:
Run test suite, the following tests requiring memory allocation / JIT support
begin passing when running mac -> linux:
Test11588.py
TestAnonymous.py
TestBreakpointConditions.py
TestCPPStaticMethods.py
TestCStrings.py
TestCallStdStringFunction.py
TestDataFormatterCpp.py
TestDataFormatterStdList.py
TestExprDoesntBlock.py
TestExprHelpExamples.py
TestFunctionTypes.py
TestPrintfAfterUp.py
TestSBValuePersist.py
TestSetValues.py

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

llvm-svn: 236933
2015-05-09 15:53:31 +00:00
Chaoren Lin f34f410e0a Set path syntax for remote executable FileSpec.
Reviewers: ovyalov, zturner

Subscribers: lldb-commits

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

llvm-svn: 236925
2015-05-09 01:21:32 +00:00
Oleksiy Vyalov a9ea07113c Use hard links to link sysroot files within ModuleCache.
http://reviews.llvm.org/D9587

llvm-svn: 236917
2015-05-08 23:54:34 +00:00
Zachary Turner a49c59145b Enable thread-safe logging.
Thread-safe logging had been disabled because of a deadlock,
possibly due to a lock acquired during a signal handler.

This patch turns thread safe logging back on and also greatly
reduces the scope of the lock, confining it only to the code that
affects the underlying output stream, instead of all the code that
builds up the formatted log message.  this should resolve the
issue surrounding the deadlock.

llvm-svn: 236892
2015-05-08 18:50:54 +00:00
Tamas Berghammer d916dbb726 Remove check for object file type from DynamicLoaderPOSIXDYLD::DidAttach
For PIE executables the type of the main executable is shared object
so we can't force that the main executable should have the type of
executable.

llvm-svn: 236870
2015-05-08 15:45:53 +00:00
Tamas Berghammer f3a243297b Use /data/local/tmp as temp directory on android
If no temp directory specified by the user on android then fall back
to /data/local/tmp what is always present on the device. It removes
the dependency of specifying TMPDIR for executing platform commands
on android.

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

llvm-svn: 236843
2015-05-08 12:46:26 +00:00
Colin Riley 5de4251474 Fix build on windows.
llvm-svn: 236836
2015-05-08 12:17:27 +00:00
Tamas Berghammer 84dc009bef Re-enable compute load address for shared modules
It is required because of systems using PIE code

llvm-svn: 236826
2015-05-08 11:07:05 +00:00
Pavel Labath 014d32b3bb Have lldb_assert accept bool expressions
Summary:
This changes lldb_assert to accept bool expressions as the parameter, this is because some
objects (such as std::shared_ptr) are convertible to bool, but are not convertible to int, which
leads to surprising errors.

Reviewers: granata.enrico, zturner

Subscribers: lldb-commits

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

llvm-svn: 236819
2015-05-08 09:53:31 +00:00
Tamas Berghammer 85fadd9fe8 Fix parsing of the plt section for android-arm
The ELF data contains two different errors in some ELF files on android.
* The link field of the symbol table don't point to the plt section or
  to the dynsym section even when it is present in the ELF files.
* The size of the plt entries aren't specified in the section header of
  the plt section.

This CL adds some workarounds for these two issue with finding the
sections by name if the link field is empty and by using a heuristic to
calculate the size and offset of the plt entries.

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

llvm-svn: 236818
2015-05-08 09:40:05 +00:00
Aidan Dodds c0c838516d This patch allows LLDB to use the $qXfer:Libraries: packet.
Differential Revision: http://reviews.llvm.org/D9471

llvm-svn: 236817
2015-05-08 09:36:31 +00:00
Pavel Labath 337f3eb929 [NativeProcessLinux] Remove the stop callback
Summary:
The stop callback is a remnant of the ThreadStateCoordinator. We don't need it now that TSC is
gone, as we know exactly which function to call when threads stop. This also removes some
stop-related functions, which were just forwarding calls to one another.

Test Plan: ninja check-lldb continues to pass

Reviewers: chaoren, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 236814
2015-05-08 08:57:45 +00:00
Zachary Turner 610e52912d Add logging to ProcessWindows.
llvm-svn: 236776
2015-05-07 21:39:33 +00:00
Enrico Granata 4878c87d5e Make it so that changing formats on a synthetic value object causes children to be invalidated and refetched when needed
This is required for supporting vector types formatting

llvm-svn: 236769
2015-05-07 20:33:31 +00:00
Jim Ingham 841ee9b998 Add a missing check for m_real_stop_reason.
<rdar://problem/20738527>

llvm-svn: 236762
2015-05-07 18:51:04 +00:00
Oleksiy Vyalov 919ef9dc37 Use file locks to synchronize access to ModuleCache.
http://reviews.llvm.org/D9056

llvm-svn: 236736
2015-05-07 15:28:49 +00:00
Mohit K. Bhakkad 5bf047e5c4 A small fix in rL236696
llvm-svn: 236716
2015-05-07 11:43:23 +00:00
Pavel Labath 5eb721edcb [NativeProcessLinux] Remove logging and error callbacks
Summary:
These are remnants of the thread state coordinator, which are now unnecessary. I have basically
inlined the callbacks. No functional change.

Test Plan: Tests continue to pass.

Reviewers: chaoren, vharron

Subscribers: lldb-commits

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

llvm-svn: 236707
2015-05-07 08:30:31 +00:00
Ilia K ece0a3f69c Fix ClangUserExpression::Evaluate return code in case of eExpressionParseError
Summary: This patch fixes retvalue of ClangUserExpression::Evaluate in case of eExpressionParseError error

Reviewers: jingham, spyffe, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, spyffe, jingham

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

llvm-svn: 236700
2015-05-07 06:27:43 +00:00
Ilia K 8f0db3e1f0 Don't call the Process::SyncIOHandler in Target::Launch
Summary: This patch moves synchronization of iohandler to CommandObjectProcessLaunch::DoExecute like it was done in CommandObjectProcessContinue::DoExecute.

Reviewers: jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, jingham

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

llvm-svn: 236699
2015-05-07 06:26:27 +00:00
Mohit K. Bhakkad cdc22a889e [LLDB][MIPS] Software single stepping
Patch by Jaydeep Patil

Reviewers: clayborg, jasonmolenda
Subscribers: bhushan, mohit.bhakkad, sagar, lldb-commits.
Differential Revision: http://reviews.llvm.org/D9519

llvm-svn: 236696
2015-05-07 05:56:27 +00:00
Greg Clayton 28eb7bf406 Don't crash if we load a file with an architecture we don't support and try to parse some DWARF.
The ClangASTContext::getTargetInfo() will return NULL in this case and could cause us to crash if we don't check.

<rdar://problem/20543554> 

llvm-svn: 236681
2015-05-07 00:07:44 +00:00
Enrico Granata 087638b3a6 I forgot to return here, so do it, and appease the compiler
llvm-svn: 236646
2015-05-06 21:54:18 +00:00
Enrico Granata ba4b8b0917 Add a language objc class-table dump command
This command dumps a bunch of interesting facts about all Objective-C classes known to LLDB in the inferior process

llvm-svn: 236640
2015-05-06 21:01:07 +00:00
Sean Callanan ac28c7044f Allow the gdb_objc_realized_classes symbol to be
any type of symbol, which is okay since we are
looking only in the Objective-C module.

<rdar://problem/20828139>

llvm-svn: 236622
2015-05-06 18:33:19 +00:00
Pavel Labath ad5ee04058 Simplify FuncUnwinders::GetEHFrameAugmentedUnwindPlan
Summary:
GetEHFrameAugmentedUnwindPlan duplicated the work of GetEHFrameUnwindPlan in getting the original
plan from DWARF CFI. This changes the function to call GetEHFrameUnwindPlan instead of doing all
the work itself. A copy constructor is added to UnwindPlan to enable plan copying.

Test Plan: No regressions on linux test suite.

Reviewers: jasonmolenda, clayborg

Subscribers: lldb-commits

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

llvm-svn: 236607
2015-05-06 15:54:48 +00:00
Pavel Labath ed89c7fe44 [NativeProcessLinux] Remove the post-stop lambda
Summary:
The lambda was always calling SetState(eStateStopped) with small variations, so I have inlined
the code. Given that we don't have the TSC anymore, I believe we don't need to be so generic.

The only major change here is the way we choose a stop reason thread when we're interrupting a
program on client request. Previously, we were setting a null stop reason for all threads and
then fixing up the reason for one victim thread in the lambda. Now, I make sure the stop reason
is set for the victim thread correctly in the first place.

I also take the opportunity to rename CallAfter* functions into something more appropriate.

Test Plan: All tests continue to pass.

Reviewers: chaoren, vharron

Subscribers: lldb-commits

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

llvm-svn: 236595
2015-05-06 12:22:37 +00:00
Pavel Labath c076559a5b [NativeProcessLinux] fold ThreadStateCoordinator into NPL
Summary:
Since all TSC operations are now executed synchronously, TSC has become a little more than a
messenger between different parts of NativeProcessLinux. Therefore, the reason for its existance
has disappeared.

This commit moves the contents of the TSC into the NPL class. This will enable us to remove all
the boilerplate code in NPL (as it stands now, this is most of the class), which I plan to do in
subsequent commits.

Unfortunately, this also means we will lose the unit tests for the TSC. However, since the size
of the TSC has diminished, the unit tests were not testing much at this point anyway, so it's not
a big loss.

No functional change.

Test Plan: All tests continue to pass.

Reviewers: vharron, chaoren

Subscribers: lldb-commits

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

llvm-svn: 236587
2015-05-06 10:46:34 +00:00
Pavel Labath 9d37c41022 [ThreadStateCoordinator] Remove Event classes
Summary:
This is a cleanup patch for thread state coordinator. After making processing of all events
synchronous, there is no need to have a a separate class for each event. I have moved back
processing of all events back into the TSC class. No functional change.

Test Plan: All tests continue to pass.

Reviewers: chaoren, vharron

Subscribers: lldb-commits

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

llvm-svn: 236576
2015-05-06 08:23:47 +00:00
Greg Clayton 9c284c4d7a Make sure that the following paths say they are equal:
/private/tmp/main.cpp
/private/tmp/..//tmp/main.cpp

We saw paths like this in makefile generate binaries when someone left an extra '/' on the end of a makefile variable.

<rdar://problem/18945972>

llvm-svn: 236541
2015-05-05 20:26:58 +00:00
Chaoren Lin ce36c4cee1 Fix process launch from Windows host to Android target.
Summary:
- Denormalized path on Windows host causes bad `A` packet.
- Executables copied from Windows host doesn't have executable bits.

Reviewers: tberghammer, zturner, ovyalov

Reviewed By: ovyalov

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 236516
2015-05-05 18:43:19 +00:00
Chaoren Lin 26438d26fa Fix Android build.
llvm-svn: 236509
2015-05-05 17:50:53 +00:00
Pavel Labath 45f5cb31dc [NativeProcessLinux] Get rid of the thread state coordinator thread
Summary:
This change removes the thread state coordinator thread by making all the operations it was
performing synchronous. In order to prevent deadlock, NativeProcessLinux must now always call
m_monitor->DoOperation with the m_threads_mutex released. This is needed because HandleWait
callbacks lock the mutex (which means the monitor thread will block waiting on whoever holds the
lock). If the other thread now requests a monitor operation, it will wait for the monitor thread
do process it, creating a deadlock.

To preserve this invariant I have introduced two new Monitor commands: "begin operation block"
and "end operation block". They begin command blocks the monitor from processing waitpid
events until the corresponding end command, thereby assuring the monitor does not attempt to
acquire the mutex.

Test Plan: Run the test suite locally, verify no tests fail.

Reviewers: vharron, chaoren

Subscribers: lldb-commits

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

llvm-svn: 236501
2015-05-05 15:05:50 +00:00
Aidan Dodds df627e73a1 Fix GetModuleInfo() not checking for unsupported RSP response.
http://reviews.llvm.org/D9473

llvm-svn: 236486
2015-05-05 08:31:55 +00:00
Jason Molenda 9060e987a0 Fix an uninitialized memory use error when interpreting
compact unwind encodings for x86_64 / i386 omit-frame-pointer
code.  It was possible for lldb to get the location of saved
registers incorrect for some of these functions.
<rdar://problem/20753264> 

llvm-svn: 236478
2015-05-05 02:05:53 +00:00
Siva Chandra e32f2b57ff [ValueObject::GetPointeeData] Get addr from value for eValueHostAddress values.
Summary:
After r236447, ValueObject::GetAddressOf returns LLDB_INVALID_ADDRESS
when the value type is eValueHostAddress. For such a case, clients of
GetAddressOf should get the address from the scalar part of the value
instead of using the value returned by GetAddressOf directly.

This change also makes ValueObject::GetAddressOf set the address type to
eAddressTypeHost for values of eValueHostAddress so that clients can
recognize that they need to fetch the address from the scalar part
of the value.

Test Plan: ninja check-lldb on linux

Reviewers: clayborg, ovyalov

Reviewed By: ovyalov

Subscribers: lldb-commits

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

llvm-svn: 236473
2015-05-05 00:41:35 +00:00
Siva Chandra a3747a9d31 [ValueObject] Do not return address of eValueTypeHostAddress values.
Summary:
This fixes TestRegisterVariables for clang and hence it is enabled in this commit.


Test Plan: dotest.py -C clang -p TestRegisterVariables

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 236447
2015-05-04 19:43:34 +00:00
Colin Riley c9c55a26bd Add language command and LanguageRuntime plugin changes to allow vending of command objects.
Differential Revision: http://reviews.llvm.org/D9402

llvm-svn: 236443
2015-05-04 18:39:38 +00:00
Jim Ingham 204d0ee01f Fix a typo in the warning.
<rdar://problem/20799707>

llvm-svn: 236429
2015-05-04 17:33:33 +00:00
Mohit K. Bhakkad 1c34f7cf18 [LLDB][MIPS] Emulate instruction using MCDisassembler
Patch by Jaydeep Patil

EmulateInstructionMIPS64 has been modified to use llvm::MCDisassembler instead of duplicating the decoding logic.
Added emulation of few branch instructions for software single stepping

Reviewers: clayborg, jasonmolenda
Subscribers: bhushan, mohit.bhakkad, sagar, lldb-commits.
Differential Revision: http://reviews.llvm.org/D9319

llvm-svn: 236411
2015-05-04 06:28:04 +00:00
Jason Molenda 8980e6bc10 Change process kill to call Process::Destroy (force_kill = true);
follow-up to the change in r235158.  Right now if you attach to 
a process and type "kill", lldb doesn't kill it, it detaches.
<rdar://problem/20691198> 

llvm-svn: 236363
2015-05-01 23:39:48 +00:00
Enrico Granata b0e8a55d4d Fix an issue where the UTF dumper was ignoring the direction to generate uncapped dumps
llvm-svn: 236362
2015-05-01 22:57:38 +00:00
Chaoren Lin b2b3ff1860 Fixed some compiler warnings because of bit-width mismatches.
llvm-svn: 236323
2015-05-01 16:58:18 +00:00
Chaoren Lin 3ea689b313 Support remote-android with multiple connected devices.
Summary:
This change introduces a new URL scheme for `platform connect`:
```
adb://device-id:port
```

Reviewers: vharron, tberghammer, clayborg, ovyalov

Reviewed By: ovyalov

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 236321
2015-05-01 16:49:28 +00:00
Chaoren Lin ec53482aef PosixPipes should not be copyable but should be movable.
Summary: This addresses Oleksiy's comment in D9307.

Reviewers: clayborg, ovyalov

Reviewed By: clayborg, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 236320
2015-05-01 16:49:23 +00:00
Sean Callanan 80c9759ef7 Added support for locating and importing functions
(including inline functions) from modules in the
expression parser.  We now have to retain a reference
to the code generator in ClangExpressionDeclMap so
that any imported function bodies can be appropriately
sent to that code generator.

<rdar://problem/19883002>

llvm-svn: 236297
2015-05-01 00:47:29 +00:00
Sean Callanan 09b41c0785 Fixed some compiler warnings because of bit-width
mismatches.

llvm-svn: 236295
2015-05-01 00:44:36 +00:00
Sean Callanan 1376469a61 Updated our use of clang::Preprocessor to reflect
a change in the API used to get macros.

llvm-svn: 236292
2015-05-01 00:19:44 +00:00
Jim Ingham 2c83e336a1 Don't return nullptr when you mean to return an empty llvm::StringRef...
<rdar://problem/20747164>

llvm-svn: 236287
2015-04-30 23:45:07 +00:00
Jason Molenda ebd01b0ae6 Guard against the case where the Write method is called with
an argument pointing into the middle of m_buffer and then
Write() calls GrowBuffer() to resize m_buffer, leaving 
the content argument pointing into deallocated memory.

Patch by Kate Stone.
<rdar://problem/20756722> 

llvm-svn: 236286
2015-04-30 23:42:56 +00:00
Sean Callanan 68f85e7d6a Made macros from modules be injected before our
global convenience expression prefix.  Also ensured
that if macros are defined by the modules we don't
try to redefine them.  Finally cleaned up a bit of
code while I was in there.

<rdar://problem/20756642>

llvm-svn: 236266
2015-04-30 21:49:58 +00:00
Zachary Turner 26c0a5ea0d Remove the NullLog class introduced in r236174.
Based on list discussions, a different approach is desired for
reducing the visual impact of logging statements on the
readability of the code.  Another mechanism will be added in
a followup patch, but for now, since NullLog is unreferenced,
this patch just removes it.

This patch does *not* remove the other half of r236174, which was
to delete some dead code surrounding logging flags.

llvm-svn: 236259
2015-04-30 21:03:37 +00:00
Ilia K d8c1475f46 Fix Process::ResumeSynchronous which waits a process even in case of error
llvm-svn: 236231
2015-04-30 13:10:32 +00:00
Pavel Labath d351bcc858 Fix typo in Core/Log
llvm-svn: 236222
2015-04-30 10:47:56 +00:00
Richard Smith 63a41277fe Fix build after Clang API change in r236176.
llvm-svn: 236182
2015-04-29 23:46:48 +00:00
Zachary Turner b74e279fe1 Fix build broken by r236174.
Apparently va_list is literally a char* on Windows.

llvm-svn: 236177
2015-04-29 23:24:12 +00:00
Zachary Turner c1592658d5 Introduce a NullLog class, which ignores all messages.
The purpose of this class is so that GetLogIfAllCategoriesSet
can always return an instance of some class, whether it be a real
logging class or a "null" class, which ignores messages.  Code
that is littered with if statements that only log if the pointer
is non-null can get very unwieldy very quickly, so this should
help code readability in such circumstances.

Since I'm in this code anyway, I'm also deleting the
PrintfWithFlags methods, as well as all the flags, since they
appear to be dead code that have been superceded by newer
mechanisms and all the flags are simply ignored.

llvm-svn: 236174
2015-04-29 22:55:28 +00:00
Jason Molenda 3114703b5c Don't force a vendor check in ProcessMachCore::CanDebug() -- if this
is a Mach-O file and it is a Mach-O core file, activate the 
ProcessMachCore plugin.
<rdar://problem/20739989> 

llvm-svn: 236170
2015-04-29 22:17:45 +00:00
Chaoren Lin 66f2e12f7a Expose Close{Read/Write}FileDescriptor for pipes.
llvm-svn: 236136
2015-04-29 18:25:18 +00:00
Chaoren Lin a52f48412d Add file descriptor constructor for PipePosix.
llvm-svn: 236133
2015-04-29 17:36:58 +00:00
Chaoren Lin 3eb4b4589e Remove trap code from disassembly.
Summary:
NativeProcessProtocol uses ReadMemory internally for setting/checking
breakpoints but also for generic memory reads (Handle_m), this change adds a
ReadMemoryWithoutTrap for that purpose. Also fixes a bunch of misuses of addr_t
as size/length.

Test Plan: `disassemble` no longer shows the trap code.

Reviewers: jingham, vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 236132
2015-04-29 17:24:48 +00:00
Omair Javaid b78e05fead This patch adds support aarch64-linux-gnu (SysV) abi in lldb.
This code is also an import from MacOSx implementation as SysV abi is
similar to what has been implemented for MacOS but may require a few tweaks.

http://reviews.llvm.org/D8538

llvm-svn: 236098
2015-04-29 11:52:35 +00:00
Omair Javaid 52f825bd1c This patch adds required piece of code for SysV Abi for arm.
Its mostly imported from MacOSx ABI for arm which is similar.

Further tweaking a updates may be required at a later stage.

http://reviews.llvm.org/D8539

llvm-svn: 236097
2015-04-29 10:49:45 +00:00
Aidan Dodds ed9f612639 Fix bug in gdb-remote xml parser which failed to parse xml split over multiple rsp packets.
llvm-svn: 236095
2015-04-29 10:08:17 +00:00
Ilia K 7f83624222 Add language option in -gdb-show command (MI)
Summary:
Add language option in -gdb-show command + test:
```
$ bin/lldb-mi ~/p/hello
[...]
b main
[...]
r
[...]
(gdb)
-gdb-show language
^done,value="c++"
(gdb)
quit
```

Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/

Reviewers: abidh, granata.enrico, jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, jingham, granata.enrico, clayborg, abidh

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

llvm-svn: 235983
2015-04-28 12:51:16 +00:00
Ilia K 6e46512ec3 Don't print a type of variable in Address::Dump if it's unknown (i.e. nullptr)
Summary: This patch fixes dereferencing of nullptr in case when GetType() returns that.

Reviewers: jingham, granata.enrico, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, granata.enrico, clayborg, jingham

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

llvm-svn: 235982
2015-04-28 12:45:57 +00:00
Pavel Labath 426bdf8861 [NativeProcessLinux] Add back synchronisation of thread create events
Summary:
Without the synchronisation between the two thread creation events the following case could
happen:
- threads A and B are running. A hits a breakpoint. We note that we want to stop B.
- before we could stop it, B creates a new thread C, we get the stop notification for B, but we
  don't record C's existence yet.
- we resume B
- before we get the C notification, B stops again (e.g. hits a breakpoint, gets our SIGSTOP,
  etc.)
- we see all known threads have stopped, and we notify LLDB
- C notification comes, we note it's existence and resume it
=> we have an inconsistent state (LLDB thinks we've stopped, but C is running)

I resolve this by doing a blocking wait for for the C notification when we get the creation
notification on the parent (B) thread. This way the two events are synchronised, but we don't
need to introduce the intermediate "launching" state which would complicate handling of thread
states as all code would need to be aware of the third possible state.

Test Plan:
This is an obscure corner case, which I had not observed in practise, so I have no
test for it. I have tested that this commit does not regress in existing tests though.

Reviewers: chaoren, vharron

Subscribers: lldb-commits

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

llvm-svn: 235969
2015-04-28 07:51:52 +00:00
Chaoren Lin 368c9f6e9b Add an unnamed pipe fail-safe to launching lldb-gdbserver.
Summary:
Currently, launching lldb-gdbserver from platform on Android requires root for
mkfifo() and an explicit TMPDIR variable. This should remove both requirements.

Test Plan: Successfully launched lldb-gdbserver on a non-rooted Android device.

Reviewers: tberghammer, vharron, clayborg

Reviewed By: clayborg

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 235940
2015-04-27 23:20:30 +00:00
Zachary Turner 7cc3494dea [Windows] Add a RegisterContextWindows_x64.
With this patch, LLDB can debug x64 executables on Windows with
the same level of functionality as for x86 executables.

llvm-svn: 235935
2015-04-27 22:58:57 +00:00
Greg Clayton 63adb3f5ff Make sure versions are valid before we try to use them. Also check for invalid versions[0] by comparing it to UINT32_MAX instead of 0.
llvm-svn: 235892
2015-04-27 16:49:57 +00:00
Omair Javaid a77ca519ea Fix LLDB ARM build error on ubuntu precise with gcc4.7
Differential revision: http://reviews.llvm.org/D9100

llvm-svn: 235865
2015-04-27 12:01:59 +00:00
Pavel Labath 6648fcc34b Fix register read callback in linux-arm single stepping
The previous read callback always read the value of the register what
caused problems when the emulator wrote some value into a register and
then expected to read the same value back. This CL add a register value
cache into the callbacks to return the correct value after a register
write also.

Test Plan: Stepping over BL/BLX instruction works on android-arm if the instruction set isn't change (other, unrelated patch will come for the case when we move to an other instruction set)

Reviewers: omjavaid, sas, clayborg

Reviewed By: clayborg

Subscribers: labath, tberghammer, rengolin, aemerson, lldb-commits

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

From: Tamas Berghammer <tberghammer@google.com>
llvm-svn: 235852
2015-04-27 09:21:14 +00:00
Robert Flack 31870e15fa Look for both .debug and dsym debugging symbol information for stripped executable.
Currently Symbols::LocateExecutableSymbolFile on MacOSX only looks for external
dsym debugging information, however if running on a stripped dwarf executable it
should also check for a .debug file as well.

Test Plan:
./dotest.py $DOTEST_OPTS -t -p TestSharedLibStrippedSymbols.py
This test now passes when running a remote Mac -> Linux test, and still passes
running locally on Mac or locally on Linux.

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

llvm-svn: 235737
2015-04-24 18:09:54 +00:00
Tamas Berghammer 224dfbf3ae Fix condition detection in EmulateInstructionARM
The condition detection code is calculating the result of the condition
based on the first 3 bit of the condition and then negate it if the LSB
of the condition is set. It works for the normal conditions but 0b1110
and 0b1111 are special as both of them should evaluate to true
independently the value of CPSR. This CL removes the negating logic from
those cases.

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

llvm-svn: 235715
2015-04-24 12:13:44 +00:00
Tamas Berghammer 0da3ee1ef3 Fix order of b and blx instrction in EmulateInstructionARM
In the previous ordering some "blx <label>" instruction was recognised
as "b #imm24" instructions causing a failure in the instruction
emulator.

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

llvm-svn: 235714
2015-04-24 12:13:41 +00:00
Tamas Berghammer 04f7144907 Fix write register context for arm "add<c> <Rd>, sp, #imm"
Differential revision: http://reviews.llvm.org/D9213

llvm-svn: 235713
2015-04-24 12:13:38 +00:00
Bruce Mitchener 17d2730ee0 Start to share SWIG interface files between languages.
Summary:
Move scripts/Python/interface to scripts/interface so that we
can start making iterative improvements towards sharing the
interface files between multiple languages (each of which would
have their own directory as now).

Test Plan: Build and see.

Reviewers: zturner, emaste, clayborg

Reviewed By: clayborg

Subscribers: mjsabby, lldb-commits

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

llvm-svn: 235676
2015-04-24 00:38:53 +00:00
Chaoren Lin 82c6a40ba6 Fix build.
llvm-svn: 235653
2015-04-23 22:19:29 +00:00
Adrian McCarthy 2304b6ff44 Factor resolution of abbreviations and aliases so that they can be tested directly. http://reviews.llvm.org/D9033
llvm-svn: 235633
2015-04-23 20:00:25 +00:00
Richard Smith 6d48859b18 Fix build of lldb after clang r235614.
llvm-svn: 235631
2015-04-23 19:36:34 +00:00
Chaoren Lin 9cf4f2c2d8 Fix TestFdLeak on Linux.
Summary:
LLGS leaks pipes (when launched by lldb), sockets (when launched by platform),
and/or log file to the inferior. This should prevent all possible leaks.

Reviewers: vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 235615
2015-04-23 18:28:04 +00:00
Aidan Dodds 5372c72a42 Replace use of %zu with PRIu64 in DYDL logging message.
llvm-svn: 235598
2015-04-23 13:57:30 +00:00