Commit Graph

661 Commits

Author SHA1 Message Date
Jason Molenda cabd1b71c7 I'm not thrilled with how I structured this but RegisterContextLLDB
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
2010-11-12 05:23:10 +00:00
Sean Callanan 8c9e538384 Added a thread plan tracer that prints lines of
assembly as well as registers that changed.

llvm-svn: 118879
2010-11-12 03:22:21 +00:00
Sean Callanan c126acc1a9 Temporary extension of the timeout for Objective-C
object diagnostic expressions while we work on the
logic for handling the timeout.

llvm-svn: 118873
2010-11-12 01:49:03 +00:00
Sean Callanan 6f86aa630f Removed redundant code for object introspection.
llvm-svn: 118872
2010-11-12 01:41:35 +00:00
Sean Callanan 36695cdecd Excised a version of the low-level function calling
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
2010-11-12 01:37:02 +00:00
Greg Clayton c3b849970d Fixed an issue with Function::GetPrologueByteSize() where if a function's first line table entry didn't have the same address as the start address of the function itself, we could end up returning and incorrect value.
llvm-svn: 118830
2010-11-11 20:13:30 +00:00
Jim Ingham 06e827cc43 Add ThreadPlanTracer class to allow instruction step tracing of execution.
Also changed eSetVarTypeBool to eSetVarTypeBoolean to make it consistent with eArgTypeBoolean.

llvm-svn: 118824
2010-11-11 19:26:09 +00:00
Greg Clayton a63012e9bf Fixed an issue where we might not be able to track down a real definition of
a forward declaration to a struct and hangle it gracefully (don't crash
trying to ask clang how many children an empty record has).

llvm-svn: 118770
2010-11-11 02:14:53 +00:00
Greg Clayton 62742b1402 Disable the debug logging I accidentally left enabled.
llvm-svn: 118758
2010-11-11 01:09:45 +00:00
Greg Clayton 96d7d7453c Added initial support to the lldb_private::SymbolFile for finding
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
2010-11-10 23:42:09 +00:00
Benjamin Kramer 2c88643a22 Silence a bunch of clang warnings.
llvm-svn: 118710
2010-11-10 20:16:47 +00:00
Greg Clayton cf7e9a0485 Don't keep appending to the current crash description with each formatted crash description call.
llvm-svn: 118703
2010-11-10 19:43:40 +00:00
Caroline Tice 5c2816d903 Move the embedded Python interpreter onto a separate thread, to prevent
main thread from having to wait on it (which was causing some I/O 
hangs).

llvm-svn: 118700
2010-11-10 19:18:14 +00:00
Johnny Chen fec456da47 Trivial fix for an error message.
llvm-svn: 118697
2010-11-10 19:02:11 +00:00
Jim Ingham 08feef8861 Remove an obsolete reference to immediate plans.
llvm-svn: 118691
2010-11-10 18:17:03 +00:00
Greg Clayton 2d95dc9b22 Modified lldb_private::SymboleFile to be able to override where its TypeList
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
2010-11-10 04:57:04 +00:00
Sean Callanan b1620224e6 Fixed a bug where the LLVM disassembler was
ignoring the show_address parameter.

llvm-svn: 118666
2010-11-10 01:38:28 +00:00
Greg Clayton 7a34528d68 Did a lot of code cleanup.
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
2010-11-09 23:46:37 +00:00
Sean Callanan 0617fcb1f1 Added a named container for the source QualType
in the type copy routine to make type problems
easier to debug.

llvm-svn: 118638
2010-11-09 22:37:10 +00:00
Greg Clayton c615ce4964 Fixed an issue in the DWARF parser that was causing forward declarations
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
2010-11-09 04:42:43 +00:00
Jason Molenda b4f65501fc Implement RegisterContext::WriteRegisterBytes in RegisterContextLLDB.
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
2010-11-09 04:31:16 +00:00
Jason Molenda 8fed295cee Refactor UnwindLLDB so it doesn't populate the entire stack unless
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
2010-11-09 02:31:21 +00:00
Jason Molenda 45b4924550 Fix thinko in UnwindTable.cpp where it wouldn't provde a
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
2010-11-09 01:21:22 +00:00
Johnny Chen 99adaf4cc1 Minor comment fix.
llvm-svn: 118450
2010-11-08 22:08:21 +00:00
Greg Clayton a78ff2ef32 Cleaned up the pseudo terminal code in ProcessGDBRemote as it was spawning
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
2010-11-08 04:29:11 +00:00
Sean Callanan ece9649264 Added more logging so we see the register state
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
2010-11-08 03:49:50 +00:00
Greg Clayton 21184644af Fixed an issue where if you try and run something in a TTY that isn't
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
2010-11-08 03:06:10 +00:00
Greg Clayton 40328bf5f3 Fixed some type parsing that was causing types to thing they were forward
declarations when they should have been.

