Commit Graph

3677 Commits

Author SHA1 Message Date
Johnny Chen 66d362e9bf Establish a baseline for bench.py score by using a fixed lldb executable as the
inferior program for the lldb debugger to operate on.  The fixed lldb executable
corresponds to r142902.

Plus some minor modifications to the test benchmark to conform to way bench.py
is meant to be invoked.

llvm-svn: 143075
2011-10-26 22:58:02 +00:00
Sean Callanan d2cb626ac1 Extended the IR interpreter to handle the variables
"_cmd", "this", and "self".  These variables are handled
differently from all other external variables used by
the expression.  Other variables are used indirectly
through the $__lldb_arg operand; only _cmd, this, and
self are passed directly through the ABI.

There are two modifications:

 - I added a function to ClangExpressionDeclMap that
   retrives the value of one of these variables by name;
   and

 - I made IRInterpreter fetch these values when needed,
   and ensured that the proper level of indirection is
   used.

llvm-svn: 143065
2011-10-26 21:20:00 +00:00
Greg Clayton 63f8cc6aca Fixed the display of OSTypes (the four character codes).
llvm-svn: 143056
2011-10-26 21:01:16 +00:00
Jim Ingham 1d18ebf62a When completing "help foo bar" if "foo" is not a real command, don't ask its NULL command object to complete the line.
llvm-svn: 143047
2011-10-26 19:32:01 +00:00
Greg Clayton f91381e82c Update the GDB format text to be a bit more clear.
llvm-svn: 143043
2011-10-26 18:35:21 +00:00
Peter Collingbourne 46df6a252a Use full path to ClangForward.h
Fixes Linux build.

llvm-svn: 143038
2011-10-26 17:55:48 +00:00
Sean Callanan 3b1d4f6785 Added a new #define, LLVM_NDEBUG_OFF, that should
be set if linking against an LLVM compiled with
NDEBUG off.  If it is set, we do not enable NDEBUG
in any place where we include LLVM headers.

llvm-svn: 143036
2011-10-26 17:46:51 +00:00
Sean Callanan 580b29f9cb Fixed VerifyDecl to use shared forward declarations.
llvm-svn: 143029
2011-10-26 16:20:57 +00:00
Greg Clayton 82f4cf46aa A simple fix for the GDB format strings so the byte size parameter gets
properly marked as valid.

Also modified the "memory read" command to be able to intelligently repeat
subsequent memory requests, so now you can do:

(lldb) memory read --format hex --count 32 0x1000

Then hit enter to keep viewing the memory that follows the last valid request.

llvm-svn: 143015
2011-10-26 04:32:38 +00:00
Greg Clayton 55561e942b Fixed an issue where a class that resides inside another class wasn't getting
an access specifier set on it, causing an assertion to fire when building
with a Debug+Asserts build of clang.

llvm-svn: 143010
2011-10-26 03:31:36 +00:00
Sean Callanan 5e9e1991e9 Added VerifyDecl, a function that, when LLDB is
linked against a debug LLVM, runs a variety of
functions -- currently just one -- that verify
that the Decls we create are valid.

ClangASTContext now calls this verifier whenever
it adds a Decl to a DeclContext, and the verifier
checks that the AccessSpecifier is sane.

llvm-svn: 143000
2011-10-26 01:06:27 +00:00
Greg Clayton 86edbf41d1 Cleaned up many error codes. For any who is filling in error strings into
lldb_private::Error objects the rules are:
- short strings that don't start with a capitol letter unless the name is a
  class or anything else that is always capitolized
- no trailing newline character
- should be one line if possible

Implemented a first pass at adding "--gdb-format" support to anything that
accepts format with optional size/count.

llvm-svn: 142999
2011-10-26 00:56:27 +00:00
Johnny Chen 457e786932 Fix typo in the docstring.
llvm-svn: 142996
2011-10-26 00:44:40 +00:00
Johnny Chen 6e5b330fb4 Add another metric for startup delay -- run to breakpoint, which measures the time from issuing
the run command till the first breakpoint hit.  Example:

 $ ./dotest.py -v +b -n -x '-F Driver::MainLoop()' -p TestStartupDelays.py
