Commit Graph

2283 Commits

Author SHA1 Message Date
Greg Clayton 020b717f6a More iteration on the new option value stuff. We now define an
OptionValueCollection class that can be subclassed to provide access to 
internal settings that are stored as ObjectValue subclasses.

llvm-svn: 129926
2011-04-21 19:21:29 +00:00
Greg Clayton 9524f25b0f Made the constructors public for all OptionValue classes
so we can instantiate them, and also moved the code that
can get the specific subclass for a OptionValue into the 
OptionValue class.

llvm-svn: 129920
2011-04-21 17:46:10 +00:00
Greg Clayton e302c2c785 Added a blog page with a description and tutorial on using the new "command regex"
command.

llvm-svn: 129898
2011-04-21 01:09:42 +00:00
Johnny Chen b89982d696 Fixed some more 'commands' to 'command' change.
llvm-svn: 129897
2011-04-21 00:39:18 +00:00
Johnny Chen 21b2b7db76 Replace 'commands' with 'command', and update to the latest prompt.
llvm-svn: 129895
2011-04-21 00:05:59 +00:00
Johnny Chen 951e3b5618 Use self.TraceOn() API.
llvm-svn: 129890
2011-04-20 22:59:01 +00:00
Greg Clayton 0e5e5a798e Renamed the "commands" command to "command" as this is the way we were using
it everywhere internally.

Modified the "command regex" command to be able to specify all regular 
expressions on the command line. For example:

(lldb) command regex f s/^$/finish/ 's/([0-9]+)/frame select %1/'

Also improved the error reporting when an invalid 's/<regex>/<subst>/' argument
is given.

llvm-svn: 129889
2011-04-20 22:55:21 +00:00
Johnny Chen eab5e08f25 Use self.TraceOn() API.
llvm-svn: 129885
2011-04-20 22:30:17 +00:00
Johnny Chen f95a869647 Fix wrong comment.
llvm-svn: 129881
2011-04-20 22:13:23 +00:00
Johnny Chen b21a1b0a4b Use self.TraceOn() API.
llvm-svn: 129880
2011-04-20 22:01:48 +00:00
Johnny Chen cd8cf861d7 Add a simple test scenario for 'command regex' invocation and subsequent use.
llvm-svn: 129879
2011-04-20 21:51:31 +00:00
Johnny Chen dbee242518 Add a test scenario for 'source list -b' which shows the line table locations from
the debug information which indicates valid places to set source level breakpoints.

llvm-svn: 129871
2011-04-20 20:35:59 +00:00
Caroline Tice 51172bfcab Remove ARMDissasembler.framework from project (it accidentally got
included in a recent commit).

llvm-svn: 129868
2011-04-20 18:58:35 +00:00
Greg Clayton 3300d778ab Fixed an issue where breakpoint were being displayed when using the "source list"
command when the file was implicit or found from a symbol.

llvm-svn: 129867
2011-04-20 18:52:45 +00:00
Greg Clayton d828f316af Added the ability for arrays and dictionaries to contain only specific
types of values.

llvm-svn: 129863
2011-04-20 18:16:33 +00:00
Caroline Tice 061defd63d Fix typo (accidental second 'const' qualifier).
llvm-svn: 129859
2011-04-20 17:14:12 +00:00
Greg Clayton de164aaa09 Added the ability for users to create new regex commands.
To do this currently, it must be done in multi-line mode:

(lldb) commands regex --help "Help text for command" --syntax "syntax for command" <cmd-name>

Any example that would use "f" for "finish" when there are no arguments,
and "f <num>" to do a "frame select <num>" would be:
(lldb) commands regex f
Enter multiple regular expressions in the form s/find/replace/ then terminate with an empty line:
s/^$/finish/
s/([0-9]+)/frame select %1/

(lldb) f 11
frame select 12
...
(lldb) f
finish
...

Also added the string version of the OptionValue as OptionValueString.

llvm-svn: 129855
2011-04-20 16:37:46 +00:00
Greg Clayton 45fa8b36d5 Added the start of a new option value system that we can use for many things
around the debugger. The class isn't hooked into anything yet, but it will be
soon. 

