Commit Graph

8946 Commits

Author SHA1 Message Date
Todd Fiala 712d1557a2 Fixed gdb-remote M test length parameter, added overwrite to test.
Initial check-in provided a nibble count instead of byte count for
the memory to write.  Fixed that.

Enhanced test to check for overwrite past the expected range of
writing to verify the correct amount is written.

llvm-svn: 210602
2014-06-10 23:12:28 +00:00
Todd Fiala 20e8edf5c7 Added gdb-remote test to verify M memory write.
llvm-svn: 210594
2014-06-10 22:15:56 +00:00
Ed Maste f57dcbb615 Remove duplicated code
We preivously had two copies of ::BytesAvailable with only trivial
differences between them, and fixes have been applied to only one of
them.

Instead of duplicating the whole function, hide the FD_SET differences
behind a macro.  This leaves only one small __APPLE__-specific #if
block, and fixes ^C on non-__APPLE__ platforms.

llvm-svn: 210592
2014-06-10 21:33:43 +00:00
Todd Fiala f9763874b7 Added gdb-remote tests around $qSupported.
Right now it just checks that qSupported returns at least
one recognized gdb stub feature.

llvm-svn: 210573
2014-06-10 20:16:31 +00:00
Todd Fiala 697bff9cb7 Added gdb-remote test for s packet, single stepping.
llvm-svn: 210481
2014-06-09 17:46:37 +00:00
Todd Fiala 58f770ffa4 Remove invalid comment from last commit.
llvm-svn: 210376
2014-06-06 21:59:19 +00:00
Todd Fiala e76013c2ad Added gdb-remote program counter check at breakpoint.
Modified the breakpoint stop and start check to verify the program
counter printed immediately after stopping does match the breakpoint
address. This is based on a conversation with Greg Clayton clarifying
that the breakpoint stop handling code on a remote should do any and
all adjusting of the program counter at stop time, not at resume time.

Added a qProcessInfo parser and helper methods to add the collection
send/response elements to the packet flow. Removed the older pid-only
query mechanism. The parser verifies all the keys provided are within
the documented known set of key-value pairs.

Added helper routine to unpack the hex value of a $p-style register
read response according to the endian-ness of the inferior as reported
by qProcessInfo.

Added a test to verify qProcessInfo includes an endian key/value pair.

Refactored several older tests to move to the less verbose test
startup code. Most of these were the tests using the older
qProcessInfo pid-only retrieval code.

llvm-svn: 210374
2014-06-06 21:50:04 +00:00
Todd Fiala f032399bc4 Added gdb-remote test for software breakpoints.
Tests $Z0 and $z0.  Extends test exe get-code-address-hex:
to take a function name.

Enabled for debugserver, disabled for llgs.  Implementing
in llgs branch next.

llvm-svn: 210272
2014-06-05 16:34:13 +00:00
Todd Fiala 7f02cff20d Remove unused defines from lldb driver.
See http://reviews.llvm.org/D3965 for details.

Change by Thiago Farina.

llvm-svn: 210268
2014-06-05 14:46:04 +00:00
Todd Fiala ba78c15c9d Move MemoryRegionInfo out of Target/Process.h into its own header.
lldb-gdbserver and NativeProcessProtocol will use MemoryRegionInfo
but don't want to pull in Process.h.  Pull this declaration and
definition out into its own header.

llvm-svn: 210213
2014-06-04 20:13:37 +00:00
Todd Fiala 11d88bd10a Added gdb-remote $qMemoryRegionInfo tests for heap and stack.
Added two new tests: one to verify that a test exe heap address
returned is readable and writeable, and a similar one to verify
a test exe stack address is readable and writeable.

Ran the main.cpp test exe code through the Xcode re-indenter.
I was using TextMate to edit the test's C++ code alongside the
Python code but last check-in found that it was not handling
tabs/indentation the way I am intending it.

Modified test exe to require C++11.

Refactored gdb remote python code's handling of memory region
info into more re-usable methods.

llvm-svn: 210196
2014-06-04 16:42:12 +00:00
Todd Fiala 0811e71402 Add gdb-remote test for $qMemoryRegionInfo code querying.
Added test stub for collecting a code, heap and stack address.

Added test to verify that the code address returns a readable,
executable memory region and that the memory region range
was indeed the one that the code belonged to.

