Commit Graph

102 Commits

Author SHA1 Message Date
Justin Hibbits db39cdfbb7 Fix some bugs from D5988
Summary:
Ed Maste found some problems with the commit in D5988.  Address most of these.
While here, also add floating point return handling.  This doesn't handle
128-bit long double yet.  Since I don't have any system that uses it, I don't
currently have plans to implement it.

Reviewers: emaste

Reviewed By: emaste

Subscribers: emaste, lldb-commits

Differential Revision: http://reviews.llvm.org/D6049

llvm-svn: 220963
2014-10-31 15:57:52 +00:00
Justin Hibbits 6256a0ea8f First cut of PowerPC(64) support in LLDB.
Summary:
This adds preliminary support for PowerPC/PowerPC64, for FreeBSD.  There are
some issues still:

 * Breakpoints don't work well on powerpc64.
 * Shared libraries don't yet get loaded for a 32-bit process on powerpc64 host.
 * Backtraces don't work.  This is due to PowerPC ABI using a backchain pointer
   in memory, instead of a dedicated frame pointer register for the backchain.
 * Breakpoints on functions without debug info may not work correctly for 32-bit
   powerpc.

Reviewers: emaste, tfiala, jingham, clayborg

Reviewed By: clayborg

Subscribers: emaste, lldb-commits

Differential Revision: http://reviews.llvm.org/D5988

llvm-svn: 220944
2014-10-31 02:34:28 +00:00
Enrico Granata 622be238eb Expose the type-info flags at the public API layer. These flags provide much more informational content to consumers of the LLDB API than the existing TypeClass. Part of the fix for rdar://18517593
llvm-svn: 220322
2014-10-21 20:52:14 +00:00
Jason Molenda 5de2e7cafb RegisterContextLLDB::InitializeNonZerothFrame had a bit of code to
detct unwind loops but there was a code path through there (using
architecture default unwind plans) that didn't do the check, and
could end up with an infinite loop unwind.  Move that code into a
separate method and call it from both places where it is needed.

Also remove the use of ABI::FunctionCallsChangeCFA in that check.
I thought about it a lot and none of the architecutres that we're
supporting today can have a looping CFA.

Since the unwinder isn't using ABI::FunctionCallsChangeCFA() and
ABI::StackUsesFrames(), and the unwinder was the only reason
those methods exists, I removed them from the ABI and all its
plugins.

<rdar://problem/17364005> 

llvm-svn: 216992
2014-09-02 23:04:01 +00:00
Todd Fiala d8eaa17587 Update lldb to track recent Triple arm64 enum removal and collapse into aarch64.
See the following llvm change for details:

r213743 | tnorthover | 2014-07-23 05:32:47 -0700 (Wed, 23 Jul 2014) | 9 lines
AArch64: remove arm64 triple enumerator.

This change fixes build breaks on Linux and MacOSX lldb.

llvm-svn: 213755
2014-07-23 14:37:35 +00:00
Deepak Panickal d4f3f94e6a Fix the warnings introduced
llvm-svn: 213643
2014-07-22 11:59:11 +00:00
Deepak Panickal 2526ee5a2d ABI for the Hexagon DSP
llvm-svn: 213566
2014-07-21 17:21:01 +00:00
Bruce Mitchener d93c4a3339 Fix typos.
llvm-svn: 212132
2014-07-01 21:22:11 +00:00
Saleem Abdulrasool 28606954bf lldb: remove adhoc implementation of array_sizeof
Replace adhoc inline implementation of llvm::array_lengthof in favour of the
implementation in LLVM.  This is simply a cleanup change, no functional change
intended.

llvm-svn: 211868
2014-06-27 05:17:41 +00:00
Saleem Abdulrasool 324a103619 sweep up -Wformat warnings from gcc
This is a purely mechanical change explicitly casting any parameters for printf
style conversion.  This cleans up the warnings emitted by gcc 4.8 on Linux.

llvm-svn: 205607
2014-04-04 04:06:10 +00:00
Saleem Abdulrasool 3985c8c646 sanitise sign comparisons
This is a mechanical change addressing the various sign comparison warnings that
are identified by both clang and gcc.  This helps cleanup some of the warning
spew that occurs during builds.

llvm-svn: 205390
2014-04-02 03:51:35 +00:00
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
Sean Callanan 866e91c9d4 Better error reporting when a variable can't be
read during materialization.  First of all, report
if we can't read the data for some reason.  Second,
consult the ValueObject's error and report that if
there's some problem.

