- (lldb) type summary add -f "int = ${*var.sp.x},
+ (lldb) type summary add --summary-string "int = ${*var.sp.x},
float = ${*var.sp.y}, char = ${*var.sp.z%u}, Simple =
${*var.s}" Couple
(lldb) type summary add -c -p Simple
@@ -570,7 +570,7 @@
the output becomes:
- (lldb) fr var c
+ (lldb) frame variable c
(Couple) c = int = 9, float = 9.99, char = 88, Simple
= (x=9, y=9.99, z='X')
@@ -584,7 +584,7 @@
produce the same output:
- (lldb) type summary add -f "int = ${*var.sp.x},
+ (lldb) type summary add --summary-string "int = ${*var.sp.x},
float = ${*var.sp.y}, char = ${*var.sp.z%u}, Simple =
${var.s}" Couple
(lldb) type summary add -c Simple
@@ -612,18 +612,18 @@
similar to that used for arrays, just you can also give
a pair of indices separated by a -.
e.g.
- (lldb) fr var float_point
+ (lldb) frame variable float_point
(float) float_point = -3.14159
|
- (lldb) type summary add -f "Sign: ${var[31]%B}
+ (lldb) type summary add --summary-string "Sign: ${var[31]%B}
Exponent: ${var[30-23]%x} Mantissa: ${var[0-22]%u}"
float
|
- (lldb) fr var float_point
+ (lldb) frame variable float_point
(float) float_point = -3.14159 Sign: true Exponent:
0x00000080 Mantissa: 4788184
In this example, LLDB shows the internal
@@ -645,7 +645,7 @@
LLDB to format arrays in special ways, possibly
independent of the way the array members' datatype is formatted.
e.g.
- (lldb) fr var sarray
+ (lldb) frame variable sarray
(Simple [3]) sarray = {
[0] = {
x = 1
@@ -666,13 +666,13 @@
|
- (lldb) type summary add -f "${var[].x}" "Simple
+ (lldb) type summary add --summary-string "${var[].x}" "Simple
[3]"
|
- (lldb) fr var sarray
+ (lldb) frame variable sarray
(Simple [3]) sarray = [1,4,7]
The [] symbol amounts to: if var
@@ -683,7 +683,7 @@
If you find some of those integers anomalous, you can
then inspect that one item in greater detail, without
the array format getting in the way:
- (lldb) fr var sarray[1]
+ (lldb) frame variable sarray[1]
(Simple) sarray[1] = {
x = 4
y = 5
@@ -695,12 +695,12 @@
for bitfields:
|
- (lldb) type summary add -f "${var[1-2].x}" "Simple
+ (lldb) type summary add --summary-string "${var[1-2].x}" "Simple
[3]"
|
- (lldb) fr var sarray
+ (lldb) frame variable sarray
(Simple [3]) sarray = [4,7]
The same logic works if you are printing a pointer
@@ -716,7 +716,7 @@
omitting square brackets, as in:
|
- (lldb) type summary add -f "${var%s}" "char *"
+ (lldb) type summary add --summary-string "${var%s}" "char *"
|
@@ -734,7 +734,7 @@
type, even if square brackets are omitted.
|
- (lldb) type summary add -f "${var%int32_t[]}" "int [10]"
+ (lldb) type summary add --summary-string "${var%int32_t[]}" "int [10]"
|
@@ -836,7 +836,7 @@
If you need to delve into several levels of hierarchy, as you can do with summary
- strings, you must use the method GetValueForExpressionPath(), passing it
+ strings, you can use the method GetValueForExpressionPath(), passing it
an expression path just like those you could use for summary strings. However, if you need
to access array slices, you cannot do that (yet) via this method call, and you must
use GetChildMemberWithName() querying it for the array items one by one.
@@ -845,12 +845,12 @@
to input a Python script as a summary:
- - using the -s option to
type summary add and typing the script
+ - using the --python-script option to
type summary add and typing the script
code as an option argument; as in:
- (lldb) type summary add -s "height =
+ (lldb) type summary add --python-script "height =
int(valobj.GetChildMemberWithName('height').GetValue());width =
int(valobj.GetChildMemberWithName('width').GetValue());
return 'Area: ' + str(height*width)" Rectangle
@@ -885,13 +885,13 @@
|
- (lldb) type summary add -f "${var[].x}"
+ (lldb) type summary add --summary-string "${var[].x}"
-x "Simple \[[0-9]+\]"
|
- (lldb) fr var sarray
+ (lldb) frame variable sarray
(Simple [3]) sarray = [1,4,7]
The above scenario works for Simple [3]
as well as for any other array of Simple
@@ -905,6 +905,9 @@
matching. Thus, if your type has a base class with a
cascading summary, this will be preferred over any
regular expression match for your type itself.
+
+ The regular expression language used by LLDB is the POSIX extended regular expression language, as defined by the SUS.
+
@@ -924,12 +927,12 @@
|
- (lldb) type summary add -f "x=${var.integer}" --name NamedSummary
+ (lldb) type summary add --summary-string "x=${var.integer}" --name NamedSummary
|
- (lldb) fr var one
+ (lldb) frame variable one
(i_am_cool) one = int = 3, float = 3.14159, char = 69
- (lldb) fr var one --summary NamedSummary
+ (lldb) frame variable one --summary NamedSummary
(i_am_cool) one = x=3
@@ -959,9 +962,9 @@
For instance, consider an STL vector:
(lldb) frame variable numbers -T
- (std::vector) numbers = {
- (std::_Vector_base >) std::_Vector_base > = {
- (std::_Vector_base >::_Vector_impl) _M_impl = {
+ (std::vector<int>) numbers = {
+ (std::_Vector_base<int, std::allocator<int> >) std::_Vector_base<int, std::allocator<int> > = {
+ (std::_Vector_base<int, std::allocator&tl;int> >::_Vector_impl) _M_impl = {
(int *) _M_start = 0x00000001001008a0
(int *) _M_finish = 0x00000001001008a8
(int *) _M_end_of_storage = 0x00000001001008a8
@@ -974,7 +977,7 @@
What you would like to see is probably something like:
(lldb) frame variable numbers -T
- (std::vector) numbers = {
+ (std::vector<int>) numbers = {
(int) [0] = 1
(int) [1] = 12
(int) [2] = 123
@@ -1004,8 +1007,83 @@
of LLDB.
For examples of how synthetic children are created, you are encouraged to look at examples/synthetic in the LLDB trunk.
+
+ Once a synthetic children provider is written, one must load it into LLDB before it can be used.
+ Currently, one can use the LLDB script command to type Python code interactively,
+ or use the script import module command to load Python code from a Python module
+ (ordinary rules apply to importing modules this way). A third option is to type the code for
+ the provider class interactively while adding it.
+
+ For example, let's pretend we have a class Foo for which a synthetic children provider class Foo_Provider
+ is available, in a Python module named Foo_Tools. The following interaction sets Foo_Provider as a synthetic
+ children provider in LLDB:
+
+
+
+ (lldb) script import Foo_Tools
+ (lldb) type synthetic add Foo --python-class Foo_Tools.Foo_Provider
+ |
+
+ (lldb) frame variable a_foo
+ (Foo) a_foo = {
+ x = 1
+ y = "Hello world"
+ }
+
+
+ Currently, in LLDB top of tree, synthetic children providers are enabled for
+ std::vector<T>, std::list<T> and std::map<K,V>.
+
+ Synthetic children enable a new symbol for summary strings, ${svar. This symbol tells LLDB to refer expression paths to the
+ synthetic children instead of the real ones. While in certain cases, you can use ${var.synthetic-child-path} and LLDB will
+ access the synthetic child correctly, it is best to always use ${svar to refer to synthetic children. For instance,
+
+
+ |
+ (lldb) type summary add --expand -x "std::vector<" --summary-string "${svar%#} items"
+ |
+
+ (lldb) frame variable numbers
+ (std::vector<int>) numbers = 4 items {
+ (int) [0] = 1
+ (int) [1] = 12
+ (int) [2] = 123
+ (int) [3] = 1234
+ }
+
+
+
+
+
+
+
+ Filters are a solution to the display of complex classes.
+ At times, classes have many member variables but not all of these are actually
+ necessary for the user to see.
+ A filter will solve this issue by only letting the user see those member
+ variables he cares about. Of course, the equivalent of a filter can be implemented easily
+ using synthetic children, but a filter lets you get the job done without having to write
+ Python code.
+ For instance, if your class Foobar has member variables named A thru Z, but you only need to see
+ the ones named B, H and Q, you can define a filter:
+
+ |
+ (lldb) type filter add Foo --child B --child H --child Q
+ |
+
+ (lldb) frame variable a_foobar
+ (Foobar) a_foobar = {
+ (int) B = 1
+ (char) H = 'H'
+ (std::string) Q = "Hello world"
+ }
+
+
+
+
+
From granata.enrico at gmail.com Tue Aug 23 16:29:50 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Tue, 23 Aug 2011 21:29:50 -0000
Subject: [Lldb-commits] [lldb] r138385 - in /lldb/trunk/include/lldb:
Target/StackFrame.h lldb-private-enumerations.h
Message-ID: <20110823212950.67D302A6C12C@llvm.org>
Author: enrico
Date: Tue Aug 23 16:29:50 2011
New Revision: 138385
URL: http://llvm.org/viewvc/llvm-project?rev=138385&view=rev
Log:
Fixing commas in enums (build breaker on GCC) as reported by Filipe Cabecinhas
Modified:
lldb/trunk/include/lldb/Target/StackFrame.h
lldb/trunk/include/lldb/lldb-private-enumerations.h
Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=138385&r1=138384&r2=138385&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Tue Aug 23 16:29:50 2011
@@ -35,7 +35,7 @@
eExpressionPathOptionCheckPtrVsMember = (1u << 0),
eExpressionPathOptionsNoFragileObjcIvar = (1u << 1),
eExpressionPathOptionsNoSyntheticChildren = (1u << 2),
- eExpressionPathOptionsNoSyntheticArrayRange = (1u << 3),
+ eExpressionPathOptionsNoSyntheticArrayRange = (1u << 3)
};
//------------------------------------------------------------------
// Constructors and Destructors
Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-enumerations.h?rev=138385&r1=138384&r2=138385&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-private-enumerations.h Tue Aug 23 16:29:50 2011
@@ -211,7 +211,7 @@
eFormatCategoryItemFilter = 0x0004,
eFormatCategoryItemRegexFilter = 0x0008,
eFormatCategoryItemSynth = 0x0010,
- eFormatCategoryItemRegexSynth = 0x0020,
+ eFormatCategoryItemRegexSynth = 0x0020
} FormatCategoryItem;
} // namespace lldb
From johnny.chen at apple.com Tue Aug 23 16:54:11 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 23 Aug 2011 21:54:11 -0000
Subject: [Lldb-commits] [lldb] r138391 - /lldb/trunk/test/make/Makefile.rules
Message-ID: <20110823215411.129762A6C12C@llvm.org>
Author: johnny
Date: Tue Aug 23 16:54:10 2011
New Revision: 138391
URL: http://llvm.org/viewvc/llvm-project?rev=138391&view=rev
Log:
Make clang the default compiler for building the test programs.
Modified:
lldb/trunk/test/make/Makefile.rules
Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=138391&r1=138390&r2=138391&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Tue Aug 23 16:54:10 2011
@@ -23,14 +23,14 @@
endif
#----------------------------------------------------------------------
-# CC defaults to gcc.
+# CC defaults to clang.
# See also these functions:
# o cxx_compiler
# o cxx_linker
#----------------------------------------------------------------------
-CC ?= gcc
+CC ?= clang
ifeq "$(CC)" "cc"
- CC = gcc
+ CC = clang
endif
#----------------------------------------------------------------------
From johnny.chen at apple.com Tue Aug 23 17:10:17 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 23 Aug 2011 22:10:17 -0000
Subject: [Lldb-commits] [lldb] r138393 -
/lldb/trunk/test/lang/cpp/this/TestCPPThis.py
Message-ID: <20110823221017.901A42A6C12C@llvm.org>
Author: johnny
Date: Tue Aug 23 17:10:17 2011
New Revision: 138393
URL: http://llvm.org/viewvc/llvm-project?rev=138393&view=rev
Log:
Skip these two cases temporarily while investigating the crash on OSX Lion with clang as the compiler.
Modified:
lldb/trunk/test/lang/cpp/this/TestCPPThis.py
Modified: lldb/trunk/test/lang/cpp/this/TestCPPThis.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/this/TestCPPThis.py?rev=138393&r1=138392&r2=138393&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/this/TestCPPThis.py (original)
+++ lldb/trunk/test/lang/cpp/this/TestCPPThis.py Tue Aug 23 17:10:17 2011
@@ -8,6 +8,7 @@
mydir = os.path.join("lang", "cpp", "this")
+ @unittest2.skip("segmentation fault -- skipping")
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
#rdar://problem/9962849
@expectedFailureClang
@@ -16,6 +17,7 @@
self.buildDsym()
self.static_method_commands()
+ @unittest2.skip("segmentation fault -- skipping")
#rdar://problem/9962849
@expectedFailureClang
def test_with_dwarf_and_run_command(self):
From johnny.chen at apple.com Tue Aug 23 17:32:45 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 23 Aug 2011 22:32:45 -0000
Subject: [Lldb-commits] [lldb] r138399 - in
/lldb/trunk/test/functionalities/data-formatter: data-formatter-advanced/
data-formatter-categories/ data-formatter-cpp/ data-formatter-globals/
data-formatter-named-summaries/ data-formatter-objc/
data-formatter-python-synth/ data-formatter-script/
data-formatter-skip-summary/ data-formatter-smart-array/
data-formatter-synth/ rdar-9973865/ rdar-9973992/ rdar-9974002/
Message-ID: <20110823223245.6F6FC2A6C12C@llvm.org>
Author: johnny
Date: Tue Aug 23 17:32:45 2011
New Revision: 138399
URL: http://llvm.org/viewvc/llvm-project?rev=138399&view=rev
Log:
Uniquefy the various data-formatter test class names so that:
./dotest.py -v -f DataFormatterTestCase.test_with_dsym_and_run_command
will not end up running 14 tests.
Modified:
lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
lldb/trunk/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py
lldb/trunk/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py
lldb/trunk/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class AdvDataFormatterTestCase(TestBase):
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-advanced")
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class CategoriesDataFormatterTestCase(TestBase):
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-categories")
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class CppDataFormatterTestCase(TestBase):
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-cpp")
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class GlobalsDataFormatterTestCase(TestBase):
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-globals")
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class NamedSummariesDataFormatterTestCase(TestBase):
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-named-summaries")
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class ObjCDataFormatterTestCase(TestBase):
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-objc")
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class PythonSynthDataFormatterTestCase(TestBase):
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-python-synth")
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class ScriptDataFormatterTestCase(TestBase):
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-script")
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class SkipSummaryDataFormatterTestCase(TestBase):
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-skip-summary")
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class SmartArrayDataFormatterTestCase(TestBase):
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-smart-array")
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class SynthDataFormatterTestCase(TestBase):
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-synth")
Modified: lldb/trunk/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class Radar9973865DataFormatterTestCase(TestBase):
# test for rdar://problem/9973865 (If you use "${var}" in the summary string for an aggregate type, the summary doesn't print for a pointer to that type)
mydir = os.path.join("functionalities", "data-formatter", "rdar-9973865")
Modified: lldb/trunk/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class Radar9973992DataFormatterTestCase(TestBase):
# test for rdar://problem/9973992 (What should we do for "${var}" in summaries of aggregate types?)
mydir = os.path.join("functionalities", "data-formatter", "rdar-9973992")
Modified: lldb/trunk/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py?rev=138399&r1=138398&r2=138399&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py Tue Aug 23 17:32:45 2011
@@ -7,7 +7,7 @@
import lldb
from lldbtest import *
-class DataFormatterTestCase(TestBase):
+class Radar9974002DataFormatterTestCase(TestBase):
# test for rdar://problem/9974002 ()
mydir = os.path.join("functionalities", "data-formatter", "rdar-9974002")
From johnny.chen at apple.com Tue Aug 23 17:36:23 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 23 Aug 2011 22:36:23 -0000
Subject: [Lldb-commits] [lldb] r138403 - /lldb/trunk/lib/Makefile
Message-ID: <20110823223623.EE2A62A6C12C@llvm.org>
Author: johnny
Date: Tue Aug 23 17:36:23 2011
New Revision: 138403
URL: http://llvm.org/viewvc/llvm-project?rev=138403&view=rev
Log:
Patch by Filipe to build lldb usng 'make'!
Modified:
lldb/trunk/lib/Makefile
Modified: lldb/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=138403&r1=138402&r2=138403&view=diff
==============================================================================
--- lldb/trunk/lib/Makefile (original)
+++ lldb/trunk/lib/Makefile Tue Aug 23 17:36:23 2011
@@ -60,7 +60,8 @@
clangParse.a \
clangSema.a \
clangSerialization.a \
- EnhancedDisassembly.a
+ EnhancedDisassembly.a \
+ LLVMMCDisassembler.a
include $(LLDB_LEVEL)/../../Makefile.config
From granata.enrico at gmail.com Tue Aug 23 20:32:46 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Wed, 24 Aug 2011 01:32:46 -0000
Subject: [Lldb-commits] [lldb] r138421 - in /lldb/trunk:
examples/synthetic/StdVectorSynthProvider.py www/varformats.html
Message-ID: <20110824013246.335EB2A6C12C@llvm.org>
Author: enrico
Date: Tue Aug 23 20:32:46 2011
New Revision: 138421
URL: http://llvm.org/viewvc/llvm-project?rev=138421&view=rev
Log:
More documentation changes (WIP)
Modified:
lldb/trunk/examples/synthetic/StdVectorSynthProvider.py
lldb/trunk/www/varformats.html
Modified: lldb/trunk/examples/synthetic/StdVectorSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/StdVectorSynthProvider.py?rev=138421&r1=138420&r2=138421&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/StdVectorSynthProvider.py (original)
+++ lldb/trunk/examples/synthetic/StdVectorSynthProvider.py Tue Aug 23 20:32:46 2011
@@ -2,19 +2,20 @@
def __init__(self, valobj, dict):
self.valobj = valobj;
- self.update()
+ self.update() # initialize this provider
def num_children(self):
- start_val = self.start.GetValueAsUnsigned(0)
- finish_val = self.finish.GetValueAsUnsigned(0)
- end_val = self.end.GetValueAsUnsigned(0)
+ start_val = self.start.GetValueAsUnsigned(0) # read _M_start
+ finish_val = self.finish.GetValueAsUnsigned(0) # read _M_finish
+ end_val = self.end.GetValueAsUnsigned(0) # read _M_end_of_storage
+
# Before a vector has been constructed, it will contain bad values
# so we really need to be careful about the length we return since
# unitialized data can cause us to return a huge number. We need
# to also check for any of the start, finish or end of storage values
# being zero (NULL). If any are, then this vector has not been
# initialized yet and we should return zero
-
+
# Make sure nothing is NULL
if start_val == 0 or finish_val == 0 or end_val == 0:
return 0
@@ -25,23 +26,46 @@
if finish_val > end_val:
return 0
+ # pointer arithmetic: (_M_finish - _M_start) would return the number of
+ # items of type T contained in the vector. because Python has no way to know
+ # that we want to subtract two pointers instead of two integers, we have to divide
+ # by sizeof(T) to be equivalent to the C++ pointer expression
num_children = (finish_val-start_val)/self.data_size
return num_children
+ # we assume we are getting children named [0] thru [N-1]
+ # if for some reason our child name is not in this format,
+ # do not bother to show it, and return an invalid value
def get_child_index(self,name):
- return int(name.lstrip('[').rstrip(']'))
+ try:
+ return int(name.lstrip('[').rstrip(']'))
+ except:
+ return -1;
def get_child_at_index(self,index):
+ # LLDB itself should never query for children < 0, but this might come
+ # from someone asking for a nonexisting child and getting -1 as index
+ if index < 0:
+ return None
if index >= self.num_children():
return None;
- offset = index * self.data_size
- return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
-
+ # *(_M_start + index), or equivalently _M_start[index] is C++ code to
+ # read the index-th item of the vector. in Python we must make an offset
+ # that is index * sizeof(T), and then grab the value at that offset from
+ # _M_start
+ offset = index * self.data_size # index * sizeof(T)
+ return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type) # *(_M_start + index)
+
+ # an std::vector contains an object named _M_impl, which in turn contains
+ # three pointers, _M_start, _M_end and _M_end_of_storage. _M_start points to the
+ # beginning of the data area, _M_finish points to where the current vector elements
+ # finish, and _M_end_of_storage is the end of the currently alloc'ed memory portion
+ # (to allow resizing, a vector may allocate more memory than required)
def update(self):
impl = self.valobj.GetChildMemberWithName('_M_impl')
self.start = impl.GetChildMemberWithName('_M_start')
self.finish = impl.GetChildMemberWithName('_M_finish')
self.end = impl.GetChildMemberWithName('_M_end_of_storage')
- self.data_type = self.start.GetType().GetPointeeType()
- self.data_size = self.data_type.GetByteSize()
+ self.data_type = self.start.GetType().GetPointeeType() # _M_start is defined as a T*
+ self.data_size = self.data_type.GetByteSize() # sizeof(T)
Modified: lldb/trunk/www/varformats.html
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/varformats.html?rev=138421&r1=138420&r2=138421&view=diff
==============================================================================
--- lldb/trunk/www/varformats.html (original)
+++ lldb/trunk/www/varformats.html Tue Aug 23 20:32:46 2011
@@ -1006,7 +1006,9 @@
Currently this method is optional, because the internal state of synthetic children providers will not be preserved. However, this is meant to change in future versions
of LLDB.
- For examples of how synthetic children are created, you are encouraged to look at examples/synthetic in the LLDB trunk.
+ For examples of how synthetic children are created, you are encouraged to look at examples/synthetic in the LLDB trunk.
+ You may especially want to begin looking at StdVector to get
+ a feel for this feature.
Once a synthetic children provider is written, one must load it into LLDB before it can be used.
Currently, one can use the LLDB script command to type Python code interactively,
@@ -1084,14 +1086,41 @@
-
+
+
+
+ Categories are a way to group related formatters. For instance, LLDB itself groups
+ the formatters for the C++ STL objects in a category named gnu-libstdc++.
+ Basically, categories act like containers in which to store formatters for a same library
+ or OS release.
+ By default, three categories are created in LLDB: system, gnu-libstdc++ and default.
+ Every formatter that is not created inside a category, is by default a part of the default category.
+ If you want to use a custom category for your formatters, all the type ... add (except for type format add),
+ provide a --category (-w) option, that names the category to add the formatter to.
+ To delete the formatter, you then have to specify the correct category.
+ Categories can be in one of two states: enabled and disabled. A category is initially disabled,
+ and can be enabled using the type category enable command. To disable an enabled category,
+ the command to use is type category disable. The order in which categories are enabled or disabled
+ is significant, in that LLDB uses that order when looking for formatters. Therefore, when you enable a category, it becomes
+ the first one to be searched. The default categories are enabled in the order: default as first, then
+ gnu-libstdc++, and finally system. As said, gnu-libstdc++ contains formatters for C++ STL
+ data types. system contains formatters for char* and char[], which are expected to be
+ consistent throughout libraries and systems, and replace
+ Categories are a way to group related formatters. For instance, LLDB itself groups
+ the formatters for the C++ STL objects in a category named gnu-libstdc++
+
+
+
While the rules for finding an appropriate format for a
type are relatively simple (just go through typedef
hierarchies), searching formatters for a type goes through
- a rather intricate set of rules. Namely, what happens is:
+ a rather intricate set of rules. Namely, what happens is that LLDB
+ starts looking in each enabled category, according to the order in which
+ they were enabled (latest enabled first). In each category, LLDB does
+ the following:
- If there is a formatter for the type of the variable,
use it
@@ -1125,6 +1154,11 @@
looking for regular expressions instead of exact
matches
+ If any of those attempts returned a valid formatter to be used,
+ that one is used, and the search is terminated (without going to look
+ in other categories). If nothing was found in the current category, the next
+ enabled category is scanned according to the same algorithm. If there are no
+ more enabled categories, the search has failed.
From granata.enrico at gmail.com Tue Aug 23 20:49:09 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Wed, 24 Aug 2011 01:49:09 -0000
Subject: [Lldb-commits] [lldb] r138423 - /lldb/trunk/www/varformats.html
Message-ID: <20110824014909.7386E2A6C12C@llvm.org>
Author: enrico
Date: Tue Aug 23 20:49:09 2011
New Revision: 138423
URL: http://llvm.org/viewvc/llvm-project?rev=138423&view=rev
Log:
Minor documentation changes (WIP)
Modified:
lldb/trunk/www/varformats.html
Modified: lldb/trunk/www/varformats.html
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/varformats.html?rev=138423&r1=138422&r2=138423&view=diff
==============================================================================
--- lldb/trunk/www/varformats.html (original)
+++ lldb/trunk/www/varformats.html Tue Aug 23 20:49:09 2011
@@ -719,15 +719,23 @@
(lldb) type summary add --summary-string "${var%s}" "char *"
-
- This works for char* and char[] objects, and uses the
- \0 terminator
- when possible to terminate the string, instead of relying on array length.
-
-
+
+ This syntax works for char* as well as for char[]
+ because LLDB can rely on the final \0 terminator to know when the string
+ has ended.
+ LLDB has default summary strings for char* and char[] that use
+ this special case. On debugger startup, the following are defined automatically:
+
+
+ (lldb) type summary add --summary-string "${var%s}" "char *"
+ (lldb) type summary add --summary-string "${var%s}" -x "char \[[0-9]+]"
+ |
+ |
| |