llvm-svn: 210187
2014-06-04 15:44:33 +00:00
Todd Fiala 99a1f2e95b Add gdb-remote test to ensure $qMemoryRegionInfo is supported.
llvm-svn: 210185
2014-06-04 14:48:22 +00:00
Todd Fiala 20f834b9ab Fix a couple minor typos in $qMemoryRegionInfo packet docs.
llvm-svn: 210163
2014-06-04 05:07:40 +00:00
Todd Fiala 68c246aad0 Added gdb-remote memory read ($m) test.
Added set-memory:{content} and get-memory-address-hex: commands
to the test exe for gdb-remote.  Added a test that sets the content
via the inferior command line, then reads it back via gdb-remote
with $m.

Passing on debugserver.  Marked as fail on llgs.  Implementing
in the llgs branch next.

llvm-svn: 210116
2014-06-03 18:09:56 +00:00
Colin Riley 28e7ed12f5 Windows fix: Disable editline for MSVC. Since r208369 there have been issues, probably related to the editline wrapper. For now, it's more stable and usable disabled.
llvm-svn: 210105
2014-06-03 14:37:35 +00:00
Colin Riley 740ed90626 Windows fix: Condition::Wait returned failure when it actually succeeded (SleepConditionVariableCS returns non-zero for success)
llvm-svn: 210104
2014-06-03 14:33:41 +00:00
Colin Riley b7fd1bd223 Fix windows build: SBTypeEnumMember.cpp added to the separate windows liblldb.dll project.
llvm-svn: 210099
2014-06-03 13:01:18 +00:00
Greg Clayton 4bd024d4e8 Small cleanups for the new enum fixes:
- Fix Xcode project to have source files for SBTypeEnumMember.h/SBTypeEnumMember.cpp in the right place
- Rename a member variable to inluce "_sp" suffix since it is a shared pointer
- Cleanup initialization code for TypeEnumMemberImpl to not warn about out of order initialization

llvm-svn: 210051
2014-06-02 21:58:30 +00:00
Todd Fiala 732215f989 Add support for inspecting enum members.
Change by Russell Harmon.

Xcode project updates (and all errors therein)
by Todd Fiala.

llvm-svn: 210046
2014-06-02 20:55:29 +00:00
Todd Fiala a4ec2fcff9 Add executable extension to debugger name, run dotest via binary.
See http://reviews.llvm.org/D3904 for details.

Change by Scott Graham.

llvm-svn: 210036
2014-06-02 17:49:35 +00:00
Todd Fiala 4dc625281d Fix most of the remaining Windows build warnings.
See http://reviews.llvm.org/D3944 for more details.

Change by Zachary Turner.

llvm-svn: 210035
2014-06-02 17:30:22 +00:00
Greg Clayton 6bc8739e57 Don't use libc's "char *basename(char *)" or "char *dirname(char *)" as they are not thread safe.
I switched the lldb_private::FileSpec code over to use "llvm::StringRef llvm::sys::path::filename(llvm::StringRef)" for basename() and "llvm::StringRef llvm::sys::path::parent_path(llvm::StringRef)" for dirname().

<rdar://problem/16870083>

llvm-svn: 209917
2014-05-30 21:06:57 +00:00
Todd Fiala 9c00cf557f gdb-remote signal delivery test cleanup.
Learned that MacOSX only accepts signal delivery on a thread that is
already signal handling.  Reworked the test exe to cause a SIGSEGV
and recover if either nothing intercepts the SIGSEGV handler, or
if a SIGUSR1 is inserted.  The test uses the latter part to test
signal delivery on continue using the SIGUSR1.

I still don't have this working on MacOSX.  I'm seeing the
signal get delivered to a different thread than the one I'm
specifying with $Hc{thread-id} + $C{signo}, or with
$vCont;C{signo}:{thread-id};c.  I'll come back to this
after getting it working on the llgs branch on Linux x86_64.

llvm-svn: 209912
2014-05-30 17:59:47 +00:00
Greg Clayton 7ab7f89ae0 iOS simulator cleanup to make sure we use "*-apple-ios" for iOS simulator apps and binaries.
Changes include:
- ObjectFileMachO can now determine if a binary is "*-apple-ios" or "*-apple-macosx" by checking the min OS and SDK load commands
- ArchSpec now says "<arch>-apple-macosx" is equivalent to "<arch>-apple-ios" since the simulator mixes and matches binaries (some from the system and most from the iOS SDK).
- Getting process inforamtion on MacOSX now correctly classifies iOS simulator processes so they have "*-apple-ios" architectures in the ProcessInstanceInfo
- PlatformiOSSimulator can now list iOS simulator processes correctly instead of showing nothing by using:
    (lldb) platform select ios-simulator
    (lldb) platform process list
