summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixed some comments.Johnny Chen2010-09-111-1/+1
| | | | llvm-svn: 113673
* Added the capability to specify a one-liner Python script as the callbackJohnny Chen2010-09-101-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | command for a breakpoint, for example: (lldb) breakpoint command add -p 1 "conditional_break.stop_if_called_from_a()" The ScriptInterpreter interface has an extra method: /// Set a one-liner as the callback for the breakpoint command. virtual void SetBreakpointCommandCallback (CommandInterpreter &interpreter, BreakpointOptions *bp_options, const char *oneliner); to accomplish the above. Also added a test case to demonstrate lldb's use of breakpoint callback command to stop at function c() only when its immediate caller is function a(). The following session shows the user entering the following commands: 1) command source .lldb (set up executable, breakpoint, and breakpoint command) 2) run (the callback mechanism will skip two breakpoints where c()'s immeidate caller is not a()) 3) bt (to see that indeed c()'s immediate caller is a()) 4) c (to continue and finish the program) test/conditional_break $ ../../build/Debug/lldb (lldb) command source .lldb Executing commands in '.lldb'. (lldb) file a.out Current executable set to 'a.out' (x86_64). (lldb) breakpoint set -n c Breakpoint created: 1: name = 'c', locations = 1 (lldb) script import sys, os (lldb) script sys.path.append(os.path.join(os.getcwd(), os.pardir)) (lldb) script import conditional_break (lldb) breakpoint command add -p 1 "conditional_break.stop_if_called_from_a()" (lldb) run run Launching '/Volumes/data/lldb/svn/trunk/test/conditional_break/a.out' (x86_64) (lldb) Checking call frames... Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread: frame #0: a.out`c at main.c:39 frame #1: a.out`b at main.c:34 frame #2: a.out`a at main.c:25 frame #3: a.out`main at main.c:44 frame #4: a.out`start c called from b Continuing... Checking call frames... Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread: frame #0: a.out`c at main.c:39 frame #1: a.out`b at main.c:34 frame #2: a.out`main at main.c:47 frame #3: a.out`start c called from b Continuing... Checking call frames... Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread: frame #0: a.out`c at main.c:39 frame #1: a.out`a at main.c:27 frame #2: a.out`main at main.c:50 frame #3: a.out`start c called from a Stopped at c() with immediate caller as a(). a(1) returns 4 b(2) returns 5 Process 20420 Stopped * thread #1: tid = 0x2e03, 0x0000000100000de8 a.out`c + 7 at main.c:39, stop reason = breakpoint 1.1, queue = com.apple.main-thread 36 37 int c(int val) 38 { 39 -> return val + 3; 40 } 41 42 int main (int argc, char const *argv[]) (lldb) bt bt thread #1: tid = 0x2e03, stop reason = breakpoint 1.1, queue = com.apple.main-thread frame #0: 0x0000000100000de8 a.out`c + 7 at main.c:39 frame #1: 0x0000000100000dbc a.out`a + 44 at main.c:27 frame #2: 0x0000000100000e4b a.out`main + 91 at main.c:50 frame #3: 0x0000000100000d88 a.out`start + 52 (lldb) c c Resuming process 20420 Process 20420 Exited a(3) returns 6 (lldb) llvm-svn: 113596
* Don't flatten lldb and import everything into the global namespace. Instead,Johnny Chen2010-09-101-2/+2
| | | | | | set the debugger_unique_id with the lldb prefix. llvm-svn: 113589
* Modify the command options help generation so that required optionsCaroline Tice2010-09-091-34/+75
| | | | | | | | | | are always printed immediately after the command, before optional options; also so that in the detailed descriptions of each command option, the options and their help are output in alphabetical order (sorted by the short option) rather in whatever order they happened to be in the table. llvm-svn: 113496
* Make all debugger-level user settable variables into instance variables.Caroline Tice2010-09-093-11/+19
| | | | | | | Make get/set variable at the debugger level always set the particular debugger's instance variables rather than the default variables. llvm-svn: 113474
* Small help text fixes, to make it more consistent and accurate.Caroline Tice2010-09-072-3/+3
| | | | | | Temporarily remove -l option from 'expr' command (at Sean's request). llvm-svn: 113298
* This is a very large commit that completely re-does the way lldbCaroline Tice2010-09-044-515/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | handles user settable internal variables (the equivalent of set/show variables in gdb). In addition to the basic infrastructure (most of which is defined in UserSettingsController.{h,cpp}, there are examples of two classes that have been set up to contain user settable variables (the Debugger and Process classes). The 'settings' command has been modified to be a command-subcommand structure, and the 'set', 'show' and 'append' commands have been moved into this sub-commabnd structure. The old StateVariable class has been completely replaced by this, and the state variable dictionary has been removed from the Command Interpreter. Places that formerly accessed the state variable mechanism have been modified to access the variables in this new structure instead (checking the term-width; getting/checking the prompt; etc.) Variables are attached to classes; there are two basic "flavors" of variables that can be set: "global" variables (static/class-wide), and "instance" variables (one per instance of the class). The whole thing has been set up so that any global or instance variable can be set at any time (e.g. on start up, in your .lldbinit file), whether or not any instances actually exist (there's a whole pending and default values mechanism to help deal with that). llvm-svn: 113041
* Delete the vestigal "select", "info" and "delete" commands.Jim Ingham2010-09-031-7/+0
| | | | | | Also move "Carbon.framework" to the right place. llvm-svn: 112993
* Move "variable list" to "frame variable"Jim Ingham2010-09-021-2/+0
| | | | llvm-svn: 112782
* Added the ability to disable ASLR (Address Space Layout Randomization). ASLRGreg Clayton2010-08-311-0/+13
| | | | | | | | is disabled by default, and can be enabled using: (lldb) set disable-aslr 0 llvm-svn: 112616
* This is a major refactoring of the expression parser.Sean Callanan2010-08-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to separate the parser's data from the data belonging to the parser's clients. This allows clients to use the parser to obtain (for example) a JIT compiled function or some DWARF code, and then discard the parser state. Previously, parser state was held in ClangExpression and used liberally by ClangFunction, which inherited from ClangExpression. The main effects of this refactoring are: - reducing ClangExpression to an abstract class that declares methods that any client must expose to the expression parser, - moving the code specific to implementing the "expr" command from ClangExpression and CommandObjectExpression into ClangUserExpression, a new class, - moving the common parser interaction code from ClangExpression into ClangExpressionParser, a new class, and - making ClangFunction rely only on ClangExpressionParser and not depend on the internal implementation of ClangExpression. Side effects include: - the compiler interaction code has been factored out of ClangFunction and is now in an AST pass (ASTStructExtractor), - the header file for ClangFunction is now fully documented, - several bugs that only popped up when Clang was deallocated (which never happened, since the lifetime of the compiler was essentially infinite) are now fixed, and - the developer-only "call" command has been disabled. I have tested the expr command and the Objective-C step-into code, which use ClangUserExpression and ClangFunction, respectively, and verified that they work. Please let me know if you encounter bugs or poor documentation. llvm-svn: 112249
* Changed the StackID to store its start PC address as a load address instead of Greg Clayton2010-08-261-19/+13
| | | | | | | | a section offset address. Fixed up some very inefficient STL code. llvm-svn: 112230
* Change "Current" as in GetCurrentThread, GetCurrentStackFrame, etc, to ↵Jim Ingham2010-08-261-1/+1
| | | | | | "Selected" i.e. GetSelectedThread. Selected makes more sense, since these are set by some user action (a selection). I didn't change "CurrentProcess" since this is always controlled by the target, and a given target can only have one process, so it really can't be selected. llvm-svn: 112221
* There is no need to restore (sys.stdin, sys.stdout) of the python scriptJohnny Chen2010-08-101-5/+0
| | | | | | | interpreter right before calling Py_Finalize(). This also fixed the crash as reported in rdar://problem/8252903. llvm-svn: 110731
* Updated help text to refer to "commands alias"Sean Callanan2010-08-091-1/+1
| | | | | | | instead of "alias." Also fixed a bunch of indentation in the help for "commands alias." llvm-svn: 110585
* We can do better when reporting the status of one-liner script execution.Johnny Chen2010-07-303-9/+28
| | | | | | | | | Change the prototype of ScriptInterpreter::ExecuteOneLine() to return bool instead of void and take one additional parameter as CommandReturnObject *. Propagate the status of one-liner execution back appropriately. llvm-svn: 109899
* The unix "source" command maps to "command source" in lldb. :-)Johnny Chen2010-07-281-1/+1
| | | | llvm-svn: 109673
* Remove use of STL collection class use of the "data()" method since it isn'tGreg Clayton2010-07-202-2/+5
| | | | | | | part of C++'98. Most of these were "std::vector<T>::data()" and "std::string::data()". llvm-svn: 108957
* More constructor warning fixes from William Lynch.Benjamin Kramer2010-07-201-2/+2
| | | | llvm-svn: 108840
* I enabled some extra warnings for hidden local variables and for hiddenGreg Clayton2010-07-143-13/+12
| | | | | | virtual functions and caught some things and did some general code cleanup. llvm-svn: 108299
* Patch from Jean-Daniel Dupas:Greg Clayton2010-07-121-2/+2
| | | | | | | | | Makefile patch to explicitly use PROJ_SRC_DIR when required. It fixes build when obj dir is not source dir. I also fixed a build warning in ClangResultSynthesizer.cpp. llvm-svn: 108210
* A few more misc warning fixes.Eli Friedman2010-07-091-1/+1
| | | | llvm-svn: 108030
* Merged Eli Friedman's linux build changes where he added Makefile files thatGreg Clayton2010-07-092-4/+31
| | | | | | | enabled LLVM make style building and made this compile LLDB on Mac OS X. We can now iterate on this to make the build work on both linux and macosx. llvm-svn: 108009
* Added some comments to clarify where "init_lldb" comes from.Greg Clayton2010-07-071-0/+4
| | | | llvm-svn: 107801
* Remove includes for removed files...Jim Ingham2010-07-071-2/+0
| | | | llvm-svn: 107753
* Fix GetRepeatCommand so it works with multi-word commands.Jim Ingham2010-07-071-27/+25
| | | | | | | | Move the "source", "alias", and "unalias" commands to "commands *". Move "source-file" to "source list". Added a "source info" command but it isn't implemented yet. llvm-svn: 107751
* Added a "GetRepeatCommand" to the command object. The Interpreter uses thisJim Ingham2010-07-061-4/+19
| | | | | | | | instead of the last history item to provide a command for the "empty" command. Use this in the source-file command to make <RETURN> continue the listing rather than relist the first listing... llvm-svn: 107736
* Hide the logic for command resolution for commands, aliases & user commands ↵Jim Ingham2010-07-062-47/+75
| | | | | | | | | | | | behind a single interface so everybody does it the same way. Add an "exact" lookup for internal uses. Fix up a few little cases where we weren't reporting command lookup errors correctly. Added "b" as an alias for "breakpoint" so it doesn't collide with "bt". llvm-svn: 107718
* Add a unique ID to each debugger instance.Caroline Tice2010-06-301-0/+4
| | | | | | | | | | | | | | | | | Add functions to look up debugger by id Add global variable to lldb python module, to hold debugger id Modify embedded Python interpreter to update the global variable with the id of its current debugger. Modify the char ** typemap definition in lldb.swig to accept 'None' (for NULL) as a valid value. The point of all this is so that, when you drop into the embedded interpreter from the command interpreter (or when doing Python-based breakpoint commands), there is a way for the Python side to find/get the correct debugger instance ( by checking debugger_unique_id, then calling SBDebugger::FindDebuggerWithID on it). llvm-svn: 107287
* Add a source file completer to the CommandCompleters.Jim Ingham2010-06-303-3/+22
| | | | | | | | Add a way for the completers to say whether the completed argument should have a space inserted after is or not. Added the file name completer to the "file" command. llvm-svn: 107247
* Handle completing "-" and "--".Jim Ingham2010-06-242-14/+64
| | | | llvm-svn: 106784
* Convert direct access to the required & optional option sets to an accessor ↵Jim Ingham2010-06-241-10/+35
| | | | | | so we can lazily run BuildValidOptionSet, but make sure it is done before access. llvm-svn: 106783
* Fix a bug in handling command resolution for non-exact matches. Now we will ↵Jim Ingham2010-06-241-4/+4
| | | | | | correctly give help options when there are both aliases & real commands matching the current input string. llvm-svn: 106782
* Very large changes that were needed in order to allow multiple connectionsGreg Clayton2010-06-239-325/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove an include of the deleted CommandObjectStatus.h.Jim Ingham2010-06-181-1/+0
| | | | llvm-svn: 106297
* Move the "status" command to "process status" since that's where it belongs. ↵Jim Ingham2010-06-181-1/+0
| | | | | | | | Also make it print "running" if invoked when the current process is running. llvm-svn: 106265
* Move Args.{cpp,h} and Options.{cpp,h} to Interpreter where they really belong.Jim Ingham2010-06-155-3/+1840
| | | | llvm-svn: 106034
* Fix include paths; please check that this works on Mac.Eli Friedman2010-06-131-34/+34
| | | | llvm-svn: 105906
* Moved files around for linux build. Fixed up Xcode project toGreg Clayton2010-06-125-769/+207
| | | | | | refer to the new locations. llvm-svn: 105885
* Fix include path.Eli Friedman2010-06-091-1/+1
| | | | llvm-svn: 105757
* Committing patch from Joseph Ranieri to handle 'exit()' the sameJason Molenda2010-06-092-2/+2
| | | | | | as 'quit()' in the python script environment. llvm-svn: 105756
* Move source/Utility/PseudoTerminal.h into include/lldb/Utility.Jason Molenda2010-06-091-2/+1
| | | | | | | | The top of the header file seems to indicate that this was intended to be over at include/lldb/Core but we should be in line with the .cpp file's location so it's include/lldb/Utility for now. llvm-svn: 105753
* Don't include Python.h in the shared header.Eli Friedman2010-06-091-2/+4
| | | | llvm-svn: 105737
* Initial checkin of lldb code from internal Apple repo.Chris Lattner2010-06-0813-0/+4236
llvm-svn: 105619
OpenPOWER on IntegriCloud