1: test_startup_delay (TestStartupDelays.StartupDelaysBench)
   Test start up delays creating a target and setting a breakpoint. ... 
lldb startup delay (create fresh target) benchmark: Avg: 0.124496 (Laps: 30, Total Elapsed Time: 3.734883)
lldb startup delay (set first breakpoint) benchmark: Avg: 0.220828 (Laps: 30, Total Elapsed Time: 6.624847)
lldb startup delay (run to breakpoint) benchmark: Avg: 0.478159 (Laps: 30, Total Elapsed Time: 14.344774)
ok

llvm-svn: 142993
2011-10-26 00:35:10 +00:00
Sean Callanan efa7d1f117 Fixed a problem where local variables conflict with
types of the same name.  If a local variable with the
given name is found (and we are not searching a
specific namespace) we stop right then and there and
report it.

llvm-svn: 142962
2011-10-25 20:36:57 +00:00
Johnny Chen fc9e79fb95 Benchmark the turnaround time starting a debugger and run to the breakpoint with lldb vs. gdb.
An example (with /Developer/usr/bin/lldb vs. /usr/bin/gdb):

[13:05:04] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v +b -n -p TestCompileRunToBreakpointTurnaround.py
1: test_run_lldb_then_gdb (TestCompileRunToBreakpointTurnaround.CompileRunToBreakpointBench)
   Benchmark turnaround time with lldb vs. gdb. ... 
lldb turnaround benchmark: Avg: 4.574600 (Laps: 3, Total Elapsed Time: 13.723799)
gdb turnaround benchmark: Avg: 7.966713 (Laps: 3, Total Elapsed Time: 23.900139)
lldb_avg/gdb_avg: 0.574214
ok

----------------------------------------------------------------------
Ran 1 test in 55.462s

OK

llvm-svn: 142949
2011-10-25 20:08:03 +00:00
Sean Callanan c70ed46dda Improved handling of static data in the expression
parser.  Now expression like the following work as
expected:

-
(lldb) expr struct { int a; int b; } $blah = { 10, 20 }
<no result>
(lldb) expr $blah
(<anonymous struct at Parse:6:5>) $blah = {
  (int) a = 10
  (int) b = 20
}
-

Now the IRForTarget subsystem knows how to handle
static initializers of various composite types.

Also removed an unnecessary parameter from
ClangExpressionDeclMap::GetFunctionInfo.

llvm-svn: 142936
2011-10-25 18:36:40 +00:00
Sean Callanan f463856fd0 Fixed our handling of const functions, compensating
for debug information that occasionally gets the
const-ness of member functions wrong.  We used to
demangle the name, add "const," and remangle it; now
we handle the mangled name directly, which is more
robust.

llvm-svn: 142933
2011-10-25 18:02:05 +00:00
Johnny Chen 3d0fcf5eae Patch from Dragos to fix Linux build!
llvm-svn: 142932
2011-10-25 17:58:16 +00:00
Greg Clayton 1deb796238 Updated all commands that use a "--format" / "-f" options to use the new
OptionGroupFormat. Updated OptionGroupFormat to be able to also use the
"--size" and "--count" options. Commands that use a OptionGroupFormat instance
can choose which of the options they want by initializing OptionGroupFormat
accordingly. Clients can either get only the "--format", "--format" + "--size",
or "--format" + "--size" + "--count". This is in preparation for upcoming
chnages where there are alternate ways (GDB format specification) to set a
format. 

llvm-svn: 142911
2011-10-25 06:44:01 +00:00
Jason Molenda 0c8e006987 Prefix display/undisplay regexp command alises with "_regexp" as per the
style of the other regexp command aliases.

