Commit Graph

8912 Commits

Author SHA1 Message Date
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
Todd Fiala 2b4307d037 Added tests for q{f,s}ThreadInfo for attached processes.
Added helper methods:
prep_debug_monitor_and_inferior(): properly handles
the two cases of running the stub against an inferior process
launched by the stub, and one attached to by the stub.  See
docs for function: simplifies test creation for tests that want
to test the same operations against a launched and attached inferior.

Added the q{f,s}ThreadInfo and $qC response comparison test (verifies
they both return the same thing) when the process is attached rather
than launched by the stub.

Modified the previous two tests added to make use of the new
prep_debug_monitor_and_inferior() facility.

llvm-svn: 209318
2014-05-21 20:12:01 +00:00
Todd Fiala 2954206e56 Added gdb-remote tests for q{f,s}ThreadInfo.
The First test verifies that qThreadInfo queries work for stub-launched processes.

The second test verifies that $qC after stub-launched inferior returns the same
thread as the qThreadInfo queries.

llvm-svn: 209314
2014-05-21 18:12:14 +00:00
Ed Maste a45c1600dc Implement Host::GetThreadName for FreeBSD
llvm-svn: 209312
2014-05-21 18:09:55 +00:00
Rafael Espindola 9cb97b630d Update for llvm api change in r209266.
llvm-svn: 209303
2014-05-21 15:08:27 +00:00
Ed Maste cc913d1453 Correct comment for thread name log option
llvm-svn: 209299
2014-05-21 13:46:46 +00:00
Jim Ingham fbe0b9abf9 ReExported symbols can point to a library that doesn't actually
contain the symbol, but just reexports wholesale from another
library.  Handle this case.

<rdar://problem/16977589>

llvm-svn: 209270
2014-05-21 03:58:03 +00:00
Reid Kleckner 64976a2a23 Update .arcconfig to point to reviews.llvm.org
Mostly a test review and commit.

Reviewers: tfiala

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

llvm-svn: 209237
2014-05-20 21:24:59 +00:00
Todd Fiala 4e53f9e1fe Change gdb remote test support multi-request format.
The multi request-response test infrastructure support was adding
the optional request suffix iteration index as decimal but it needed
to be hex per spec.  This change fixes that.

llvm-svn: 209234
2014-05-20 20:02:08 +00:00
Todd Fiala 62b2317fd8 Added gdb remote protocol tests across all qRegisterInfo responses.
Added support for gdb remote protocol capture/playback where there is a query/multiple-response
pattern.  The new playback entry supports:

- a general query command (key: next_query or query)
- an optional first-query command if that differs from the subsequent queries (key: first_query)
- an end regex for matching anything that would signify that the query/multi-response
  iteration has come to an end.  An assumption is that the end regex is not a content
  package we care about aside from ending the iteration. (key: end_regex)
- an optional 0-based index appended to the end of the query command 
  (key: append_iteration_suffix), default: False.
- a key used to collect responses from the query.  Any response from the gdb remote
  that doesn't match the end-of-iteration regex is captured in the playback context
  dictionary using the key specified.  That key will be an array, where each array
  entry is one of the responses from the query/multi-response iteration. (key: save_key).
- a runaway response value, defaulting to 10k, where if this many responses is captured,
  assume the ending condition regex is invalid, or the debug monitor is doing something
  goofy that is going to blow out memory or time. (key: runaway_response_count, default: 10000)

See the lldbgdbserverutils.MultiResponseGdbRemoteEntry class for details.

A MultiResponseGdbRemoteEntry is added by adding an element to the GdbRemoteTestSequence
(via GdbRemoteTestSequence.add_log_lines), using a dictionary, where the "type" key
is set to "multi_response", and the rest of the keys in the dictionary entry are
set to the keys documented for MultiResponseGdbRemoteEntry.

Added helper functions to add the required entry to grab all qRegisterInfo responses.
Added another helper to parse the qRegisterInfo response packets into an array of
dictionaries, where each key:value in the dictionary comes from the register info
response packet.

Added a test to verify that a generic register exists for the program counter,
frame pointer, stack pointer and cpu flags across all register info responses.

Added a test to verify that at least one register set exists across all register
info responses.

