Commit Graph

615 Commits

Author SHA1 Message Date
Jason Molenda a332978b2a lldb arm64 import.
These changes were written by Greg Clayton, Jim Ingham, Jason Molenda.

It builds cleanly against TOT llvm with xcodebuild.  I updated the
cmake files by visual inspection but did not try a build.  I haven't
built these sources on any non-Mac platforms - I don't think this
patch adds any code that requires darwin, but please let me know if
I missed something.

In debugserver, MachProcess.cpp and MachTask.cpp were renamed to
MachProcess.mm and MachTask.mm as they picked up some new Objective-C
code needed to launch processes when running on iOS.

llvm-svn: 205113
2014-03-29 18:54:20 +00:00
Greg Clayton 23f8c95a44 JITed functions can now have debug info and be debugged with debug and source info:
(lldb) b puts
(lldb) expr -g -i0 -- (int)puts("hello")

First we will stop at the entry point of the expression before it runs, then we can step over a few times and hit the breakpoint in "puts", then we can continue and finishing stepping and fininsh the expression.

Main features:
- New ObjectFileJIT class that can be easily created for JIT functions
- debug info can now be enabled when parsing expressions
- source for any function that is run throught the JIT is now saved in LLDB process specific temp directory and cleaned up on exit
- "expr -g --" allows you to single step through your expression function with source code

<rdar://problem/16382881>

llvm-svn: 204682
2014-03-24 23:10:19 +00:00
Saleem Abdulrasool a68f7b67f1 cleanup unreferenced functions
This is a mechanical cleanup of unused functions.  In the case where the
functions are referenced (in comment form), I've simply commented out the
functions.  A second pass to clean that up is warranted.

The functions which are otherwise unused have been removed.  Some of these were
introduced in the initial commit and not in use prior to that point!

NFC

llvm-svn: 204310
2014-03-20 06:08:36 +00:00
Greg Clayton 6fea17e874 "size_t" isn't always 64 bit, it is 32 bit on 32 bit systems. All printf style statements that were assuming size_t were 64 bit were changed, and they were also changed to display them as unsigned values as "size_t" isn't signed.
If you print anything with 'size_t', please cast it to "uint64_t" in the printf and use PRIu64 or PRIx64.

llvm-svn: 202738
2014-03-03 19:15:20 +00:00
Deepak Panickal 99fbc07600 Fix Windows build using portable types for formatting the log outputs
llvm-svn: 202723
2014-03-03 15:39:47 +00:00
Todd Fiala 955fe6f6ed Fix build break due to signature change on ASTContext' setExternalSource parameter.
This change converts points to clang::ExternalASTSource from llvm::OwningPtr<> to
llvm::IntrusiveRefCntPtr<>.

llvm-svn: 202411
2014-02-27 17:18:23 +00:00
Enrico Granata 8a2a0dfba5 Restore the ability of SBFrame::FindValue() to look for file global variables
This should clean up the new test failures caused by r201614

llvm-svn: 201710
2014-02-19 19:35:13 +00:00
Enrico Granata 08a04327a9 <rdar://problem/15960553>
Fix a bug where calling SBFrame::FindValue() would cause a copy of all variables in the block to be inserted in the frame's variable list, regardless of whether those same variables were there or not - which means one could end up with a frame with lots of duplicate copies of the same variables

llvm-svn: 201614
2014-02-18 23:48:11 +00:00
Sean Callanan 11e32d3db4 Properly report when a struct is anonymous.
<rdar://problem/16071066>

llvm-svn: 201539
2014-02-18 00:31:38 +00:00
Jean-Daniel Dupas 36b5eea258 Fix UnwindAssembly memory leak by defining and using a shared UnwindAssemblySP type.
llvm-svn: 200725
2014-02-03 23:49:47 +00:00
Greg Clayton 44d937820b Merging the iohandler branch back into main.
The many many benefits include:
1 - Input/Output/Error streams are now handled as real streams not a push style input
2 - auto completion in python embedded interpreter
3 - multi-line input for "script" and "expression" commands now allow you to edit previous/next lines using up and down arrow keys and this makes multi-line input actually a viable thing to use
4 - it is now possible to use curses to drive LLDB (please try the "gui" command)

