Commit Graph

147 Commits

Author SHA1 Message Date
Johnny Chen f94c8c2bf9 Use lldb.SBDebugger.Create() factory method to create an instance first.
llvm-svn: 106910
2010-06-25 23:22:48 +00:00
Johnny Chen 9320d4ab60 A simple test of 'help' command and its output.
llvm-svn: 106909
2010-06-25 23:15:47 +00:00
Johnny Chen a765c28db3 A simple testing framework for lldb using python's unit testing framework.
Tests for lldb are written as python scripts which take advantage of the script
bridging provided by LLDB.framework to interact with lldb core.

A specific naming pattern is followed by the .py script to be recognized as
a module which implements a test scenario, namely, Test*.py.

To specify the directories where "Test*.py" python test scripts are located,
you need to pass in a list of directory names.  By default, the current
working directory is searched if nothing is specified on the command line.

An example:

[14:10:20] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v example
test_choice (TestSequenceFunctions.TestSequenceFunctions) ... ok
test_sample (TestSequenceFunctions.TestSequenceFunctions) ... ok
test_shuffle (TestSequenceFunctions.TestSequenceFunctions) ... ok

----------------------------------------------------------------------
Ran 3 tests in 0.000s

OK

llvm-svn: 106890
2010-06-25 21:14:08 +00:00
Jim Ingham e1c8c4b132 Remove a reference to Leopard.
llvm-svn: 106814
2010-06-25 00:34:35 +00:00
Jim Ingham d43e0094b7 Handle completing "-" and "--".
llvm-svn: 106784
2010-06-24 20:31:04 +00:00
Jim Ingham d6ccc60035 Convert direct access to the required & optional option sets to an accessor so we can lazily run BuildValidOptionSet, but make sure it is done before access.
llvm-svn: 106783
2010-06-24 20:30:15 +00:00
Jim Ingham 490ac55536 Fix a bug in handling command resolution for non-exact matches. Now we will correctly give help options when there are both aliases & real commands matching the current input string.
llvm-svn: 106782
2010-06-24 20:28:42 +00:00
Sean Callanan 562a5a3904 Improved printing of LLVM IR. We now print
complete instructions rather than simply their
opcodes.

llvm-svn: 106708
2010-06-24 00:47:05 +00:00
Sean Callanan 16ad5faeeb Extensive code cleanup of the expression command.
- Rationalized EvaluateExpression to remove a lot
  of nesting; also added comments to make it easy
  to find what's happening where
- Made ExecuteRawCommandString subcontract out to
  EvaluateExpression
- Minor logging improvements

llvm-svn: 106703
2010-06-24 00:16:27 +00:00
Sean Callanan 1d389c4b02 Added the temporary -i option to expr, which
switches the expression parsing over to use the
LLVM IR as opposed to Clang ASTs.  Right now,
that functionality only logs.

llvm-svn: 106695
2010-06-23 23:18:04 +00:00
Sean Callanan 4be3990f3b Fixed the log streams for logs that output to
standard output, resolving a crasher.

llvm-svn: 106682
2010-06-23 21:28:25 +00:00
Sean Callanan d448c1ba04 Fixes for array handling and dynamic type casting
errors pointed out by John McCall.

llvm-svn: 106665
2010-06-23 18:58:10 +00:00
Greg Clayton 6611103cfe Very large changes that were needed in order to allow multiple connections
to the debugger from GUI windows. Previously there was one global debugger
instance that could be accessed that had its own command interpreter and
current state (current target/process/thread/frame). When a GUI debugger
was attached, if it opened more than one window that each had a console
window, there were issues where the last one to setup the global debugger
object won and got control of the debugger.

To avoid this we now create instances of the lldb_private::Debugger that each 
has its own state:
- target list for targets the debugger instance owns
- current process/thread/frame
- its own command interpreter
- its own input, output and error file handles to avoid conflicts
- its own input reader stack

So now clients should call:

    SBDebugger::Initialize(); // (static function)

    SBDebugger debugger (SBDebugger::Create());
    // Use which ever file handles you wish
    debugger.SetErrorFileHandle (stderr, false);
    debugger.SetOutputFileHandle (stdout, false);
    debugger.SetInputFileHandle (stdin, true);

    // main loop
    
    SBDebugger::Terminate(); // (static function)
    
SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to
ensure nothing gets destroyed too early when multiple clients might be
attached.

Cleaned up the command interpreter and the CommandObject and all subclasses
to take more appropriate arguments.