<rdar://problem/16074201>

llvm-svn: 202552
2014-02-28 22:27:53 +00:00
Jason Molenda 9c37cbdb86 Re-apply r201292. We're not going to enforce proper stack frame alignment on i386/x86_64
because there are too many trap handlers that will have an improperly aligned caller sp 
and this will cause the unwinder to stop too early.  

llvm-svn: 201637
2014-02-19 03:42:19 +00:00
Jason Molenda abba74b4ee Revert r201292 which relaxed the stack frame alignment requirements.
This was primarily working around problems where we weren't able
to identify trap handlers for different environments -- but instead,
I'm working to make it easier to specify those trap handler function
names.

llvm-svn: 201366
2014-02-13 23:29:36 +00:00
Jason Molenda 9098f1d3d9 Change the ABI CallFrameAddressIsValid methods for i386 and x86_64.
They were enforcing 16-byte alignment on stack frames for Darwin x86 programs.
But we've found that trap handlers typically don't have the stack pointer
aligned correctly when a trap happens and lldb wasn't backtracing all
the way through.  This method is only used as a safety guard to prevent
lldb's unwinder from using a bogus address as a stack frame - we'll still
enforce word-size alignment on stack frames so that should be fine.

Also rolled back akaylor's changes from August 2013 in r188952 which changed
the i386 ABI plugin to relax the CallFrameAddressIsValid offsets for non-Darwin
targets where only 4-byte alignment is enforced.  Now Darwin is the same as
those environments.

<rdar://problem/15982682> 

llvm-svn: 201292
2014-02-13 04:19:32 +00:00
Sean Callanan a464f3d43a Changed the ABIs and ClangFunction to take a
llvm::ArrayRef of arguments rather than taking
a fixed number of possibly-NULL pointers to
arguments.

Also changed ClangFunction::GetThreadPlanToCallFunction
to take the address of the argument struct by value
instead of by reference, since it doesn't actually
modify the value passed into it.

llvm-svn: 194232
2013-11-08 01:14:26 +00:00
Greg Clayton bb3a9b74e7 Update ABISysV_x86_64.cpp to use more efficient register finding calls.
Instead of looking up registers by name, we use the generic ID when we can.

Also added code that creates an extra frame when running expressions by pushing the current PC and FP and then hooking up the FP backchain. This code is "#if 0" out for now until we can pair it with unwinder fixes.

llvm-svn: 194035
2013-11-05 01:24:05 +00:00
Jason Molenda 8065867ff7 Fix the architectural default unwind plan's settings for restoring
the stack pointer.

llvm-svn: 194029
2013-11-05 00:19:09 +00:00
Jason Molenda 00ec491fc6 Fix a bug in the x86_64 architectural default unwindplan
where it was using the wrong register numbering scheme
to express where the rbp could be retrieved from.

llvm-svn: 194023
2013-11-04 22:57:40 +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
Joerg Sonnenberger 340a17595e Convert to UNIX line endings.
llvm-svn: 191367
2013-09-25 10:37:32 +00:00
Jason Molenda a609fe1576 Add link to Darwin iOS arm ABI docs in ABIMacOSX_arm.cpp.
llvm-svn: 189082
2013-08-23 01:31:25 +00:00
Jason Molenda 4a561c16f5 Fix ABIMacOSX_arm::RegisterIsVolatile() so it identifies r12 as a volatile reg.
llvm-svn: 189077
2013-08-22 23:53:14 +00:00
Jason Molenda 9f9c963e47 Simplify the CreateFunctionEntryUnwindPlan () and CreateDefaultUnwindPlan()
methods in the ABIs.  Specify the register numbering of the UnwindPlan
we're creating and use those only register numbers.

llvm-svn: 189074
2013-08-22 23:13:43 +00:00
Jason Molenda cbe9862305 Update ABISysV_x86_64::CallFrameAddressIsValid() to check for
16-byte alignment of stack frames.

llvm-svn: 189073
2013-08-22 22:51:48 +00:00
Andrew Kaylor 30787d1448 Fixing build errors from r188952
llvm-svn: 188955
2013-08-21 22:53:15 +00:00
Andrew Kaylor a90d44061b Adding separate cfa alignment check for Darwin and non-Darwin targets in 32-bit ABI.
llvm-svn: 188952
2013-08-21 22:40:46 +00:00
Jason Molenda ad9a53c510 Add an SBFrame::FindRegister() method to make it a little
easier to retrieve a register value.