- debugserver can now properly return "*-apple-ios" for the triple in the process info packets for iOS simulator executables
- GDBRemoteCommunicationClient now correctly passes along the triples it gets for process info by setting the OS in the llvm::Triple correctly

<rdar://problem/17060217>

llvm-svn: 209852
2014-05-29 21:33:45 +00:00
Todd Fiala 0428c97837 gdb-remote testing: new test, cleaned up socket reading.
Added new SocketPacketPump class to decouple gdb remote packet
reading from packet expectations code.  This allowed for cleaner
implementation of the separate $O output streams (non-deterministic
packaging of inferior stdout/stderr) from all the rest of the packets.

Added a packet expectation matcher that can match expected accumulated
output with a timeout.  Use a dictionary with "type":"output_match".
See lldbgdbserverutils.MatchRemoteOutputEntry for details.

Added a gdb remote test to verify that $Hc (continue thread selection)
plus signal delivery ($C{signo}) works.  Having trouble getting this
to pass with debugserver on MacOSX 10.9.  Tried different variants,
including $vCont;C{signo}:{thread-id};c.  In some cases, I get the
test exe's signal handler to run ($vCont variant first time), in others I don't
($vCont second and further times).  $C{signo} doesn't hit the signal
handler code at all in the test exe but delivers a stop.  Further
$Hc and $C{signo} deliver the stop marking the wrong thread.  For now I'm
marking the test as XFAIL on dsym/debugserver.  Will revisit this on
lldb-dev.

Updated the text exe for these tests to support thread:print-ids (each
thread announces its thread id) and provide a SIGUSR1 thread handler
that prints out the thread id on which it was signaled.

llvm-svn: 209845
2014-05-29 20:44:45 +00:00
Greg Clayton 36d7c89497 Fixed the Module::Module(ModuleSpec) constructor to properly copy the file offset and object file mod time from the actual module specifications so we will always be able to directly load the image we care about when calling Module::GetObjectFile().
llvm-svn: 209833
2014-05-29 17:52:46 +00:00
Arnaud A. de Grandmaison 53ae251a17 Fix r209807 which inadvertently removed things
llvm-svn: 209809
2014-05-29 13:42:17 +00:00
Nikola Smiljanic 2882a12337 Fix build. Method was renamed in r209800.
llvm-svn: 209807
2014-05-29 12:38:17 +00:00
Todd Fiala 303934ba49 Disabled warning C4251 on MSVC builds.
See http://reviews.llvm.org/D3934 for more details.
This is only the CMakeLists.txt portion of that change.

Change by Zachary Turner.

llvm-svn: 209756
2014-05-28 17:58:29 +00:00
Todd Fiala b6ee2f8061 Cmake build changes.
Disables exception handling in LLDB, using appropriate compiler
flags depending on the platform. This is consistent with the build
of LLVM, should improve performance, and also removes a substantial number
of warnings from the Windows build.

See http://reviews.llvm.org/D3929 for more details.

Change by Zachary Turner

llvm-svn: 209752
2014-05-28 17:06:04 +00:00
Todd Fiala 0a70a84534 Fix Windows warnings.
This fixes a number of trivial warnings in the Windows build. This is part of a larger effort to make the Windows build warning-free.

See http://reviews.llvm.org/D3914 for more details.

Change by Zachary Turner

llvm-svn: 209749
2014-05-28 16:43:26 +00:00
Ed Maste 4aeb3c0a4c Avoid passing null signal name for Log %s argument
llvm-svn: 209739
2014-05-28 14:11:20 +00:00
Ed Maste f886ac0b85 Fix whitespace / formatting
llvm-svn: 209737
2014-05-28 14:05:43 +00:00
Greg Clayton 23377e9fe6 Remove unused variable.
llvm-svn: 209703
2014-05-28 00:23:43 +00:00
Greg Clayton 641c23f332 Allow classes to be intialized using current lldb::SB objects. This can help to import/export the current process state.
llvm-svn: 209702
2014-05-28 00:21:15 +00:00
Ed Maste 1ae28dd793 Add stdlib.h for malloc and friends
llvm-svn: 209633
2014-05-26 14:07:26 +00:00
Ed Maste 8c43ed45ef Remove include of obsolete stropts.h header
The header is for POSIX streams functionality, and does not exist on
FreeBSD, OS X, or contemporary Linux distributions.

