Commit Graph

2290 Commits

Author SHA1 Message Date
Johnny Chen d545d9cbbc Make the test case more robust by installing a teardown hook to kill the inferior
rather than calling "process kill" explicitly at the end of the test.

The test might not even reach the end because it could have failed prematurely.

llvm-svn: 129963
2011-04-22 00:33:09 +00:00
Johnny Chen 13af1b55cd Conditionalize the self.expect("dis -f", ...) test scenario to check on Intel disassembly
only when the test is currently running against the relevant architecture.

llvm-svn: 129960
2011-04-22 00:13:28 +00:00
Johnny Chen 9ee96e7b40 Add a HideStdout() method to our TestBase class and call it from TestAbbreviations.py
and TestAliases.py.  Pass the keyword argument 'check=False' to:

    self.runCmd("script my.date()", check=False)

since we want to restore sys.stdout no matter what the outcome of the runCmd is.

llvm-svn: 129949
2011-04-21 22:50:23 +00:00
Greg Clayton 2048ea5eba Fixed a case where if a function, inlined function, or global with a mangled
name had a DW_AT_name that was the same string as the DW_AT_MIPS_linkage_name,
then it would get added twice to the DWARF index.

llvm-svn: 129942
2011-04-21 21:41:13 +00:00
Johnny Chen 72c40825dd Hopefully fix the last fallout of 'commands' to 'command' change.
llvm-svn: 129937
2011-04-21 20:55:57 +00:00
Johnny Chen 71aaf75e3d Use self.TraceOn() API.
llvm-svn: 129936
2011-04-21 20:48:32 +00:00
Johnny Chen ea80ba8b97 Use self.TraceOn() API to decide whether to print debug output.
llvm-svn: 129935
2011-04-21 20:27:45 +00:00
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