llvm-svn: 118393
2010-11-08 02:05:08 +00:00
Sean Callanan a4e55178bc Made variable resolution more robust by handling
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
2010-11-08 00:31:32 +00:00
Greg Clayton 7481c20f09 Fixed FileSpec's operator == to deal with equivalent paths such as "/tmp/a.c"
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
2010-11-08 00:28:40 +00:00
Greg Clayton 2ccf8cfc4b Modified the DWARF parser for both the single DWARF file and for the case
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
2010-11-07 21:02:03 +00:00
Greg Clayton 2d4edfbc6a Modified all logging calls to hand out shared pointers to make sure we
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
2010-11-06 01:53:30 +00:00
Sean Callanan c70f8ff417 Fixed a bug where variables in the source operands
of store statements were not being marked for
resolution.

llvm-svn: 118316
2010-11-06 00:09:34 +00:00
Greg Clayton efabb123af Added copy constructors and assignment operators to all lldb::SB* classes
so we don't end up with weak exports with some compilers.

llvm-svn: 118312
2010-11-05 23:17:00 +00:00
Caroline Tice 5e254d37a6 If debugserver is running on the local machine, pass it a
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
2010-11-05 22:37:44 +00:00
Johnny Chen 76c381b6f5 Fix the infinite recursion crash reported by Antoine Missout:
rdar://problem/8557095 lldb disas crashed (from lldb developer)

llvm-svn: 118299
2010-11-05 21:43:19 +00:00
Jim Ingham 399f1cafa6 Added the equivalent of gdb's "unwind-on-signal" to the expression command, and a parameter to control it in ClangUserExpression, and on down to ClangFunction.
llvm-svn: 118290
2010-11-05 19:25:48 +00:00
Jim Ingham d403f26bbe Don't need both LIBLLDB_LOG_DYNAMIC_LOADER and LIBLLDB_LOG_SHLIB. Go with the former.
llvm-svn: 118283
2010-11-05 17:59:33 +00:00
Jim Ingham 3cbb931504 Don't need both LIBLLDB_LOG_DYNAMIC_LOADER and LIBLLDB_LOG_SHLIB. Go with the former.
llvm-svn: 118282
2010-11-05 17:59:19 +00:00
Sean Callanan 2a39652303 Fixed error handling when the utility functions
that check pointer validity fail to parse.  Now
lldb does not crash in that case.  Also added
support for checking Objective-C class validity
in the Version 1 runtime as well as Version 2
runtimes with varying levels of available debug
support.

llvm-svn: 118271
2010-11-05 00:57:06 +00:00
Jim Ingham 5822173bc8 Handle stepping through ObjC vtable trampoline code.
llvm-svn: 118270
2010-11-05 00:18:21 +00:00
Jim Ingham f7f4f50113 Added a setting to "log timer" so you can see the incremental timings as well:
log timer increment true/false

llvm-svn: 118268
2010-11-04 23:19:21 +00:00
Jim Ingham 302448352c Added a top level Timer to the interpreter execute command. Also added an option to pass the depth to "log timer enable". That allows you to time just command execution with:
log timer enable 1
<command>
log timer dump

llvm-svn: 118267
2010-11-04 23:08:45 +00:00
Jim Ingham 932725fa11 Added a top level Timer to the interpreter execute command. Also added an option to pass the depth to "log timer enable". That allows you to time just command execution with:
log timer enable 1
<command>
log timer dump

llvm-svn: 118266
2010-11-04 23:08:26 +00:00
Jason Molenda 744aa8a14d Use the new native unwinder by default.
llvm-svn: 118264
2010-11-04 22:29:24 +00:00
Jim Ingham 2a5e0f03fb Add a ObjC V1 runtime, and a generic AppleObjCRuntime plugin.
Also move the Checker creation into the Apple Runtime code.

llvm-svn: 118255
2010-11-04 18:30:59 +00:00
Jason Molenda 504d3f51ff Revert last checkin to DisassemblerLLVM.cpp; that was some temporary
debug printfs that got left behind by accident.

llvm-svn: 118244
2010-11-04 09:53:38 +00:00
Jason Molenda c311c23402 Add #ifdef to easily switch between the current libunwind-remote based unwinder
or the native unwinder (UnwindLLDB).  I'll make the native unwinder the default
once I check in with everyone tomorrow.

llvm-svn: 118243
2010-11-04 09:51:29 +00:00
Jason Molenda 311eb2deec Revert last checking to ThreadGDBRemote.cpp; I accidentally checked
that in along with some cleanup work with the native unwinder code.

llvm-svn: 118242
2010-11-04 09:46:43 +00:00
Jason Molenda dae97b4a29 Revert last checking to CommandObjectDisassemble.cpp; that was
some diagnostic test code I was using while debugging the 
native unwinder and didn't mean to check in.

llvm-svn: 118241
2010-11-04 09:43:27 +00:00