Commit Graph

3676 Commits

Author SHA1 Message Date
Jason Molenda 1a100cd78f Add ifdef LLDB_DISABLE_PYTHON around newly added use of
AddCXXSummary in FormatManager::LoadSystemFormatters(); 
that function pulls in code that assumes python; can't
be used without the ifdef.

llvm-svn: 172300
2013-01-12 04:24:50 +00:00
Sean Callanan 0bf0bafbc9 Removed the hack that uses "frame variable" to
evaluate expressions.  The expression parser and
IR interpreter are now fully capable of evaluating
expressions with as much (or better) fidelity.

<rdar://problem/12879364>

llvm-svn: 172293
2013-01-12 02:04:23 +00:00
Greg Clayton 399bf618de Don't always strip the first extension from the module basename when looking for python scripts. Now we take a name like "a.b.c" and look for scripts that are "a_b_c.py", "a_b.py" and "a.py" inside the dSYM.
llvm-svn: 172291
2013-01-12 01:36:05 +00:00
Enrico Granata e274088db0 <rdar://problem/12239827>
Making a summary for std::wstring as provided by libstdc++ along with a relevant test case

llvm-svn: 172286
2013-01-12 01:22:57 +00:00
Enrico Granata 3309d88198 <rdar://problem/12239827>
Providing a data formatter for libc++ std::wstring
In the process, refactoring the std::string data formatter to be written in C++ so that commonalities between the two can be exploited
Also, providing a new API on the ValueObject to navigate a hierarchy by index-path
Lastly, an appropriate test case is included

llvm-svn: 172282
2013-01-12 01:00:22 +00:00
Greg Clayton 91c0e749e3 <rdar://problem/12973809>
Fixed an issue with the auto loading of script resources in debug info files. Any platform can add support for this, and on MacOSX we allow dSYM files to contain python modules that get automatically loaded when a dSYM file is associated with an executable or shared library. 

The modifications will now:
- Let the module locate the symbol file naturally instead of using a function that only works in certain cases. This helps us to locate the script resources as long as the dSYM file can be found.
- Don't try and do any of this if the script interpreter has scripting disabled.
- Allow more than one scripting resource to be found in a symbol file by returning the list
- Load the scripting resources when a symbol file is added via the "target symbols add" command.
- Be smarter about matching the dSYM mach-o file to an existing executable in the target images by stripping extensions on the symfile basname if needed.

llvm-svn: 172275
2013-01-11 23:44:27 +00:00
Greg Clayton 1e0c88401e <rdar://problem/12990038>
Fixed an issue where the platform auto select code was changing the architecture and causing the wrong architecture to be assigned to the target.

llvm-svn: 172251
2013-01-11 20:49:54 +00:00
Greg Clayton c0e8a85ea8 Modified Value.cpp to share the code that gets the values as bytes (Value::GetValueAsData()) so now Value::ResolveValue() doesn't do its own thing by reading memory directly.
Also modified the Value class so that you can evaluate expressions without a process, yet with some sections loaded in the target. This allows casting pointers that are in data sections to types and being able to evaluate expressions in the data. For example:

(lldb) target create a.out
(lldb) target modules load --file a.out --slide 0
... find address of something in data ...
(lldb) script
expr_opts = lldb.SBExpressionOptions()
v = lldb.target.EvaluateExpression('(foo *)0x1230000', expr_opts)
print v
vv = lldb.value(v)
print v.pt.x

Above we were able to cast a pointer to an address which was in a.out's data
section and print out entire structures and navigate to the child ivars of the expression.

llvm-svn: 172227
2013-01-11 18:01:02 +00:00
Enrico Granata 2500e767a0 Making the Unicode formatters visually nicer by using the same prefix characters as the compiler expects in C++ code
Also, marking the Unicode data formatters test cases as dataformatter related for the benefit for the --category flag in dotest.py

llvm-svn: 172167
2013-01-11 03:01:25 +00:00
Enrico Granata 3835204ade <rdar://problem/11383764>
Making a data formatter for wchar_t *