llvm-svn: 187184
2013-07-26 02:08:48 +00:00
Jason Molenda 32359897ce Update link for the SysV x86_64 ABI standard doc; x86-64.org has
been down for months and is likely no longer supported.  This was
the most stable-looking link I could find for the current (0.99.6) 
version of the ABI doc.  

llvm-svn: 187087
2013-07-24 23:25:27 +00:00
Greg Clayton 57ee306789 Huge change to clean up types.
A long time ago we start with clang types that were created by the symbol files and there were many functions in lldb_private::ClangASTContext that helped. Later we create ClangASTType which contains a clang::ASTContext and an opauque QualType, but we didn't switch over to fully using it. There were a lot of places where we would pass around a raw clang_type_t and also pass along a clang::ASTContext separately. This left room for error.

This checkin change all type code over to use ClangASTType everywhere and I cleaned up the interfaces quite a bit. Any code that was in ClangASTContext that was type related, was moved over into ClangASTType. All code that used these types was switched over to use all of the new goodness.

llvm-svn: 186130
2013-07-11 22:46:58 +00:00
Greg Clayton 57abc5d6a6 <rdar://problem/13854277>
<rdar://problem/13594769>

Main changes in this patch include:
- cleanup plug-in interface and use ConstStrings for plug-in names
- Modfiied the BSD Archive plug-in to be able to pick out the correct .o file when .a files contain multiple .o files with the same name by using the timestamp
- Modified SymbolFileDWARFDebugMap to properly verify the timestamp on .o files it loads to ensure we don't load updated .o files and cause problems when debugging

The plug-in interface changes:

Modified the lldb_private::PluginInterface class that all plug-ins inherit from:

Changed:

virtual const char * GetPluginName() = 0;

To: 

virtual ConstString GetPluginName() = 0;

Removed:

virtual const char * GetShortPluginName() = 0;

- Fixed up all plug-in to adhere to the new interface and to return lldb_private::ConstString values for the plug-in names. 
- Fixed all plug-ins to return simple names with no prefixes. Some plug-ins had prefixes and most ones didn't, so now they all don't have prefixed names, just simple names like "linux", "gdb-remote", etc.

llvm-svn: 181631
2013-05-10 21:47:16 +00:00
Ashok Thirumurthi 999caf900a Adds 64-bit POSIX support for AVX
- Adds unique enums for ymm registers to the ABI and the POSIX register context.
- Reworks the register context data structures to support a union of FXSAVE and XSAVE
--- Allows the same code base to deal with the FPU independent of the availability of AVX.
- Determine if AVX is supported by attempting to read XSAVE using ptrace.
--- Support an extended register set for avx registers if available.
- Provide a mechanism to assemble/parse register halves into a single ymm buffer for use with RegisterValue.
--- Reworked Read/WriteRegister routines to read/write/parse ymm registers.

Adds tests for ymm register write with read-back, and expressions involving ymm registers.
- Tests vary depending on the availability of an avx register set.

Thanks to Daniel and Matt for their reviews.

llvm-svn: 180572
2013-04-25 20:12:45 +00:00
Greg Clayton 7b0992d9cd After discussing with Chris Lattner, we require C++11, so lets get rid of the macros and just use C++11.
llvm-svn: 179805
2013-04-18 22:45:39 +00:00
Greg Clayton beb02fd1ea Missed some cases when switching over to using our STD_UNIQUE_PTR macros.
llvm-svn: 179796
2013-04-18 21:01:59 +00:00
Greg Clayton 1c8ef47681 Added support "__attribute__((__vector_size__(B)))" and "__attribute__((ext_vector_type(N)))".
Now we can:
1 - see the return value for functions that return types that use the "ext_vector_size"
2 - dump values that use the vector attributes ("expr $ymm0")
3 - modified the DWARF parser to correctly parse GNU vector types from the DWARF by turning them into clang::Type::ExtVector types instead of just standard arrays

llvm-svn: 178924
2013-04-05 23:27:21 +00:00
Jim Ingham 0b55b438b2 Fixme comment.
llvm-svn: 178889
2013-04-05 17:39:29 +00:00
Greg Clayton 5160ce5c72 <rdar://problem/13521159>
LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down.

All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down.

llvm-svn: 178191
2013-03-27 23:08:40 +00:00
Daniel Malea 23720cc66c Adding CMake build system to LLDB. Some known issues remain:
- generate-vers.pl has to be called by cmake to generate the version number
- parallel builds not yet supported; dependency on clang must be explicitly specified

