do. Closing on EOF is an option that can be set on the
lldb_private::Communication or the lldb::SBCommunication objects after they
are created. Of course the EOF support isn't hooked up, so they don't do
anything at the moment, but they are left in so when the code is fixed, it
will be easy to get working again.
llvm-svn: 120885
was done as an settings variable in the process for now. We will eventually
move all environment stuff over to the target, but we will leave it with the
process for now. The default setting is for a process to inherit the host
environment. This can be disabled by setting the "inherit-env" setting to
false in the process.
llvm-svn: 120862
inferior to be launched without setting up terminal stdin/stdout for it
(leaving the lldb command line accessible while the program is executing).
Also add a user settings variable, 'target.process.disable-stdio' to allow
the user to set this globally rather than having to use the command option
each time the process is launched.
llvm-svn: 120825
an error saying the resume timed out. Previously the thread that was trying
to resume the process would eventually call ProcessGDBRemote::DoResume() which
would broadcast an event over to the async GDB remote thread which would sent the
continue packet to the remote gdb server. Right after this was sent, it would
set a predicate boolean value (protected by a mutex and condition) and then the
thread that issued the ProcessGDBRemote::DoResume() would then wait for that
condition variable to be set. If the async gdb thread was too quick though, the
predicate boolean value could have been set to true and back to false by the
time the thread that issued the ProcessGDBRemote::DoResume() checks the boolean
value. So we can't use the predicate value as a handshake. I have changed the code
over to using a Event by having the GDB remote communication object post an
event:
GDBRemoteCommunication::eBroadcastBitRunPacketSent
This allows reliable handshaking between the two threads and avoids the erroneous
ProcessGDBRemote::DoResume() errors.
Added a host backtrace service to allow in process backtraces when trying to track
down tricky issues. I need to see if LLVM has any backtracing abilities abstracted
in it already, and if so, use that, but I needed something ASAP for the current issue
I was working on. The static function is:
void
Host::Backtrace (Stream &strm, uint32_t max_frames);
And it will backtrace at most "max_frames" frames for the current thread and can be
used with any of the Stream subclasses for logging.
llvm-svn: 120793
so that it is not referring to potentially stale
state during IR execution.
This was done by introducing modular state (like
ClangExpressionVariable) where groups of state
variables have well-defined lifetimes:
- m_parser_vars are specific to parsing, and only
exist between calls to WillParse() and DidParse().
- m_struct_vars survive for the entire execution
of the ClangExpressionDeclMap because they
provide the template for a materialized set of
expression variables.
- m_material_vars are specific to a single
instance of materialization, and only exist
between calls to Materialize() and
Dematerialize().
I also removed unnecessary references to long-
lived state that really didn't need to be referred
to at all, and also introduced several assert()s
that helped me diagnose a few bugs (fixed too).
llvm-svn: 120778
Add bool member to Communication class indicating whether the
Connection should be closed on receiving an EOF or not. Update the
Connection read to return an EOF status when appropriate. Modify the
Communication class to pass the EOF along or not, and to close the
Connection or not, as appropriate.
llvm-svn: 120723
Don't overwhelm the expression mechanism. Previously, there was no delay
between successive invocations of 'expression' command. The test suite
run has experienced 'Resume timed out' or similar error messages. Now we
currently add a sleep of 1.0 second before issuing the next 'expression'
command.
llvm-svn: 120626
test classes or test cases to be excludued from the test suite.
Check in an example blacklist file: blacklist.py:
"""
'blacklist' is a Python dictionary, it stores the mapping of a string describing
either a testclass or a testcase, i.e, testclass.testmethod, to the reason (a
string) it is blacklisted.
Following is an example which states that test class IntegerTypesExprTestCase
should be skipped because 'This test class crashed' and the test case
FoundationTestCase.test_data_type_and_expr_with_dsym should be skipped because
it is 'Temporarily disabled'.
blacklist = {'IntegerTypesExprTestCase': 'This test class crashed',
'FoundationTestCase.test_data_type_and_expr_with_dsym': 'Temporarily disabled'
}
"""
blacklist = {}
An example of invoking the test driver and specifying a blacklist file:
./dotest.py -b blacklist.py -v types
This runs the tests under 'types' directory but excludes the tests specified in
balcklist.py.
llvm-svn: 120620
in C++ methods. There were two fixes involved:
- For an object whose contents are not known, the
expression should be treated as a non-member, and
"this" should have no meaning.
- For a const object, the method should be declared
const as well.
llvm-svn: 120606
copied by the copy constructor for ClangExpressionVariable.
This meant that a NULL m_register_info wouldn't be
copied, and instead the field was uninitialized, potentially
confusing the materializer.
llvm-svn: 120472
Added a ThreadPlanCallUserExpression that differs from ThreadPlanCallFunction in that it holds onto a shared pointer to its ClangUserExpression so that can't go away before the thread plan is done using it.
Fixed the stop message when you hit a breakpoint while running a user expression so it is more obvious what has happened.
llvm-svn: 120386
the process status is indeed 'stopped' before invoking 'frame variable -t val'
command to inspect the frame variable. When I run the test suite, it sometimes
emits an output like:
runCmd: frame variable -t val
runCmd failed!
error: you must be stopped in a valid stack frame to view frame variables.
The expect() statement inserted is to make sure that the process is stopped and
we have a valid frame.
llvm-svn: 120318
Increase the delta between successive test cases, enabled with the '-w' option to
the test driver, from 0.5 to 1.0 second, to arrive at a cleaner state before the
next test case.
llvm-svn: 120315
RegisterContext* - normally this is retrieved from the ExecutionContext's
StackFrame but when we need to evaluate an expression while creating
the stack frame list this can be a little tricky.
Add DW_OP_deref_size, needed for the _sigtramp FDE expression.
Add support for processing DWARF expressions in RegisterContextLLDB.
Update callers to DWARFExpression::Evaluate.
llvm-svn: 119885
perform recursive type lookups, because these are not
required for full type fidelity. We also make the
SelectorTable last for the full lifetime of the Clang
compiler; this was the source of many bugs.
llvm-svn: 119835
that the result of an expression should be coerced to
a specific type. Also made breakpoint conditions pass
in the bool type for this type.
The expression parser ignores this indication for now.
llvm-svn: 119779
changing it to use it. There was an extra parameter added to the static
accessor global user settings controllers that wasn't needed. A bool was being
used as a parameter to the accessor just so it could be used to clean up
the global user settings controller which is now fixed by splitting up the
initialization into the "static void Class::Initialize()", access into the
"static UserSettingsControllerSP & Class::GetSettingsController()", and
cleanup into "static void Class::Terminate()".
Also added initialize and terminate calls to the logging code to avoid issues
when LLDB is shutting down. There were cases after the logging was switched
over to use shared pointers where we could crash if the global destructor
chain was being run and it causes the log to be destroyed and any any logging
occurred.
llvm-svn: 119757
by being able to get the data count and data. Each thread stop reason
has one or more data words that can help describe the stop. To do this
I added:
size_t
SBThread::GetStopReasonDataCount();
uint64_t
SBThread::GetStopReasonDataAtIndex(uint32_t idx);
llvm-svn: 119720
to the DoHalt down in ProcessGDBRemote. I also moved the functionality that
was in ProcessGDBRemote::DoHalt up into Process::Halt so not every class has
to implement a tricky halt/resume on the internal state thread. The
functionality is the same as it was before with two changes:
- when we eat the event we now just reuse the event we consume when the private
state thread is paused and set the interrupted bool on the event if needed
- we also properly update the Process::m_public_state with the state of the
event we consume.
Prior to this, if you issued a "process halt" it would eat the event, not
update the process state, and then produce a new event with the interrupted
bit set and send it. Anyone listening to the event would get the stopped event
with a process that whose state was set to "running".
Fixed debugserver to not have to be spawned with the architecture of the
inferior process. This worked fine for launching processes, but when attaching
to processes by name or pid without a file in lldb, it would fail.
Now debugserver can support multiple architectures for a native debug session
on the current host. This currently means i386 and x86_64 are supported in
the same binary and a x86_64 debugserver can attach to a i386 executable.
This change involved a lot of changes to make sure we dynamically detect the
correct registers for the inferior process.
llvm-svn: 119680
with the Interrupted bit set. Process::HandlePrivateEvent ignores Interrupted events.
DoHalt is changed to ensure that the stop even is processed, and an event with
the Interrupted event is posted. Finally ClangFunction is rationalized to use this
facility so the that Halt is handled more deterministically.
llvm-svn: 119453
output from clang and llvm-gcc compiled program; both generate the correct debug
info with respect to the typedef scoped inside a namespace.
Add a TestBase.getCompiler(self) method which returns the compiler in effect the
test suite is now running with. Subclasses (like TestNamespace) can use it to
distinguish among different compilers.
llvm-svn: 119445
This is not to be used during normal test suite run, but to be used to stress test
specific test sequences repeatedly.
Example:
./dotest.py -# 3 -v breakpoint_conditions
will repeat the test suite 3 times for tests under the breakpoint_conditions directory.
llvm-svn: 119399
ReadThread stuff into the main Process class (out of the Process Plugins).
This has the (intended) side effect of disabling the command line tool
from reading input/commands while the process is running (the input is
directed to the running process rather than to the command interpreter).
llvm-svn: 119329
we're using the stack pointer to define the CFA again. Makes unwinds
while sitting at the 'ret' instruction work, assuming we have accurate
function address bounds.
llvm-svn: 119327
expression logging.
Added some properties to the "objc" test. The expression parser can currently
display properties that are backed by the default functions "expr myStr.string"
will work. But it won't currently work when the property is backed by a
different function such as "expr myStr.date".
llvm-svn: 119103
can too. So now the lldb_private::Variable class has support for this.
Variables now have support for having a basename ("i"), and a mangled name
("_ZN12_GLOBAL__N_11iE"), and a demangled name ("(anonymous namespace)::i").
Nowwhen searching for a variable by name, users might enter the fully qualified
name, or just the basename. So new test functions were added to the Variable
and Mangled classes as:
bool NameMatches (const ConstString &name);
bool NameMatches (const RegularExpression ®ex);
I also modified "ClangExpressionDeclMap::FindVariableInScope" to also search
for global variables that are not in the current file scope by first starting
with the current module, then moving on to all modules.
Fixed an issue in the DWARF parser that could cause a varaible to get parsed
more than once. Now, once we have parsed a VariableSP for a DIE, we cache
the result even if a variable wasn't made so we don't do any re-parsing. Some
DW_TAG_variable DIEs don't have locations, or are missing vital info that
stops a debugger from being able to display anything for it, we parse a NULL
variable shared pointer for these DIEs so we don't keep trying to reparse it.
llvm-svn: 119085
types to their full definitions more than we needed to. This caused an assertion
in the DWARF parser to fire -- which is an indication that we are parsing too much.
llvm-svn: 119020
breakpoints on inlined functions by name. This involved fixing the DWARF parser
to correctly back up and parse the concrete function when we find inlined
functions by name, then grabbing any appropriate inlined blocks and returning
symbol contexts with the block filled in. After this was fixed, the breakpoint
by name resolver needed to correctly deal with symbol contexts that had the
inlined block filled in in the symbol contexts.
llvm-svn: 119017
a debug map with DWARF in the .o files due to the attemted shortcut that was
being taken where the global variables were being searched for by looking in
the symbol table. The problem with the symbols in the symbol table is we don't
break apart the symbol names for symbols when they are mangled into basename
and the fully mangled name since this would take a lot of CPU time to chop up
the mangled names and try and find the basenames. The DWARF info typically has
this broken up for us where the basename of the variable is in a the DW_AT_name
attribute, and the mangled name is in the DW_AT_MIPS_linkage_name attribute.
Now we correctly find globals by searching all OSO's for the information so we
can take advantage of this split information.
llvm-svn: 119012
expression. This currently takes waaaayyyyy too much time to evaluate. We will
need to look at the expression parser and find ways to optimize the info we
provide and get this to evaluate quicker. I believe the performance issue is
currently related to us always providing a complete C++ class type when asked
about a C++ class which can cause a lot of information to be pulled since all
classes will be fully created (methods, base classes, members, all their
types). We will need to give the classes back the parser and mark them as
having external sources and get parser (Sema) to query us when it needs more
info. This should bring things up to an acceptable level.
llvm-svn: 118979
cases when getting the clang type:
- need only a forward declaration
- need a clang type that can be used for layout (members and args/return types)
- need a full clang type
This allows us to partially parse the clang types and be as lazy as possible.
The first case is when we just need to declare a type and we will complete it
later. The forward declaration happens only for class/union/structs and enums.
The layout type allows us to resolve the full clang type _except_ if we have
any modifiers on a pointer or reference (both R and L value). In this case
when we are adding members or function args or return types, we only need to
know how the type will be laid out and we can defer completing the pointee
type until we later need it. The last type means we need a full definition for
the clang type.
Did some renaming of some enumerations to get rid of the old "DC" prefix (which
stands for DebugCore which is no longer around).
Modified the clang namespace support to be almost ready to be fed to the
expression parser. I made a new ClangNamespaceDecl class that can carry around
the AST and the namespace decl so we can copy it into the expression AST. I
modified the symbol vendor and symbol file plug-ins to use this new class.
llvm-svn: 118976
needs to use the current pc and current offset in two ways: To
determine which function we are currently executing, and the decide
how much of that function has executed so far. For the former use,
we need to back up the saved pc value by one byte if we're going to
use the correct function's unwind information -- we may be executing
a CALL instruction at the end of a function and the following instruction
belongs to a new function, or we may be looking at unwind information
which only covers the call instruction and not the subsequent instruction.
But when we're talking about deciding which row of an UnwindPlan to
execute, we want to use the actual byte offset in the function, not the
byte offset - 1.
Right now RegisterContextLLDB is tracking both the "real" offset and
an "offset minus one" and different parts of the class have to know
which one to use and they need to be updated/set in tandem. I want
to revisit this at some point.
The second change made in looking up eh_frame information; it was
formerly done by looking for the start address of the function we
are currently executing. But it is possible to have unwind information
for a function which only covers a small section of the function's
address range. In which case looking up by the start pc value may not
find the eh_frame FDE.
The hand-written _sigtramp() unwind info on Mac OS X, which covers
exactly one instruction in the middle of the function, happens to
trigger both of these issues.
I still need to get the UnwindPlan runner to handle arbitrary dwarf
expressions in the FDE but there's a good chance it will be easy to
reuse the DWARFExpression class to do this.
llvm-svn: 118882
logic that supported calling functions with arbitrary
arguments. We use ClangFunction for this, and the
low-level logic is only required to support one or two
pointer arguments.
llvm-svn: 118871
thread basic info state and not realize that a thread was already suspended
or if a thread was starting up and not ready to be displayed to the user
(in an uninterruptable state). If it is not user ready yet, we don't add it
to our list of threads that can be played with.
llvm-svn: 118866
namespaces by name given an optional symbol context. I might end up
dressing up the "clang::NamespaceDecl" into a lldb_private::Namespace
class if we need to do more than is currenlty required of namespaces.
Currently we only need to be able to lookup a namespace by name when
parsing expressions, so I kept it simple for now. The idea here is
even though we are passing around a "clang::NamespaceDecl *", that
we always have it be an opaque pointer (it is forward declared inside
of "lldb/Core/ClangForward.h") and we only use clang::NamespaceDecl
implementations inside of ClangASTContext, or ClangASTType when we need
to extract information from the namespace decl object.
llvm-svn: 118737
comes from by using a virtual function to provide it from the Module's
SymbolVendor by default. This allows the DWARF parser, when being used to
parse DWARF in .o files with a parent DWARF + debug map parser, to get its
type list from the DWARF + debug map parser so when we go and find full
definitions for types (that might come from other .o files), we can use the
type list from the debug map parser. Otherwise we ended up mixing clang types
from one .o file (say a const pointer to a forward declaration "class A") with
the a full type from another .o file. This causes expression parsing, when
copying the clang types from those parsed by the DWARF parser into the
expression AST, to fail -- for good reason. Now all types are created in the
same list.
Also added host support for crash description strings that can be set before
doing a piece of work. On MacOSX, this ties in with CrashReporter support
that allows a string to be dispalyed when the app crashes and allows
LLDB.framework to print a description string in the crash log. Right now this
is hookup up the the CommandInterpreter::HandleCommand() where each command
notes that it is about to be executed, so if we crash while trying to do this
command, we should be able to see the command that caused LLDB to exit. For
all other platforms, this is a nop.
llvm-svn: 118672
Fixed the DWARF plug-in such that when it gets all attributes for a DIE, that
it omits the DW_AT_sibling and DW_AT_declaration when getting attributes
from a DW_AT_abstract_origin or DW_AT_specification DIE.
llvm-svn: 118654
invoke the test driver to rerun the very same test. Example output:
/Volumes/data/lldb/svn/trunk/test $ tail 2010-11-09-14_51_34/ExpectedFailure-TestSettings.SettingsCommandTestCase.test_set_output_path.log
Traceback (most recent call last):
File "/Volumes/data/lldb/svn/trunk/test/settings/TestSettings.py", line 136, in test_set_output_path
"'stdout.txt' exists due to target.process.output-path.")
AssertionError: False is not True : 'stdout.txt' exists due to target.process.output-path.
To rerun this test, issue the following command from the 'test' directory:
./dotest.py -v -t -f SettingsCommandTestCase.test_set_output_path
llvm-svn: 118646
@unittest2.skip("rdar://problem/8641483 ./dotest.py -v -t -w forward seg faults")
and add a @skip decorator for test_with_dwarf_and_run_command() method:
@unittest2.skip("rdar://problem/8648070 'expression *bar_ptr' seg faults")
llvm-svn: 118632
to not get resolved.
Fixed the "void **isa_ptr" variable inside the objective C verifier to start
with a '$' character so we don't go looking for it in our program.
Moved the lookup for "$__lldb_class" into the part that knows we are looking
for internal types that start with a '$'.
llvm-svn: 118488
I only did a tiny bit of testing; in the one case I tried changing the
contents of a radar in the middle of a stack and it was still current in
the live register context so it filtered down to frame 0 and was handed
over to the live register set RegisterContext. I need to test a case
where a register is saved on the stack in memory before I check this
one off.
llvm-svn: 118486
the frame count is requested or each frame is individually requested.
In practice this doesn't seem to help anything because we have
functions like StackFrameList::GetNumFrames() which is going to
request each frame anyway. And classes like ThreadPlanStepRange
and ThreadPlanStepOverRange get the stack depth in their ctor forcing
a full stack walk. But at least UnwindLLDB will delay doing a full
walk if it can.
llvm-svn: 118477
FuncUnwinders object if the eh_frame section was missing
from an objfile. Worked fine on x86_64 but on i386 where
eh_frame is unusual, that resulted in the arch default
UnwindPlan being used all the time instead of picking up
an assembly profile based unwindplan.
llvm-svn: 118467
failed/errored tests at the start of the test run, in case the test run crashes
for any reason. That way, it is easy to locate the session logs for accumulated
failures/errors.
llvm-svn: 118427
a pseudo terminal even when the process being attached to.
Fixed a possible crasher in the in:
bool
ClangASTContext::IsAggregateType (clang_type_t clang_type);
It seems that if you pass in a record decl, enum decl, or objc class decl
and ask it if it is an aggregate type, clang will crash.
llvm-svn: 118404
when a function starts and ends, and also the
disassembly for anything that is a client of
ClangExpressionParser after it has been JIT
compiled.
llvm-svn: 118401
the same architecture as a default program, the attach architecture auto
detection would change the architecture to the architecture of the darwin-debug
(which was always x86_64) and hose up your debug session.
llvm-svn: 118399
we want to run just the instance of testclass-testmethod combination and nothing else.
Specifying '-g' now will admit the whole .py test module if it does not contain a matching
testclass-testmethod combination at all.
This option arrangement adheres to the RISC principle of making the common cases fast. :-)
rdar://problem/8584914 Can the default for dotest.py's "-g" flag be switched?
llvm-svn: 118392
every external variable reference in the module,
and returning a clean error (instead of letting
LLVM issue a fatal error) if the variable could
not be resolved.
llvm-svn: 118388
and "/private/tmp/a.c". This was done by adding a "mutable bool m_is_resolved;"
member to FileSpec and then modifying the equal operator to check if the
filenames are equal, and if they are, then check the directories. If they are
not equal, then both paths are checked to see if they have been resolved. If
they have been resolved, we resolve the paths in temporary FileSpec objects
and set each of the m_is_resolved bools to try (for lhs and rhs) if the paths
match what is contained in the path. This allows us to do more intelligent
compares without having to resolve all paths found in the debug info (which
can quickly get costly if the files are on remote NFS mounts).
llvm-svn: 118387
where the DWARF is in the .o files so they can track down the actual type for
a forward declaration. This was working before for just DWARF files, but not
for DWARF in .o files where the actual definition was in another .o file.
Modified the main thread name in the driver to be more consistent with the
other LLDB thread names.
llvm-svn: 118383
don't crash if we disable logging when some code already has a copy of the
logger. Prior to this fix, logs were handed out as pointers and if they were
held onto while a log got disabled, then it could cause a crash. Now all logs
are handed out as shared pointers so this problem shouldn't happen anymore.
We are also using our new shared pointers that put the shared pointer count
and the object into the same allocation for a tad better performance.
llvm-svn: 118319
lldb_private::SharingPtr<A> p = llvm::make_shared<A>(i, j);
Currently up to five constructor arguments are supported and each must be an LValue.
llvm-svn: 118317
identification of the test failures/errors by human beings as well as automatic
processings.
The prefix which identifies the type can be: Error, Failure, or ExpectedFailure.
llvm-svn: 118315
pseudoterminal to pass to the inferior for the inferior's I/O
(to allow direct writing, rather than passing all the I/O around
via packets).
llvm-svn: 118308