Commit Graph

6095 Commits

Author SHA1 Message Date
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
Greg Clayton 89f255e426 Updated documentation on the "register_data_addr" key that can be supplied in the "thread" dictionary return value for the python OS plug-ins.
llvm-svn: 171934
2013-01-09 02:05:38 +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 0ac31ac380 Add test to check the number of threads.
llvm-svn: 171869
2013-01-08 17:29:00 +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
Daniel Malea 326fd7fdf5 Re-enabling C++ exception breakpoint testcase (on Linux)
- bug fixed in r170241, thanks Andy!
- closing related PR 14423

llvm-svn: 171794
2013-01-07 21:42:11 +00:00
Jason Molenda 153c8e0cc2 <rdar://problem/12602653>
Add unconditional logging messages to every place in debugserver
where we send a SIGKILL signal or do a ptrace PT_KILL call to
terminate the inferior process.  When the debuggee is silently
killed off, the console logging from debugserver can disambiguate
whether debugserver killed off the process because it failed to
completely set it up, becuase it was told to (via the "k" packet),
or if some external daemon killed it.

llvm-svn: 171606
2013-01-05 06:08:51 +00:00
Daniel Malea 939ec18099 Mark TestPlatformCommand (test_status) as expected to fail on Linux
- due to bugzilla 14806 (platform status command prints more information on Mac OS X than on Linux)

llvm-svn: 171569
2013-01-05 00:25:12 +00:00
Daniel Malea 1e6764b485 Simplify build instructions
- setting PYTHONPATH is no longer needed to run the lldb CLI on Linux.
- added instructions for setting PYTHONPATH correctly for running scripts in the native interpreter

llvm-svn: 171566
2013-01-05 00:16:08 +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
Andrew Kaylor 184c6591ec Generalizing expected stop reason string checking in InferiorCrashing test case.
llvm-svn: 171554
2013-01-04 23:27:36 +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
Daniel Malea 7dea7bd8a8 Mark TestExprHelpExamples.py as expected to fail on Linux
- requires memory allocation during expression evaluation
- opened related bugzilla 14805

llvm-svn: 171547
2013-01-04 22:52:19 +00:00
Jason Molenda 2114187370 A few small tweaks to the symbolication page.
llvm-svn: 171542
2013-01-04 22:37:21 +00:00
Greg Clayton 6aede697c9 Added a bit more explanation for the python modules that aid with symbolication.
llvm-svn: 171500
2013-01-04 19:01:39 +00:00
Greg Clayton cbaf730927 Added a page that describes how to to manual symbolication with LLDB from the command line, from python, and also how to use the build in modules to do symbolication.
llvm-svn: 171477
2013-01-04 18:18:21 +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 06a18d7d56 Updating TestAbbreviations.py to check for a reduced set of instructions when testing 'dis -f'.
Not all of the expected instructions were being generated for the function being disassembled on x86-64-based Linux.  It had no push, pop or leave.

llvm-svn: 170818
2012-12-21 00:26:22 +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
Andrew Kaylor d362d910f3 Setting TestInferiorChanged.py to expectedFailureLinux because of bugzilla 14662.
Note that the test actually fails before reaching the assertion described in that bug, but the failure is a trivial matter of adding OS-conditional expected stop reason strings (as noted by new comments in this patch).  However, with the stop reason strings changed, the test fails for the more substantial reason noted in bugzilla 14662.

llvm-svn: 170619
2012-12-20 00:19:27 +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
Andrew Kaylor a817191605 Mark register tests as expectedFailureLinux because of bugzilla reports 14600 and 14661.
llvm-svn: 170605
2012-12-19 23:31:12 +00:00
Daniel Malea c66cf9e3eb Disable confirmation prompt in TestProcessLaunch (to avoid hang on Linux once bug is fixed)
llvm-svn: 170603
2012-12-19 23:22:11 +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
Andrew Kaylor 8013df71c7 Skip libc++ data formatter tests on Linux because there is no standard location for the makefile to find libc++.
llvm-svn: 170575
2012-12-19 19:32:40 +00:00
Daniel Malea 34f21d18b5 Test suite cleanup for Linux: mark test cases expected to fail due to open bugzillas
- bugzillas covered: 14323, 14600, 14541, 14437, 14540, 14541

llvm-svn: 170564
2012-12-19 17:19:28 +00:00