llvm-svn: 172165
2013-01-11 02:44:00 +00:00
Enrico Granata f68df12fb0 <rdar://problem/12725746>
Providing data formatters for char16_t* and char32_t* C++11-style Unicode strings
Using this chance to refactor the UTF data reader used for data formatters for added generality
Added a relevant test case

llvm-svn: 172119
2013-01-10 22:08:35 +00:00
Enrico Granata c921e34c81 <rdar://problem/11146929>
Enabling support for the wchar_t type.
Without the proper language option setup, clang's ASTContexts will be configured to have wchar_t == int
This patch enables the correct options to make sure that we report wchar_t as itself
Added a test case to make sure we do not regress 

Adding files missing from the previous commit

llvm-svn: 172039
2013-01-10 02:37:22 +00:00
Greg Clayton e05b2efe27 Fixed an issue the "process plugin" proxy object was trying to use the m_exe_ctx when it wasn't ok to do so.
llvm-svn: 172014
2013-01-09 22:58:18 +00:00
Sean Callanan 087f437b60 Added emulation of shifts to the IR interpreter.
<rdar://problem/12978619>

llvm-svn: 172013
2013-01-09 22:44:41 +00:00
Enrico Granata b576bba229 <rdar://problem/12028723>
Adding useful formatting options to the expression (expr) command.
As a side effect of this change, the -d option now supports the same three-values enumeration that frame variables uses (run, don't run, none) instead of a boolean like it did previously

These options do not apply to print, p or po because these are aliased to not take any options.
In order to use them, use expression or expr.

llvm-svn: 171993
2013-01-09 20:12:53 +00:00
Greg Clayton f9fc609fe7 Expanded the flags that can be set for a command object in lldb_private::CommandObject. This list of available flags are:
enum
{
    //----------------------------------------------------------------------
    // eFlagRequiresTarget
    //
    // Ensures a valid target is contained in m_exe_ctx prior to executing
    // the command. If a target doesn't exist or is invalid, the command
    // will fail and CommandObject::GetInvalidTargetDescription() will be
    // returned as the error. CommandObject subclasses can override the
    // virtual function for GetInvalidTargetDescription() to provide custom
    // strings when needed.
    //----------------------------------------------------------------------
    eFlagRequiresTarget         = (1u << 0),
    //----------------------------------------------------------------------
    // eFlagRequiresProcess
    //
    // Ensures a valid process is contained in m_exe_ctx prior to executing
    // the command. If a process doesn't exist or is invalid, the command
    // will fail and CommandObject::GetInvalidProcessDescription() will be
    // returned as the error. CommandObject subclasses can override the
    // virtual function for GetInvalidProcessDescription() to provide custom
    // strings when needed.
    //----------------------------------------------------------------------
    eFlagRequiresProcess        = (1u << 1),
    //----------------------------------------------------------------------
    // eFlagRequiresThread
    //
    // Ensures a valid thread is contained in m_exe_ctx prior to executing
    // the command. If a thread doesn't exist or is invalid, the command
    // will fail and CommandObject::GetInvalidThreadDescription() will be
    // returned as the error. CommandObject subclasses can override the
    // virtual function for GetInvalidThreadDescription() to provide custom
    // strings when needed.
    //----------------------------------------------------------------------
    eFlagRequiresThread         = (1u << 2),
    //----------------------------------------------------------------------
    // eFlagRequiresFrame
    //
    // Ensures a valid frame is contained in m_exe_ctx prior to executing
    // the command. If a frame doesn't exist or is invalid, the command
    // will fail and CommandObject::GetInvalidFrameDescription() will be
    // returned as the error. CommandObject subclasses can override the
    // virtual function for GetInvalidFrameDescription() to provide custom
    // strings when needed.
    //----------------------------------------------------------------------
    eFlagRequiresFrame          = (1u << 3),
    //----------------------------------------------------------------------
    // eFlagRequiresRegContext
    //
    // Ensures a valid register context (from the selected frame if there
    // is a frame in m_exe_ctx, or from the selected thread from m_exe_ctx)
    // is availble from m_exe_ctx prior to executing the command. If a
    // target doesn't exist or is invalid, the command will fail and
    // CommandObject::GetInvalidRegContextDescription() will be returned as
    // the error. CommandObject subclasses can override the virtual function
    // for GetInvalidRegContextDescription() to provide custom strings when
    // needed.
    //----------------------------------------------------------------------
    eFlagRequiresRegContext     = (1u << 4),
    //----------------------------------------------------------------------
    // eFlagTryTargetAPILock
    //
    // Attempts to acquire the target lock if a target is selected in the
    // command interpreter. If the command object fails to acquire the API
    // lock, the command will fail with an appropriate error message.
    //----------------------------------------------------------------------
    eFlagTryTargetAPILock       = (1u << 5),
    //----------------------------------------------------------------------
    // eFlagProcessMustBeLaunched
    //
    // Verifies that there is a launched process in m_exe_ctx, if there
    // isn't, the command will fail with an appropriate error message.
    //----------------------------------------------------------------------
    eFlagProcessMustBeLaunched  = (1u << 6),
    //----------------------------------------------------------------------
    // eFlagProcessMustBePaused
    //
    // Verifies that there is a paused process in m_exe_ctx, if there
    // isn't, the command will fail with an appropriate error message.
    //----------------------------------------------------------------------
    eFlagProcessMustBePaused    = (1u << 7)
};

Now each command object contains a "ExecutionContext m_exe_ctx;" member variable that gets initialized prior to running the command. The validity of the target objects in m_exe_ctx are checked to ensure that any target/process/thread/frame/reg context that are required are valid prior to executing the command. Each command object also contains a Mutex::Locker m_api_locker which gets used if eFlagTryTargetAPILock is set. This centralizes a lot of checking code that was previously and inconsistently implemented across many commands.

llvm-svn: 171990
2013-01-09 19:44:40 +00:00
Jim Ingham 196bbc2571 Add a "--reverse" or "-r" option to the "list" with no options command. This will list backwards from the
last source point listed.
Also fix the setting of the default file & line to the file containing main, when you do a plain "list".

<rdar://problem/12685226>

llvm-svn: 171945
2013-01-09 03:27:33 +00:00
Jim Ingham bf2956a2f8 Add an SBProcess API to get the current StopID, either considering or ignoring stops caused by expression
evaluation.

<rdar://problem/12968562>

llvm-svn: 171914
2013-01-08 23:22:42 +00:00
Han Ming Ong c2c423eac2 <rdar://problem/12976225>
Checking in the support for doing index ids reservation when given a thread id.

llvm-svn: 171904
2013-01-08 22:10:01 +00:00
Greg Clayton b65d733f06 <rdar://problem/12586010>
Python OS plug-ins now fetch thread registers lazily.

Also changed SBCommandInterpreter::HandleCommand() to not take the API lock. The logic here is that from the command line you can execute a command that might result in another thread (like the private process thread) to execute python or run any code that can re-enter the public API. When this happens, a deadlock immediately occurs for things like "process launch" and "process attach".

llvm-svn: 171901
2013-01-08 21:56:43 +00:00
Greg Clayton e55c9f9cfb Fixed comment typo.
llvm-svn: 171900
2013-01-08 21:54:15 +00:00
Matt Kopec 650648fa57 Add initial support to trace spawned threads in a process on Linux.
llvm-svn: 171864
2013-01-08 16:30:18 +00:00
Daniel Malea 97059d4377 Enable ProcessGDBRemote plugin on Linux
- Fixes test case TestConnectRemote

llvm-svn: 171855
2013-01-08 14:55:36 +00:00
Daniel Malea 6217d2ae37 Implement -w flag to process launch (allow launching inferior process in different working directory) on Linux/FreeBSD
- fixes test case TestProcessLaunch

llvm-svn: 171854
2013-01-08 14:49:22 +00:00
Enrico Granata d994540259 <rdar://problem/12968925>
Ensuring that the Module's FileSpec is not NULL before attempting to deref it for loading the python scripting resource

llvm-svn: 171838
2013-01-08 02:36:54 +00:00
Matt Kopec 845d7d8302 Fix TestSendSignals.py on Linux. The wrong stop reason was being set when stopping for a received signal.
llvm-svn: 171819
2013-01-08 00:13:33 +00:00
Greg Clayton c1b2ccfd34 <rdar://problem/12953853>
Setting breakpoints using "breakpoint set --selector <SEL>" previously didn't when there was no dSYM file.

Also fixed issues in the test suite that arose after fixing the bug.

Also fixed the log channels to properly ref count the log streams using weak pointers to the streams. This fixes a test suite problem that would happen when you specified a full path to the compiler with the "--compiler" option.

llvm-svn: 171816
2013-01-08 00:01:36 +00:00
Enrico Granata 070db184fb Make sure that the GenerateFunction call can support arbitrary levels of indentation for user code
llvm-svn: 171810
2013-01-07 23:09:58 +00:00
Jason Molenda 7a37c1ec4c <rdar://problem/12389806>
Have the disassembler's Instruction::Dump always insert at least
one space character between an opcode and its arguments, don't let
a long opcode name abut the arguments.

llvm-svn: 171561
2013-01-04 23:52:35 +00:00
Daniel Malea 53430eb877 Fix lldb -P on Linux
- now prints the correct PYTHONPATH
- update dotest.py to use lldb -P result correctly
- resolves TestPublicAPIHeaders test failure (on Linux)

llvm-svn: 171558
2013-01-04 23:35:13 +00:00
Sean Callanan ecda2b2df7 Read bytes from zero-filled sections correctly
instead of failing to read.

<rdar://problem/12958589>

llvm-svn: 171552
2013-01-04 23:20:01 +00:00
Andrew Kaylor c740150f0b Handle the case of unordered sequences in a DWARF line table.
llvm-svn: 171548
2013-01-04 22:57:56 +00:00
Greg Clayton 4b63a5c1ce <rdar://problem/12928282>
Added SBTarget::EvaluateExpression() so expressions can be evaluated without needing a process.

Also fixed many functions that deal with clang AST types to be able to properly handle the clang::Type::Elaborated types ("struct foo", "class bar").

llvm-svn: 171476
2013-01-04 18:10:18 +00:00
Sean Callanan 8258705dbd Clang sometimes emits "objc_object*" rather than "id"
for id types with protocols on them.  We detect this
and report "id" instead.

Also added a testcase.

<rdar://problem/12595644>

llvm-svn: 171431
2013-01-03 00:05:56 +00:00
Chandler Carruth 38336a168d Update to reflect API changes in r171367.
llvm-svn: 171381
2013-01-02 12:55:00 +00:00
Chandler Carruth 1e157587fe Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate to reflect the
migration in r171366.

I don't know anything about lldb, but a force run of the build bot indicated it
would need this patch. I'll try to watch the build bot to get it green.

llvm-svn: 171374
2013-01-02 12:20:07 +00:00
Jim Ingham 6200471a70 Remember to tell the target about dyld when we resolve the address for it.
llvm-svn: 170975
2012-12-22 01:52:32 +00:00
Sean Callanan f466a6eddc Added support for the modulus operator (%) to
the IR interpreter.

<rdar://problem/12921700>

llvm-svn: 170934
2012-12-21 22:27:55 +00:00
Jim Ingham e2231ac783 Added an SBAPI to get the PythonPath (if the Host knows how to do that). And a -P option to the Driver
to print it out.  Changed dotest.py to use that to find the PythonPath it should use given the lldb binary
it was told to run.

llvm-svn: 170932
2012-12-21 22:22:26 +00:00
Sean Callanan 5deaa4c902 Made LLDB compile with LLVM top-of-tree again.
The results from Clang name lookups changed to
be ArrayRefs, so I had to change the way we
check for the presence of a result and the way
we iterate across results.

llvm-svn: 170927
2012-12-21 21:34:42 +00:00
Sean Callanan bab7cc405d Fixed a bug where we could accept the wrong
slice of a fat dSYM in certain cases.

<rdar://problem/12921206>

llvm-svn: 170926
2012-12-21 21:32:25 +00:00
Andrew Kaylor f85defaea5 Adding eStopReasonThreadExiting and fixing the handling of this state on Linux.
llvm-svn: 170800
2012-12-20 23:08:03 +00:00
Jim Ingham a0b151715a If we can't find the python function for a given summary, print the name of the function in the warning message.
llvm-svn: 170729
2012-12-20 20:08:17 +00:00
Jason Molenda 253a19a004 Clarify the comments in PlatformDarwin::LocateExecutableScriptingResource
a bit.

llvm-svn: 170641
2012-12-20 02:53:18 +00:00
Enrico Granata 04e92149a1 <rdar://problem/12903081>
When looking for the Python script to load for a given module, replace dots with underscores if there are any after stripping the extension
This means that for a module named foo.devel.xyz a file named foo_devel.py will be what we try to load

llvm-svn: 170633
2012-12-20 02:07:45 +00:00
Enrico Granata 557fd00a6f <rdar://problem/12446222>
Implement the ability for Python commands to be interrupted by pressing CTRL+C
Also add a new Mutex subclass that attempts to be helpful for debugging by logging actions performed on it

FYI of all interested - there is a separate deadlocking issue related to how LLDB dispatches CTRL+C that might cause LLDB to deadlock upon pressing CTRL+C while in a Python command.
This is not a regression, and was just previously masked by us not even trying to bail out of Python commands, so that it would not be clear from a user perspective whether we were
deadlocked or stuck in an inconsistent state within the Python interpreter.

llvm-svn: 170612
2012-12-19 23:42:07 +00:00
Sean Callanan 7be70e8528 This patch removes the SymbolFileSymtab support
for reporting class types from Objective-C runtime
class symbols.  Instead, LLDB now queries the 
Objective-C runtime for class types.

We have also added a (minimal) Objective-C runtime
type vendor for Objective-C runtime version 1, to 
prevent regressions when calling class methods in
the V1 runtime.

Other components of this fix include:

- We search the Objective-C runtime in a few more
  places.

- We enable enumeration of all members of
  Objective-C classes, which Clang does in certain
  circumstances.

- SBTarget::FindFirstType and SBTarget::FindTypes
  now query the Objective-C runtime as needed.

- I fixed several test cases.

<rdar://problem/12885034>

llvm-svn: 170601
2012-12-19 23:05:01 +00:00
Jason Molenda f17b5ac6e1 <rdar://problem/11961650>
Update the debugserver "qProcessInfo" implementation to return the
cpu type, cpu subtype, OS and vendor information just like qHostInfo
does so lldb can create an ArchSpec based on the returned values.

Add a new GetProcessArchitecture to GDBRemoteCommunicationClient akin
to GetHostArchitecture.  If the qProcessInfo packet is supported,
GetProcessArchitecture will return the cpu type / subtype of the 
process -- e.g. a 32-bit user process running on a 64-bit x86_64 Mac
system. 

Have ProcessGDBRemote set the Target's architecture based on the 
GetProcessArchitecture when we've completed an attach/launch/connect.

llvm-svn: 170491
2012-12-19 02:54:03 +00:00
Greg Clayton 0b510bca73 Don't read the SP when getting argument values from registers in case the SP isn't available. We don't want the availability of SP to limit when we get get arguments from registers.
llvm-svn: 170476
2012-12-18 23:45:33 +00:00
Daniel Malea f00b751175 Fix typo in error message (print requested URL instead of command name when plugin missing)
llvm-svn: 170447
2012-12-18 20:00:40 +00:00