Commit Graph

719 Commits

Author SHA1 Message Date
Greg Clayton ab843393f2 Fixed an issue that would cause an assertion to fire when an inlined function was found during a regex function find call.
llvm-svn: 120814
2010-12-03 17:49:14 +00:00
Greg Clayton e521966054 Fixed a race condition that could cause ProcessGDBRemote::DoResume() to return
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
2010-12-03 06:02:24 +00:00
Sean Callanan 4a5fcbb92b Removed a compiler warning.
llvm-svn: 120788
2010-12-03 03:02:31 +00:00
Sean Callanan 979f74d1dd Fixed object lifetimes in ClangExpressionDeclMap
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
2010-12-03 01:38:59 +00:00
Greg Clayton 621801846e Fixed DoResume to watch for the correct return value from WaitForIsRunning to avoid spurious errors due to previous fix.
llvm-svn: 120762
2010-12-03 00:27:48 +00:00
Greg Clayton a975990111 Fixed bad logic that was trying to determine if the gdb remote resumed a process or not.
llvm-svn: 120761
2010-12-03 00:19:58 +00:00
Greg Clayton 38a614034a Updated to latest LLVM/Clang for external AST source changes that allow
TagDecl subclasses and Objective C interfaces to complete themselves through
the ExternalASTSource class.

llvm-svn: 120749
2010-12-02 23:20:03 +00:00
Johnny Chen c4221e47b0 Fixed a typo in comment.
llvm-svn: 120733
2010-12-02 20:53:05 +00:00
Sean Callanan d7a1ca2a12 Fixed IRForTarget so that it errors out when function
pointers are used.  Previously, they caused a crash
in the JIT because we didn't resolve them correctly.

llvm-svn: 120728
2010-12-02 19:47:57 +00:00
Caroline Tice 82305fc59a Add proper EOF handling to Communication & Connection classes:
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
2010-12-02 18:31:56 +00:00
Sean Callanan 3670ba5c87 Fixed ClangUserExpression's wrapping of expressions
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
2010-12-01 21:35:54 +00:00
Sean Callanan 83b0918938 Allowed ClangExpressionDeclMap to dematerialize
persistent variables even after the parser has
finished running.

llvm-svn: 120521
2010-12-01 01:29:06 +00:00
Sean Callanan 1d47cafc1c Whitespace fix.
llvm-svn: 120520
2010-12-01 01:28:23 +00:00
Johnny Chen ce81496fab Make CommandObjectMultiword::GetSubcommandSP() more robust by appending the
exactly-matched sub_cmd to the passed in 'matches' string list.

llvm-svn: 120516
2010-12-01 01:04:22 +00:00
Jim Ingham 97253e62e9 GetCommandObject returns no matches in the match array when there is only one match. That's odd, but I don't want to change that right now, just cope with it where I'm doing the command matching.
llvm-svn: 120511
2010-12-01 00:42:17 +00:00
Jim Ingham 271ad29a4e Fix completion for multi-word commands in the "help" command.
llvm-svn: 120484
2010-11-30 22:59:37 +00:00
Sean Callanan f5a998643c Fixed a problem where m_register_info was not being
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
2010-11-30 22:01:58 +00:00
Jim Ingham f48169bb4f Moved the code in ClangUserExpression that set up & ran the thread plan with timeouts, and restarting with all threads into a utility function in Process. This required a bunch of renaming.
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
2010-11-30 02:22:11 +00:00
Sean Callanan 348b5897f9 Added a feature where registers can be referred to
using special $-variables from expressions.

(lldb) expr $rip

These variables are available for reading and
writing.

llvm-svn: 120367
2010-11-30 00:27:43 +00:00
Jason Molenda c1903406e5 Fix build error when lldb is being built i386.
llvm-svn: 120322
2010-11-29 21:38:58 +00:00
Greg Clayton facfd06c4f When we resolve a forward declaration type, be sure to put it into the m_die_to_type map so we don't assert later when someone tries to resolve the type.
llvm-svn: 119910
2010-11-20 19:16:50 +00:00
Sean Callanan fbfd7ba547 Removed a stray dump() that made it into top-of-tree.
llvm-svn: 119890
2010-11-20 02:23:49 +00:00
Sean Callanan a3aa0cf6e6 Made GetVariableValue() more robust in the face
of failures in the AST importer.  Also ensured
that a variable will not be blindly added if
GetVariableValue() returns an error.

llvm-svn: 119889
2010-11-20 02:19:29 +00:00
Sean Callanan 80eee3a989 Removed a stray dump().
llvm-svn: 119888
2010-11-20 02:06:01 +00:00
Jason Molenda 2d107dd02b Change the DWARFExpression::Evaluate methods to take an optional
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
2010-11-20 01:28:30 +00:00
Greg Clayton cd55b1957e Revert the End of file stuff that was added as it was causing read threads
to hang around and take a ton of CPU time. Caroline will fix this when she
gets back from vacation.

