llvm-c166/lldb/source/Commands
Johnny Chen 94de55d5c2 Added the capability to specify a one-liner Python script as the callback
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
2010-09-10 18:21:10 +00:00
..
CommandCompletions.cpp This is a very large commit that completely re-does the way lldb 2010-09-04 00:03:46 +00:00
CommandObjectApropos.cpp Small help text fixes, to make it more consistent and accurate. 2010-09-07 22:38:08 +00:00
CommandObjectApropos.h
CommandObjectArgs.cpp Change "Current" as in GetCurrentThread, GetCurrentStackFrame, etc, to "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. 2010-08-26 21:32:51 +00:00
CommandObjectArgs.h
CommandObjectBreakpoint.cpp More help text fixes. 2010-09-08 22:08:58 +00:00
CommandObjectBreakpoint.h
CommandObjectBreakpointCommand.cpp Added the capability to specify a one-liner Python script as the callback 2010-09-10 18:21:10 +00:00
CommandObjectBreakpointCommand.h
CommandObjectCall.cpp This is a major refactoring of the expression parser. 2010-08-27 01:01:44 +00:00
CommandObjectCall.h
CommandObjectCommands.cpp More help text fixes. 2010-09-08 22:08:58 +00:00
CommandObjectCommands.h
CommandObjectCrossref.cpp
CommandObjectDisassemble.cpp Small help text fixes, to make it more consistent and accurate. 2010-09-07 22:38:08 +00:00
CommandObjectDisassemble.h
CommandObjectExpression.cpp Small help text fixes, to make it more consistent and accurate. 2010-09-07 22:38:08 +00:00
CommandObjectExpression.h Small help text fixes, to make it more consistent and accurate. 2010-09-07 22:38:08 +00:00
CommandObjectFile.cpp If the file the user specifies can't be found in the current directory, 2010-09-10 04:48:55 +00:00
CommandObjectFile.h
CommandObjectFrame.cpp Clean up, clarify and standardize help text, and fix a few help text formatting problems. 2010-09-08 21:06:11 +00:00
CommandObjectFrame.h
CommandObjectHelp.cpp Make all debugger-level user settable variables into instance variables. 2010-09-09 06:25:08 +00:00
CommandObjectHelp.h
CommandObjectImage.cpp Make all debugger-level user settable variables into instance variables. 2010-09-09 06:25:08 +00:00
CommandObjectImage.h
CommandObjectLog.cpp Clean up, clarify and standardize help text, and fix a few help text formatting problems. 2010-09-08 21:06:11 +00:00
CommandObjectLog.h
CommandObjectMemory.cpp Clean up, clarify and standardize help text, and fix a few help text formatting problems. 2010-09-08 21:06:11 +00:00
CommandObjectMemory.h
CommandObjectMultiword.cpp Changed the StackID to store its start PC address as a load address instead of 2010-08-26 22:05:43 +00:00
CommandObjectProcess.cpp Make all debugger-level user settable variables into instance variables. 2010-09-09 06:25:08 +00:00
CommandObjectProcess.h
CommandObjectQuit.cpp Small help text fixes, to make it more consistent and accurate. 2010-09-07 22:38:08 +00:00
CommandObjectQuit.h
CommandObjectRegister.cpp The first part of an lldb native stack unwinder. 2010-09-10 07:49:16 +00:00
CommandObjectRegister.h
CommandObjectSettings.cpp Make all debugger-level user settable variables into instance variables. 2010-09-09 06:25:08 +00:00
CommandObjectSettings.h This is a very large commit that completely re-does the way lldb 2010-09-04 00:03:46 +00:00
CommandObjectSource.cpp fix a bunch of signed/unsigned comparison warnings, stop evaluating "getsize" every time through the loop. 2010-09-08 22:55:31 +00:00
CommandObjectSource.h
CommandObjectSyntax.cpp Make all debugger-level user settable variables into instance variables. 2010-09-09 06:25:08 +00:00
CommandObjectSyntax.h
CommandObjectTarget.cpp Clean up, clarify and standardize help text, and fix a few help text formatting problems. 2010-09-08 21:06:11 +00:00
CommandObjectTarget.h
CommandObjectThread.cpp More help text fixes. 2010-09-08 22:08:58 +00:00
CommandObjectThread.h Add -c (count - i.e. number of frames to show) and -s (start frame.) 2010-08-26 23:36:03 +00:00
Makefile