Commit Graph

628 Commits

Author SHA1 Message Date
Zachary Turner a21fee0ee4 Move the rest of the HostInfo functions over.
This should bring HostInfo up to 99% completion.  The remainder
of code in Host will be split into instantiatable classes
representing host processes, threads, dynamic libraries, and
process launching strategies.

llvm-svn: 216230
2014-08-21 21:49:24 +00:00
Zachary Turner 42ff0ad882 Move Host::GetLLDBPath to HostInfo.
This continues the effort to get Host code moved over to HostInfo,
and removes many more instances of preprocessor defines along the
way.

llvm-svn: 216195
2014-08-21 17:29:12 +00:00
Sylvestre Ledru 802a353065 Buffer not null terminated CID 1094354
llvm-svn: 215976
2014-08-19 12:13:14 +00:00
Jim Ingham 7ab079b6d0 Add an option to suppress the persistent result variable when running EvaluateExpression
from Python.  If you don't need to refer to the result in another expression, there's no
need to bloat the persistent variable table with them since you already have the result
SBValue to work with.

<rdar://problem/17963645>

llvm-svn: 215244
2014-08-08 21:45:36 +00:00
Zachary Turner 3f55974024 Optimizations for FileSpec.
llvm-svn: 215124
2014-08-07 17:33:36 +00:00
Greg Clayton 06357c930c (no commit message)
llvm-svn: 214319
2014-07-30 17:38:47 +00:00
David Majnemer 12bb77ddd1 SBCommunication: Fix a pointer-to-function to void-pointer cast
reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

This fixes a diagnostic emitted by GCC.

llvm-svn: 213696
2014-07-22 22:12:58 +00:00
David Majnemer 702c1d0986 SBHostOS: Fix a pointer-to-function to void-pointer cast
reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

This fixes a warning emitted by GCC.

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

llvm-svn: 213692
2014-07-22 22:00:04 +00:00
Zachary Turner 4041116579 Fix some warnings in the Windows build.
llvm-svn: 213194
2014-07-16 20:28:24 +00:00
Greg Clayton 45a44f3c4d Any commands that are executed through the public interface using SBCommandInterpreter::HandleCommand() are assumed to be in non-interactive mode.
Any commands that want interactivity (stdin) will need to be executed through the normal command interpreter using the debugger's in/out/err file handles, or by using "command source".

Individual commands through the API will have their STDIN disabled. The STDOUT and STDERR will be redirected into the SBCommandReturnObject argument to SBCommandInterpreter::HandleCommand() as usual.

This helps with a deadlock situation in an IDE (Xcode) where the IDE was managing the breakpoint actions by setting a breakpoint callback and doing things manually.

<rdar://problem/17386271>

llvm-svn: 213023
2014-07-15 00:25:59 +00:00
Greg Clayton 205ca1e89f Enable the ability to enable debug info generation when evaluating expressions.
llvm-svn: 212792
2014-07-11 01:03:57 +00:00
Jim Ingham e029fa5781 If a breakpoint gets deleted, any SBBreakpoints representing that
breakpoint should return false from IsValid.

llvm-svn: 212206
2014-07-02 18:44:43 +00:00
Bruce Mitchener d93c4a3339 Fix typos.
llvm-svn: 212132
2014-07-01 21:22:11 +00:00
Jim Ingham 106d02866d Added an option to turn OFF the "detach on error" behavior that was added
to debugserver when launching processes.

<rdar://problem/16216199>

llvm-svn: 211658
2014-06-25 02:32:56 +00:00
Todd Fiala 5d1b9c7386 Fix up Windows build for the SBUnixSignals addition.
Change by Zachary Turner.

llvm-svn: 211635
2014-06-24 21:38:31 +00:00
Todd Fiala 802dc40228 Add API control of the signal disposition.
See http://reviews.llvm.org/D4221 for details.

This commit allows you to control the signals that lldb will suppress, stop or forward using the Python and C++ APIs.

Change by Russell Harmon.

Xcode build system changes (and any mistakes) by Todd Fiala.  Tested on MacOSX 10.9.3 and Xcode 6 beta.  (Xcode 5 is hitting the dependency checker crasher on all my systems).