Tested on Linux.
- Building on Mac will require code-signing logic to be implemented.
- Building on Windows will require OS-detection logic and some selective directory inclusion

Thanks to Carlo Kok (who originally prepared these CMakefiles for Windows) and Ben Langmuir
who ported them to Linux!

llvm-svn: 175795
2013-02-21 20:58:22 +00:00
Greg Clayton c7bece56fa <rdar://problem/13069948>
Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary.

So I defined a new "lldb::offset_t" which should be used for all file offsets.

After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed.

Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections.

llvm-svn: 173463
2013-01-25 18:06:21 +00:00
Greg Clayton 0b510bca73 Don't read the SP when getting argument values from registers in case the SP isn't available. We don't want the availability of SP to limit when we get get arguments from registers.
llvm-svn: 170476
2012-12-18 23:45:33 +00:00
Jason Molenda 21d1e9e53d Update comments around ABISysV_x86_64::RegisterIsCalleeSaved to
make it clear that this is the list of callee-saved registers,
add reference to the ABI doc that this comes from.

llvm-svn: 169807
2012-12-11 01:20:57 +00:00
Daniel Malea 89660bf795 More Linux warnings fixes (remove default labels as needed):
- as per http://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations

Patch by Matt Kopec!

llvm-svn: 169633
2012-12-07 20:51:09 +00:00
Jason Molenda 7964ab5e49 Fix ABIMacOSX_i386::RegisterIsVolatile to return the negated value of
RegisterIsCalleeSaved.  Add ebp back to the list of registers that
are callee saved.
<rdar://problem/12817918> 

llvm-svn: 169466
2012-12-06 02:49:20 +00:00
Greg Clayton 2a354a2969 Backed out part of the ABI changes that were checked in because it breaks the i386 test suite as it makes backtraces for the first instruction of a function fail. Stepping relies on backtraces being correct, so I am reverting what is causing the breakage.
I filed this to track the fix:

<rdar://problem/12817918> Recent i386 ABI changes break the i386 test suite because stack backtracing is busted when stopped in trampolines

llvm-svn: 169409
2012-12-05 19:43:20 +00:00
Jason Molenda 011aea45a9 Fix comment in ABIMacOSX_i386::RegisterIsCalleeSaved to say that
these are the *non-volatile* registers on Darwin/i386, not the
volatile registers.
Recognize the sp, pc, fp generic reg names as well.

llvm-svn: 169316
2012-12-04 22:08:50 +00:00
Daniel Malea d01b2953fa Resolve printf formatting warnings on Linux:
- use macros from inttypes.h for format strings instead of OS-specific types

Patch from Matt Kopec!

llvm-svn: 168945
2012-11-29 21:49:15 +00:00
Jason Molenda 60f0bd4944 Add a new capability to RegisterContextLLDB: To recognize when the
Full UnwindPlan is trying to do an impossible unwind; in that case
invalidate the Full UnwindPlan and replace it with the architecture
default unwind plan.

This is a scenario that happens occasionally with arm unwinds in
particular; the instruction analysis based full unwindplan can
mis-parse the functions and the stack walk stops prematurely.  Now
we can do a simpleminded frame-chain walk to find the caller frame
and continue the unwind.  It's not ideal but given the complicated
nature of analyzing the arm functions, and the lack of eh_frame
information on iOS, it is a distinct improvement and fixes some
long-standing problems with the unwinder on that platform.  

This is fixing <rdar://problem/12091421>.  I may re-use this
invalidate feature in the future if I can identify other cases where
the full unwindplan's unwind information is clearly incorrect.

This checkin also includes some cleanup for the volatile register
definition in the arm ABI plugin for <rdar://problem/10652166> 
although work remains to be done for that bug.

llvm-svn: 166757
2012-10-26 06:08:58 +00:00
Jason Molenda af2521fd74 Add a new ABI plugin method which specifies whether the architecture
must push something on the stack for a function call or not.  In
x86, the stack pointer is decremented when the caller's pc is saved
on the stack.  In arm, the stack pointer and frame pointer don't
necessarily have to change for a function call, although most
functions need to use some stack space during their execution.

Use this information in the RegisterContextLLDB to detect invalid 
unwind scenarios more accurately.

<rdar://problem/12348574>

llvm-svn: 166005
2012-10-16 02:39:21 +00:00