llvm-svn: 129843
2011-04-20 01:33:38 +00:00
Caroline Tice 3ac6711aec Add the infrastructure to test instruction emulations automatically.
The idea is that the instruction to be emulated is actually executed
on the hardware to be emulated, with the before and after state of the
hardware being captured and 'freeze-dried' into .dat files.  The
emulation testing code then loads the before & after state from the
.dat file, emulates the instruction using the before state, and
compares the resulting state to the 'after' state.  If they match, the
emulation is accurate, otherwise there is a problem.

The final format of the .dat files needs a bit more work; the plan is
to generalize them a bit and to convert the plain values to key-value pairs. 
But I wanted to get this first pass committed.

This commit adds arm instruction emulation testing to the testsuite, along with
many initial .dat files.

It also fixes a bug in the llvm disassembler, where 32-bit thumb opcodes
were getting their upper & lower 16-bits reversed.

There is a new Instruction sub-class, that is intended to be loaded
from a .dat file rather than read from an executable.  There is also a
new EmulationStateARM class, for handling the before & after states.
EmulationStates for other architetures can be added later when we
emulate their instructions.

llvm-svn: 129832
2011-04-19 23:30:03 +00:00
Johnny Chen 0b8fd43397 Rename test/threads to python_api/lldbutil; it uses lldbutil functions to print stack traces.
llvm-svn: 129828
2011-04-19 22:44:20 +00:00
Johnny Chen 85866ba033 Use self.TraceOn() API.
llvm-svn: 129827
2011-04-19 22:32:57 +00:00
Greg Clayton 4c20717a8f General cleanup on the UserSettingsController stuff. There were 5 different
places that were dumping values for the settings. Centralized all of the
value dumping into a single place. When dumping values that aren't strings
we no longer surround the value with single quotes. When dumping values that
are strings, surround the string value with double quotes. When dumping array
values, assume they are always string values, and don't put quotes around
dictionary values.

llvm-svn: 129826
2011-04-19 22:32:36 +00:00
Johnny Chen 742668144e Use self.TraceOn() API.
llvm-svn: 129825
2011-04-19 22:11:23 +00:00
Johnny Chen c1c92a2ab3 Converted to use SBProcess.LaunchSimple().
And use self.TraceOn() API.

llvm-svn: 129797
2011-04-19 20:11:58 +00:00
Johnny Chen bd9b6e9ffb Converted to use SBProcess.LaunchSimple().
llvm-svn: 129795
2011-04-19 19:54:06 +00:00
Johnny Chen aedbe0f347 Converted to use SBProcess.LaunchSimple().
llvm-svn: 129793
2011-04-19 19:50:43 +00:00
Johnny Chen 90da3ccadb Use self.TraceOn() API.
llvm-svn: 129792
2011-04-19 19:49:09 +00:00
Johnny Chen 9efcb0ec4d Converted to use SBProcess.LaunchSimple() API.
And use self.TraceOn() in order to print more debug output.

llvm-svn: 129791
2011-04-19 19:44:26 +00:00
Johnny Chen fbf1cfea12 Converted to use SBProcess.LaunchSimple().
And use self.TraceOn() API.

llvm-svn: 129790
2011-04-19 19:34:41 +00:00
Johnny Chen 272ae4df7c Converted to use SBProcess.LaunchSimple().
llvm-svn: 129789
2011-04-19 19:25:37 +00:00
Johnny Chen baf11799da Only print more debug out when self.TraceOn() returns True.
llvm-svn: 129788
2011-04-19 19:21:19 +00:00
Johnny Chen d04cd7b0c4 Converted to use SBProcess.LaunchSimple().
llvm-svn: 129787
2011-04-19 19:14:12 +00:00
Johnny Chen ff4a08372e Modify docstring.
llvm-svn: 129786
2011-04-19 19:12:24 +00:00
Johnny Chen f1251cc820 Add a TraceOn(self) method to the base test class, which returns True if we are
currently in trace mode (-t to dotest.py), i.e., tracing the lldb command execution.
Change TestInferiorCrashing.inferior_crashing_python(self) to check this flag in
order to print the stack trace of the inferior thread.