llvm-svn: 211526
2014-06-23 19:30:49 +00:00
Saleem Abdulrasool 3924d754e5 Remove unused variables
Address the 'variable set but not used' warning from GCC.  In some cases a few
additional calls were removed where there should be no visible side effects of
the calls (i.e. should not effect any cached state).

llvm-svn: 210879
2014-06-13 03:30:39 +00:00
Jason Molenda 705b180964 Initial merge of some of the iOS 8 / Mac OS X Yosemite specific
lldb support.  I'll be doing more testing & cleanup but I wanted to
get the initial checkin done.

This adds a new SBExpressionOptions::SetLanguage API for selecting a
language of an expression.

I added adds a new SBThread::GetInfoItemByPathString for retriving
information about a thread from that thread's StructuredData.

I added a new StructuredData class for representing
key-value/array/dictionary information (e.g. JSON formatted data).
Helper functions to read JSON and create a StructuredData object,
and to print a StructuredData object in JSON format are included.

A few Cocoa / Cocoa Touch data formatters were updated by Enrico
to track changes in iOS 8 / Yosemite.

Before we query a thread's extended information, the system runtime may 
provide hints to the remote debug stub that it will use to retrieve values
out of runtime structures.  I added a new SystemRuntime method 
AddThreadExtendedInfoPacketHints which allows the SystemRuntime to add 
key-value type data to the initial request that we send to the remote stub.

The thread-format formatter string can now retrieve values out of a thread's
extended info structured data.  The default thread-format string picks up
two of these - thread.info.activity.name and thread.info.trace_messages.

I added a new "jThreadExtendedInfo" packet in debugserver; I will
add documentation to the lldb-gdb-remote.txt doc soon.  It accepts
JSON formatted arguments (most importantly, "thread":threadnum) and
it returns a variety of information regarding the thread to lldb
in JSON format.  This JSON return is scanned into a StructuredData
object that is associated with the thread; UI layers can query the
thread's StructuredData to see if key-values are present, and if
so, show them to the user.  These key-values are likely to be
specific to different targets with some commonality among many
targets.  For instance, many targets will be able to advertise the
pthread_t value for a thread.

I added an initial rough cut of "thread info" command which will print
the information about a thread from the jThreadExtendedInfo result.
I need to do more work to make this format reasonably.

Han Ming added calls into the pmenergy and pmsample libraries if
debugserver is run on Mac OS X Yosemite to get information about the
inferior's power use.

I added support to debugserver for gathering the Genealogy information
about threads, if it exists, and returning it in the jThreadExtendedInfo
JSON result.

llvm-svn: 210874
2014-06-13 02:37:02 +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
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
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 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
Greg Clayton 3e32ad65fb Allow clients to control the exact path that is used to launch processes by adding new calls to SBLaunchInfo.
The new calls are:

SBFileSpec
SBLaunchInfo::GetExecutableFile ();

void
SBLaunchInfo::SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg);

<rdar://problem/16833939>

llvm-svn: 208245
2014-05-07 20:16:06 +00:00
Jim Ingham 8646d3c164 Rename eExecution*** to eExpression*** to be consistent with the result type.
llvm-svn: 207945
2014-05-05 02:47:44 +00:00
Jim Ingham 1624a2d3c8 Make the Expression Execution result enum available to the SB API layer.
Add a callback that will allow an expression to be cancelled between the
expression evaluation stages (for the ClangUserExpressions.)

<rdar://problem/16790467>, <rdar://problem/16573440>

llvm-svn: 207944
2014-05-05 02:26:40 +00:00
Jason Molenda b9ffa98cab Add a new SBThread::GetQueue() method to get the queue that is
currently associated with a given thread, on relevant targets.

Change the queue detection code to verify that the queues 
associated with all live threads are included in the list.
<rdar://problem/16411314> 

llvm-svn: 207160
2014-04-25 00:01:15 +00:00
Sean Callanan af90cf528c Included <inttypes.h> in a few headers that were
using preprocessor constants for printf() format
specifications.

