Commit Graph

1140 Commits

Author SHA1 Message Date
Dawn Perchik a431f152df [lldb-mi] Add (gdb) prompt after =breakpoint-modified and =breakpoint-created.
Reviewed by: abidh, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12113

llvm-svn: 245488
2015-08-19 20:04:03 +00:00
Greg Clayton 2ad6ac5461 Quiet build warnings on MacOSX.
llvm-svn: 245373
2015-08-18 22:30:25 +00:00
Bruce Mitchener 023e3050c5 Add missing newline at EOF.
This fixes a warning on the Mac OS X build.

llvm-svn: 244863
2015-08-13 02:44:40 +00:00
Bruce Mitchener aab764965a Remove DNBConfig.h
Summary:
This was no longer needed and hasn't been needed since r143244
in 2011.  This removes everything associated with generating
or using it.

Reviewers: clayborg, jasonmolenda

Subscribers: lldb-commits

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

llvm-svn: 244850
2015-08-13 00:32:01 +00:00
Jason Molenda 6acc86c3f5 Have debugserver send the OS version string plus
major, minor, and patchlevel in the qHostInfo reply.  
Document that qHostInfo may report major/minor/patch
separately / in addition to the version: combination.

<rdar://problem/22125465> 

llvm-svn: 244716
2015-08-12 03:27:33 +00:00
Ilia K d7f932a8c8 Add size field to library load event (MI)
Summary:
(This revision supersedes the abandon: http://reviews.llvm.org/D9716)
Size field is used to let the debugger attribute an address to a specific library when symbols are not available. 
For example:
	OpenGLESApp4.app!Cube_draw() Line 74	C
 	OpenGLESApp4.app!-[GameViewController glkView:drawInRect:](GameViewController * self, SEL _cmd, GLKView * view, CGRect rect) Line 89	C++
 	GLKit!<redacted>	
 	QuartzCore!<redacted>	
 	QuartzCore!<redacted>	
 	QuartzCore!<redacted>	
 	QuartzCore!<redacted>	
 	QuartzCore!<redacted>	
 	UIKit!<redacted>	
 	UIKit!<redacted>	
 	UIKit!<redacted>	
 	UIKit!<redacted>	
 	FrontBoardServices!<redacted>	
 	CoreFoundation!<redacted>	

Patch from paulmay@microsoft.com

Reviewers: ChuckR, abidh, ki.stfu

Subscribers: greggm, lldb-commits

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

llvm-svn: 244573
2015-08-11 06:07:14 +00:00
Bruce Mitchener 381b73c96b [lldb-mi] Fix non-OS X builds.
llvm-svn: 243978
2015-08-04 13:25:23 +00:00
Bruce Mitchener 2d6b2f2010 [lldb-mi] Simplify MICmnMIOutOfBandRecord implementation.
Summary:
* Remove extraneous members that were just storing temporary
  values.
* OutOfBand_e parameters don't need to be const as they are
  scalars.
* Switch from a map with CMIUtilString values to using a mapping
  function. This uses a switch statement which will generate
  a warning if a new result class is added.
* Make BuildAsyncRecord a static function rather than a private
  member function so that we can construct the result text
  correctly and avoid having extra stuff in the header.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 243975
2015-08-04 13:12:31 +00:00
Bruce Mitchener e2453afff6 [lldb-mi] Use empty arg lists instead of (void).
Summary: This brings the code more in line with the usual LLDB style. NFC.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 243967
2015-08-04 10:24:20 +00:00
Bruce Mitchener bfcb6c870a [debugserver] Fix "control may reach end of non-void function" warnings.
Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 243953
2015-08-04 04:01:16 +00:00
Jason Molenda 3874ee6869 Bump the version # in the xcode proj file from major number 340 to 350.
The SB API for major version 340 won't be changing any more.

llvm-svn: 243943
2015-08-04 03:14:49 +00:00
Dawn Perchik c18daf29ae [lldb-mi] Fix evaluation for children of created variable object.
Move code in CMICmdCmdVarListChildren::Execute() up so that the child
object will always be added when the MI command -var-list-children is
entered (instead of only when the print-value was all or simple).  This
patch fixes evaluation of expressions like varobj.member for a created
varobj with children.

Reviewed by: abidh
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11659

llvm-svn: 243782
2015-07-31 21:00:00 +00:00
Hafiz Abid Qadeer 311d08f8de Escape new line and tabs in the result of variable evaluation.
Expression evaluation error messages may have embedded new lines
and tabs. These should be escaped in the result string.

Patch by paulmaybee. Reviewed in http://reviews.llvm.org/D11570.

llvm-svn: 243741
2015-07-31 09:24:39 +00:00
Dawn Perchik 3cb6dd6e94 Fix build of lldb on Mavericks after svn rev.243511.
This patch adds a test for ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED
around the code which requires 10.10 support to link. Without this, lldb
gets unresolved references to _csr_check and _rootless_allows_task_for_pid.

Reviewed by: jasonmolenda
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11668

llvm-svn: 243715
2015-07-31 00:26:46 +00:00
Ilia K 6940581e45 Fix bug in expression display when determining if a pointer should be treated as a string
Summary:
Currently if the "first child" of the pointer is a char type then the pointer is displayed as a string. This test succeeds incorrectly when the pointer is to a structured type with a char type as its first field. Fix this by switching the test to retrieve the pointee type and checking that it is a char type.


Reviewers: abidh, ChuckR, ki.stfu

Subscribers: greggm, lldb-commits

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

llvm-svn: 243619
2015-07-30 05:32:41 +00:00
Jason Molenda 752e1e833b When debugserver fails to attach to a process on a Darwin
system, make a couple of additional checks to see if the
attach was denied via the System Integrity Protection that
is new in Mac OS X 10.11.  If so, return a special E87
error code to indicate this to lldb.

Up in lldb, if we receive the E87 error code, be specific
about why the attach failed.

Also detect the more common case of general attach failure
and print a better error message than "lost connection".

I believe this code will all build on Mac OS X 10.10 systems.
It may not compile or run on earlier versions of the OS.
None of this should build on other non-darwin systems.

llvm-svn: 243511
2015-07-29 01:42:16 +00:00
Dawn Perchik c69780d797 [lldb-mi] Fix setting of breakpoints using file:func syntax.
Reviewed by: ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11499

llvm-svn: 243484
2015-07-28 21:40:57 +00:00
Ilia K b56c50f0ec Support escapes and quotes in string and character values.
Summary:
Escape characters in strings and strings containing quotes were not appearing correctly in expression values.

Patch from paulmay@microsoft.com

Reviewers: abidh, ChuckR, paulmaybee

Subscribers: greggm, lldb-commits

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

llvm-svn: 243383
2015-07-28 05:43:47 +00:00
Dawn Perchik c9a0d3be69 [lldb-mi] Fix breakpoints on functions when C++ namespaces are used.
The command "-break-insert ns::foo" for function 'foo' in namespace 'ns'
was being parsed as file:function.  This patch fixes these cases by adding
checks for '::'. (Note: '::func' is not parsed correctly by lldb due to
llvm.org/pr24271).

Reviewed by: ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11396

llvm-svn: 243281
2015-07-27 17:03:34 +00:00
Bruce Mitchener 8a67bf7298 Add UNUSED_IF_ASSERT_DISABLED and apply it.
Summary:
This replaces (void)x; usages where they x was subsequently
involved in an assertion with this macro to make the
intent more clear.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 243074
2015-07-24 00:23:29 +00:00
Bruce Mitchener b1e77a3642 Fix Mac OS X build, debugserver version handling.
Summary:
No longer rely on cmake to set DEBUGSERVER_VERSION_STR,
but now generate the _vers.c file like xcode does
and include the generated file into the build on Mac OS X.

This fixes the cmake Mac OS X build after an earlier change
by Jason Molenda.

Reviewers: clayborg, jasonmolenda

Subscribers: lldb-commits

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

llvm-svn: 243072
2015-07-24 00:13:45 +00:00
Bruce Mitchener 5a95b0a043 [lldb-mi] Remove unwanted comment blocks.
Summary:
This removes Authors:, Gotchas:, Changes: and Copyright:.

It leaves a couple of Gotcha: blocks that were not empty.

Reviewers: abidh, ki.stfu, domipheus

Subscribers: lldb-commits

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

llvm-svn: 242996
2015-07-23 09:04:56 +00:00
Jason Molenda 5d935e8d24 Fix the variable used to reply to the qGDBServerVersion
packet so that debugserver will send a reply like

name:debugserver;version:340.99;

<rdar://problem/21933963> 

llvm-svn: 242968
2015-07-22 23:42:54 +00:00
Greg Clayton 97f9e40e3a Don't water JSONGenerator objects down into ObjectSP's too early so that we can call member functions specific to dictionaries and arrays without calling GetAsDictionary() or GetAsArray() on them.
llvm-svn: 242917
2015-07-22 18:15:30 +00:00
Bruce Mitchener a026de0585 Fix warnings.
Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 242913
2015-07-22 17:31:44 +00:00
Bruce Mitchener 2c674d347e [lldb-mi] Remove unused bool results.
Summary:
Many methods, in particular various 'Add' methods didn't have
any actual failure scenarios that were being emitted. This meant
that a lot of surrounding code could be simplified.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 242911
2015-07-22 17:07:27 +00:00
Pavel Labath cb213b3831 Fix warnings found by -Wextra-semi
patch by Eugene Zelenko.

llvm-svn: 242875
2015-07-22 08:12:01 +00:00
Bruce Mitchener 39e8823f84 [lldb-mi] Correct file names in first line comments.
llvm-svn: 242781
2015-07-21 13:09:39 +00:00
Bruce Mitchener dec98e1c84 [lldb-mi] Fix Windows build, missing assert.h include.
Reviewers: ki.stfu, abidh

Subscribers: lldb-commits

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

llvm-svn: 242778
2015-07-21 12:39:58 +00:00
Bruce Mitchener 8d60fac5ba [lldb-mi] Simplify MICmnMIResultRecord implementation.
Summary:
* Remove extraneous members that were just storing temporary
  values.
* ResultClass_e parameters don't need to be const as they are
  scalars.
* Switch from a map with CMIUtilString values to using a mapping
  function. This uses a switch statement which will generate
  a warning if a new result class is added.
* Make BuildRecordResult a static function rather than a private
  member function so that we can construct the result text
  correctly and avoid having extra stuff in the header.
* Don't need (void) parameter lists in C++.

Reviewers: abidh, ki.stfu, domipheus

Subscribers: lldb-commits

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

llvm-svn: 242769
2015-07-21 11:30:39 +00:00
Bruce Mitchener 81457feffb [lldb-mi] Remove unused portions of MIDataTypes.h.
Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 242768
2015-07-21 11:27:40 +00:00
Bruce Mitchener 6268bacc0f [lldb-mi] size_t rather than MIuint for arg counts.
Summary: [lldb-mi] size_t rather than MIuint for arg counts.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 242762
2015-07-21 08:07:27 +00:00
Greg Clayton 2e309076f2 More packet performance improvements.
Changed the "jthreads" key/value in the stop reply packets to be "jstopinfo". This JSON only contains threads with valid stop reasons and allows us not to have to ask about other threads via qThreadStopInfo when we are stepping. The "jstopinfo" only gets sent if there are more than one thread since the stop reply packet contains all the info needed for a single thread.

Added a Process::WillPublicStop() in case process subclasses want to do any extra gathering for public stops. For ProcessGDBRemote, we end up sending a jThreadsInfo packet to gather all expedited registers, expedited memory and MacOSX queue information. We only do this for public stops to minimize the packets we send when we have multiple private stops. Multiple private stops happen when a source level single step, step into or step out run the process multiple times while implementing the stepping, and none of these private stops make it out to the UI via notifications because they are private stops. 

llvm-svn: 242593
2015-07-17 23:42:28 +00:00
Pavel Labath 4a0d7bcaa7 Fix liblldb linking on RHEL 6 (bug #24140)
Patch by Eugene Zelenko.

llvm-svn: 242525
2015-07-17 15:26:27 +00:00
Jason Molenda d25d72fb79 Only include the stack memory for the caller stack
frame, don't go any further, in RNBRemote::SendStopReplyPacketForThread.

These are the memory pre-fetches in the T05 packet and are
included in every private stop that lldb does.  lldb needs, at most,
the caller stack frame so we're sending more data than needed by
including additional stack memory prefetches in this reply packet.

Once we've stopped for a public stop, we're going to do a jThreadsInfo
which will include the stack memory prefetches for all threads, 
including the one which had the stop reason.

llvm-svn: 242380
2015-07-16 03:42:40 +00:00
Greg Clayton a5801ade5a Added the ability to get JSON thread stop info with thread ID and stop info only in the normal stop reply packets using the new "jthreads" key value pair.
This allows stepping operations that don't ever do a public stop to get all the info they need without having to send a jThreadsInfo packet since those tend to be large.

This patch will be followed by a patch that will detect when we do a public stop, and when that happens we will send a jThreadsInfo packet at that time to get all expedited registers and memory.

llvm-svn: 242352
2015-07-15 22:59:03 +00:00
Dawn Perchik a3ff7032c8 Fix -data-info-line when source includes column number.
This fixes an off-by-one bug in CMICmdCmdDataInfoLine::Acknowledge.  Given:
    LineEntry: \[0x0000000100000f37-0x0000000100000f45\): /path/to/file:123:1
-data-info-line would report the line as 12, omitting the last digit.

Reviewed by: ki.stfu, abidh
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11209

llvm-svn: 242306
2015-07-15 17:25:01 +00:00
Oleksiy Vyalov df62ed3f8b Fix temp port file path generation in lldb-platform.
http://reviews.llvm.org/D11152

llvm-svn: 242182
2015-07-14 18:54:52 +00:00
Dawn Perchik aa80814c69 Fix debugserver build breakage on Mavericks after lldb commit svn 240728
vm_kernel_page_size appears to not be defined on OSX Mavericks, so the
build fails.  This patch fixes the build by calculating the pagesize if
_VM_PAGE_SIZE_H_ is not defined.

llvm-svn: 242114
2015-07-14 03:50:10 +00:00
Dawn Perchik 6145ad2d36 [lldb-mi] Add const qualifier to vMITextLine in InterpretCommandThisDriver.
llvm-svn: 242057
2015-07-13 20:16:13 +00:00
Pavel Labath 77dc9569c6 Introduce a MainLoop class and switch llgs to use it
Summary:
This is the first part of our effort to make llgs single threaded. Currently, llgs consists of
about three threads and the synchronisation between them is a major source of latency when
debugging linux and android applications.

In order to be able to go single threaded, we must have the ability to listen for events from
multiple sources (primarily, client commands coming over the network and debug events from the
inferior) and perform necessary actions. For this reason I introduce the concept of a MainLoop.
A main loop has the ability to register callback's which will be invoked upon receipt of certain
events. MainLoopPosix has the ability to listen for file descriptors and signals.

For the moment, I have merely made the GDBRemoteCommunicationServerLLGS class use MainLoop
instead of waiting on the network socket directly, but the other threads still remain. In the
followup patches I indend to migrate NativeProcessLinux to this class and remove the remaining
threads.

Reviewers: ovyalov, clayborg, amccarth, zturner, emaste

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 242018
2015-07-13 10:44:55 +00:00
Jason Molenda 20ee21bde6 Add a another packet to the gdb-remote protocol,
jGetLoadedDynamicLibrariesInfos.  This packet is similar to
qXfer:libraries:read except that lldb supplies the number of solibs
that should be reported about, and the start address for the list
of them.  At the initial process launch we'll read the full list
of solibs linked by the process -- at this point we could be using
qXfer:libraries:read -- but on subsequence solib-loaded notifications,
we'll be fetching a smaller number of solibs, often only one or two.

A typical Mac/iOS GUI app may have a couple hundred different 
solibs loaded  - doing all of the loads via memory reads takes 
a couple of megabytes of traffic between lldb and debugserver.
Having debugserver summarize the load addresses of all the solibs
and sending it in JSON requires a couple of hundred kilobytes
of traffic.  It's a significant performance improvement when 
communicating over a slower channel.

This patch leaves all of the logic for loading the libraries
in DynamicLoaderMacOSXDYLD -- it only call over ot ProcesGDBRemote
to get the JSON result.

If the jGetLoadedDynamicLibrariesInfos packet is not implemented,
the normal technique of using memory read packets to get all of
the details from the target will be used.

<rdar://problem/21007465>

llvm-svn: 241964
2015-07-10 23:15:22 +00:00
Bruce Mitchener 0a07397433 [lldb-mi] Remove unused typedefs.
Summary: [lldb-mi] Remove unused typedefs.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 241791
2015-07-09 08:45:26 +00:00
Jim Ingham 22302e5995 Make command files specified to the driver actually print their
results if the -Q option is not provided.  Also took out the quietly
option from AddInitialCommand, we don't use that to set this option,
we use the override set by the -Q option.

<rdar://problem/21232087>

llvm-svn: 241652
2015-07-08 00:59:59 +00:00
Greg Clayton a7b2690cb3 Fix debugserver build after someone moved StrintExtractor.h.
llvm-svn: 241628
2015-07-07 21:27:08 +00:00
Bruce Mitchener 6c971ec217 [lldb-mi] Spell resource string name correctly.
Broardcaster -> Broadcaster

Summary: [lldb-mi] Spell resource string name correctly.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 241591
2015-07-07 14:54:07 +00:00
Bruce Mitchener c5638f915b [lldb-mi] Fix typo in variable name.
Seperated -> Separated.

Summary: [lldb-mi] Fix typo in variable name.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 241586
2015-07-07 14:26:28 +00:00
Bruce Mitchener ae4c026765 [lldb-mi] Fix typos
llvm-svn: 241585
2015-07-07 14:04:40 +00:00
Jason Molenda 3f661e0899 When debugserver is running on an iOS device, call
proc_set_wakemon_params() to raise the limit on the # of wakeups
per second that are acceptable before the system may send an 
EXC_RESOURCE signal to debugserver.  

<rdar://problem/19631512> 

llvm-svn: 241553
2015-07-07 04:15:43 +00:00
Oleksiy Vyalov 298be46e3f Add --port-file flag to lldb-platform to store port number which platform is listening.
http://reviews.llvm.org/D10886

llvm-svn: 241479
2015-07-06 18:05:19 +00:00
Bruce Mitchener 88205302c1 [lldb-mi] Use 'override' on overridden virtual methods.
Summary: [lldb-mi] Use 'override' on overridden virtual methods.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 241457
2015-07-06 15:48:55 +00:00
Bruce Mitchener 6b067074f9 [lldb-mi] Fix misc. typos in comments.
llvm-svn: 241448
2015-07-06 14:37:53 +00:00
Bruce Mitchener 0b6ba7c668 Use string::find(char) for single character strings.
Summary: Use string::find(char) for single character strings.

Reviewers: abidh, ki.stfu, clayborg

Subscribers: lldb-commits

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

llvm-svn: 241390
2015-07-04 05:16:58 +00:00
Bruce Mitchener e86c6fa3dc [lldb-mi] Use size_t where appropriate.
Summary:
Many places should have been using size_t rather than MIuint or
MIint. This is particularly true for code that uses std::string::find(),
std::string::rfind(), std::string::size(), and related methods.

Reviewers: abidh, ki.stfu, domipheus

Subscribers: lldb-commits

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

llvm-svn: 241360
2015-07-03 15:40:44 +00:00
Bruce Mitchener 201dec7dc2 [lldb-mi] Remove unnecessary const_cast.
Summary: Remove unnecessary const_cast.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 241359
2015-07-03 15:31:32 +00:00
Bruce Mitchener 44519f8608 [lldb-mi] GetVarFormatForChar needn't pass a char by const ref.
Summary: GetVarFormatForChar needn't pass a char by const ref.

Reviewers: ki.stfu, abidh

Subscribers: lldb-commits

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

llvm-svn: 241358
2015-07-03 15:30:48 +00:00
Bruce Mitchener 53be30077f [lldb-mi] Remove unnecessary members from MICmdArgContext.
Summary:
Remove unnecessary members from MICmdArgContext.

We don't need constants for these value stored in every instance
of the class.

Reviewers: ki.stfu, abidh

Subscribers: lldb-commits

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

llvm-svn: 241357
2015-07-03 15:30:38 +00:00
Bruce Mitchener d0ee89d81a [lldb-mi] Typo fixes
Summary: Some more typo fixes in LLDB-MI.

Reviewers: ki.stfu, abidh

Subscribers: lldb-commits

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

llvm-svn: 241351
2015-07-03 14:09:56 +00:00
Bruce Mitchener 3b25b479bf Remove typedefs for MIchar, MIschar, MIuchar.
Summary:
This is a start on bringing lldb-mi more in line with the typical
LLDB coding style. This just removes the usage of the typedefs and
doesn't yet clean up any logic or other issues. (This is to keep
the review simple.)

Reviewers: abidh, ki.stfu, domipheus

Subscribers: lldb-commits

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

llvm-svn: 241349
2015-07-03 13:45:34 +00:00
Bruce Mitchener 68dc553fda Fix type signature for CMIUtilString::IsAllValidAlphaAndNumeric.
This should take a "const char*" not a "char &".

Summary:
Fix type signature for CMIUtilString::IsAllValidAlphaAndNumeric.

This passes the MI tests on Mac OS X.

Reviewers: ki.stfu, abidh, domipheus

Subscribers: lldb-commits-list

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

llvm-svn: 241322
2015-07-03 07:28:11 +00:00
Bruce Mitchener cb30079f41 Typo fixes.
Summary: Some typo fixes in comments in lldb-mi.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits-list

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

llvm-svn: 241317
2015-07-03 03:54:17 +00:00
Keno Fischer 121c1c54bf Add -lpthread to LLDB shared lib link line unconditionally
Usually -lpthread is included due to LLVM link options,
but when LLVM threading is disabled, this does not happen.
pthread is still needed however because LLDB uses threading
regardless of whether LLVM is built with threading support or not.

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

llvm-svn: 241006
2015-06-29 21:52:45 +00:00
Greg Clayton 2e59d4fffe More packet reduction when debugging with GDB server.
- Avoid sending the qfThreadInfo, qsThreadInfo packets if we have a stop reply packet with the threads already (save 2 round trip packets)
- Include the qname, qserial and qkind in the JSON info
- Report the qname, qserial and qkind to the thread so it can cache it to avoid many packets on MacOSX and iOS
- Don't clear all discoverable settings when we exec, just the ones we need to saves 1-5 packets for each exec.

llvm-svn: 240988
2015-06-29 20:08:51 +00:00
Pavel Labath 17cace6475 fix lldb-server linking on RHEL 6 (bug #23774)
Patch by: Eugene Zelenko

llvm-svn: 240933
2015-06-29 10:30:06 +00:00
Han Ming Ong 459a23e0a3 Use the right ifdef macro, reviewed by Jason
llvm-svn: 240739
2015-06-26 00:04:51 +00:00
Han Ming Ong 74c14819ce rdar://problem/21469556
Make sure that the memory report is correct for 64-bit devices.

llvm-svn: 240728
2015-06-25 23:39:56 +00:00
Greg Clayton c9a2f6efd4 Commit file that was missing 240466.
<rdar://problem/21494354>

llvm-svn: 240712
2015-06-25 22:34:08 +00:00
Greg Clayton 358cf1ea30 Resubmitting 240466 after fixing the linux test suite failures.
A few extras were fixed

- Symbol::GetAddress() now returns an Address object, not a reference. There were places where people were accessing the address of a symbol when the symbol's value wasn't an address symbol. On MacOSX, undefined symbols have a value zero and some places where using the symbol's address and getting an absolute address of zero (since an Address object with no section and an m_offset whose value isn't LLDB_INVALID_ADDRESS is considered an absolute address). So fixing this required some changes to make sure people were getting what they expected. 
- Since some places want to access the address as a reference, I added a few new functions to symbol:
    Address &Symbol::GetAddressRef();
    const Address &Symbol::GetAddressRef() const;

Linux test suite passes just fine now.

<rdar://problem/21494354>

llvm-svn: 240702
2015-06-25 21:46:34 +00:00
Ilia K 0b9e04b7c4 Expand result with type char* to string in -data-evaluate-expression
Summary:
Expand result with type char* to string in -data-evaluate-expression.
was:
  ```
    -data-evaluate-expression str
    ^done,value="0x00007fffffffece0"
  ```
now:
  ```
    -data-evaluate-expression str
    ^done,value="0x00007fffffffece0 \"hello\""
  ```

All tests pass on Linux.

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

Reviewers: abidh

Reviewed By: abidh

Subscribers: lldb-commits, dawn, abidh

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

llvm-svn: 240631
2015-06-25 11:10:12 +00:00
Greg Clayton 0b90be1c4f Implement the "qSymbol" packet in order to be able to read queue information in debugserver and return the info in the stop reply packets.
A "qSymbol::" is sent when shared libraries have been loaded by hooking into the Process::ModulesDidLoad() function from within ProcessGDBRemote. This function was made virtual so that the ProcessGDBRemote version is called, which then first calls the Process::ModulesDidLoad(), and then it queries for any symbol lookups that the remote GDB server might want to do.

This allows debugserver to request the "dispatch_queue_offsets" symbol so that it can read the queue name, queue kind and queue serial number and include this data as part of the stop reply packet. Previously each thread would have to do 3 memory reads in order to read the queue name.

This is part of reducing the number of packets that are sent between LLDB and the remote GDB server.

<rdar://problem/21494354>

llvm-svn: 240466
2015-06-23 21:27:50 +00:00
Chaoren Lin 7a30608026 Revert "Reduced packet counts to the remote GDB server where possible."
This reverts commit 0cc0745ea9c68d7fdcadc9904cee3f13c96dae60.

Due to breakage on Linux build bot:

http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/3436

llvm-svn: 240371
2015-06-23 03:17:01 +00:00
Greg Clayton ffb2d44ab9 Reduced packet counts to the remote GDB server where possible.
We have been working on reducing the packet count that is sent between LLDB and the debugserver on MacOSX and iOS. Our approach to this was to reduce the packets required when debugging multiple threads. We currently make one qThreadStopInfoXXXX call (where XXXX is the thread ID in hex) per thread except the thread that stopped with a stop reply packet. In order to implement multiple thread infos in a single reply, we need to use structured data, which means JSON. The new jThreadsInfo packet will attempt to retrieve all thread infos in a single packet. The data is very similar to the stop reply packets, but packaged in JSON and uses JSON arrays where applicable. The JSON output looks like:


[
  { "tid":1580681,
    "metype":6,
    "medata":[2,0],
    "reason":"exception",
    "qaddr":140735118423168,
    "registers": {
      "0":"8000000000000000",
      "1":"0000000000000000",
      "2":"20fabf5fff7f0000",
      "3":"e8f8bf5fff7f0000",
      "4":"0100000000000000",
      "5":"d8f8bf5fff7f0000",
      "6":"b0f8bf5fff7f0000",
      "7":"20f4bf5fff7f0000",
      "8":"8000000000000000",
      "9":"61a8db78a61500db",
      "10":"3200000000000000",
      "11":"4602000000000000",
      "12":"0000000000000000",
      "13":"0000000000000000",
      "14":"0000000000000000",
      "15":"0000000000000000",
      "16":"960b000001000000",
      "17":"0202000000000000",
      "18":"2b00000000000000",
      "19":"0000000000000000",
      "20":"0000000000000000"},
    "memory":[
      {"address":140734799804592,"bytes":"c8f8bf5fff7f0000c9a59e8cff7f0000"},
      {"address":140734799804616,"bytes":"00000000000000000100000000000000"}
    ]
  }
]

It contains an array of dicitionaries with all of the key value pairs that are normally in the stop reply packet. Including the expedited registers. Notice that is also contains expedited memory in the "memory" key. Any values in this memory will get included in a new L1 cache in lldb_private::Process where if a memory read request is made and that memory request fits into one of the L1 memory cache blocks, it will use that memory data. If a memory request fails in the L1 cache, it will fall back to the L2 cache which is the same block sized caching we were using before these changes. This allows a process to expedite memory that you are likely to use and it reduces packet count. On MacOSX with debugserver, we expedite the frame pointer backchain for a thread (up to 256 entries) by reading 2 pointers worth of bytes at the frame pointer (for the previous FP and PC), and follow the backchain. Most backtraces on MacOSX and iOS now don't require us to read any memory!

We will try these packets out and if successful, we should port these to lldb-server in the near future. 

<rdar://problem/21494354>

llvm-svn: 240354
2015-06-22 23:12:45 +00:00
Keno Fischer c847e7e543 Don't link ObjCARCOpts twice. Fixes PR22543
ObjCARCOpts is already included by ClangCodeGen. Linking it again causes the error in PR22543.

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

llvm-svn: 240104
2015-06-18 23:45:51 +00:00
Jason Molenda 91ffe0a570 Add a new wart, I mean feature, on to gdb-remote protocol: compression.
For some communication channels, sending large packets can be very 
slow.  In those cases, it may be faster to compress the contents of
the packet on the target device and decompress it on the debug host
system.  For instance, communicating with a device using something
like Bluetooth may be an environment where this tradeoff is a good one.

This patch adds a new field to the response to the "qSupported" packet
(which returns a "qXfer:features:" response) -- SupportedCompressions
and DefaultCompressionMinSize.  These tell you what the remote
stub can support.

lldb, if it wants to enable compression and can handle one of those 
algorithms, it can send a QEnableCompression packet specifying the
algorithm and optionally the minimum packet size to use compression
on.  lldb may have better knowledge about the best tradeoff for
a given communication channel.

I added support to debugserver an lldb to use the zlib APIs
(if -DHAVE_LIBZ=1 is in CFLAGS and -lz is in LDFLAGS) and the
libcompression APIs on Mac OS X 10.11 and later 
(if -DHAVE_LIBCOMPRESSION=1).  libz "zlib-deflate" compression.
libcompression can support deflate, lz4, lzma, and a proprietary
lzfse algorithm.  libcompression has been hand-tuned for Apple
hardware so it should be preferred if available.

debugserver currently only adds the SupportedCompressions when
it is being run on an Apple watch (TARGET_OS_WATCH).  Comment
that #if out from RNBRemote.cpp if you want to enable it to
see how it works.  I haven't tested this on a native system
configuration but surely it will be slower to compress & decompress
the packets in a same-system debug session.

I haven't had a chance to add support for this to 
GDBRemoteCommunciationServer.cpp yet.

<rdar://problem/21090180> 

llvm-svn: 240066
2015-06-18 21:46:06 +00:00
Bruce Mitchener 58ef391f3e Fix a variety of typos.
No functional change.

llvm-svn: 239995
2015-06-18 05:27:05 +00:00
Dawn Perchik 73404c3c89 Add help for lldb-mi --source/-s option (MI)
Test Plan: lldb-mi --interpreter --help
Reviewed By: clayborg, abidh
Differential Revision: http://reviews.llvm.org/D10489

llvm-svn: 239975
2015-06-17 23:43:29 +00:00
Dawn Perchik 86e90b3cfa Fix comments (MI).
llvm-svn: 239861
2015-06-16 22:53:27 +00:00
Bruce Mitchener 1425b47773 [LLDB-MI] Properly detect missing mandatory arguments to MI commands
Summary:
Previously if an MI command had **X** mandatory and **Y** optional arguments you could provide **X** or more optional arguments without providing any of the mandatory arguments, and the argument validation code wouldn't complain.

For example this would pass argument validation even though the mandatory **address** and **count** arguments are missing:

-data-read-memory-bytes --thread 1 --frame 0

Part of the problem was that an empty string was considered a valid value for a mandatory argument, which didn't make much sense.

Patch by Vadim Macagon. Thanks!

Test Plan:
./dotest.py -A x86_64 -C clang --executable $BUILDDIR/bin/lldb tools/lldb-mi/

No unexpected failures on my Ubuntu 14.10 64bit Virtualbox VM.

Reviewers: domipheus, ki.stfu, abidh

Reviewed By: ki.stfu, abidh

Subscribers: brucem, lldb-commits

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

llvm-svn: 239297
2015-06-08 11:15:09 +00:00
Pavel Labath 83a4b3f225 Remove unused editline includes
LLDB included editline in a couple of places, not respecting LLDB_DISABLE_LIBEDIT. As far as I can tell, these includes are not used, so I am removing them.

llvm-svn: 239199
2015-06-05 23:14:14 +00:00
Jason Molenda 294af5ce9c Make the function that parses the json packets in debugserver
a little more resilient to freely formatted json.  Greg's change
in r238279 made the json output from StructuredData unconditionally
pretty-printed and the spaces were confusing debugserver.

llvm-svn: 239013
2015-06-04 06:03:03 +00:00
Andrew Wilkins 7175f16cdb [lldb] Enable building with Cmake/BUILD_SHARED_LIBS
Summary:
Several changes to fix CMake builds of LLDB with the
BUILD_SHARED_LIBS setting on.

- Force all internal libraries to be built STATIC.
- Add additional library dependencies (pthread, dl,
  runtimedyld).
- modify finalisation of SWIG wrapper to symlink the
  "lib" dir into python/site-packages, so _lldb.so's
  RPATH resolves.

Test Plan: Verified one test case with "dotest.py".

Reviewers: sylvestre.ledru, zturner

Reviewed By: zturner

Subscribers: zturner, ted, tberghammer, emaste, lldb-commits

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

llvm-svn: 239007
2015-06-04 03:12:37 +00:00
Ying Chen 223dd95f24 Add '+' sign at the end of echo message for debugserver
Summary:
-ammend to r238538
-Fix test failure of TestGdbRemoteAuxvSupport.py and TestLldbGdbServer.py on MacOSX

Test Plan:
./dotest -p TestGdbRemoteAuxvSupport.py
./dotest -p TestLldbGdbServer.py

Reviewers: chaoren, clayborg

Subscribers: lldb-commits

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

llvm-svn: 238595
2015-05-29 18:44:08 +00:00
Zachary Turner 1124045ac7 Don't #include "lldb-python.h" from anywhere.
Since interaction with the python interpreter is moving towards
being more isolated, we won't be able to include this header from
normal files anymore, all includes of it should be localized to
the python library which will live under source/bindings/API/Python
after a future patch.

None of the files that were including this header actually depended
on it anyway, so it was just a dead include in every single instance.

llvm-svn: 238581
2015-05-29 17:41:47 +00:00
Hafiz Abid Qadeer ba9614f643 Improve handling of print value argument in -stack-list-* commands.
It was reviewed in http://reviews.llvm.org/D10106.
Patch by paulmaybee.

llvm-svn: 238572
2015-05-29 16:48:40 +00:00
Greg Clayton b30c50c8fa Add a new "qEcho" packet with the following format:
qEcho:%s

where '%s' is any valid string. The response to this packet is the exact packet itself with no changes, just reply with what you received!

This will help us to recover from packets timing out much more gracefully. Currently if a packet times out, LLDB quickly will hose up the debug session. For example, if we send a "abc" packet and we expect "ABC" back in response, but the "abc" command takes longer than the current timeout value this will happen:


--> "abc"
<-- <<<error: timeout>>>

Now we want to send "def" and get "DEF" back:

--> "def"
<-- "ABC"

We got the wrong response for the "def" packet because we didn't sync up with the server to clear any current responses from previously issues commands.

The fix is to modify GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock() so that when it gets a timeout, it syncs itself up with the client by sending a "qEcho:%u" where %u is an increasing integer, one for each time we timeout. We then wait for 3 timeout periods to sync back up. So the above "abc" session would look like:

--> "abc"
<-- <<<error: timeout>>> 1 second
--> "qEcho:1"
<-- <<<error: timeout>>> 1 second
<-- <<<error: timeout>>> 1 second
<-- "abc"
<-- "qEcho:1"

The first timeout is from trying to get the response, then we know we timed out and we send the "qEcho:1" packet and wait for 3 timeout periods to get back in sync knowing that we might actually get the response for the "abc" packet in the mean time...

In this case we would actually succeed in getting the response for "abc". But lets say the remote GDB server is deadlocked and will never response, it would look like:

--> "abc"
<-- <<<error: timeout>>> 1 second
--> "qEcho:1"
<-- <<<error: timeout>>> 1 second
<-- <<<error: timeout>>> 1 second
<-- <<<error: timeout>>> 1 second

We then disconnect and say we lost connection.

We might also have a bad GDB server that just dropped the "abc" packet on the floor. We can still recover in this case and it would look like:

--> "abc"
<-- <<<error: timeout>>> 1 second
--> "qEcho:1"
<-- "qEcho:1"

Then we know our remote GDB server is still alive and well, and it just dropped the "abc" response on the floor and we can continue to debug.

<rdar://problem/21082939>

llvm-svn: 238530
2015-05-29 00:01:55 +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
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
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
Chaoren Lin 9afad0e954 Fix lldb-platform usage string.
llvm-svn: 237966
2015-05-21 22:43:43 +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
Ilia K 5e47696da2 Don't print =breakpoint-created if BP info was emitted in the result record (MI)
llvm-svn: 237676
2015-05-19 09:57:56 +00:00
Ilia K 3ac979c4da Fix CMICmdArgValPrintValues::Validate & enable 4 tests that were XFAIL'ed in r237437 (MI)
llvm-svn: 237443
2015-05-15 12:33:04 +00:00
Ilia K 25d29ba5ec Set specific values for VariableInfoFormat_e enum and remove kNumVariableInfoFormats (MI)
llvm-svn: 237438
2015-05-15 11:55:09 +00:00
Ilia K 27e2c058c9 Fix parsing of print-values arg (MI)
# Add CMICmdArgValPrintValues argument
# Rework -stack-list-arguments/-stack-list-locals/-stack-list-variables/-var-update/-var-list-children
  commands to use the CMICmdArgValPrintValues argument instead of usage of pair of non-mandatory
  arguments like: CMICmdArgValNumber(0) || CMICmdArgValLongOptions("no-values")

llvm-svn: 237429
2015-05-15 09:46:28 +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 0e919bca7f Refactor lldb-mi's prompt
Summary:
This patch fixes/cleans code around of (gdb) prompt:
# Add CMICmnStreamStdout::WritePrompt
# Clean up CMICmnStreamStdout::TextToStdout (don't lock
  the m_mutex twice because it will be locked in CMICmnStreamStdout::WritePriv)