llvm-svn: 209170
2014-05-19 22:35:24 +00:00
Greg Clayton cb172b104a Don't allow two threads to both be in SBDebugger::Create() due to threading issues in FormatManager.
<rdar://problem/16937126>

llvm-svn: 209160
2014-05-19 20:42:14 +00:00
Todd Fiala 76e1bf53b4 Revert r209142.
Need to spend a little more time with suppressing the debugserver 64-to-32 bit warnings.
Will re-submit after I get the warnings properly suppressed.

llvm-svn: 209151
2014-05-19 18:30:48 +00:00
Todd Fiala 37ba9f5d8a Update Xcode settings for Xcode 5.1 (5B130a) to remove workspace warning.
llvm-svn: 209142
2014-05-19 16:58:52 +00:00
Hafiz Abid Qadeer 31f56816af Build lldb-mi with autotools on Linux.
THe lldb-mi stuff was not being built on Linux with autotools.
I only added Linux now as I have tested that it build fine on Linux.

llvm-svn: 209117
2014-05-19 09:12:15 +00:00
Todd Fiala 06fcbd95e8 Added gdb remote test for one valid qRegisterInfo result.
Checks that at at least qRegisterInfo0 responds with a valid
register info reply packet.  The packet is parsed and validates
that all keys come from the documented set of valid keys.  It
then validates that a minimum set of expected keys
are present in the returned packet.

This test is set to pass on debugserver and fail on llgs TOT.

llvm-svn: 209109
2014-05-19 06:11:41 +00:00
Todd Fiala ff6131a958 Add support for gdb remote $X stop notification.
debugserver now returns $X09 as the immediate response to
a $k kill process request rather than $W09.

ProcessGDBRemote now properly handles X as indication of
a process exit state.

The @debugserver_test and @lldb_test for $k now properly expects
an X notification (signal-caused exit) after killing a just-attached
inferior that was still in the stopped state.

llvm-svn: 209108
2014-05-19 04:57:23 +00:00
Enrico Granata e8daa2f843 Introduce the concept of a "display name" for types
Rationale:
Pretty simply, the idea is that sometimes type names are way too long and contain way too many details for the average developer to care about. For instance, a plain ol' vector of int might be shown as
std::__1::vector<int, std::__1::allocator<....
rather than the much simpler std::vector<int> form, which is what most developers would actually type in their code

Proposed solution:
Introduce a notion of "display name" and a corresponding API GetDisplayTypeName() to return such a crafted for visual representation type name
Obviously, the display name and the fully qualified (or "true") name are not necessarily the same - that's the whole point
LLDB could choose to pick the "display name" as its one true notion of a type name, and if somebody really needs the fully qualified version of it, let them deal with the problem
Or, LLDB could rename what it currently calls the "type name" to be the "display name", and add new APIs for the fully qualified name, making the display name the default choice

The choice that I am making here is that the type name will keep meaning the same, and people who want a type name suited for display will explicitly ask for one
It is the less risky/disruptive choice - and it should eventually make it fairly obvious when someone is asking for the wrong type

Caveats:
- for now, GetDisplayTypeName() == GetTypeName(), there is no logic to produce customized display type names yet.
- while the fully-qualified type name is still the main key to the kingdom of data formatters, if we start showing custom names to people, those should match formatters

llvm-svn: 209072
2014-05-17 19:14:17 +00:00
Jason Molenda 64a68d6157 Update how we create our MCSymbolizer to keep working correctly
on arm64 binaries after the llvm r206063 changes.  
Patch written by Jim Ingham and Lang Hames.
<rdar://problem/16935671> 

llvm-svn: 209051
2014-05-17 00:27:44 +00:00
Greg Clayton 5c6a2cd920 Fix the copy constructor and assignement operator for the lldb_private::Value class to "do the right thing".
llvm-svn: 209036
2014-05-16 21:49:19 +00:00
Todd Fiala 4fc3cdd054 Refactored RegisterInfoInterface into its own header.
Also moved it into the lldb_private namespace.

The llgs branch is making use of this interface and its use is not
strictly limited to POSIX.

llvm-svn: 209016
2014-05-16 20:43:19 +00:00
Jim Ingham ec47b2217e Fix from: Scott Knight(knightsc@gmail.com):
Use a map rather than a vector to store the objects managed by the shared 
cluster since mostly want this for random lookup, so the map is much faster.