llvm-svn: 206679
2014-04-19 03:09:28 +00:00
Greg Clayton 8334e14efc Fixed SBThread.GetStopReasonDataAtIndex() to correctly return breakpoint location ID.
Patch from Vyacheslav Karpukhin.

llvm-svn: 206040
2014-04-11 17:27:02 +00:00
Saleem Abdulrasool 324a103619 sweep up -Wformat warnings from gcc
This is a purely mechanical change explicitly casting any parameters for printf
style conversion.  This cleans up the warnings emitted by gcc 4.8 on Linux.

llvm-svn: 205607
2014-04-04 04:06:10 +00:00
Jim Ingham 6c9ed91cca Make the fail messages
llvm-svn: 205497
2014-04-03 01:26:14 +00:00
Saleem Abdulrasool 3985c8c646 sanitise sign comparisons
This is a mechanical change addressing the various sign comparison warnings that
are identified by both clang and gcc.  This helps cleanup some of the warning
spew that occurs during builds.

llvm-svn: 205390
2014-04-02 03:51:35 +00:00
Jim Ingham d80102e420 Add the ability to set python breakpoint commands from the SBBreakpoint & SBBreakpointLocation API's.
You can either provide the function name, or function body text.
Also propagate the compilation error up from where it is checked so we can report compilation errors.

<rdar://problem/9898371>

llvm-svn: 205380
2014-04-02 01:04:55 +00:00
Jason Molenda a332978b2a lldb arm64 import.
These changes were written by Greg Clayton, Jim Ingham, Jason Molenda.

It builds cleanly against TOT llvm with xcodebuild.  I updated the
cmake files by visual inspection but did not try a build.  I haven't
built these sources on any non-Mac platforms - I don't think this
patch adds any code that requires darwin, but please let me know if
I missed something.

In debugserver, MachProcess.cpp and MachTask.cpp were renamed to
MachProcess.mm and MachTask.mm as they picked up some new Objective-C
code needed to launch processes when running on iOS.

llvm-svn: 205113
2014-03-29 18:54:20 +00:00
Jim Ingham 914f4e7092 Add the ability from the SB API's to set the "one thread" timeout
for expression evaluations that try one and then all threads.

<rdar://problem/15598528>

llvm-svn: 205060
2014-03-28 21:58:28 +00:00
Jason Molenda aac16e0f80 Add a SBQueue::GetKind() method to retrieve the type of libdispatch queue (serial or concurrent).
<rdar://problem/7964505>

