This is the conclusion of an effort to get LLDB's Python code
structured into a bona-fide Python package. This has a number
of benefits, but most notably the ability to more easily share
Python code between different but related pieces of LLDB's Python
infrastructure (for example, `scripts` can now share code with
`test`).
llvm-svn: 251532
Summary:
Virtual dynamic shared objects, or vdso files were
not loaded for Linux OS.In Bug 17384 the call
stack could not be unwinded from functions
residing in the vdso object.
This commit adds support for loading such files by
reading the Aux vectors since a vdso is invisibily
mapped to the inferiors address space and the
actual file is not present in the filesystem. The
presence of the vdso is detected by inspecting
the Aux vector for AT_SYSINFO_EHDR tag.
Reviewers: lldb-commits, ovyalov, tberghammer
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D14118
llvm-svn: 251505
The idea behind this patch is to expose the meat of
LLDB's Python infrastructure (test suite, scripts, etc)
as a single package. This makes reusability and code
sharing among sub-packages easy.
Differential Revision: http://reviews.llvm.org/D14131
llvm-svn: 251460
Summary:
This change deprecates -m/+m dotest options (the options are still recognized but they print an
error message pointing to the new options) and adds a new lldb-mi test category instead. To just
run lldb-mi tests, use '-G lldb-mi'. To skip lldb-mi tests, use '--skip-category lldb-mi'. All
lldb-mi tests are marked as such using the getCategories method on the base MiTestCaseBase class
and the @lldbmi_test decorator is not needed. In case one still needs to annotate a specific test
function as an lldb-mi test, one can use the @add_test_categories(['lldb-mi']) decorator to
achieve that.
Reviewers: tfiala, dawn, ki.stfu, abidh
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D14060
llvm-svn: 251400
Summary:
Gdb-remote's async thread sent out the eBroadcastBitRunPacketSent message *before* actually
sending out the continue packet. Since it's this message the actually triggers the public state
transition, it could happen (and it did happen in TestAttachResume, which does an "process
interrupt" right after a continue) that we attempt to stop the inferior before it was actually
started (which obviously did not end well). This fixes the problem by moving the broadcast after
the packet was actually sent.
Reviewers: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D14083
llvm-svn: 251399
On some combination of platform and c++ library, this dependency was causing the test to fail for reasons tangential to its real objective
llvm-svn: 251368
Python 3 has a different syntax for octal literals than Python 2
and they are incompatible with each other. Six doesn't provide
a transparent wrapper around this, so the most sane thing to do
is to not use octal literals. If you need an octal literal,
use a decimal literal and if it's not obvious what the value is,
provide the value in octal as a comment.
llvm-svn: 251328
The problem was that the @skipIfNoSBHeaders on darwin was trying to use self.lib_dir when it hadn't been set yet.
I looked at the code and places were required to set "self.lib_dir" for no real reason as all places that used it just used the LLDB_LIB_DIR environment variable. So I removed all uses of self.lib_dir and replaced them to use 'os.environ["LLDB_LIB_DIR"]'. Did the same for self.implib_dir.
llvm-svn: 251315
Python3 has no analogue to sys.maxint since ints in Python 3 have
arbitrary size. However, the distinction was not actually important
in any of these cases, and in a few cases using maxint was already
a bug to begin with.
llvm-svn: 251306
Summary:
Per discussions on the mailing list, I have implemented a decorator which annotates individual
test methods with categories. I have used this framework to replace the '-a' and '+a'
command-line switches (now '-G pyapi' and '--skip-category pyapi') and the @python_api_test
decorator (now @add_test_categories('pyapi')). The test suite now gives an error message
suggesting the new options if the user specifies the deprecated +/-a switches. If the general
direction is good, I will follow this up with other switches.
Reviewers: tberghammer, tfiala, granata.enrico, zturner
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D14020
llvm-svn: 251277
A variable of type:
struct S {
union {
int i1;
unsigned u1;
};
union {
int i2;
unsigned u2;
};
};
had been impossible to evaluate in lldb-mi, because MI assigns '??' as the
variable name to each of the unnamed unions after "-var-list-children" command.
Also '??' incorrectly goes to 'exp' field which is treated by IDE as a
structure field name and is displayed in watch window.
The patch fixes this returning empty string as type name for unnamed union and
assigning $N to variable name, where N is the field number in the parent entity.
Patch from evgeny.leviant@gmail.com
Reviewed by: clayborg, abidh
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13947
llvm-svn: 251176
Summary:
"from __future__ import print_function" was added to the test file but
not to the embedded interpreter. This change uses file.write instead to
avoid all problems with print.
Reviewers: zturner
Subscribers: zturner, lldb-commits
Differential Revision: http://reviews.llvm.org/D14029
llvm-svn: 251150
Six provides six.u() which resolves to either u"" or "" depending on
Python version, and and six.unichr() which resolves to either unichr()
or chr() depending on Python version. Use these functions anywhere
where we were relying on u"" or unichr().
llvm-svn: 251139
Apparently there were tons of instances I missed last time, I
guess I accidentally ran 2to3 non-recursively. This should be
every occurrence of a print statement fixed to use a print function
as well as from __future__ import print_function being added to
every file.
After this patch print statements will stop working everywhere in
the test suite, and the print function should be used instead.
llvm-svn: 251121
Summary:
The list of loaded modules which skip_if_library_missing is depending on is not available on
linux until after we run the target. This causes the tests to be wrongfully skipped. This commit
moves the skip call after the run command.
Reviewers: granata.enrico, tfiala
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13985
llvm-svn: 251102
Previously, lldb did not use type summaries for simple types with no children
(like function pointers). This patch enables MI to use lldb type summaries for
evaluation of all types of objects, so MI own formatters are no longer needed.
Patch from evgeny.leviant@gmail.com
Reviewed by: abidh
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13799
llvm-svn: 251082
Under Python 2 this has no effect, since map() returns a list.
In Python 3 map() returns an iterable, so wrapping in a list is
necessary to keep the same semantics.
llvm-svn: 251060
This is necessary in order to allow third party modules to be
located under lldb/third_party rather than under the test
folder directly.
Since we're already touching every test file anyway, we also
go ahead and delete the unittest2 import and main block wherever
possible. The ability to run a test as a standalone file has
already been broken for some time, and if we decide we want this
back, we should use unittest instead of unittest2.
A few places could not have the import of unittest2 removed,because
they depend on the unittest2.expectedFailure or skip decorators.
Removing all those was orthogonal in spirit to the purpose of this
CL, so the import of unittest2 remains in those files that were
using it for its test decorators. Those can be addressed
separately.
llvm-svn: 251055
Summary:
Along with this, support for an optional argument to the "num_children"
method of a Python synthetic child provider has also been added. These have
been added with the following use case in mind:
Synthetic child providers currently have a method "has_children" and
"num_children". While the former is good enough to know if there are
children, it does not give any insight into how many children there are.
Though the latter serves this purpose, calculating the number for children
of a data structure could be an O(N) operation if the data structure has N
children. The new method added in this change provide a middle ground.
One can call GetNumChildren(K) to know if a child exists at an index K
which can be as large as the callers tolerance can be. If the caller wants
to know about children beyond K, it can make an other call with 2K. If the
synthetic child provider maintains state about it counting till K
previosly, then the next call is only an O(K) operation. Infact, all
calls made progressively with steps of K will be O(K) operations.
Reviewers: vharron, clayborg, granata.enrico
Subscribers: labath, lldb-commits
Differential Revision: http://reviews.llvm.org/D13778
llvm-svn: 250930
Summary:
Loop detection code is being called before every element access. Although it tries to cache some
of the data by remembering the loop-free initial segment, every time it needs to increase this
segment, it will start from scratch. For the typical usage pattern, where one accesses the
elements in order, the loop detection will need to be run after every access, resulting in
quadratic behavior. This behavior is noticable even for the default 255 element limit.
In this commit, I rewrite the algorithm to be truly incremental -- it maintains the state of its
loop-detection runners between calls, and reuses them when it needs to check another segment.
This way, each part of the list is scanned only once, resulting in linear behavior.
Also note that I have changed the operator== of ListEntry to do the comparison based on the
value() function (instead of relying on ValueObjectSP equality). In my experiments, I kept
getting different ValueObjectSPs when going through the same element twice.
Reviewers: granata.enrico
Subscribers: lldb-commits, sivachandra
Differential Revision: http://reviews.llvm.org/D13902
llvm-svn: 250890
Right now our Python code does not all share a common root. Tests and
scripts both contain python code that cannot take advantage of reusability
since they are unrelated siblings of each other.
In particular, this presents a problem for wanting to use third party
packages from both sides, since it does not make sense to copy the module
into both places.
This patch solves this by introducing a script lldb_shared.py which is a
very lightweight script that just searches up the tree until it finds a
root, and then imports a module from there. That module knows how to
find all of the shared code that LLDB uses, and adjusts sys.path
accordingly to make them all visible.
llvm-svn: 250858
Summary:
ADB packets have a maximum size of 4k. This means the size of memory reads does not affect speed
too much (as long as it fits in one packet). Therefore, I am increasing the default memory read
size for android to 2k. This value is used only if the user has not modified the default
memory-cache-line-size setting.
Reviewers: clayborg, tberghammer
Subscribers: tberghammer, danalbert, srhines, lldb-commits
Differential Revision: http://reviews.llvm.org/D13812
llvm-svn: 250814
This patch was generating by running `2to3` on the files in the
lldb/test directory. This patch should be NFC, but it does
introduce the `from __future__ import print_function` line, which
will break future uses of the print statement.
llvm-svn: 250763
It was adding all the test infrastructure paths properly, but it
was not adding the lldb module. The current approach only adds the
lldb from the path. That can be improved (in the comments) to add
the one from the related build directory if it can be ascertained.
With this change, lldb tests can be run through pylint/flake8
and have the lldb module found and used as part of the checks.
llvm-svn: 250453
disabled the use of the jThreadGetExtendedInfo packet which is used
to retrieve additional information about a thread, such as the QoS
setting for that thread on darwin systems.
Re-enable the use of the jThreadGetExtendedInfo packet, and add
some quick tests to the TestQueues mac test case which will verify
that we can retrieve the QoS names for these test threads.
<rdar://problem/22925096>
llvm-svn: 250364
Summary:
This commit adds support for binary memory reads ($x) to lldb-server. It also removes the "0x"
prefix from the $x client packet, to make it more compatible with the old $m packet. This allows
us to use almost the same code for handling both packet types. I have verified that debugserver
correctly handles $x packets even without the leading "0x". I have added a test which verifies
that the stub returns the same memory contents for both kinds of memory reads ($x and $m).
Reviewers: tberghammer, jasonmolenda
Subscribers: iancottrell, lldb-commits
Differential Revision: http://reviews.llvm.org/D13695
llvm-svn: 250295
* ArchSpec::MergeFrom() would erroneously promote an unspecified
unknown to a specified unknown when both the ArchSpec and the merged
in ArchSpec were both unspecified unknowns. This no longer happens,
which fixes issues with global module cache lookup in some
situations.
* Added ArchSpec::DumpTriple(Stream&) that now properly prints
unspecified unknowns as '*' and specified unknows as 'unknown'.
This makes it trivial to tell the difference between the two.
Converted printing code over ot using DumpTriple() rather than
building from scratch.
* Fixed up a couple places that were not guaranteeing that an
unspecified unknown was recorded as such.
llvm-svn: 250253
Summary:
Test decorators were ignoring AttributeError exceptions. These were introduced three years ago,
and copied to all decorators. They seem to serve no purpose and removing them produces no errors.
Given that they have prevented us from noticing the problem in r249819, I am removing them.
Reviewers: zturner, tfiala
Subscribers: iancottrell, lldb-commits
Differential Revision: http://reviews.llvm.org/D13583
llvm-svn: 250038
* XFAIL it for android arm/aarch64 as watchpoints aren't supported there
* Remove the dwarf/dsym test separation as they will be generated automatically
llvm-svn: 250024
Summary:
- Changed from 16 bits to 8 bits for Intel Architecture
-- FXSAVE structure now conforms with the layout of FXSAVE
area specified by IA Architecture Software Developer Manual
- Modified Linux and FreeBSD specific files to support this change
-- MacOSX already uses 8 bits for ftag register
- Modified TestRegisters.py and a.cpp:
-- Change allows 8 bit comparison of ftag values
-- Change resolves Bug 24733:
Removed XFAIL for Clang as the test works and passes for
Clang compiler as well
-- Change provides a Generic/Better way of testing Bug 24457
and Bug 25050 by using 'int3' inline assembly in inferior
Signed-off-by: Abhishek Aggarwal <abhishek.a.aggarwal@intel.com>
Reviewers: ovyalov, jingham, clayborg
Subscribers: tfiala, emaste
Differential Revision: http://reviews.llvm.org/D13587
llvm-svn: 250022
Summary: On x86, we only have 4 watchpoint registers.
Reviewers: mohit.bhakkad
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13608
llvm-svn: 249916
Summary:
Log files produced by dotest have names derived from the test name, and this produces errors in
case we have multiple tests with the same name. Additionally, it's good if the test name explains
what the test is testing (which it clearly doesn't do well if there are multiple tests with
identical names). This commit makes the presence of such tests a hard error.
Reviewers: tberghammer, zturner
Subscribers: iancottrell, lldb-commits
Differential Revision: http://reviews.llvm.org/D13588
llvm-svn: 249828
We want to skip these tests when the target platform is darwin, not
when the host because they have to be enabled in case of darwin ->
android
llvm-svn: 249825
Summary:
In bug 24074, the type information is not shown
correctly. This commit includes the following -
-> Changes for displaying correct type based on
current lexical scope for the command "image
lookup -t"
-> The corresponding testcase.
-> This patch was reverted due to segfaults in
FreeBSD and Mac, I fixed the problems for both now.
Reviewers: emaste, granata.enrico, jingham, clayborg
Differential Revision: http://reviews.llvm.org/D13290
llvm-svn: 249673
Summary: This change fixes pr24916. As associated test has been added.
Reviewers: clayborg
Subscribers: zturner, lldb-commits
Differential Revision: http://reviews.llvm.org/D13224
llvm-svn: 249629
If a string contained characters outside the ASCII range, lldb-mi would
print them as hexadecimal codes. This patch fixes this behaviour by
converting to UTF-8 instead, by having lldb-mi use registered type
summary providers, when they are available. This patch also fixes
incorrect evaluation of some composite types, like std::string, by
having them use a type registered type summary provider.
Based on patch from evgeny.leviant@gmail.com
Reviewed by: ki.stfu, granata.enrico, clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13058
llvm-svn: 249597
Introduce the notion of Language-based formatter prefix/suffix
This is meant for languages that share certain data types but present them in syntatically different ways, such that LLDB can now have language-based awareness of which of the syntax variations it has to present to the user when formatting those values
This is goodness for new languages and interoperability, but is NFC for existing languages. As such, existing tests cover this
llvm-svn: 249587
Previously we haven't cleaned up the working directory we created on
the remote platform and because of it we run out of storage on some
android device/emulator (caused by the 2x increase of the number of
test cases because of dwo).
llvm-svn: 249541
dwo symbol files are generated when code compiled with the "-gsplit-dwarf"
command option (https://gcc.gnu.org/wiki/DebugFission). This CL modifies
the test system to run tests with inferiors compile with the "-gsplit-dwarf"
Differential revision: http://reviews.llvm.org/D13300
llvm-svn: 249530
Go tests fail on Ubuntu 14.04's go1.2.1. This change puts a minimum
go version in the skipUnlessGoInstalled() decorator of go1.3.0.
Go maintainers are encouraged to modify as needed. For now this fixes
failing tests on Ubuntu 14.04 x86_64 buildbots with stock distro go installed.
llvm-svn: 249446
4-core CPUs have a hard time keeping up with the number of debuggers
we were simultaneously spawning. This leads to a timeout, which
leaves processes hanging around in "suspended mode", which can't be
killed with signals.
llvm-svn: 249421
Rename the python source file for DataFormatterOSTypeTestCase to match
the purpose of the test and to avoid a name conflict with
DataFormatterBoolRefPtr. The name conflict caused a race condition in
the test runner what we have to address separately.
llvm-svn: 249407