llvm-svn: 142902
2011-10-25 02:11:20 +00:00
Jason Molenda 4223b3b380 typeo
llvm-svn: 142900
2011-10-25 01:28:56 +00:00
Jason Molenda b278f1e191 Add examples of shortest-possible lldb commands where appropriate.
Add new "Examining Variables" section.
Updated a few command entries to match current lldb behavior.

llvm-svn: 142898
2011-10-25 01:28:31 +00:00
Greg Clayton 4495393fed <rdar://problem/10335756>
Fixed an issue where bad DWARF from clang would get recycled from DWARF back
into types and cause clang to assert and die, killing the lldb binary, when
it tried to used the type in an expression.

llvm-svn: 142897
2011-10-25 01:25:35 +00:00
Greg Clayton 5196416772 Simplified the CommandInterpreter::StripFirstWord logic by making it a static
function and having it not require both a bool and a quote char to fill in.
We intend to get rid of this functionality when we rewrite the command 
interpreter for streams eventually, but not for now.

llvm-svn: 142888
2011-10-25 00:36:27 +00:00
Johnny Chen 447a2507a4 Add a bench-history file to keep track of simple bench results.
llvm-svn: 142874
2011-10-24 23:18:17 +00:00
Johnny Chen aeab25c70f Add more context information to the stop-hook mechanism by displaying the stop-hook
command in the '- Hook id' header.  This should improve readbility of the 'display'
command if, for example, we have issued 'display a' and 'display b' which turn into
"target stop-hook add -o 'expr -- a'" and "target stop-hook add -o 'expr -- b'".

Plus some minor change in TestAbbreviations.py to conditionalize the platform-specific
checkings of the "image list" output.

llvm-svn: 142868
2011-10-24 23:01:06 +00:00
Johnny Chen 51a4655201 Minor change.
llvm-svn: 142858
2011-10-24 22:06:48 +00:00
Johnny Chen 0deafe065a Test some lldb command abbreviations to make sure the common short spellings of
many commands remain available even after we add/delte commands in the future.

llvm-svn: 142857
2011-10-24 22:03:01 +00:00
Johnny Chen 7149b6f115 Add two new @expectedFailure decorators.
rdar://problem/10334911

llvm-svn: 142839
2011-10-24 20:06:23 +00:00
Jim Ingham 7e18e42235 Add "di" and "dis" aliases to "disassemble" so they will win over "display".
llvm-svn: 142834
2011-10-24 18:37:00 +00:00
Jim Ingham c10312cea2 Add a "-a" option to "image list" to show the image at a given address.
llvm-svn: 142833
2011-10-24 18:36:33 +00:00
Johnny Chen 9593622b08 Fix test regressions due to the addition of 'display' alias to the top level commands, which conflicts
with the original 'dis' -> 'disassemble' unique expansion.  Change it to 'disass' now.

llvm-svn: 142825
2011-10-24 18:24:54 +00:00
Johnny Chen e5b190304d Removed the @expectedFailure decorators from test cases. They have been fixed with the r142717 check-in.
llvm-svn: 142823
2011-10-24 18:11:16 +00:00
Enrico Granata 47c6f6d43d Decoupling of lock-related code from the core of ScriptInterpreterPython. All that concerns locking the Python interpreter is now delegated to the internal ScriptInterpreterPython::Locker class. Several changes in ScriptInterpreterPython to accommodate this new pattern.
llvm-svn: 142802
2011-10-24 17:22:21 +00:00
Benjamin Kramer 1695466fe3 Move Python.h includes out of the headers into the .cpp file where it's actually used.
Python.h includes a ton of macros that can cause weird behavior down the road.

llvm-svn: 142754
2011-10-23 16:49:03 +00:00
Benjamin Kramer d34a329c68 Remove unused include of deprecated header.
llvm-svn: 142753
2011-10-23 16:31:38 +00:00
Greg Clayton 607ddc571e Bumped versions for lldb-81 and debugserver-146.
llvm-svn: 142718
2011-10-22 03:38:38 +00:00
Greg Clayton f0705c8b90 Added template support when parsing DWARF into types. We can now use STL
classes in the expression parser.