We will need to deal with and fix any buildbot failures and tests and arise now that input/output and error are correctly hooked up in all cases.

llvm-svn: 200263
2014-01-27 23:43:24 +00:00
Alp Toker 6a6ff05b57 Track clang changes from r200082
llvm-svn: 200085
2014-01-25 16:57:13 +00:00
Greg Clayton 1f4db7da8f Added the ability to get the type that a typedef points to via:
SBType SBType::GetTypedefedType();

Also added the ability to get a type by type ID from a SBModule:

SBType SBModule::GetTypeByID (lldb::user_id_t uid);

llvm-svn: 199939
2014-01-23 21:38:34 +00:00
Alp Toker f747ff1f54 Build fix following clang r199686
llvm-svn: 199689
2014-01-20 21:14:57 +00:00
Sean Callanan 79fde96b6a Fixed some API drift by making "used" attributes
in a better way.

llvm-svn: 199408
2014-01-16 18:47:07 +00:00
Jason Molenda 25f3961caf Roll back r198729; it seems to be causing two testsuite failures if llvm is built with asserts -
210: test_with_dsym_and_run_command (Test-rdar-10642615.Radar10642615DataFormatterTestCase)
     Test data formatter commands. ... Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/include/llvm/Support/Casting.h, line 239.

     226: test_with_dsym_and_run_command (Test-rdar-13338477.Radar13338477DataFormatterTestCase)
         Test that LLDB handles the clang typeclass Paren correctly. ... Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/include/llvm/Support/Casting.h, line 239.

llvm-svn: 198811
2014-01-09 00:02:17 +00:00
Jason Molenda 491caa14d5 Roll back my change to r198729; I'm going to revert it entirely.
llvm-svn: 198810
2014-01-09 00:00:53 +00:00
Jason Molenda 5005de4bac Revert the vector part of Enrico's change in r198729;
it is causing an llvm assert when run against
test/functionalities/data-formatter/rdar-10642615,

Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/include/llvm/Support/Casting.h, line 239.

llvm-svn: 198809
2014-01-08 23:35:54 +00:00
Enrico Granata af76481caf <rdar://problem/15453076>
When determining the type of array members, do not see-through typedefs
For instance, in BOOL arr[4], we want the elements to be typed as BOOL, not signed char

llvm-svn: 198729
2014-01-08 03:02:33 +00:00
Todd Fiala fb10118bfa Fix lldb build break due to TypedefNameDecl member signature change.
Patch by Steve Pucci.

llvm-svn: 198635
2014-01-06 20:25:42 +00:00
Enrico Granata 16f35ea9bb <rdar://problem/14822563> - Do not attempt to use a null VariableList or crashes will ensue
llvm-svn: 197862
2013-12-21 08:44:28 +00:00
Jason Molenda 135e55f8f3 Fix log message for new invalidation checks in PlanValidAtAddress().
Thanks to Ed and Greg for catching the incorrect logging statements.

llvm-svn: 196322
2013-12-03 21:59:39 +00:00
Jason Molenda 61cd0729bb Build up UnwindPlan::PlanValidAtAddress to recognize some general
indications that the UnwindPlan is invalid -- for instance, a
complete lack of rows, or a row that fails to define a register to
base the CFA off of.
<rdar://problem/15246247> 

llvm-svn: 196201
2013-12-03 04:46:27 +00:00
Jason Molenda b57e4a1bc6 Roll back the changes I made in r193907 which created a new Frame
pure virtual base class and made StackFrame a subclass of that.  As
I started to build on top of that arrangement today, I found that it
wasn't working out like I intended.  Instead I'll try sticking with
the single StackFrame class -- there's too much code duplication to
make a more complicated class hierarchy sensible I think.

llvm-svn: 193983
2013-11-04 09:33:30 +00:00
Jason Molenda f23bf7432c Add a new base class, Frame. It is a pure virtual function which
defines a protocol that all subclasses will implement.  StackFrame
is currently the only subclass and the methods that Frame vends are
nearly identical to StackFrame's old methods.

Update all callers to use Frame*/Frame& instead of pointers to
StackFrames.

This is almost entirely a mechanical change that touches a lot of
the code base so I'm committing it alone.  No new functionality is
added with this patch, no new subclasses of Frame exist yet.