llvm-svn: 106615
2010-06-23 01:19:29 +00:00
Sean Callanan f06ba8d89c Updated the expression parser to use proper logging when
looking for external variables.  Also cleaned up the log
messages coming from the DWARF interpreter.

llvm-svn: 106613
2010-06-23 00:47:48 +00:00
Sean Callanan 468574bd34 Added support to the expression parser for locating
externally-defined functions.

llvm-svn: 106606
2010-06-22 23:46:24 +00:00
Benjamin Kramer 1e89cd804c Avoid tolower, it's slow and unnecessary.
llvm-svn: 106580
2010-06-22 21:28:05 +00:00
Benjamin Kramer b328d72d77 Turns out __cxa_demangle returns the size of the buffer instead of the size of
the demangled name. Fall back to strlen.

llvm-svn: 106579
2010-06-22 21:27:55 +00:00
Jim Ingham 05407f6b25 Make an explicit GetThreadSpecNoCreate accessor so you don't have to get the const-ness right to ensure you are not making a copy of the owning breakpoint's ThreadSpec in a breakpoint location. Also change the name from NoCopy to NoCreate since that's clearer.
llvm-svn: 106578
2010-06-22 21:12:54 +00:00
Benjamin Kramer eb9165c08f Reduce code duplication.
This also moves strlen out of the mutex scope.

llvm-svn: 106545
2010-06-22 15:28:34 +00:00
Benjamin Kramer 53a61dc531 Ensure GetDemangledName's thread safety by making the demangle buffer thread specific.
I'm not sure when multiple threads enter this method but a race-condition
causing a crash in malloc can be reproduced with this little script:

echo file $(which lldb) > cmd
echo "run\nbreak set -n main\nrun\nexit" >> cmd
lldb -s cmd

It may need a few runs before it crashes though.

llvm-svn: 106544
2010-06-22 15:28:29 +00:00
Benjamin Kramer 104819c6eb Move trivial parts of UserID into the header.
llvm-svn: 106535
2010-06-22 10:44:12 +00:00
Johnny Chen 7c3f7fee41 Left a debug statement in the previous checkin.
llvm-svn: 106510
2010-06-22 00:13:20 +00:00
Johnny Chen a02199f5e7 Remove stale reference to the lldb path component.
llvm-svn: 106509
2010-06-22 00:11:26 +00:00
Benjamin Kramer 466b31e900 Move a bunch of trivial methods into the header. These compile down to 1-2
instructions so it's really profitable to inline them.

llvm-svn: 106450
2010-06-21 19:26:54 +00:00
Benjamin Kramer 1e909fc0b6 Initialize member so GDBRemoteRegisterContext::ReadRegisterBytes doesn't rely on
an unitialized variable.

valgrind_errors -= 1;

llvm-svn: 106418
2010-06-21 14:39:40 +00:00
Benjamin Kramer ae39fc196b Return false from FileSpec::GetPath early instead of making the return value
dependent on the last byte of the buffer, which could be unitialized.

llvm-svn: 106417
2010-06-21 14:36:20 +00:00
Benjamin Kramer e1ce369628 Don't snprintf directly into a std::string, it's undefined behavior per C++03.
This also fixes a bug where we were trying to copy m_string into itself
via a format string. The pointer was invalidated by m_string.resize and
lldb (sometimes) crashed inside vsnprintf.

llvm-svn: 106416
2010-06-21 14:34:03 +00:00
Jim Ingham b01e742af7 Two changes in this checkin. Added a ThreadPlanKind so that I can do some reasoning based on the kind of thread plan
without having to use RTTI.
Removed the ThreadPlanContinue and replaced with a ShouldAutoContinue query that serves the same purpose.  Having to push
another plan to assert that if there's no other indication the target should continue when this plan is popped was flakey
and error prone.  This method is more stable, and fixed problems we were having with thread specific breakpoints.

llvm-svn: 106378
2010-06-19 04:45:32 +00:00
Jim Ingham b2a38a7286 Remember whether a queue or thread name were passed into "breakpoint modify" so we can recognize an empty argument as unsetting the option.
llvm-svn: 106377
2010-06-19 04:35:20 +00:00
Jim Ingham 8dae7f2e8f Remove an include of the deleted CommandObjectStatus.h.
llvm-svn: 106297
2010-06-18 18:17:30 +00:00
Jim Ingham 62b02c61c9 Adding setting thread specific breakpoints by name, ID, index & queue name to the SB interfaces.
llvm-svn: 106268
2010-06-18 01:47:08 +00:00
Jim Ingham 4b9bea87e6 Move the "status" command to "process status" since that's where it belongs. Also make it print "running" if invoked
when the current process is running.