llvm-svn: 142717
2011-10-22 03:33:13 +00:00
Jason Molenda a98d106d49 Document nexti, show some shorter versions of long lldb
commands.

llvm-svn: 142715
2011-10-22 02:31:42 +00:00
Sean Callanan a76eadd8bb Made the expression parser handle persistent variables
correctly even after the process has quit.

llvm-svn: 142712
2011-10-22 01:58:08 +00:00
Jason Molenda bc7748b7d3 Add "display" and "undisplay" aliases for target stop-hook add/delete.
A patina of gdb's "display" command, intended mostly for simply monitoring
a variable as you step through source code.  Formatters do not work, e.g.
display/x $pc does not work.

llvm-svn: 142710
2011-10-22 01:30:52 +00:00
Johnny Chen b8da426285 Add bench.py as a driver script to run some benchmarks on lldb.
Add benchmarks for expression evaluations (TestExpressionCmd.py) and disassembly (TestDoAttachThenDisassembly.py).

An example:
[17:45:55] johnny:/Volumes/data/lldb/svn/trunk/test $ ./bench.py 2>&1 | grep -P '^lldb.*benchmark:'
lldb startup delay (create fresh target) benchmark: Avg: 0.104274 (Laps: 30, Total Elapsed Time: 3.128214)
lldb startup delay (set first breakpoint) benchmark: Avg: 0.102216 (Laps: 30, Total Elapsed Time: 3.066470)
lldb frame variable benchmark: Avg: 1.649162 (Laps: 20, Total Elapsed Time: 32.983245)
lldb stepping benchmark: Avg: 0.104409 (Laps: 50, Total Elapsed Time: 5.220461)
lldb expr cmd benchmark: Avg: 0.206774 (Laps: 25, Total Elapsed Time: 5.169350)
lldb disassembly benchmark: Avg: 0.089086 (Laps: 10, Total Elapsed Time: 0.890859)

llvm-svn: 142708
2011-10-22 00:57:05 +00:00
Jason Molenda f385f12e17 Add "stepi" as an alias for thread step-inst in addition to "si".
Add "nexti" an "ni" as aliases for thread step-inst-over.

llvm-svn: 142707
2011-10-22 00:47:41 +00:00
Sean Callanan 2e2b8b844c Enabled dedicated debugger support in Clang, meaning
that Objective-C methods returning types incompatible
with "id" can be properly cast.

llvm-svn: 142702
2011-10-21 23:40:00 +00:00
Greg Clayton 7c6d7b83c1 Fixed a missing quote.
llvm-svn: 142698
2011-10-21 23:04:20 +00:00
Sean Callanan b226916528 Implemented an extension to the namespace map that
permits a namespace map to be created and populated
when the namespace is imported, not just when it is
requested via FindExternalVisibleDecls().

llvm-svn: 142690
2011-10-21 22:18:07 +00:00
Greg Clayton 596ed24e43 If a process plug-in was specified by name, always let the plug-in get used.
llvm-svn: 142688
2011-10-21 21:41:45 +00:00
Johnny Chen 31fdfb1f33 Add a benchmark for measuring the response time of the 'frame variable' command.
Example (start the lldb inferior, break at the Driver::MainLoop() function, and
issue 'frame variable'):

 $ ./dotest.py -v +b -x '-F Driver::MainLoop()' -n -p TestFrameVariableResponse.py
----------------------------------------------------------------------
Collected 1 test

1: test_startup_delay (TestFrameVariableResponse.FrameVariableResponseBench)
   Test response time for the 'frame variable' command. ... 
lldb frame variable benchmark: Avg: 1.636897 (Laps: 20, Total Elapsed Time: 32.737944)
ok

----------------------------------------------------------------------
Ran 1 test in 65.105s

OK

llvm-svn: 142678
2011-10-21 20:19:51 +00:00
Johnny Chen 99904b33b7 Rephrase benchmark output display.
llvm-svn: 142676
2011-10-21 20:11:40 +00:00