# Remove unused CMICmnStreamStdin::m_bShowPrompt field
# Refactor CMICmnLLDBDebuggerHandleEvents to use CMICmnStreamStdout::WritePrompt
  instead of TextToStdout("(gdb)")
# Refactor CMIDriver to use CMICmnStreamStdout::WritePrompt instead of
  ```
    if (bOk && m_rStdin.GetEnablePrompt())
        bOk = m_rStdOut.WriteMIResponse(m_rStdin.GetPrompt());
  ```

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

Reviewers: abidh

Reviewed By: abidh

Subscribers: lldb-commits, abidh

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

llvm-svn: 237248
2015-05-13 12:18:20 +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
Ilia K d84713bd86 Show error message from failed evaluation when doing -var-create
Summary:
When -var-create fails, we will now show the error message from the failed evaluation if it is available.

Patch from chuckr@microsoft.com

Test Plan: I fixed the MiVarTestCase.test_lldbmi_eval test to expect the new error string. All MI tests passing on OS X.

Reviewers: abidh, ChuckR

Subscribers: greggm, lldb-commits, paulmaybee

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

llvm-svn: 237094
2015-05-12 06:15:16 +00:00
Ilia K f44ab29e05 Escape strings in disassembly comments.
Summary: Patch from chuckr@microsoft.com