I'll probably need to tweak some of the separation, possibly moving
some of StackFrame's methods up in to Frame, but this is a good
starting point.

<rdar://problem/15314068>

llvm-svn: 193907
2013-11-02 02:23:02 +00:00
Sylvestre Ledru 779f921311 Fix the format warnings.
In almost all cases, the misuse is about "%lu" being used instead of the correct "%zu" (even though these are compatible on 64-bit platforms in practice). There are even a couple of cases where "%ld" (ie., signed int) is used instead of "%zu", and one where "%lu" is used instead of "%" PRIu64.

Fixes bug #17551.

Patch by "/dev/humancontroller"

llvm-svn: 193832
2013-10-31 23:55:19 +00:00
Enrico Granata fcf0c4e31a Further fixes to the dynamic type system prompted by ObjCDataFormatterTestCase.test_nserror_with_dsym_and_run_command
llvm-svn: 193818
2013-10-31 22:42:00 +00:00
Enrico Granata df7c7f99ba Fixing an issue in yesterday's dynamic type changes where we would not craft a valid SBType given debug information
Added a test case to help us detect regression in this realm

llvm-svn: 193631
2013-10-29 17:42:02 +00:00
Enrico Granata dc4db5a6eb <rdar://problem/15144376>
This commit reimplements the TypeImpl class (the class that backs SBType) in terms of a static,dynamic type pair

This is useful for those cases when the dynamic type of an ObjC variable can only be obtained in terms of an "hollow" type with no ivars
In that case, we could either go with the static type (+iVar information) or with the dynamic type (+inheritance chain)

With the new TypeImpl implementation, we try to combine these two sources of information in order to extract as much information as possible
This should improve the functionality of tools that are using the SBType API to do extensive dynamic type inspection

llvm-svn: 193564
2013-10-29 00:28:35 +00:00
Greg Clayton 9191db47da <rdar://problem/14496092>
Fixed an issue with reexported symbols on MacOSX by adding support for symbols re-exporting symbols. There is now a new symbol type eSymbolTypeReExported which contains a new name for the re-exported symbol and the new shared library. These symbols are only used when a symbol is re-exported as a symbol under a different name.

Modified the expression parser to be able to deal with finding the re-exported symbols and track down the actual symbol it refers to.

llvm-svn: 193101
2013-10-21 18:40:51 +00:00
Jim Ingham be40554915 ValueObject and SBValue's GetChildMemberWithName should look through anonymous structs
and unions the same way that C would.

<rdar://problem/11987906>

llvm-svn: 193016
2013-10-18 23:53:55 +00:00
Michael Sartain 762df1f139 Merge RegisterContextPOSIX_x86_64 and RegisterContextPOSIX_i386 into RegisterContextPOSIX_x86
llvm-svn: 192332
2013-10-10 00:16:10 +00:00
Sean Callanan 931a0def9e Implemented the reverse-lookup API in the AST
importer to avoid duplicate imports of anonymous
structs.

<rdar://problem/14421722>

llvm-svn: 192327
2013-10-09 22:33:34 +00:00
Ed Maste b0e33d4165 Fix endianness in ObjectFile::CopyData
ObjectFile::CopyData is used to copy a block of target memory to the
caller's buffer (e.g. for "memory read").  This should be a straight
memcpy, and not byte-swapped if the target and host have different
endianness.

Add a new DataExtractor::CopyData() method that performs this straight
copy and use it in ObjectFile::CopyData().

llvm-svn: 192323
2013-10-09 20:34:25 +00:00
Jason Molenda a3a542ff21 Handle the case where completing variables in a frame
with no source-level debug information correctly.
<rdar://problem/15182936> 

llvm-svn: 192268
2013-10-09 02:39:26 +00:00
Enrico Granata 99c8f7ae79 <rdar://problem/15180638>
Making GetNumberOfDirectBaseClasses() work for ObjC pointers, and for classes for which we don't have full debug info

llvm-svn: 192255
2013-10-09 00:13:17 +00:00
Sean Callanan ddd7a2a65b Changed the bool conversion operator on ConstString
to be explicit, to prevent horrid things like

std::string a = ConstString("foo")

from taking the path ConstString -> bool -> char
-> std::string.

This fixes, among other things, ClangFunction.