llvm-svn: 129785
2011-04-19 19:04:38 +00:00
Johnny Chen 4a2283a954 Converted to use SBProcess.LaunchSimple().
llvm-svn: 129784
2011-04-19 18:52:56 +00:00
Johnny Chen 9ef4563c2a Converted to use SBProcess.LaunchSimple().
llvm-svn: 129782
2011-04-19 18:50:04 +00:00
Johnny Chen 0fbb74406c Converted to use SBProcess.LaunchSimple().
llvm-svn: 129780
2011-04-19 18:38:30 +00:00
Johnny Chen 822198ef77 Converted to use SBProcess.LaunchSimple().
llvm-svn: 129779
2011-04-19 18:23:28 +00:00
Johnny Chen c506d8bf9f Converted to use SBProcess.LaunchSimple().
llvm-svn: 129778
2011-04-19 18:17:20 +00:00
Johnny Chen d1d11c8c9f Convert some tests to use the SBProcess.LaunchSimple API requiring only args, envs, and cwd
from SBProcess.Launch which takes many more arguments that are useless for the test scenario.

llvm-svn: 129776
2011-04-19 18:12:47 +00:00
Greg Clayton 176761e530 Added a new option to the "source list" command that allows us to see where
line tables specify breakpoints can be set in the source. When dumping the
source, the number of breakpoints that can be set on a source line are shown
as a prefix:

(lldb) source list -f test.c -l1 -c222 -b
       1   	#include <stdio.h>
       2   	#include <sys/fcntl.h>
       3   	#include <unistd.h>
       4   	int
       5   	sleep_loop (const int num_secs)
[2]    6   	{
       7   	    int i;
[1]    8   	    for (i=0; i<num_secs; ++i)
       9   	    {
[1]    10  	        printf("%d of %i - sleep(1);\n", i, num_secs);
[1]    11  	        sleep(1);       
       12  	    }
       13  	    return 0;
[1]    14  	}
       15  	
       16  	int 
       17  	main (int argc, char const* argv[])
[1]    18  	{
[1]    19  	    printf("Process: %i\n\n", getpid());
[1]    20  	    puts("Press any key to continue..."); getchar();
[1]    21  	    sleep_loop (20);
       22  	    return 12;
[1]    23  	}

Above we can see there are two breakpoints for line 6 and one breakpoint for
lines 8, 10, 11, 14, 18, 19, 20, 21 and 23. All other lines have no line table
entries for them. This helps visualize the data provided in the debug 
information without having to manually dump all line tables. It also includes
all inline breakpoint that may result for a given file which can also be very
handy to see.

llvm-svn: 129747
2011-04-19 04:19:37 +00:00
Greg Clayton 431ce67823 Fixed an issue where if you specify an architecture from the command line like:
$ lldb --arch i386-unknown-unknown a.out

It would then create a target with only the "i386" part due to 
SBDebugger::GetDefaultArchitecture(...) truncating the arch triple due to the
way things used to be.

llvm-svn: 129731
2011-04-18 23:15:17 +00:00
Johnny Chen a6ca9fb407 Rename some variables, no functionality change.
llvm-svn: 129724
2011-04-18 22:11:31 +00:00
Johnny Chen 1ee61a7f3b Add a test script for exercising the "taregt create", "target list", and "target select" commands.
llvm-svn: 129717
2011-04-18 21:08:05 +00:00
Johnny Chen d28977c7c2 Add header comment.
llvm-svn: 129710
2011-04-18 18:50:24 +00:00
Johnny Chen 238de9a804 Add docstring.
llvm-svn: 129707
2011-04-18 18:34:09 +00:00
Johnny Chen 72f51aafe7 Modify some docstrings.
llvm-svn: 129706
2011-04-18 18:32:09 +00:00
Greg Clayton 7260f6206f Centralized a lot of the status information for processes,
threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the 
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example). 

Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.

We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:

(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000) 
(lldb) target list
Current targets:
  target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
  target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
  frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
  frame #1: 0x0000000100000b64 a.out`start + 52

Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.

llvm-svn: 129695
2011-04-18 08:33:37 +00:00
Jim Ingham 78a685aa2d Add support for "dynamic values" for C++ classes. This currently only works for "frame var" and for the
expressions that are simple enough to get passed to the "frame var" underpinnings.  The parser code will
have to be changed to also query for the dynamic types & offsets as it is looking up variables.

The behavior of "frame var" is controlled in two ways.  You can pass "-d {true/false} to the frame var
command to get the dynamic or static value of the variables you are printing.

There's also a general setting:

target.prefer-dynamic-value (boolean) = 'true'

which is consulted if you call "frame var" without supplying a value for the -d option.

llvm-svn: 129623
2011-04-16 00:01:13 +00:00
Jim Ingham f46b33852c Fix comment typo.
llvm-svn: 129621
2011-04-15 23:42:06 +00:00