Reviewers: abidh, ChuckR

Subscribers: paulmaybee, lldb-commits

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

llvm-svn: 237092
2015-05-12 05:55:23 +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
Ilia K fd0325b81e Fix =breakpoint-created event after creation of BP (MI)
For example:
was:
```
$ bin/lldb-mi ~/p/hello
[...]
-break-insert main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000e2d",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="14",times="0",original-location="main"}
(gdb)
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000e2d",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="14",times="0",original-location="main"}
```

now:
```
$ bin/lldb-mi ~/p/hello
[...]
-break-insert main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000e2d",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="14",times="0",original-location="main"}
(gdb)
=breakpoint-created,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000e2d",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="14",times="0",original-location="main"}
```

llvm-svn: 236837
2015-05-08 12:18:11 +00:00
Ilia K 3e6f515531 Remove duplicated code in CMICmdCmdBreakInsert::Acknowledge (MI)
llvm-svn: 236834
2015-05-08 12:11:13 +00:00
Ilia K e077ef7a69 Fix -break-insert without -f to cause an error if BP not resolved (MI)
For example:
was:
```
$ bin/lldb-mi ~/p/hello
[...]
-break-insert main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000e2d",func="main",file="hello.cpp",fullname="/Users/Ilia
hello.cpp",line="14",pending=["main"],times="0",original-location="main"}
```