llvm-svn: 119877
2010-11-20 00:17:57 +00:00
Greg Clayton a651b537d6 Updated to latest and greatest clang for a "print cvr-qualifiers on function
declarations" fix.

llvm-svn: 119847
2010-11-19 21:46:54 +00:00
Caroline Tice efed613172 Add the ability to catch and do the right thing with Interrupts (often control-c)
and end-of-file (often control-d).

llvm-svn: 119837
2010-11-19 20:47:54 +00:00
Sean Callanan 6abfabff61 Modifications to type handling logic. We no longer
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
2010-11-19 20:20:02 +00:00
Johnny Chen beae523a20 Fill in more test sequences for Python API SBFrame.LookupVarInScope(name, scope).
Change SBFrame::LookupVarInScope() to also work with "global" scope in addition
to "local" and "parameter" scope.

llvm-svn: 119811
2010-11-19 18:07:14 +00:00
Greg Clayton 35f1a0d58d Print out addresses with the correct width for 32 bit programs.
llvm-svn: 119786
2010-11-19 04:16:11 +00:00
Greg Clayton dbe5450898 Fixed an issue where the UserSettingsControllers were being created out of
order and this was causing the target, process and thread trees to not be
available.

llvm-svn: 119784
2010-11-19 03:46:01 +00:00
Sean Callanan f7c3e27f62 Added support for indicating to the expression parser
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
2010-11-19 02:52:21 +00:00
Greg Clayton 1b95a6ff95 Added some logging back and cleaned up the code to match LLDB's coding
conventions.

llvm-svn: 119771
2010-11-19 01:05:25 +00:00
Greg Clayton 99d0faf27e Cleaned up code that wasn't using the Initialize and Terminate paradigm by
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
2010-11-18 23:32:35 +00:00
Sean Callanan 7a55a32108 Fixed the logic in IRForTarget that recognizes
externally-defined variables to match up with
the code in ClangASTSource that produces them.

llvm-svn: 119750
2010-11-18 22:21:58 +00:00
Greg Clayton 4e78f60660 Added the ability to get more information on the SBThread's stop reason
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
2010-11-18 18:52:36 +00:00
Greg Clayton 3af9ea56d3 Fixed Process::Halt() as it was broken for "process halt" after recent changes
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
2010-11-18 05:57:03 +00:00
Sean Callanan 79439e86d1 Updated to the LLVM/Clang of 2010-11-17 at 3:30pm.
llvm-svn: 119677
2010-11-18 02:56:27 +00:00
Jim Ingham 773d981ce2 The thread plan destructors may call Thread virtual methods. That means they have to get cleaned up in the derived class's destructor. Make sure that happens.
llvm-svn: 119675
2010-11-18 02:47:07 +00:00
Sean Callanan afe16a71f7 Added support for constant strings of the form @"this-is-a-string".
They are replaced with calls to the CoreFoundation function 
CFStringCreateWithBytes() by a portion of the IRForTarget pass.

llvm-svn: 119582
2010-11-17 23:00:36 +00:00
Sean Callanan ac6429fc9a Whitespace fix.
llvm-svn: 119581
2010-11-17 23:00:07 +00:00
Jim Ingham 978e071f16 Add a missing newline to the ThreadPlanAssemblyTracer output.
llvm-svn: 119553
2010-11-17 20:40:29 +00:00
Jim Ingham a80ef35902 Add a ThreadPlanAssemblyTracer that takes just a thread (since that's how we call it from ThreadPlanBase...)
llvm-svn: 119549
2010-11-17 20:19:50 +00:00
Jim Ingham 0d8bcc79f4 Added an "Interrupted" bit to the ProcessEventData. Halt now generates an event
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
2010-11-17 02:32:00 +00:00
Greg Clayton 47fbf1aecb Use different qualifier enums on the request of a clang engineer.
llvm-svn: 119396
2010-11-16 22:09:25 +00:00
Caroline Tice ef5c6d02f5 Make processes use InputReaders for their input. Move the process
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
2010-11-16 05:07:41 +00:00
Jason Molenda 5920333be1 Add an UnwindPlan Row for the last instruction of a function when
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
2010-11-16 03:01:20 +00:00
Greg Clayton 7fedea2c6f First attempt and getting "const" C++ method function signatures correct.
It currently isn't working, but it should be close. I will work on this more
when I figure out what I am not doing correctly.

llvm-svn: 119324
2010-11-16 02:10:54 +00:00
Greg Clayton cb7e3b3505 Added quotes around names that are being lookup up or inspected in the
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
2010-11-15 01:47:11 +00:00