llvm-svn: 203748
2014-03-13 02:54:54 +00:00
Jim Ingham 4b4b2478fc This commit reworks how the thread plan's ShouldStopHere mechanism works, so that it is useful not only
for customizing "step-in" behavior (e.g. step-in doesn't step into code with no debug info), but also 
the behavior of step-in/step-out and step-over when they step out of the frame they started in.

I also added as a proof of concept of this reworking a mode for stepping where stepping out of a frame
into a frame with no debug information will continue stepping out till it arrives at a frame that does
have debug information.  This is useful when you are debugging callback based code where the callbacks
are separated from the code that initiated them by some library glue you don't care about, among other
things.

llvm-svn: 203747
2014-03-13 02:47:14 +00:00
Hafiz Abid Qadeer 581eb95983 Add some missing defines that are already present in the cmake side.
This is to help fix mingw build.

llvm-svn: 203649
2014-03-12 10:35:00 +00:00
Jason Molenda fe95dc95b5 SBQueue::GetNumPendingItems() should not force a fetch of the pending
items; the backing Queue object has the number of pending items
already cached.  Also, add SBQueue::GetNumRunningItems() to provide
that information.
<rdar://problem/16272016> 

llvm-svn: 203420
2014-03-09 19:41:30 +00:00
Virgile Bello da0fc76e7f Add inttypes.h to SBQueue.cpp (MSVC compilation error with PRIx32).
llvm-svn: 203348
2014-03-08 16:22:55 +00:00
Jason Molenda ac605f4a3a Add API logging to the SBQueue/SBQueueItem/SBThread calls.
llvm-svn: 203330
2014-03-08 01:34:55 +00:00
Jason Molenda a8ff543c28 When a client asks for a queue pending item's extended backtrace,
hold a strong pointer to that extended backtrace thread in the Process
just like we do for asking a thread's extended backtrace.
Also, give extended backtrace threads an invalid ThreadIndexID number.
We'll still give them valid thread_id's.  Clients who want to know the
original thread's IndexID can call GetExtendedBacktraceOriginatingIndexID().
<rdar://problem/16126034> 

llvm-svn: 203088
2014-03-06 06:31:18 +00:00
Greg Clayton 6fea17e874 "size_t" isn't always 64 bit, it is 32 bit on 32 bit systems. All printf style statements that were assuming size_t were 64 bit were changed, and they were also changed to display them as unsigned values as "size_t" isn't signed.
If you print anything with 'size_t', please cast it to "uint64_t" in the printf and use PRIu64 or PRIx64.

llvm-svn: 202738
2014-03-03 19:15:20 +00:00
Deepak Panickal 99fbc07600 Fix Windows build using portable types for formatting the log outputs
llvm-svn: 202723
2014-03-03 15:39:47 +00:00
Sean Callanan 866e91c9d4 Better error reporting when a variable can't be
read during materialization.  First of all, report
if we can't read the data for some reason.  Second,
consult the ValueObject's error and report that if
there's some problem.

<rdar://problem/16074201>

llvm-svn: 202552
2014-02-28 22:27:53 +00:00
Jim Ingham 286fb1ef32 Plumb the EvaluateExpressionOptions::{Set,Get}StopOthers through the SB API, and make it work in RunThreadPlan.
Also remove SetStopOthers from the ThreadPlanCallFunction, because if the value you have doesn't match what is
in the EvaluateExpressionOptions the plan was passed when created it won't work correctly.

llvm-svn: 202464
2014-02-28 02:52:06 +00:00
Enrico Granata 8a2a0dfba5 Restore the ability of SBFrame::FindValue() to look for file global variables
This should clean up the new test failures caused by r201614

llvm-svn: 201710
2014-02-19 19:35:13 +00:00
Enrico Granata 08a04327a9 <rdar://problem/15960553>
Fix a bug where calling SBFrame::FindValue() would cause a copy of all variables in the block to be inserted in the frame's variable list, regardless of whether those same variables were there or not - which means one could end up with a frame with lots of duplicate copies of the same variables

llvm-svn: 201614
2014-02-18 23:48:11 +00:00
Greg Clayton 751caf65c2 Modified ObjectFile::SetLoadAddress() to now be:
ObjectFile::SetLoadAddress (Target &target,
                            lldb::addr_t value,
                            bool value_is_offset);

Now "value" is a slide if "value_is_offset" is true, and "value" is an image base address otherwise. All previous usage of this API was using slides.

Updated the ObjectFileELF and ObjectFileMachO SetLoadAddress methods to do the right thing.

Also updated the ObjectFileMachO::SetLoadAddress() function to not load __LINKEDIT when it isn't needed and to only load sections that belong to the executable object file.

llvm-svn: 201003
2014-02-07 22:54:47 +00:00
Jason Molenda 2fd83355a8 Change the Mac OS X SystemRuntime plugin from using the placeholder
libldi library to collect extended backtrace information; switch
to the libBacktraceRecording library and its APIs.  Complete the
work of adding QueueItems to Queues and allow for the QueueItems
to be interrogated about their extended backtraces in turn.

There's still cleanup and documentation to do on this code but the
code is functional and I it's a good time to get the work-in-progress 
checked in.  
<rdar://problem/15314027> 

llvm-svn: 200822
2014-02-05 05:44:54 +00:00
Greg Clayton 44d937820b Merging the iohandler branch back into main.
The many many benefits include:
1 - Input/Output/Error streams are now handled as real streams not a push style input
2 - auto completion in python embedded interpreter
3 - multi-line input for "script" and "expression" commands now allow you to edit previous/next lines using up and down arrow keys and this makes multi-line input actually a viable thing to use
4 - it is now possible to use curses to drive LLDB (please try the "gui" command)

We will need to deal with and fix any buildbot failures and tests and arise now that input/output and error are correctly hooked up in all cases.

llvm-svn: 200263
2014-01-27 23:43:24 +00:00