llvm-svn: 209632
2014-05-26 14:04:29 +00:00
Ed Maste 4c433e5206 Use MIUtilSystemLinux on FreeBSD as well
We should later rename this file (probably MIUtilSystemPOSIX), but
more clean-up is still needed here, and we can wait until we better
understand how this code may be shared between FreeBSD, Linux, and OS X.

llvm-svn: 209631
2014-05-26 13:57:15 +00:00
Ed Maste d60480f7b6 Add missing header
Presumably included by header leakage on other platforms.

llvm-svn: 209630
2014-05-26 13:48:38 +00:00
Jason Molenda 4da8706e5d Add a lock ivar to the Platform so that multiple Targets
trying to populate the list of trap handler names at
the same time don't conflict with one another.
<rdar://problem/17011969> 

llvm-svn: 209563
2014-05-23 23:11:27 +00:00
Todd Fiala 771bb72aa7 Remove some unnecessary comments from previous check-in.
Removed a "done" TODO comment.

Moved some helper methods to the top of the unit test.

Removed some commented out code I was considering implementing
before I came up with a better overall approach.

llvm-svn: 209561
2014-05-23 22:33:42 +00:00
Todd Fiala dee6d286de Added gdb remote tests to verify $Hg{thread-id}.
Added test to check that each thread reported by $q{f,s}ThreadInfo
can be switched to by $Hg, verified by a follow-up $qC.

Modified test exe to accept "thread:new" to create a new thread 
that runs and sleeps for 5 seconds.

@llgs_test/@debugserver_test now buffer output.
   
llgs and debugserver gdbremote protocol tests now collect $O notification
output into the context returned from expect_lldb_gdbserver_replay.
context["O_count"] is an integer indicating the number of $O packets
collected during the replay, and context["O_content"] contains the
accumulated hex-decoded text output by the inferior (stdout and stderr).

Modified the $O check test to check the accumulated output rather than
a direct $O packet.

llvm-svn: 209560
2014-05-23 22:25:29 +00:00
Sean Callanan 25ea6a1b8e Fixed the Symbol code to resolve the callable address
of the symbol itself rather than forcing clients to do
it.  This simplifies the logic for the expression
parser a great deal.

<rdar://problem/16935324>

llvm-svn: 209494
2014-05-23 02:30:48 +00:00
Jason Molenda ab35aa92da Instead of having an UnwindTable own a single assembly profiler,
and sharing it with all of its FuncUnwinders, have each FuncUnwinder
create an AssemblyProfiler on demand as needed.  I was worried that
the cost of creating the llvm disassemblers would be high for this
approach but it's not supposed to be an expensive operation, and it
means we don't need to add locks around this section of code.
<rdar://problem/16992332> 

llvm-svn: 209493
2014-05-23 01:48:10 +00:00
Jason Molenda 23a285d2d6 Revert r209488; Greg suggests a different approach.
llvm-svn: 209492
2014-05-23 01:42:56 +00:00
Jason Molenda f5e8a14bd6 The UnwindTable (one per module) used to hand out shared pointers
to its unwind assembly profiler to all of the FuncUnwinders (one
per symbol) under it.  If lldb is running multiple targets, you
could get two different FuncUnwinders in the same Module trying
to use the same llvm disassembler simultaneously and that may be
a re-entrancy problem.  

Instead, the UnwindTable has the unwind assembly profiler and when
the FuncUnwinders want to use it, they get exclusive access to
the assembly profiler until they're done using it.
<rdar://problem/16992332> 

llvm-svn: 209488
2014-05-23 00:08:09 +00:00
Greg Clayton e756aa3571 Make sure SectionLoadHistory::GetCurrentSectionLoadList () is thread safe.
<rdar://problem/15818525>

llvm-svn: 209485
2014-05-22 23:54:17 +00:00
Todd Fiala fbce07ced0 Added gdbremote protocol test for $p and returned data size.
Each register returned by $qRegisterInfo is tested that it's
$p register read returns a representation that is the correct byte size
as indicated by $qRegisterInfo.

Currently enabled for debugserver, disabled for llgs.

The llgs branch will use this to verify $p implementation.

llvm-svn: 209452
2014-05-22 17:18:18 +00:00
Jason Molenda 8eb3281731 Change ProcessKDP::DoReadMemory() to break up large memory
read requests into smaller chunks; some remote kdp stubs
cannot handle memory reads larger than a KB or two & will
error out.
<rdar://problem/16983125> 

llvm-svn: 209341
2014-05-21 23:44:02 +00:00