<rdar://problem/15137989>

llvm-svn: 191934
2013-10-03 22:27:29 +00:00
Jim Ingham fb6fc0dd90 Convert ClangASTType::GetTypeName over to return a ConstString to be consistent with
the other "Get*TypeName" functions.

llvm-svn: 191556
2013-09-27 20:59:37 +00:00
Jim Ingham 6dafc4203d If you erase while iterating, remember to update the iterator. Bug found by Carlo Kok.
llvm-svn: 191555
2013-09-27 20:58:17 +00:00
Jim Ingham 2b89a53181 DWARF says line number 0 is a valid line number - used to indicate a source line that should
not have breakpoints set on it inserted into code that does have a valid line number.  So allow
that line number, and the ThreadPlanStepRange should just continue stepping over 0 line ranges
as if they had the same line number as whatever we were previously stepping through.

llvm-svn: 191477
2013-09-27 01:15:46 +00:00
Joerg Sonnenberger 340a17595e Convert to UNIX line endings.
llvm-svn: 191367
2013-09-25 10:37:32 +00:00
Jason Molenda 2cd21b87cd Update RegisterContextLLDB::GetFullUnwindPlanForFrame() to use the architectural-
default-at-first-instruction UnwindPlan if we're at the beginning of a function and
the ABI can provide us with an UnwindPlan to get out of there before falling back
to the generic architectural default UnwindPlan (which usually assumes that the stack
has already been set up.)

Update the FuncUnwinders methods to gracefully handle the case where an assembly
profiler may not be available.

Fix a bug where FuncUnwinders::GetUnwindPlanArchitectureDefaultAtFunctionEntry was
returning the wrong UnwindPlan to its caller.

llvm-svn: 191262
2013-09-24 02:42:54 +00:00
Richard Mitton f70d60404d Fixed a bug where CFI data would become corrupted when using remember/restore state instructions.
This would prevent system calls on Linux from being able to backtrace correctly.

llvm-svn: 190642
2013-09-12 23:38:30 +00:00
Virgile Bello 8452cb5486 Fix DWARF for 0-length CIE (data after the length should not be read if length is 0).
llvm-svn: 189191
2013-08-25 13:24:48 +00:00
Virgile Bello b2f1fb2943 MingW compilation (windows). Includes various refactoring to improve portability.
llvm-svn: 189107
2013-08-23 12:44:05 +00:00
Michael Sartain 093bf45f9c A clang::Type::Decayed type to kill compile warning
llvm-svn: 189061
2013-08-22 20:50:18 +00:00
Sean Callanan a424181eec Fixed a problem where "image lookup -t" was printing
a bunch of semicolons where the IndirectFieldDecls
were.  These IndirectFieldDecls should have been
implicit.

<rdar://problem/14628784>

llvm-svn: 188247
2013-08-13 01:42:34 +00:00
Ashok Thirumurthi 6e264d39dc Adds a DW_OP_call_frame_cfa handler when evaluating DWARF 3/4 expressions
in LLDB that load the canonical frame address rather than a location list.

- Handles the simple case where a CFA can be pulled from the current stack frame.
- Fixes more than one hundred failing tests with gcc 4.8!

TODO: Use UnwindPlan::GetRowForFunctionOffset if the DWARFExpression needs
to be evaluated in a context analogous to a virtual unwind (perhaps using RegisterContextLLDB).

- Also adds some comments to DWARFCallFrameInfo whenever I got confused.

llvm-svn: 187361
2013-07-29 16:05:11 +00:00
Greg Clayton 2540a8a7bc Fixed GetModuleSpecifications() to work better overall:
- MachO files now correctly extract the UUID all the time
- More file size and offset verification done for universal mach-o files to watch for truncated files
- ObjectContainerBSDArchive now supports enumerating all objects in BSD archives (.a files)
- lldb_private::Module() can not be properly constructed using a ModuleSpec for a .o file in a .a file
- The BSD archive plug-in shares its cache for GetModuleSpecifications() and the create callback
- Improved printing for ModuleSpec objects

llvm-svn: 186211
2013-07-12 22:07:46 +00:00
Ed Maste 9895ac1119 TypeHierarchyNavigator was removed in r186130
llvm-svn: 186160
2013-07-12 13:41:18 +00:00