now:
```
$ bin/lldb-mi ~/p/hello
[...]
-break-insert main
^error,msg="Command 'break-insert'. Breakpoint location 'main' not found"
```

llvm-svn: 236832
2015-05-08 12:09:56 +00:00
Ilia K 913b2d4fd3 Fix BP address for local symbols if target not launched (MI)
For example:
was:
```
$ bin/lldb-mi ~/p/hello
[...]
-break-insert -f main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffffffffffff",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="14",pending=["main"],times="0",original-location="main"}
```

now:
```
$ bin/lldb-mi ~/p/hello
[...]
-break-insert -f main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000e2d",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="14",pending=["main"],times="0",original-location="main"}
```

llvm-svn: 236830
2015-05-08 12:06:17 +00:00
Ilia K b9bfd969e3 Add support for Unicode strings in CMICmnLLDBUtilSBValue::GetValue (MI)
This patch includes the following changes:
# Add CMIUtilString::ConvertToASCII to convert unicode to ASCII (MI)
# Rework CMICmnLLDBUtilSBValue::GetSimpleValue to print wide/unicode char (MI)
## Add CMICmnLLDBUtilSBValue::GetSimpleValueChar
## Extend CMICmnLLDBUtilSBValue::IsCharType to accept char16_t/char32_t
## Don't ignore the fail_value in SBValue::GetValueAsUnsigned
# Rework CMIUtilString::ConvertToASCII (MI)
## Don't use templates
## Change the function signature to convert signle characters (was std::basic_string)
## Rename CMIUtilString::ConvertToASCII to CMIUtilString::ConvertToPrintableASCII
# Add CMIUtilString::ConvertToPrintableASCII for char (MI)
## Refactor CMIUtilString::Escape
## Simplify CMICmnLLDBUtilSBValue::GetSimpleValueChar for char
# Add char16_t* and char32_t* support in CMICmnLLDBUtilSBValue::GetSimpleValue (MI)
## Add CMICmnLLDBUtilSBValue::GetSimpleValueCStringPointer
## Add CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory2
   (it's extended version of CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory)
# Improve error checking in CMICmnLLDBUtilSBValue::GetSimpleValueChar (MI)
# Refactor CMICmnLLDBUtilSBValue (MI)
## Remove CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory
   (use CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory2 instead)
## Rename CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory2 to
   CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory
## Move CMICmnLLDBUtilSBValue::GetValueCString to private methods
## Rename CMICmnLLDBUtilSBValue::GetValueCString to
   CMICmnLLDBUtilSBValue::GetSimpleValueCStringArray
## Remove CMICmnLLDBUtilSBValue::GetChildValueCString
# Improve MiGdbSetShowTestCase.test_lldbmi_gdb_set_show_print_char_array_as_string test to check char16_t/char32_t (MI)
# Fix CMICmnLLDBUtilSBValue::GetSimpleValueCStringArray for Unicode (MI)
## Fix handling of char16_t and char32_t
## Improve CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory to read
   variables of type char[]: add vnMaxLen argument
## Turn on few cases to check char16_t[] and char32_t[] output in
   MiGdbSetShowTestCase.test_lldbmi_gdb_set_show_print_char_array_as_string
# Remove unnecessary checks in CMICmnLLDBUtilSBValue (MI)

llvm-svn: 236827
2015-05-08 11:21:13 +00:00
Ilia K 24862eaca0 Fix -var-create for undefined variables (MI)
llvm-svn: 236825
2015-05-08 10:58:45 +00:00
Ilia K a4cfe98a86 Print process's output line by line (MI)
For example:
was:
```
@"'\r\n` - it's \\ni=1\r\nj=2\r\nx=3\r\ny=4\r\nargc: /Users/IliaK/p/hello\r\nargc: (null)\r\n"
```

now:
```
@"'\r\n"
@"` - it's \\ni=1\r\n"
@"j=2\r\n"
@"x=3\r\n"
@"y=4\r\n"
@"argc: /Users/IliaK/p/hello\r\n"
@"argc: (null)\r\n"
```

llvm-svn: 236824
2015-05-08 10:52:50 +00:00
Ilia K 307b917696 Fix -var-list-children command (MI)
This patch incldues the following:
# Add from/to arguments in -var-list-children command (MI)
## Handle from and to args
## Don't print children=[] if numchild is 0
## A bit refactoring
## Add MiVarTestCase.test_lldbmi_var_list_children test
# Refactor -var-list-children (MI)
## Remove CMICmdCmdVarListChildren::VecMIValueResult_t
## Add CMICmdCmdVarListChildren::m_miValueList
## Remove CMICmdCmdVarListChildren::m_vecMiValueResult
   (use CMICmdCmdVarListChildren::m_miValueList instead)
## Print error message if value is invalid:
   ```
     ^error,msg="variable invalid"
   ```
## Refactor CMICmdCmdVarListChildren::Acknowledge and remove duplicated code
## Don't print children=[] if numchild is 0
## Add error checking
## Use CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e for print-values
## Add few more empty-range test cases in MiVarTestCase.test_lldbmi_var_list_children
#Improve MiVarTestCase.test_lldbmi_var_list_children test (MI)

llvm-svn: 236820
2015-05-08 10:10:14 +00:00
Greg Clayton 3d415cd2cd qProcessInfo was not correctly detecting the sysctl value for "hw.cpu64bit_capable".
It was just detecting the existance of the value. If it gets the value correctly, we need to check that it is non-zero to see if cpu64bit_capable should be true.

<rdar://problem/20857426> 

llvm-svn: 236759
2015-05-07 18:42:03 +00:00
Ilia K 7bb59b360b Implement -target-attach and -target-detach
Summary:
This changes add -target-attach and -target-detach. 

-target-attach allows lldb-mi to attach to an existing process by it's process id, matching gdb mi's syntax of '-target-attach <pid'. Additionally, support has been added for attaching to a process by name using '-target-attach -n <name>'. Combining this with --waitfor will allow lldb mi to attach to a process by name when the process starts. 

-target-detach simply detaches from the current process

Patch from chuckr@microsoft.com

Test Plan: I have added three tests, one each for -target-attach <pid>, -target-attach -n <name>, and -target-attach -n <name> --waitfor

Reviewers: paulmaybee, abidh, ChuckR

Subscribers: greggm, lldb-commits

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

llvm-svn: 236705
2015-05-07 07:38:49 +00:00
Ilia K d3da77e84e Add -s/--source option support (MI)
Summary:
This patch adds -s/--source option to execute source file with prepared command.
For example:
```
$ cat start_script 
target create ~/p/hello
process launch -s
continue
$ bin/lldb-mi -s start_script 
(gdb)
target create ~/p/hello
Current executable set to '~/p/hello' (x86_64).
^done
(gdb)
process launch -s
=shlibs-added,shlib-info=[num="1",name="hello",dyld-addr="-",reason="dyld",path="/Users/IliaK/p/hello",loaded_addr="-",dsym-objpath="/Users/IliaK/p/hello.dSYM/Contents/Resources/DWARF/hello"]
Process 33289 launched: '/Users/IliaK/p/hello' (x86_64)
^done
(gdb)
continue
=thread-created,id="1",group-id="i1"
=thread-selected,id="1"
(gdb)
Process 33289 resuming
Process 33289 exited with status = 0 (0x00000000) 
^done
```

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

Reviewers: abidh

Reviewed By: abidh

Subscribers: lldb-commits, abidh

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

llvm-svn: 236703
2015-05-07 06:51:46 +00:00
Ilia K 8913012ee9 Remove quit hook in CMIDriver::DoMainLoop (MI)
Summary:
This patch removes quit hook and fixes 1 bug:
# Fix "quit" hook in CMIDriver::DoMainLoop (MI)
# Fix bug when the handler thread exits without any notification (MI)
# Fix a race condition in CMICmnLLDBDebugger::MonitorSBListenerEvents (MI)

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

Reviewers: abidh

Reviewed By: abidh

Subscribers: lldb-commits, abidh

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

llvm-svn: 236702
2015-05-07 06:45:42 +00:00
Bruce Mitchener 2873469ec0 Fix LLDB-MI -data-read-memory-bytes command to comply with GDB/MI spec
Summary:
- The address argument can now be an expression (e.g. &array), it's no longer restricted to being just a number literal.
- The -o (offset) option is now properly handled, not just silently ignored.
- The --thread option is now properly handled.
- A new --frame option has been added for consistency with GDB.
- Added a new test to verify old and new functionality.

Patch by Vadim Macagon. Thanks!

Test Plan: ./dotest.py -A x86_64 -C clang --executable $BUILDDIR/bin/lldb tools/lldb-mi/data

Reviewers: domipheus, abidh, ki.stfu

Reviewed By: abidh, ki.stfu

Subscribers: brucem, lldb-commits

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

llvm-svn: 236694
2015-05-07 05:32:13 +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
Jason Molenda 29db330ce7 Use #include "lldb/API/SBCommandReturnObject.h" instead of <...>.
llvm-svn: 236284
2015-04-30 23:31:04 +00:00
Ilia K ebb4dfd350 Rework =shlibs-added/=shlibs-removed
Summary:
This patch includes the following:
* Rename =shlibs-added/=shlibs-removed to standard =library-loaded/=library-unloaded
* Remove redundant fields
* Add extra symbols-loaded/symbols-path and loaded_addr fields
* Rename CMICmnMIOutOfBandRecord::eOutOfBand_TargetModulesLoaded/eOutOfBand_TargetModulesUnloaded to CMICmnMIOutOfBandRecord::eOutOfBand_TargetModuleLoaded/eOutOfBand_TargetModuleUnloaded

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

Reviewers: jasonmolenda, jingham, abidh

Reviewed By: abidh

Subscribers: lldb-commits, jingham, jasonmolenda, abidh

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

llvm-svn: 236225
2015-04-30 11:08:31 +00:00
Ilia K 4ba3aee138 Add -data-info-line command (MI)
Summary: Add -data-info-line command + test

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

Reviewers: abidh

Reviewed By: abidh

Subscribers: lldb-commits, abidh

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

llvm-svn: 236208
2015-04-30 07:14:24 +00:00
Chaoren Lin 4dc65069a1 lldb-gdbserver should not use unnamed pipes on Windows.
llvm-svn: 236138
2015-04-29 19:01:43 +00:00
Chaoren Lin a52f48412d Add file descriptor constructor for PipePosix.
llvm-svn: 236133
2015-04-29 17:36:58 +00:00
Hafiz Abid Qadeer fda237d09f Add support for -stack-list-variables.
This command is able to list both local variables and stack arguments for a specific thread/frame.
Args are denoted with 'arg="1"'.
Patch from Chuck Ries.

llvm-svn: 236090
2015-04-29 08:18:41 +00:00
Hafiz Abid Qadeer 7f2f0ccb0a Replace sprintf with snprintf to avoid a crash.
During testing -data-list-register-values, I saw a crash here due to buffer overflow.
This commit should fix the crash. There is still problem with printing 1-byte register
in some cases that I will fix separately.

No regression on MI test cases.

llvm-svn: 235991
2015-04-28 14:16:00 +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
Bruce Mitchener 41ad9c4128 LLDB-MI: -var-list-children with no children doesn't need a children value in the response.
Summary:
When using GDB with MI, if there aren't children for a variable,
it doesn't include a "children" value in the response. LLDB does
and sets it to "[]" while variables with children have an unquoted
list: children=[...].

This removes the children value entirely when there are no children
making this match GDB in behavior.

Test Plan: Ran tests on Mac OS X and they passed.

Reviewers: abidh, domipheus

Subscribers: lldb-commits

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

llvm-svn: 235974
2015-04-28 10:03:55 +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
Hafiz Abid Qadeer 398732979a Improve handling of ctrl-c with MSVC.
Currently hitting Ctrl-C in Windows LLDB-MI just exits MI. But according to test_lldbmi_stopped_when_interrupt() in TestMiSignal.py Ctrl-C should send a SIGINT signal to the inferior.
Patch adds this functionality to Windows so SIGINT is sent on Ctrl-C.

Patch from EwanCrawford. Reviewed in http://reviews.llvm.org/D9248.

llvm-svn: 235887
2015-04-27 15:04:42 +00:00
Ilia K c04ce6e25c Fix double stdout/stderr output from CLI commands in MI mode (MI)
Summary:
This patch fixes stdout/stderr output that printed twice for CLI commands:
was:
```
(gdb)
target create ~/p/hello
Current executable set to '~/p/hello' (x86_64).
Current executable set to '~/p/hello' (x86_64).
^done
(gdb)
```
now:
```
(gdb)
target create ~/p/hello
Current executable set to '~/p/hello' (x86_64).
^done
(gdb)
```

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

Reviewers: abidh

Reviewed By: abidh

Subscribers: lldb-commits, abidh

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

llvm-svn: 235857
2015-04-27 10:07:49 +00:00
Ilia K b64b8e16db Clean the CMIDriver (MI)
This patch does the following things:
* Use CMICmnStreamStdout::TextToStdout to print (gdb) prompt in CMIDriver::InitClientIDEEclipse
* Remove unnecessary inclusions

llvm-svn: 235817
2015-04-26 05:55:59 +00:00
Ilia K fb2be6c6f3 Clean CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateSuspended (MI)
Don't call the lldb::SBProcess::GetRestartedFromEvent twice while
handling the CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateSuspended.

llvm-svn: 235812
2015-04-25 21:21:55 +00:00
Ilia K 41a38d2021 Fix CMIUtilThreadActiveObjBase::ThreadIsActive when a thread has died (MI)
llvm-svn: 235811
2015-04-25 21:20:00 +00:00
Ilia K 94b8ebcacf Add -gdb-set/-gdb-show aggregate-field-names option (MI)
Use this option to print/skip field names (default is on):
```
-var-create var1 * complx
^done,name="var1",numchild="3",value="{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}",type="complex_type",thread-id="1",has_more="0"
-var-create var2 * complx_array
^done,name="var2",numchild="2",value="{[0] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, [1] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}",type="complex_type [2]",thread-id="1",has_more="0"
-gdb-set print aggregate-field-names off
^done
-var-create var3 * complx
^done,name="var3",numchild="3",value="{3,{3},0x[0-9a-f]+}",type="complex_type",thread-id="1",has_more="0"
-var-create var4 * complx_array
^done,name="var4",numchild="2",value="{{4,{4},0x[0-9a-f]+},{5,{5},0x[0-9a-f]+}}",type="complex_type [2]",thread-id="1",has_more="0"
```

llvm-svn: 235807
2015-04-25 20:33:02 +00:00
Ilia K 81bd06d787 Add -gdb-set/-gdb-show expand-aggregates option (MI)
Use this option to expand complex types always:
```
-var-create var1 * complx
^done,name="var1",numchild="3",value="{...}",type="complex_type",thread-id="1",has_more="0"
-var-create var2 * complx_array
^done,name="var2",numchild="2",value="[2]",type="complex_type [2]",thread-id="1",has_more="0"
-gdb-set print expand-aggregates on
^done
-var-create var3 * complx
^done,name="var3",numchild="3",value="{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}",type="complex_type",thread-id="1",has_more="0"
-var-create var4 * complx_array
^done,name="var4",numchild="2",value="{[0] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, [1] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}",type="complex_type [2]",thread-id="1",has_more="0"
```

llvm-svn: 235805
2015-04-25 20:10:02 +00:00
Ilia K aa82b4af84 Add -gdb-set/-gdb-show print char-array-as-string option (MI)
llvm-svn: 235804
2015-04-25 19:44:56 +00:00
Ilia K afef49267a Fix CMICmnLLDBDebuggerHandleEvents::GetProcessStdout/GetProcessStderr to use stream-record (MI)
llvm-svn: 235711
2015-04-24 11:33:36 +00:00
Ilia K b9355045e1 Fix CMICmnMIOutOfBandRecord to accept stream-records (MI)
Previously the CMICmnMIOutOfBandRecord class worked only with async-records.

llvm-svn: 235709
2015-04-24 11:27:36 +00:00
Ilia K 3b0494c304 MI fix allowing multiple logging instances of lldb-mi to run simultaneously.
Summary:
Currently if two instances of lldb-mi are running with logging enabled using '--log' the log file conflicts. This produces the following error 
MI: Error: File Handler. Error Permission denied opening 'C:\Users\Ewan\LLVM\build\Debug\bin\lldb-mi-log.txt'

Fixed in this patch by renaming lldb-mi-log.txt based on the date, e.g. lldb-mi-log.txt-20150316163631.log, and moving the file into the temp directory by using the --log-dir option.

Regrading previous review comments the P_tmpdir macro is defined in Windows but always points to "\", which doesn't help much. Also when using the Windows API for GetTempPath() dynamic memory seems much more messy.

Patch from ewan@codeplay.com

Reviewers: abidh, EwanCrawford

Subscribers: zturner, lldb-commits, deepak2427

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

llvm-svn: 235589
2015-04-23 12:48:42 +00:00
Ilia K 5a931869d4 MI Refactor CMIUtilSystemWindows::GetExecutablesPath()
Summary:
My understanding of the Windows API call GetLastError() is that it should only be checked when ::GetModuleFileName()  returns 0 on error.
Otherwise GetExecutablesPath() could return an error despite nLen being valid if GetLastError() was inconsistent.
Patch updates function to only call GetOSLastError() when nLen == 0

Patch from ewan@codeplay.com

Reviewers: EwanCrawford

Subscribers: lldb-commits, deepak2427

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

llvm-svn: 235515
2015-04-22 15:43:43 +00:00
Ilia K d854180afb MI support for '-var-create $regname' command.
Summary:
This command is currently processed using expression evaluation, meaning the variable binds to the result of the expression not the register.
Therefore any subsequent calls to '-var-assign' will not update the register. Fixed by detecting '$' prefix for registers according to specification.

Thanks, Ewan

Patch from ewan@codeplay.com

Reviewers: EwanCrawford

Subscribers: lldb-commits, deepak2427

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

llvm-svn: 235195
2015-04-17 14:49:54 +00:00
Pavel Labath 1107b5a597 Use non-blocking waitpid in NativeProcessLinux
Summary:
This is the first phase of the merging of Monitor and Operation threads in NativeProcessLinux
(which is necessary since the two threads race inside Linux kernel). Here, I reimplement the
Monitor thread do use non-blocking waitpid calls, which enables later addition of code from the
operation thread.

Test Plan: Ran the test suite a couple of times, no regressions detected.

Reviewers: vharron, ovyalov, tberghammer

Subscribers: lldb-commits

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

llvm-svn: 235193
2015-04-17 14:07:49 +00:00
Ilia K 7e38b5802a Add comments to LLDB-MI disassembly.
Summary:
This patch adds the comments which are included in LLDB disassembly, but are currently missing in MI, e.g.

 ^done,asm_insns=[...,{address="0x00000000004004ff",func-name="main",offset="18",size="2",inst="jmp 0x40050b ; <+30> at main.c:7"}]

 instead of

 ^done,asm_insns=[...,{address="0x00000000004004ff",func-name="main",offset="18",size="2",inst="jmp 0x40050b"}]

Thanks, Ewan

Patch from ewan@codeplay.com

Reviewers: abidh, EwanCrawford

Subscribers: ted, lldb-commits, deepak2427

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

llvm-svn: 235017
2015-04-15 16:17:50 +00:00
Ilia K bc929b80dc Fix handling of the executable arg which contains spaces (MI)
* Don't use the CMICmdArgValFile::GetFileNamePath for the CMIDriver::m_strCmdLineArgExecuteableFileNamePath
  because it wraps path with spaces into quotes what is already being done in CMIDriver::LocalDebugSessionStartupExecuteCommands
* Improve the MiSyntaxTestCase.test_lldbmi_specialchars test to catch this error
  ```
    $ bin/lldb-mi "~/p/ hello"
    (gdb)
    -file-exec-and-symbols "\"~/p/ hello\""
    ^error,msg="Command 'file-exec-and-symbols'. Target binary '\"~/p/ hello\"' is invalid. error: unable to find executable for '/"~/p/ hello/"'"
  ```

llvm-svn: 234888
2015-04-14 14:12:22 +00:00
Ilia K 2ecf23bc5d Fix CMICmnStreamStdout::WritePriv which causes a stack overflow (MI)
This includes:
* Remove IDS_STDOUT_ERR_NOT_ALL_DATA_WRITTEN enum value
* Remove IDS_STDOUT_ERR_NOT_ALL_DATA_WRITTEN mapped string in CMICmnResources::ms_pResourceId2TextData
* Fix a stack overflow which happens when fputs() fails:
  ```
    [...]
    frame #21153: 0x00000001045db6f0 lldb-mi`CMICmnStreamStderr::WritePriv(CMIUtilString const&, CMIUtilString const&, bool) + 416
    frame #21154: 0x00000001045db529 lldb-mi`CMICmnStreamStderr::Write(CMIUtilString const&, bool) + 265
    frame #21155: 0x00000001045c6a27 lldb-mi`CMICmnBase::SetErrorDescription(CMIUtilString const&) const + 215
    frame #21156: 0x00000001045db6f0 lldb-mi`CMICmnStreamStderr::WritePriv(CMIUtilString const&, CMIUtilString const&, bool) + 416
    frame #21157: 0x00000001045db529 lldb-mi`CMICmnStreamStderr::Write(CMIUtilString const&, bool) + 265
    frame #21158: 0x00000001045c6a27 lldb-mi`CMICmnBase::SetErrorDescription(CMIUtilString const&) const + 215
    frame #21159: 0x00000001045db6f0 lldb-mi`CMICmnStreamStderr::WritePriv(CMIUtilString const&, CMIUtilString const&, bool) + 416
    frame #21160: 0x00000001045db529 lldb-mi`CMICmnStreamStderr::Write(CMIUtilString const&, bool) + 265
    frame #21161: 0x00000001045c6a27 lldb-mi`CMICmnBase::SetErrorDescription(CMIUtilString const&) const + 215
    frame #21162: 0x00000001045db6f0 lldb-mi`CMICmnStreamStderr::WritePriv(CMIUtilString const&, CMIUtilString const&, bool) + 416
    frame #21163: 0x00000001045db529 lldb-mi`CMICmnStreamStderr::Write(CMIUtilString const&, bool) + 265
    frame #21164: 0x00000001045c6a27 lldb-mi`CMICmnBase::SetErrorDescription(CMIUtilString const&) const + 215
    frame #21165: 0x00000001045dc540 lldb-mi`CMICmnStreamStdout::WritePriv(CMIUtilString const&, CMIUtilString const&, bool) + 416
    frame #21166: 0x00000001045de5fb lldb-mi`CMIDriver::DoMainLoop() + 939
    frame #21167: 0x00000001045e2334 lldb-mi`CMIDriverMgr::DriverMainLoop() + 36
    frame #21168: 0x00000001045e1a39 lldb-mi`main + 217
    frame #21169: 0x00007fff90f395c9 libdyld.dylib`start + 1
  ```

llvm-svn: 234751
2015-04-13 14:40:16 +00:00
Ilia K 9b618d25ca Generate an event when a pending breakpoint binds
Summary:
This checkin sends an MI event when a module is loaded that causes a pending breakpoint to bind to it's real address in the target. This allows breakpoints to be set before the process is launched, and the target address of the BP to be discovered when the module loads, prior to the breakpoint being hit. 

Patch from chuckr@microsoft.com

Test Plan:
I ran the check-lldb target with and without this patch and saw no change. I am unsure of how to write an MI specific test for this because the new event is buried in module load events. Here is an example (the new event is in bold):


```
(gdb)
-file-exec-and-symbols a.out
^done
(gdb)
=shlibs-added,shlib-info=[num="1",name="a.out",dyld-addr="-",reason="dyld",path="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/a.out",loaded_addr="-",dsym-objpath="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/a.out.dSYM/Contents/Resources/DWARF/a.out"]
-break-insert -f main.cpp:15
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffffffffffff",func="main",file="main.cpp",fullname="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/main.cpp",line="15",pending=["main.cpp:15"],times="0",original-location="main.cpp:15"}
(gdb)
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffffffffffff",func="main",file="main.cpp",fullname="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/main.cpp",line="15",pending=["main.cpp:15"],times="0",original-location="main.cpp:15"}
-exec-run
^running
=thread-group-started,id="i1",pid="75620"
(gdb)
=thread-created,id="1",group-id="i1"
=thread-selected,id="1"
(gdb)
=shlibs-added,shlib-info=[num="2",name="dyld",dyld-addr="0x7fff5fc00000",reason="dyld",path="/usr/lib/dyld",loaded_addr="0x7fff5fc00000"]
(gdb)
=shlibs-added,shlib-info=[num="3",name="dyld",dyld-addr="0x7fff5fc00000",reason="dyld",path="/usr/lib/dyld",loaded_addr="0x7fff5fc00000"]
(gdb)
*running,thread-id="all"
(gdb)
(gdb)
=shlibs-added,shlib-info=[num="4",name="libc++.1.dylib",dyld-addr="0x7fff85dd0000",reason="dyld",path="/usr/lib/libc++.1.dylib",loaded_addr="0x7fff85dd0000"]
(gdb)
=shlibs-added,shlib-info=[num="5",name="libSystem.B.dylib",dyld-addr="0x7fff851ab000",reason="dyld",path="/usr/lib/libSystem.B.dylib",loaded_addr="0x7fff851ab000"]
(gdb)
=shlibs-added,shlib-info=[num="6",name="libc++abi.dylib",dyld-addr="0x7fff81be8000",reason="dyld",path="/usr/lib/libc++abi.dylib",loaded_addr="0x7fff81be8000"]
(gdb)
=shlibs-added,shlib-info=[num="7",name="libcache.dylib",dyld-addr="0x7fff8b975000",reason="dyld",path="/usr/lib/system/libcache.dylib",loaded_addr="0x7fff8b975000"]
(gdb)
=shlibs-added,shlib-info=[num="8",name="libcommonCrypto.dylib",dyld-addr="0x7fff85d14000",reason="dyld",path="/usr/lib/system/libcommonCrypto.dylib",loaded_addr="0x7fff85d14000"]
(gdb)
=shlibs-added,shlib-info=[num="9",name="libcompiler_rt.dylib",dyld-addr="0x7fff86154000",reason="dyld",path="/usr/lib/system/libcompiler_rt.dylib",loaded_addr="0x7fff86154000"]
(gdb)
=shlibs-added,shlib-info=[num="10",name="libcopyfile.dylib",dyld-addr="0x7fff81ac7000",reason="dyld",path="/usr/lib/system/libcopyfile.dylib",loaded_addr="0x7fff81ac7000"]
(gdb)
=shlibs-added,shlib-info=[num="11",name="libcorecrypto.dylib",dyld-addr="0x7fff87d5d000",reason="dyld",path="/usr/lib/system/libcorecrypto.dylib",loaded_addr="0x7fff87d5d000"]
(gdb)
=shlibs-added,shlib-info=[num="12",name="libdispatch.dylib",dyld-addr="0x7fff8ea8c000",reason="dyld",path="/usr/lib/system/libdispatch.dylib",loaded_addr="0x7fff8ea8c000"]
(gdb)
=shlibs-added,shlib-info=[num="13",name="libdyld.dylib",dyld-addr="0x7fff89087000",reason="dyld",path="/usr/lib/system/libdyld.dylib",loaded_addr="0x7fff89087000"]
(gdb)
=shlibs-added,shlib-info=[num="14",name="libkeymgr.dylib",dyld-addr="0x7fff8e818000",reason="dyld",path="/usr/lib/system/libkeymgr.dylib",loaded_addr="0x7fff8e818000"]
(gdb)
=shlibs-added,shlib-info=[num="15",name="liblaunch.dylib",dyld-addr="0x7fff84936000",reason="dyld",path="/usr/lib/system/liblaunch.dylib",loaded_addr="0x7fff84936000"]
(gdb)
=shlibs-added,shlib-info=[num="16",name="libmacho.dylib",dyld-addr="0x7fff8534e000",reason="dyld",path="/usr/lib/system/libmacho.dylib",loaded_addr="0x7fff8534e000"]
(gdb)
=shlibs-added,shlib-info=[num="17",name="libquarantine.dylib",dyld-addr="0x7fff90f97000",reason="dyld",path="/usr/lib/system/libquarantine.dylib",loaded_addr="0x7fff90f97000"]
(gdb)
=shlibs-added,shlib-info=[num="18",name="libremovefile.dylib",dyld-addr="0x7fff8ccb5000",reason="dyld",path="/usr/lib/system/libremovefile.dylib",loaded_addr="0x7fff8ccb5000"]
(gdb)
=shlibs-added,shlib-info=[num="19",name="libsystem_asl.dylib",dyld-addr="0x7fff8df67000",reason="dyld",path="/usr/lib/system/libsystem_asl.dylib",loaded_addr="0x7fff8df67000"]
(gdb)
=shlibs-added,shlib-info=[num="20",name="libsystem_blocks.dylib",dyld-addr="0x7fff8621c000",reason="dyld",path="/usr/lib/system/libsystem_blocks.dylib",loaded_addr="0x7fff8621c000"]
(gdb)
=shlibs-added,shlib-info=[num="21",name="libsystem_c.dylib",dyld-addr="0x7fff83c0f000",reason="dyld",path="/usr/lib/system/libsystem_c.dylib",loaded_addr="0x7fff83c0f000"]
(gdb)
=shlibs-added,shlib-info=[num="22",name="libsystem_configuration.dylib",dyld-addr="0x7fff8fd71000",reason="dyld",path="/usr/lib/system/libsystem_configuration.dylib",loaded_addr="0x7fff8fd71000"]
(gdb)
=shlibs-added,shlib-info=[num="23",name="libsystem_coreservices.dylib",dyld-addr="0x7fff8a028000",reason="dyld",path="/usr/lib/system/libsystem_coreservices.dylib",loaded_addr="0x7fff8a028000"]
(gdb)
=shlibs-added,shlib-info=[num="24",name="libsystem_coretls.dylib",dyld-addr="0x7fff90996000",reason="dyld",path="/usr/lib/system/libsystem_coretls.dylib",loaded_addr="0x7fff90996000"]
(gdb)
=shlibs-added,shlib-info=[num="25",name="libsystem_dnssd.dylib",dyld-addr="0x7fff8b71f000",reason="dyld",path="/usr/lib/system/libsystem_dnssd.dylib",loaded_addr="0x7fff8b71f000"]
(gdb)
=shlibs-added,shlib-info=[num="26",name="libsystem_info.dylib",dyld-addr="0x7fff8b9f2000",reason="dyld",path="/usr/lib/system/libsystem_info.dylib",loaded_addr="0x7fff8b9f2000"]
(gdb)
=shlibs-added,shlib-info=[num="27",name="libsystem_kernel.dylib",dyld-addr="0x7fff81ad0000",reason="dyld",path="/usr/lib/system/libsystem_kernel.dylib",loaded_addr="0x7fff81ad0000"]
(gdb)
=shlibs-added,shlib-info=[num="28",name="libsystem_m.dylib",dyld-addr="0x7fff84953000",reason="dyld",path="/usr/lib/system/libsystem_m.dylib",loaded_addr="0x7fff84953000"]
(gdb)
=shlibs-added,shlib-info=[num="29",name="libsystem_malloc.dylib",dyld-addr="0x7fff887bd000",reason="dyld",path="/usr/lib/system/libsystem_malloc.dylib",loaded_addr="0x7fff887bd000"]
(gdb)
=shlibs-added,shlib-info=[num="30",name="libsystem_network.dylib",dyld-addr="0x7fff88304000",reason="dyld",path="/usr/lib/system/libsystem_network.dylib",loaded_addr="0x7fff88304000"]
(gdb)
=shlibs-added,shlib-info=[num="31",name="libsystem_networkextension.dylib",dyld-addr="0x7fff82085000",reason="dyld",path="/usr/lib/system/libsystem_networkextension.dylib",loaded_addr="0x7fff82085000"]
(gdb)
=shlibs-added,shlib-info=[num="32",name="libsystem_notify.dylib",dyld-addr="0x7fff8eb69000",reason="dyld",path="/usr/lib/system/libsystem_notify.dylib",loaded_addr="0x7fff8eb69000"]
(gdb)
=shlibs-added,shlib-info=[num="33",name="libsystem_platform.dylib",dyld-addr="0x7fff89ac7000",reason="dyld",path="/usr/lib/system/libsystem_platform.dylib",loaded_addr="0x7fff89ac7000"]
(gdb)
=shlibs-added,shlib-info=[num="34",name="libsystem_pthread.dylib",dyld-addr="0x7fff83ff8000",reason="dyld",path="/usr/lib/system/libsystem_pthread.dylib",loaded_addr="0x7fff83ff8000"]
(gdb)
=shlibs-added,shlib-info=[num="35",name="libsystem_sandbox.dylib",dyld-addr="0x7fff89084000",reason="dyld",path="/usr/lib/system/libsystem_sandbox.dylib",loaded_addr="0x7fff89084000"]
(gdb)
=shlibs-added,shlib-info=[num="36",name="libsystem_secinit.dylib",dyld-addr="0x7fff8e816000",reason="dyld",path="/usr/lib/system/libsystem_secinit.dylib",loaded_addr="0x7fff8e816000"]
(gdb)
=shlibs-added,shlib-info=[num="37",name="libsystem_stats.dylib",dyld-addr="0x7fff89eaf000",reason="dyld",path="/usr/lib/system/libsystem_stats.dylib",loaded_addr="0x7fff89eaf000"]
(gdb)
=shlibs-added,shlib-info=[num="38",name="libsystem_trace.dylib",dyld-addr="0x7fff8ead4000",reason="dyld",path="/usr/lib/system/libsystem_trace.dylib",loaded_addr="0x7fff8ead4000"]
(gdb)
=shlibs-added,shlib-info=[num="39",name="libunc.dylib",dyld-addr="0x7fff8ab27000",reason="dyld",path="/usr/lib/system/libunc.dylib",loaded_addr="0x7fff8ab27000"]
(gdb)
=shlibs-added,shlib-info=[num="40",name="libunwind.dylib",dyld-addr="0x7fff85cf3000",reason="dyld",path="/usr/lib/system/libunwind.dylib",loaded_addr="0x7fff85cf3000"]
(gdb)
=shlibs-added,shlib-info=[num="41",name="libxpc.dylib",dyld-addr="0x7fff88896000",reason="dyld",path="/usr/lib/system/libxpc.dylib",loaded_addr="0x7fff88896000"]
(gdb)
=shlibs-added,shlib-info=[num="42",name="libobjc.A.dylib",dyld-addr="0x7fff84f13000",reason="dyld",path="/usr/lib/libobjc.A.dylib",loaded_addr="0x7fff84f13000"]
(gdb)
=shlibs-added,shlib-info=[num="43",name="libauto.dylib",dyld-addr="0x7fff85d89000",reason="dyld",path="/usr/lib/libauto.dylib",loaded_addr="0x7fff85d89000"]
(gdb)
=shlibs-added,shlib-info=[num="44",name="libDiagnosticMessagesClient.dylib",dyld-addr="0x7fff822e1000",reason="dyld",path="/usr/lib/libDiagnosticMessagesClient.dylib",loaded_addr="0x7fff822e1000"]
```
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000f4d",func="main",file="main.cpp",fullname="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/main.cpp",line="15",pending=["main.cpp:15"],times="0",original-location="main.cpp:15"}
```
(gdb)
=shlibs-added,shlib-info=[num="45",name="a.out",dyld-addr="0x100000000",reason="dyld",path="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/a.out",loaded_addr="0x100000000",dsym-objpath="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/a.out.dSYM/Contents/Resources/DWARF/a.out"]
=shlibs-added,shlib-info=[num="46",name="libc++.1.dylib",dyld-addr="0x7fff85dd0000",reason="dyld",path="/usr/lib/libc++.1.dylib",loaded_addr="0x7fff85dd0000"]
=shlibs-added,shlib-info=[num="47",name="libSystem.B.dylib",dyld-addr="0x7fff851ab000",reason="dyld",path="/usr/lib/libSystem.B.dylib",loaded_addr="0x7fff851ab000"]
=shlibs-added,shlib-info=[num="48",name="libc++abi.dylib",dyld-addr="0x7fff81be8000",reason="dyld",path="/usr/lib/libc++abi.dylib",loaded_addr="0x7fff81be8000"]
=shlibs-added,shlib-info=[num="49",name="libcache.dylib",dyld-addr="0x7fff8b975000",reason="dyld",path="/usr/lib/system/libcache.dylib",loaded_addr="0x7fff8b975000"]
=shlibs-added,shlib-info=[num="50",name="libcommonCrypto.dylib",dyld-addr="0x7fff85d14000",reason="dyld",path="/usr/lib/system/libcommonCrypto.dylib",loaded_addr="0x7fff85d14000"]
=shlibs-added,shlib-info=[num="51",name="libcompiler_rt.dylib",dyld-addr="0x7fff86154000",reason="dyld",path="/usr/lib/system/libcompiler_rt.dylib",loaded_addr="0x7fff86154000"]
=shlibs-added,shlib-info=[num="52",name="libcopyfile.dylib",dyld-addr="0x7fff81ac7000",reason="dyld",path="/usr/lib/system/libcopyfile.dylib",loaded_addr="0x7fff81ac7000"]
=shlibs-added,shlib-info=[num="53",name="libcorecrypto.dylib",dyld-addr="0x7fff87d5d000",reason="dyld",path="/usr/lib/system/libcorecrypto.dylib",loaded_addr="0x7fff87d5d000"]
=shlibs-added,shlib-info=[num="54",name="libdispatch.dylib",dyld-addr="0x7fff8ea8c000",reason="dyld",path="/usr/lib/system/libdispatch.dylib",loaded_addr="0x7fff8ea8c000"]
=shlibs-added,shlib-info=[num="55",name="libdyld.dylib",dyld-addr="0x7fff89087000",reason="dyld",path="/usr/lib/system/libdyld.dylib",loaded_addr="0x7fff89087000"]
=shlibs-added,shlib-info=[num="56",name="libkeymgr.dylib",dyld-addr="0x7fff8e818000",reason="dyld",path="/usr/lib/system/libkeymgr.dylib",loaded_addr="0x7fff8e818000"]
=shlibs-added,shlib-info=[num="57",name="liblaunch.dylib",dyld-addr="0x7fff84936000",reason="dyld",path="/usr/lib/system/liblaunch.dylib",loaded_addr="0x7fff84936000"]
=shlibs-added,shlib-info=[num="58",name="libmacho.dylib",dyld-addr="0x7fff8534e000",reason="dyld",path="/usr/lib/system/libmacho.dylib",loaded_addr="0x7fff8534e000"]
=shlibs-added,shlib-info=[num="59",name="libquarantine.dylib",dyld-addr="0x7fff90f97000",reason="dyld",path="/usr/lib/system/libquarantine.dylib",loaded_addr="0x7fff90f97000"]
=shlibs-added,shlib-info=[num="60",name="libremovefile.dylib",dyld-addr="0x7fff8ccb5000",reason="dyld",path="/usr/lib/system/libremovefile.dylib",loaded_addr="0x7fff8ccb5000"]
=shlibs-added,shlib-info=[num="61",name="libsystem_asl.dylib",dyld-addr="0x7fff8df67000",reason="dyld",path="/usr/lib/system/libsystem_asl.dylib",loaded_addr="0x7fff8df67000"]
=shlibs-added,shlib-info=[num="62",name="libsystem_blocks.dylib",dyld-addr="0x7fff8621c000",reason="dyld",path="/usr/lib/system/libsystem_blocks.dylib",loaded_addr="0x7fff8621c000"]
=shlibs-added,shlib-info=[num="63",name="libsystem_c.dylib",dyld-addr="0x7fff83c0f000",reason="dyld",path="/usr/lib/system/libsystem_c.dylib",loaded_addr="0x7fff83c0f000"]
=shlibs-added,shlib-info=[num="64",name="libsystem_configuration.dylib",dyld-addr="0x7fff8fd71000",reason="dyld",path="/usr/lib/system/libsystem_configuration.dylib",loaded_addr="0x7fff8fd71000"]
=shlibs-added,shlib-info=[num="65",name="libsystem_coreservices.dylib",dyld-addr="0x7fff8a028000",reason="dyld",path="/usr/lib/system/libsystem_coreservices.dylib",loaded_addr="0x7fff8a028000"]
=shlibs-added,shlib-info=[num="66",name="libsystem_coretls.dylib",dyld-addr="0x7fff90996000",reason="dyld",path="/usr/lib/system/libsystem_coretls.dylib",loaded_addr="0x7fff90996000"]
=shlibs-added,shlib-info=[num="67",name="libsystem_dnssd.dylib",dyld-addr="0x7fff8b71f000",reason="dyld",path="/usr/lib/system/libsystem_dnssd.dylib",loaded_addr="0x7fff8b71f000"]
=shlibs-added,shlib-info=[num="68",name="libsystem_info.dylib",dyld-addr="0x7fff8b9f2000",reason="dyld",path="/usr/lib/system/libsystem_info.dylib",loaded_addr="0x7fff8b9f2000"]
=shlibs-added,shlib-info=[num="69",name="libsystem_kernel.dylib",dyld-addr="0x7fff81ad0000",reason="dyld",path="/usr/lib/system/libsystem_kernel.dylib",loaded_addr="0x7fff81ad0000"]
=shlibs-added,shlib-info=[num="70",name="libsystem_m.dylib",dyld-addr="0x7fff84953000",reason="dyld",path="/usr/lib/system/libsystem_m.dylib",loaded_addr="0x7fff84953000"]
=shlibs-added,shlib-info=[num="71",name="libsystem_malloc.dylib",dyld-addr="0x7fff887bd000",reason="dyld",path="/usr/lib/system/libsystem_malloc.dylib",loaded_addr="0x7fff887bd000"]
=shlibs-added,shlib-info=[num="72",name="libsystem_network.dylib",dyld-addr="0x7fff88304000",reason="dyld",path="/usr/lib/system/libsystem_network.dylib",loaded_addr="0x7fff88304000"]
=shlibs-added,shlib-info=[num="73",name="libsystem_networkextension.dylib",dyld-addr="0x7fff82085000",reason="dyld",path="/usr/lib/system/libsystem_networkextension.dylib",loaded_addr="0x7fff82085000"]
=shlibs-added,shlib-info=[num="74",name="libsystem_notify.dylib",dyld-addr="0x7fff8eb69000",reason="dyld",path="/usr/lib/system/libsystem_notify.dylib",loaded_addr="0x7fff8eb69000"]
=shlibs-added,shlib-info=[num="75",name="libsystem_platform.dylib",dyld-addr="0x7fff89ac7000",reason="dyld",path="/usr/lib/system/libsystem_platform.dylib",loaded_addr="0x7fff89ac7000"]
=shlibs-added,shlib-info=[num="76",name="libsystem_pthread.dylib",dyld-addr="0x7fff83ff8000",reason="dyld",path="/usr/lib/system/libsystem_pthread.dylib",loaded_addr="0x7fff83ff8000"]
=shlibs-added,shlib-info=[num="77",name="libsystem_sandbox.dylib",dyld-addr="0x7fff89084000",reason="dyld",path="/usr/lib/system/libsystem_sandbox.dylib",loaded_addr="0x7fff89084000"]
=shlibs-added,shlib-info=[num="78",name="libsystem_secinit.dylib",dyld-addr="0x7fff8e816000",reason="dyld",path="/usr/lib/system/libsystem_secinit.dylib",loaded_addr="0x7fff8e816000"]
=shlibs-added,shlib-info=[num="79",name="libsystem_stats.dylib",dyld-addr="0x7fff89eaf000",reason="dyld",path="/usr/lib/system/libsystem_stats.dylib",loaded_addr="0x7fff89eaf000"]
=shlibs-added,shlib-info=[num="80",name="libsystem_trace.dylib",dyld-addr="0x7fff8ead4000",reason="dyld",path="/usr/lib/system/libsystem_trace.dylib",loaded_addr="0x7fff8ead4000"]
=shlibs-added,shlib-info=[num="81",name="libunc.dylib",dyld-addr="0x7fff8ab27000",reason="dyld",path="/usr/lib/system/libunc.dylib",loaded_addr="0x7fff8ab27000"]
=shlibs-added,shlib-info=[num="82",name="libunwind.dylib",dyld-addr="0x7fff85cf3000",reason="dyld",path="/usr/lib/system/libunwind.dylib",loaded_addr="0x7fff85cf3000"]
=shlibs-added,shlib-info=[num="83",name="libxpc.dylib",dyld-addr="0x7fff88896000",reason="dyld",path="/usr/lib/system/libxpc.dylib",loaded_addr="0x7fff88896000"]
=shlibs-added,shlib-info=[num="84",name="libobjc.A.dylib",dyld-addr="0x7fff84f13000",reason="dyld",path="/usr/lib/libobjc.A.dylib",loaded_addr="0x7fff84f13000"]
=shlibs-added,shlib-info=[num="85",name="libauto.dylib",dyld-addr="0x7fff85d89000",reason="dyld",path="/usr/lib/libauto.dylib",loaded_addr="0x7fff85d89000"]
=shlibs-added,shlib-info=[num="86",name="libDiagnosticMessagesClient.dylib",dyld-addr="0x7fff822e1000",reason="dyld",path="/usr/lib/libDiagnosticMessagesClient.dylib",loaded_addr="0x7fff822e1000"]
(gdb)
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x0000000100000f4d",func="main",args=[{name="argc",value="1"},{name="argv",value="0x00007fff5fbffed8"}],file="main.cpp",fullname="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/main.cpp",line="15"},thread-id="1",stopped-threads="all"
(gdb)
```

Reviewers: abidh, clayborg, ChuckR, jingham

Subscribers: ki.stfu, paulmaybee, lldb-commits

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

llvm-svn: 234483
2015-04-09 12:55:13 +00:00
Ilia K b49b2d2166 Fix MiGdbSetShowTestCase.test_lldbmi_gdb_set_ouptut_radix after r234476
This includes:
* Add CMICmnLLDBUtilSBValue::IsIntegerType to check integer type
* Improve CMICmnLLDBDebugSessionInfoVarObj::GetValueStringFormatted to handle veVarFormat arg

llvm-svn: 234480
2015-04-09 12:21:56 +00:00
Ilia K 58627321f6 Refactor CMICmnLLDBDebuggerHandleEvents/CMICmnLLDBDebugSessionInfo/CMICmnLLDBDebugSessionInfoVarObj (MI)
Summary:
This patch includes the following changes:

# Refactor GetVariableInfo/GetValueStringFormatted/GetValue to use the same code (MI)
Also it expands the variable value format for strings (aka char*):
was:
```
^done,name="v4",numchild="1",value="0x0000000100000f56",type="const char *",thread-id="1",has_more="0"
```
now:
```
^done,name="v4",numchild="1",value="0x0000000100000f56 \"ab\"",type="const char *",thread-id="1",has_more="0"
```

# Expand the variable value format for arrays (according to GDB)
For example:
was:
```
^done,name="v3",numchild="2",value="{...}",type="char [2]",thread-id="1",has_more="0"
```
now:
```
^done,name="v3",numchild="2",value="[2]",type="char [2]",thread-id="1",has_more="0"
```

# Rename MiGdbSetShowTestCase.test_lldbmi_gdb_show_process_stopatentry_default to test_lldbmi_gdb_show_process_stopatentry (MI)

# Fix a comment in MiGdbSetShowTestCase.test_lldbmi_gdb_show_process_stopatentry (MI)

# Refactor CMICmnLLDBUtilSBValue
## Add CMICmnLLDBUtilSBValue::IsPointerType/IsArrayType
## Refactor CMICmnLLDBUtilSBValue::GetValue
## Fix CMICmnLLDBUtilSBValue::IsChildCharType to ignore a number of childs
## Rename CMICmnLLDBUtilSBValue::IsChildCharType to IsFirstChildCharType
## Fix CMICmnLLDBUtilSBValue::GetValueCString to accept char[]

# Minor changes in CMICmnLLDBUtilSBValue::GetValue

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo family functions (MI)

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo2
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo to accept args

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Add vArgInfo arg to CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo
## Move CMICmnLLDBDebugSessionInfo::GetFrameInfo/MIResponseFormFrameInfo to private namespace

# Refactor CMICmnLLDBDebugSessionInfo::GetThreadFrames family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::GetThreadFrames2
## Improve CMICmnLLDBDebugSessionInfo::GetThreadFrames to accept vnMaxDepth

# Fix vnMaxDepth arg name in CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo (MI)

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Merge CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo functions into one

# Don't modify fnName in CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo3
## Improve -CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo to accept vnMaxDepth

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo2
## Add CMICmnLLDBDebugSessionInfo::ThreadInfoFormat_e enum to specify thread format
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo to accept veThreadInfoFormat
## Remove vnMaxDepth arg in CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo (not needed because veThreadInfoFormat was added)

# Move CMICmnLLDBDebugSessionInfo::GetThreadFrames to private namespace (MI)

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo (MI)
## Add CMICmnLLDBDebugSessionInfo::FrameInfoFormat_e enum to specify frame format
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo to accept veFrameInfoFormat
## Remove vnMaxDepth arg in CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo (not needed because veFrameInfoFormat was added)

# Remove duplicated level field in CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)

# Refactor CMICmnLLDBUtilSBValue::GetValue (MI)
## Add CMICmnLLDBUtilSBValue::GetSimpleValue
## Use CMICmnLLDBUtilSBValue::GetSimpleValue in GetVlaue

# Fix CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)
## Add CMICmnLLDBDebugSessionInfo::FrameInfoFormat_e::eFrameInfoFormat_AllArgumentsInSimpleForm which is used to get stack-args in simple form (i.e. show {...} for composite types). It can be done by calling MIResponseFormVariableInfo with vnMaxDepth=0.
## Improve CMICmnLLDBDebugSessionInfo::GetThreadFrames to accept veFrameInfoFormat
## Remove vnMaxDepth from CMICmnLLDBDebugSessionInfo::GetThreadFrames (we should use veFrameInfoFormat instead)

# Refactor CMICmnLLDBUtilSBValue::GetValue to expand composite types (MI)
## Add CMICmnLLDBUtilSBValue::GetCompositeValue to expand composite types
## Add CMICmnLLDBUtilSBValue::m_pComposite to avoid multiple {...} in the code
## Improve CMICmnLLDBUtilSBValue::GetValue to accept vbExpandAggregates option (default=false)
## Clean up CMICmnLLDBDebugSessionInfo::GetVariableInfo to use CMICmnLLDBUtilSBValue::GetValue
## Remove the wrapping into {} in CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo
## Fix MiStackTestCase.test_lldbmi_stack_list_locals test to expect result without superfluous space ' ' around the '{' or '}' brackets:
was:
```
{name=\"var_c\",value=\"{var_a = 10,var_b = 97 'a',inner_ = { var_d = 30 }}
```
now:
```
{name=\"var_c\",value=\"{var_a = 10,var_b = 97 'a',inner_ = {var_d = 30}}
```
## Fix vwrValue arg name in CMICmnLLDBUtilSBValue::GetSimpleValue (was vrValue)

# Refactor CMICmnLLDBDebugSessionInfo::GetVariableInfo (MI)
## Remove vnMaxDepth/vbIsChildValue/vnDepth args in CMICmnLLDBDebugSessionInfo::GetVariableInfo
## Improve CMICmnLLDBDebugSessionInfo::GetVariableInfo to accept vwrStrValue
## Remove vwrMiValueList arg in CMICmnLLDBDebugSessionInfo::GetVariableInfo (we should use vwrStrValue instead)
## Fix CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo to Escape values
was:
```
{name="p",value="0x0000000000000000 """}
```
now:
```
{name="p",value="0x0000000000000000 \"\""}
```

# Refactor CMICmnLLDBUtilSBValue
## Improve CMICmnLLDBUtilSBValue::GetValue to handle PrintExpandAggregates
## Improve CMICmnLLDBUtilSBValue::GetSimpleValue to handle vbHandleArrayType (use it to specify that array should be represented as simple type, i.e. value="[2]")

# Add spacing between fields in CMICmnLLDBUtilSBValue::GetCompositeValue (MI)
For example:
was:
```
^done,name="var3",numchild="3",value="{i = 3,inner = {l = 3},complex_ptr = 0x00007fff5fbff848}",type="complex_type",thread-id="1",has_more="0"
```
now:
```
^done,name="var3",numchild="3",value="{i = 3, inner = {l = 3}, complex_ptr = 0x00007fff5fbff848}",type="complex_type",thread-id="1",has_more="0"
```

# Fix spacing in MiStackTestCase.test_lldbmi_stack_list_locals test (MI)

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

Reviewers: abidh

Subscribers: lldb-commits, abidh

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

llvm-svn: 234476
2015-04-09 11:17:54 +00:00
Sylvestre Ledru 5a1a7ebe53 Force the inclusion of the LLVMSupport lib. Otherwise, the build (might?) fails with an undefined reference to 'llvm::llvm_is_multithreaded()'
llvm-svn: 234407
2015-04-08 14:09:36 +00:00
Ilia K 68757ed2e9 implement gdb-set output-radix
Summary: Patch from chuckr@microsoft.com

Reviewers: abidh, ChuckR

Reviewed By: abidh

Subscribers: paulmaybee, ki.stfu, greggm, scarroll, lldb-commits

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

llvm-svn: 234305
2015-04-07 09:47:23 +00:00
Greg Clayton f55ec07b38 Don't export a ton of lldb_private symbols from argdumper.
llvm-svn: 233825
2015-04-01 17:38:08 +00:00
Zachary Turner e6e2bb3842 Rework LLDB system initialization.
In an effort to reduce binary size for components not wishing to
link against all of LLDB, as well as a parallel effort to reduce
link dependencies on Python, this patch splits out the notion of
LLDB initialization into "full" and "common" initialization.

All code related to initializing the full LLDB suite lives directly
in API now.  Previously it was only referenced from API, but because
it was defined in lldbCore, it would get implicitly linked against
by everything including lldb-server, causing a considerable
increase in binary size.

By moving this to the API layer, it also creates a better layering
for the ongoing effort to make the embedded interpreter replacable
with one from a different language (or even be completely removeable).

One semantic change necessary to get this all working was to remove
the notion of a shared debugger refcount.  The debugger is either
initialized or uninitialized now, and calling Initialize() multiple
times will simply have no effect, while the first Terminate() will
now shut it down no matter how many times Initialize() was called.
This behaves nicely with all of our supported usage patterns though,
and allows us to fix a number of nasty hacks from before.

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

llvm-svn: 233758
2015-03-31 21:03:22 +00:00
Greg Clayton 1988ac60a6 Silence a compiler warning about "bAsyncMode" possibly being used uninitialized.
llvm-svn: 233754
2015-03-31 20:55:50 +00:00
Hafiz Abid Qadeer 0e1f11ffe0 Changed a function to static.
A temp object was being created to call StripOffFileName. This function
is not dependent on class members so I am making it static.
No regression on testsuite on Linux.

llvm-svn: 233703
2015-03-31 16:30:29 +00:00