llvm-svn: 106265
2010-06-18 01:23:09 +00:00
Jim Ingham 0136309f5a Change the Breakpoint & BreakpointLocation GetDescription methods so they call the BreakpointOptions::GetDescription rather
than picking bits out of the breakpoint options.  Added BreakpointOptions::GetDescription to do this job.  Some more mucking
around to keep the breakpoint listing from getting too verbose.

llvm-svn: 106262
2010-06-18 01:00:58 +00:00
Jim Ingham ae1c4cf568 Change "breakpoint configure" to "breakpoint modify" so it doesn't collide with "breakpoint command"
Change "breakpoint enable/disable" so changing a breakpoint's state doesn't also overwrite the location states.

llvm-svn: 106261
2010-06-18 00:58:52 +00:00
Owen Anderson 836af6bb36 Fix comment, per Chris' suggestion.
llvm-svn: 106192
2010-06-17 00:51:12 +00:00
Sean Callanan a68c1a2188 Unstick the -r option for the disassemble command.
llvm-svn: 106186
2010-06-17 00:32:05 +00:00
Sean Callanan d50c96a002 Fixed a problem where invalid triples were being passed
into the constructor for the LLVMDisassembler, resulting
in asserts.

llvm-svn: 106160
2010-06-16 22:19:05 +00:00
Johnny Chen 22ce5b62b0 Fixed a typo in comment.
llvm-svn: 106133
2010-06-16 19:30:20 +00:00
Caroline Tice d6ac38485b Parameterize the shell scripts for creating and copying the python and
other script files around, so they can be run from outside Xcode.  Also,
check the current OS, and only try to use the framework structure stuff on
Darwin systems.

llvm-svn: 106132
2010-06-16 19:26:52 +00:00
Owen Anderson c7da5f413b Switch from qsort_r to std::stable_sort for a performance win and improved portability.
llvm-svn: 106116
2010-06-16 17:34:05 +00:00
Jim Ingham 1b54c88cc4 Add a "thread specification" class that specifies thread specific breakpoints by name, index, queue or TID.
Push this through all the breakpoint management code.  Allow this to be set when the breakpoint is created.
Fix the Process classes so that a breakpoint hit that is not for a particular thread is not reported as a 
breakpoint hit event for that thread.
Added a "breakpoint configure" command to allow you to reset any of the thread 
specific options (or the ignore count.)

llvm-svn: 106078
2010-06-16 02:00:15 +00:00
Jason Molenda e166ecadad Add definition for DW_LANG_MIPS_Assembler. This file was originally
generated by a script.  I don't know if we're still regenerating
it or not; will have to check with Greg about how he's handling this
now.  Should update it for the final DWARF3 and soon-to-be-released
DWARF4 constants while I'm at it..

llvm-svn: 106045
2010-06-15 21:20:35 +00:00
Jason Molenda 9eb41c35ce It makes me nervous seeing those bitfield shift values without parens.
llvm-svn: 106036
2010-06-15 20:04:41 +00:00
Jim Ingham 40af72e106 Move Args.{cpp,h} and Options.{cpp,h} to Interpreter where they really belong.
llvm-svn: 106034
2010-06-15 19:49:27 +00:00
Jim Ingham 64f78a310d Fix a typo in a comment...
llvm-svn: 106022
2010-06-15 18:50:32 +00:00
Jim Ingham 8651121c11 Change the Options parser over to use a mask rather than an ordinal for option sets.
Fixed the Disassemble arguments so you can't specify start address or name in multiple ways.
Fixed the command line input so you can specify the filename without "-f" even if you use other options.

llvm-svn: 106020
2010-06-15 18:47:14 +00:00
Greg Clayton 7a47bd9f02 Move posix specific files into posix subdirectory so they can
be shared with linux.

Updated Xcode project.

llvm-svn: 105928
2010-06-14 04:30:13 +00:00
Greg Clayton 13238c4455 patch from: Jean-Daniel Dupas
BreakpointLocation::GetLoadAddress() does not match the 'StoppointLocation::GetLoadAddress() const' virtual function prototype, and so, does not override the superclass function.

llvm-svn: 105927
2010-06-14 04:18:27 +00:00
Eli Friedman e13a8dbf14 Make include paths work on Linux. ifdef out stuff that isn't relevant to
Linux or doesn't compile on Linux.

llvm-svn: 105923
2010-06-13 19:36:42 +00:00
Eli Friedman adb3502477 Make getopt() use portable to Linux.
llvm-svn: 105922
2010-06-13 19:18:49 +00:00