llvm-svn: 209010
2014-05-16 19:46:56 +00:00
Deepak Panickal 95442c445f Do not require the triple to be hard-coded
llvm-svn: 208982
2014-05-16 13:26:45 +00:00
Deepak Panickal 6f9c468102 Initial commit of LLDB Machine Interface Frontend.
- Tested with Eclipse, likely to work with other GDB/MI compatible GUIs.
- Some but not all MI commands have been implemented. See MIReadme.txt for more info.
- Written from scratch, no GPL code, based on LLDB Public API.
- Built for Linux, Windows and OSX. Tested on Linux and Windows.
- GDB/MI Command Reference, https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html

llvm-svn: 208972
2014-05-16 10:51:01 +00:00
Todd Fiala d18b767b04 Added gdbremote tests to verify kill and continue after attach.
llvm-svn: 208804
2014-05-14 19:34:06 +00:00
Greg Clayton 24feaf70aa Fixed SectionLoadHistory::GetSectionLoadListForStopID() to always return a valid "SectionLoadList *".
<rdar://problem/15818525>

llvm-svn: 208796
2014-05-14 17:25:00 +00:00
Todd Fiala 028a43f910 Fix up TestLldbGdbServer C++ test slug exe.
Missing header for Linux, replaces with iostreams.

llvm-svn: 208794
2014-05-14 17:12:02 +00:00
Todd Fiala fd8ae3a140 Replace SIZE_T_MAX with std::numeric_limits value in Section.cpp.
SIZE_T_MAX is not available on Linux.

llvm-svn: 208789
2014-05-14 16:15:43 +00:00
Todd Fiala f05ca45b1e Added debugserver/llgs test for command-line --attach {pid} variant.
Checks that the pid reported by $qProcessInfo matches the pid that was
launched as the attach test subject.

test exe now supports "sleep:{sleep_seconds}" command line argument.

llvm-svn: 208782
2014-05-14 14:51:27 +00:00
Greg Clayton 3698a715ee Don't assert and crash when sections are malformed.
<rdar://problem/16833247>

llvm-svn: 208749
2014-05-14 01:12:09 +00:00
Todd Fiala e24614f74e lldb: gdb remote support always falls back to $qC when no $qProcessInfo.
See thread here:
http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-May/003992.html

This is meant to address case 3 that I recently broke with an earlier
change to rectify usage of the $qC message for thread ids, specifically:

3. TOT lldb <=> gdbserver (without $qProcessInfo support and not Apple/iOS).

llvm-svn: 208741
2014-05-14 00:15:32 +00:00
Jason Molenda 060ca7596c Fix the quoting in my x packet documentation so it's
consistent with the rest of the entries.

llvm-svn: 208736
2014-05-13 22:21:34 +00:00
Jason Molenda b4892cd266 Add a new SBThread::SafeToCallFunctions API; this calls over to
the SystemRuntime to check if a thread will have any problems 
performing an inferior function call so the driver can skip
making that function call on that thread.  Often the function
call can be executed on another thread instead.
<rdar://problem/16777874> 

llvm-svn: 208732
2014-05-13 22:02:48 +00:00
Todd Fiala 9d03d8a65d Fix broken TestMultithreaded on Linux.
The clean line is failing under Ubuntu 12.04/gcc.  It cleans fine
without it on MacOSX.  It doesn't clean right on Linux but at least
now it doesn't fail the test.

llvm-svn: 208713
2014-05-13 17:20:17 +00:00
Saleem Abdulrasool f69b64d6d2 python: silence macro redefinition warnings
Python defines _XOPEN_SOURCE and _POSIX_C_SOURCE unconditionally.  On Linux,
this is problematic as glibc's features.h defines these values if _GNU_SOURCE is
defined to the value that is currently implemented.  Python defines it to the
versions that it requires, which may be different.  Undefine the macros on Linux
(technically, this should be safe to do globally) before including the python
headers.

llvm-svn: 208520
2014-05-12 06:44:01 +00:00
Jim Ingham 7b113009a9 Documented our "attach" extension packets.
llvm-svn: 208423
2014-05-09 16:17:24 +00:00