Commit Graph

8238 Commits

Author SHA1 Message Date
Jason Molenda 5dd4916f63 Add a new GetThreadOriginExtendedBacktrace method to the
SystemRuntime and SBThread classes.
<rdar://problem/15314369> 

llvm-svn: 194111
2013-11-06 00:04:44 +00:00
Greg Clayton 095eeaa025 <rdar://problem/15367122>
Fixed the test case for "test/functionalities/exec/TestExec.py" on Darwin.

The issue was breakpoints were persisting and causing problems. When we exec, we need to clear out the process and target and start fresh with nothing and let the breakpoints populate themselves again. This patch correctly clears out the breakpoints and also flushes the process so that the objects (process/thread/frame) give out valid information.

llvm-svn: 194106
2013-11-05 23:28:00 +00:00
Jim Ingham afbb0af827 Give a better error when the index argument for “frame select” can’t be parsed.
<rdar://problem/15390829>

llvm-svn: 194087
2013-11-05 18:25:23 +00:00
Jason Molenda 8c71337abc Add the GetNumThreadOriginExtendedBacktraceTypes and
GetThreadOriginExtendedBacktraceTypeAtIndex methods to
SBProcess.

Add documentation for the GetQueueName and GetQueueID methods
to SBThread.
<rdar://problem/15314369> 

llvm-svn: 194063
2013-11-05 11:00:35 +00:00
Jason Molenda b4db43fad6 Add a GetThreadOriginExtendedBacktraceTypes method to the
SystemRuntime class.
<rdar://problem/15314369> 

llvm-svn: 194045
2013-11-05 04:25:57 +00:00
Jason Molenda eef510667b Add a new system runtime plugin type - just the top level
class, not any actual plugin implementation yet.
<rdar://problem/15314068> 

llvm-svn: 194044
2013-11-05 03:57:19 +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
Greg Clayton bc3122ead3 <rdar://problem/15367406>
Fixed a case where on darwin, after recent compiler changes a few months ago, we could not execute dlopen() in an expression, or use "process load".

The issue was some compiler option default values changed. We now override these settings to get the old behavior back.

llvm-svn: 194012
2013-11-04 19:50:49 +00:00
Greg Clayton 62afb9f663 Added a "--debug" option to the "expression" command.
Cleaned up ClangUserExpression::Evaluate() to have only one variant that takes a "const EvaluateExpressionOptions& options" instead of taking many arguments.

The "--debug" option is designed to allow you to debug your expression by stopping at the first instruction (it enables --ignore-breakpoints=true and --unwind-on-error=false) and allowing you to step through your JIT code. It needs to be more integrated with the thread plan, so I am checking this in so Jim Ingham can make it happen.

llvm-svn: 194009
2013-11-04 19:35:17 +00:00
Jason Molenda 99618476ad Add new ivars to StackFrame so it can represent a stack collected
at some point in the past.  We may have nothing more than a pc value
for this type of stack frame -- hopefully we'll have a pc and a
stop_id so we can track module loads and unloads over time and
symbolicate the pc at the correct point in time.

Also add a flag to indicate if the CFA for the frame is available
(a bit different from a CFA of LLDB_INVALID_ADDRESS) and also an
overall setting to indicate whether this is a history stack frame
or not.  A history stack frame may not have a CFA, it may not have
a register context, it may not have variables, it may not have a
frame pointer or a stack pointer.

<rdar://problem/15314068>

llvm-svn: 193987
2013-11-04 11:02:52 +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
Filip Pizlo 8677577395 It is no longer necessary to opt out of pretty stack traces.
llvm-svn: 193972
2013-11-04 02:25:07 +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
Enrico Granata e397a94c5d <rdar://problem/15368142>
For this test case, one needs to get the name of the symbol since we don't have debug info to generate an SBFunction

llvm-svn: 193879
2013-11-01 18:48:03 +00:00
Enrico Granata e615d20041 Use 0x00... as the magic constant to write in st0. That should be reliably 0 regardless of OS/hardware
llvm-svn: 193877
2013-11-01 18:19:05 +00:00
Enrico Granata 4c379c2b8d Skip this test case pending figuring out why it fails
llvm-svn: 193844
2013-11-01 01:00:57 +00:00
Enrico Granata 03e474bcef This only fails on Darwin ; thanks Jim for pointing that out
llvm-svn: 193843
2013-11-01 00:57:53 +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 60bd35012a This test is expected to fail pending proper support
llvm-svn: 193831
2013-10-31 23:43:42 +00:00
Enrico Granata 3a48185f79 Thread::SetState() is not being called upon hitting the breakpoint
Given that, this test will never pass
Marking as expected failure pending a fix

llvm-svn: 193830
2013-10-31 23:36:47 +00:00
Enrico Granata 2dba1135db Fix this test to work with either st0 or stmm0
llvm-svn: 193829
2013-10-31 23:25:47 +00:00
Enrico Granata 667a911901 This test is failing because expressions involving dlopen() currently do not work
Mark it as expected to fail pending a fix

llvm-svn: 193828
2013-10-31 23:19:13 +00:00
Enrico Granata 7eeda58588 Fix this test to be consistent in whether a process will or will not be there
llvm-svn: 193827
2013-10-31 23:14:48 +00:00
Enrico Granata 7037b3f915 Another instance of the same test failing
llvm-svn: 193826
2013-10-31 23:07:41 +00:00
Enrico Granata 4510a159c2 Another instance of the same test failing
llvm-svn: 193825
2013-10-31 23:06:54 +00:00
Enrico Granata 4a2dc3b01b Mark this as an expected failure
llvm-svn: 193824
2013-10-31 23:05:35 +00:00
Enrico Granata c955ac3723 This test is currently expected to fail, mark it as such pending fixes
llvm-svn: 193822
2013-10-31 22:55:55 +00:00
Enrico Granata 0ede1094bf Workaround the DWARF info is anticipating the derived class assignment issue in this test case for now
llvm-svn: 193821
2013-10-31 22:49:31 +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
Andrew Kaylor 70ce6d2e62 Marking dynamic value test as expected failure on Linux.
llvm-svn: 193809
2013-10-31 22:07:11 +00:00
Greg Clayton 49fd8de3c2 Fixed printf warnings.
llvm-svn: 193806
2013-10-31 21:38:47 +00:00
Enrico Granata 90a8db30de Renaming the setting to enable/disable automatic one-lining of summaries as auto-one-line-summaries
llvm-svn: 193801
2013-10-31 21:01:07 +00:00
Ed Maste 1c09d4a537 Migrate DWARFDebugLine to DWARFDataExtractor 64-bit DWARF support
llvm-svn: 193794
2013-10-31 19:51:53 +00:00
Andrew Kaylor 7268e6ef9d Fix dynamic value test to build correctly on Linux with C++11 features.
llvm-svn: 193793
2013-10-31 19:42:35 +00:00
Ed Maste d8f57278b8 Remove unused DWARFDebugLine length functions
llvm-svn: 193792
2013-10-31 19:31:16 +00:00
Enrico Granata d7373f69cf SBValue::GetValueAsUnsigned()/GetValueAsSigned() should not replicate the Scalar manipulation logic found in ValueObject, but rather just call down to it
llvm-svn: 193786
2013-10-31 18:57:50 +00:00
Greg Clayton a1e0318c42 Added more details on the exact version of the cxa_demangle.cpp file for the built in demangler. This will help us track when we need to update this file.
llvm-svn: 193784
2013-10-31 18:41:50 +00:00
Ed Maste 3606da2614 Use inlined demangler on FreeBSD
FreeBSD includes the elftoolchain project's demangler in the base system.
It does not handle some unusual mangled names, so use the inlined
libcxxabi one.

llvm-svn: 193776
2013-10-31 17:42:32 +00:00
Ed Maste fb15ba6879 Tls test fails on FreeBSD due to llvm.org/pr16696
(Threaded inferior debugging not yet available on FreeBSD.)

llvm-svn: 193771
2013-10-31 17:21:15 +00:00
Greg Clayton dc25a0bc64 <rdar://problem/14496092>
Fixes from code review by Jim Ingham that reinstate preferring an external vs non-external symbol when finding function addresses.

llvm-svn: 193761
2013-10-31 16:59:47 +00:00
Enrico Granata 686f3deb44 This checkin introduces the notion of hardcoded formatters, which LLDB can bind to a ValueObject internally depending on any criteria
User-vended by-type formatters still would prevail on these hardcoded ones

For the time being, while the infrastructure is there, no such formatters exist

This can be useful for cases such as expanding vtables for C++ class pointers, when there is no clear cut notion of a typename matching, and the feature is low-level enough that it makes sense for the debugger core to be vending it

llvm-svn: 193724
2013-10-30 23:46:27 +00:00
Greg Clayton f32db51c50 <rdar://problem/14496092>
Fixed the expression parser to be able to iterate across all function name matches that it finds when it is looking for the address of a function that the IR is looking for. Also taught it to deal with reexported symbols.

llvm-svn: 193716
2013-10-30 21:37:46 +00:00
Andrew Kaylor ba8ce0414e Removing expected failure decorator for a test that's passing.
llvm-svn: 193715
2013-10-30 21:05:36 +00:00
Greg Clayton 19c8e78b86 <rdar://problem/15201312>
Inlined a copy of cxa_demangle.cpp from:

http://llvm.org/svn/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp

For systems that don't have demangling built into the system, and for systems that don't want to use the version that is installed. Defining LLDB_USE_BUILTIN_DEMANGLER in your build system allows you to use the built in demangler. This setting is curently automatically enabled for Windows builds.

llvm-svn: 193708
2013-10-30 18:42:59 +00:00
Greg Clayton c1ae724757 Fixed a warning in PlatformiOSSimulator where GetSDKDirectory was hiding recently added virtual function. Renamed GetSDKDirectory to GetSDKsDirectory to fix the issue. GetSDKsDirectory is a better fit because it finds the directory that contains all SDKs, not the current one.
llvm-svn: 193707
2013-10-30 18:40:41 +00:00
Enrico Granata 5e1480c5dc <rdar://problem/13308704>
Fixing a problem where ValueObject::GetPointeeData() would not accept "partial" valid reads (i.e. asking for 10 items and getting only 5 back)
While suboptimal, this situation is not a flat-out failure and could well be caused by legit scenarios, such as hitting a page boundary

Among others, this allows data formatters to print char* buffers allocated under libgmalloc

llvm-svn: 193704
2013-10-30 17:52:44 +00:00
Enrico Granata 34b6671ca3 <rdar://problem/15143022>
CFNumberRef is toll-free bridged to NSNumber
We can use the same summary formatter for both types

llvm-svn: 193666
2013-10-30 00:17:52 +00:00
Enrico Granata 38c546320c <rdar://problem/15045059>
One of the things that dynamic typing affects is the count of children a type has
Clear out the flag that makes us blindly believe the children count when a dynamic type change is detected

llvm-svn: 193663
2013-10-30 00:04:29 +00:00
Enrico Granata 0947a6e93b <rdar://problem/15296388>
Fix a crasher that would occur if one tried to read memory as characters of some size != 1, e.g.
x -f c -s 10  buffer

This commit tries to do the right thing and uses the byte-size as the number of elements, unless both are specified and the number of elements is != 1
In this latter case (e.g. x -f c -s 10 -c 3  buffer) one could multiply the two and read 30 characters, but it seems a stretch in mind reading.

llvm-svn: 193659
2013-10-29 23:04:29 +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
Andrew Kaylor 2c206688db Fixing TestAnonymous to build dwarf where it says it will.
llvm-svn: 193628
2013-10-29 17:09:59 +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
Jim Ingham 4396b8e618 Change the default handling for SIGALRM and SIGCHLD to not notify.
<rdar://problem/15208799>

llvm-svn: 193530
2013-10-28 19:00:42 +00:00
Jason Molenda 6a8658ad61 Fix the signed-ness of a few log printf directives in Process::RunThreadPlan.
llvm-svn: 193488
2013-10-27 02:32:23 +00:00
Enrico Granata 553fad5c9a <rdar://problem/15319880>
Introduce a new boolean setting enable-auto-oneliner
This setting if set to false will force LLDB to not use the new compact one-line display

By default, one-line mode stays on, at least until we can be confident it works.
But now if it seriously impedes your workflow while it evolves/it works wonders but you still hate it, there's a way to turn it off

llvm-svn: 193450
2013-10-25 23:09:40 +00:00
Greg Clayton bac3ff1aa7 Update the key/value documentation for the qHostInfo packet.
llvm-svn: 193426
2013-10-25 18:22:24 +00:00
Greg Clayton 9ac6d2db73 <rdar://problem/15263540>
Added a new key that we understand for the "qHostInfo" packet: "default_packet_timeout:T;" where T is a default packet timeout in seconds.

This allows GDB servers with known slow packet response times to increase the default timeout to a value that makes sense for the connection.

llvm-svn: 193425
2013-10-25 18:13:17 +00:00
Ed Maste 9204e6d8f5 Update DWARFDebugPubnamesSet 64-bit DWARF to use new DWARFDataExtractor
llvm-svn: 193407
2013-10-25 13:18:17 +00:00
Greg Clayton 9b2349888f Added the ability to get the SDK path for a target using the platform plugins. If LLDB lives inside an Xcode.app bundle, it will select the SDK in the Xcode bundle, else it will use the currently selected Xcode.
Also added the DWARFDataExtractor classes to the Xcode project file.

llvm-svn: 193380
2013-10-24 22:54:08 +00:00
Ed Maste eeae72184b Introduce DWARFDataExtractor for 64-Bit DWARF parsing
Review: http://llvm-reviews.chandlerc.com/D2007
llvm-svn: 193368
2013-10-24 20:43:47 +00:00
Greg Clayton 4598907ff8 Fixed format strings as they still must specicy a '%' prior to using PRI*64 macros.
llvm-svn: 193260
2013-10-23 18:24:30 +00:00
Ed Maste 2ea0f2cdae 64-Bit DWARF support for .debug_aranges and .debug_pubnames
llvm-svn: 193250
2013-10-23 17:24:15 +00:00
Ed Maste 726a591482 Initial DWARF64 support for .debug_line
Some versions of the GNU MIPS toolchain generate 64-Bit DWARF (even though
it isn't really necessary).  This change adds support for the 64-Bit DWARF
format, but is not actually tested with >4GB of debug data.

Similar changes are in progress for llvm's version of DWARFDebugLine, in
review D1988.

llvm-svn: 193242
2013-10-23 14:18:41 +00:00
Enrico Granata c89e4ca3c1 One should actually not do one-line printing of nested aggregates even if they are not the base class
This check was overly strict. Relax it.
While one could conceivably want nested one-lining:
(Foo) aFoo = (x = 1, y = (t = 3, q = “Hello), z = 3.14)
the spirit of this feature is mostly to make *SMALL LINEAR* structs come out more compact.
Aggregates with children and no summary for now just disable the one-lining. Define a one-liner summary to override :)

llvm-svn: 193218
2013-10-23 01:34:31 +00:00
Wei Pan 133ac8714d LUI: Fix some issues causing crashes in the source view
llvm-svn: 193217
2013-10-23 01:18:21 +00:00
Enrico Granata 106260c574 Improvements to the ValueObjectPrinter to behave correctly in more dynamic value cases
llvm-svn: 193204
2013-10-22 22:42:14 +00:00
Sean Callanan 13b4ef2dba Simplified the code that materializes a variable,
obviating the need to create a new ValueObject.

llvm-svn: 193191
2013-10-22 20:01:17 +00:00
Deepak Panickal d66b50c96c Fixes to get LLDB building on Windows again.
llvm-svn: 193159
2013-10-22 12:27:43 +00:00
Jason Molenda 12075f71f9 Update ResolveFunctionPointers to build after the changes
of llvm r193091.  Thanks to Ed Maste for narrowing it down.

llvm-svn: 193140
2013-10-22 03:11:55 +00:00
Jason Molenda 5e873dbc40 Fix for a mistake spotted by Enrico with the SBThread::queue_id accessor.
llvm-svn: 193136
2013-10-22 01:37:18 +00:00
Jason Molenda 4fdb5863b9 Expose the Thread::GetQueueID() method through the SBThread API, similar to
the existing SBThread::GetQueueName() method.

llvm-svn: 193132
2013-10-21 23:52:54 +00:00
Greg Clayton d65ef14df3 Fixed breakpoints to be able to be set on eSymbolTypeReExported symbols and resolve to the correct function. This allows setting a breakpoint on "memset" for iOS simulator binaries and the correct breakpoint will be set on "__platform_memset".
llvm-svn: 193114
2013-10-21 20:04:47 +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
Enrico Granata aff6565f85 Get rid of the FooStructSynth, it was a testing thing I put in and forgot to remove
Hopefully nobody had a struct Foo in their app:-)

llvm-svn: 193092
2013-10-21 17:29:51 +00:00
Joerg Sonnenberger e77b0424fd Fix python-free build.
llvm-svn: 193053
2013-10-20 17:36:05 +00:00
Joerg Sonnenberger c5e53bd14a Make sure switch covers all values.
llvm-svn: 193052
2013-10-20 17:35:46 +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
Ed Maste f7920c8798 Fix build failure on FreeBSD/clang by using auto iterator type
llvm-svn: 192999
2013-10-18 20:32:25 +00:00
Ed Maste 68f517938a Add stub FreeBSD ProcessMonitor::ReadThreadPointer
llvm-svn: 192994
2013-10-18 19:16:44 +00:00
Enrico Granata fcb37ae365 <rdar://problem/15182550>
Removing Host/Atomic.h
This header file was not being copied as part of our public API headers and this in turn was causing any plugin to link against LLDB.framework, since SharingPtr.h depends on it

Out of several possible options to fix this issue, the cleanest one is to revert LLDB to use std::atomic<>, as we are a C++11 project and should take advantage of it

The original rationale for going from std::atomic to Host/Atomic.h was that MSVC++ fails to link in CLR mode when std::atomic is used
This is a very Visual Studio/.net specific issue, which hopefully will be fixed
Until them, to allow Windows development to proceed, we are going with a targeted solution where we #ifdef include the Windows specific calls, and let everyone else use the
proper atomic support, as should be

If there is an unavoidable need for a LLDB-specific atomic header, the right way to go at it would be to make an API/lldb-atomic.h header and #ifdef the Windows dependency there

The FormatManager should not need to conditionalize use of std::atomic<>, as other parts of the LLDB internals are successfully using atomic (Address and IRExecutionUnit), so this
Win-specific hack is limited to SharingPtr

llvm-svn: 192993
2013-10-18 18:57:49 +00:00
Jim Ingham 8ec10efc5d Mark the selected frame of the selected thread in backtraces.
<rdar://problem/15252474>

llvm-svn: 192989
2013-10-18 17:38:31 +00:00
Jim Ingham b1499243f3 Make sure the CallFunction Thread plans don't try to do DoTakedown if their thread
has gone  away by the time they get around to doing it.

<rdar://problem/15245544>

llvm-svn: 192987
2013-10-18 17:11:02 +00:00
Jim Ingham 5010b6972c BreakpointResolverFileRegex.cpp wandered from the lldb-core target to the LLDB.framework target.
Put it back where it belongs.

llvm-svn: 192986
2013-10-18 17:05:45 +00:00
Hafiz Abid Qadeer 85a4daf4f6 Adjust PC after hitting breakpoint on remote target.
This commit adds an example python file that can be used with 'target-definition-file' setting for Linux gdbserver.
This file has an extra key 'breakpoint-pc-offset' that LLDB uses to determine how much to change the PC
after hitting the breakpoint.

llvm-svn: 192962
2013-10-18 10:04:33 +00:00
Jason Molenda 3dc4f44e71 Move the code which translates a dispatch_qaddr into a
queue name out of ProcessGDBRemote and in to the Platform
plugin, specifically PlatformDarwin.

Also add a Platform method to translate a dispatch_quaddr
to a QueueID, and a Thread::GetQueueID().

I'll add an SBThread::GetQueueID() next.

llvm-svn: 192949
2013-10-18 05:55:24 +00:00
Richard Mitton 665068b379 Removed unnecessary call to OpenFirstAvailableMaster.
::Fork already does this internally, so this was simply leaking file handles.

This fixes the problem where the test suite would occasionally run out of file handles.

llvm-svn: 192929
2013-10-17 22:36:28 +00:00
Enrico Granata 52b4b6cddc This is the last piece of work for "formats in categories": we now cache formats as well as summaries and synthetics
llvm-svn: 192928
2013-10-17 22:27:19 +00:00
Richard Mitton 0a55835755 Added support for reading thread-local storage variables, as defined using the __thread modifier.
To make this work this patch extends LLDB to:

- Explicitly track the link_map address for each module. This is effectively the module handle, not sure why it wasn't already being stored off anywhere. As an extension later, it would be nice if someone were to add support for printing this as part of the modules list.

- Allow reading the per-thread data pointer via ptrace. I have added support for Linux here. I'll be happy to add support for FreeBSD once this is reviewed. OS X does not appear to have __thread variables, so maybe we don't need it there. Windows support should eventually be workable along the same lines.

- Make DWARF expressions track which module they originated from.

- Add support for the DW_OP_GNU_push_tls_address DWARF opcode, as generated by gcc and recent versions of clang. Earlier versions of clang (such as 3.2, which is default on Ubuntu right now) do not generate TLS debug info correctly so can not be supported here.

- Understand the format of the pthread DTV block. This is where it gets tricky. We have three basic options here:

  1) Call "dlinfo" or "__tls_get_addr" on the inferior and ask it directly. However this won't work on core dumps, and generally speaking it's not a good idea for the debugger to call functions itself, as it has the potential to not work depending on the state of the target.

  2) Use libthread_db. This is what GDB does. However this option requires having a version of libthread_db on the host cross-compiled for each potential target. This places a large burden on the user, and would make it very hard to cross-debug from Windows to Linux, for example. Trying to build a library intended exclusively for one OS on a different one is not pleasant. GDB sidesteps the problem and asks the user to figure it out.

  3) Parse the DTV structure ourselves. On initial inspection this seems to be a bad option, as the DTV structure (the format used by the runtime to manage TLS data) is not in fact a kernel data structure, it is implemented entirely in useerland in libc. Therefore the layout of it's fields are version and OS dependent, and are not standardized.

  However, it turns out not to be such a problem. All OSes use basically the same algorithm (a per-module lookup table) as detailed in Ulrich Drepper's TLS ELF ABI document, so we can easily write code to decode it ourselves. The only question therefore is the exact field layouts required. Happily, the implementors of libpthread expose the structure of the DTV via metadata exported as symbols from the .so itself, designed exactly for this kind of thing. So this patch simply reads that metadata in, and re-implements libthread_db's algorithm itself. We thereby get cross-platform TLS lookup without either requiring third-party libraries, while still being independent of the version of libpthread being used.

Test case included.

llvm-svn: 192922
2013-10-17 21:14:00 +00:00
Ed Maste a0191d1101 Fix building with ENABLE_DEBUG_PRINTF
Clang tells me that "token pasting of ',' and __VA_ARGS__ is a GNU
extension".  Also catch up with changes in function args.

llvm-svn: 192920
2013-10-17 20:42:56 +00:00
Ed Maste 4c24b1264a Whitespace: replace 4-space-tabs with spaces
llvm-svn: 192918
2013-10-17 20:13:14 +00:00
Richard Mitton ec8b282bde Rearranged linker flags for test suite.
Some linkers (GNU ld) are picky about library order, so if we import libraries as part of our LDFLAGS then that needs to come after any DYLIB_NAME which might require that library.

llvm-svn: 192917
2013-10-17 20:09:33 +00:00
Ed Maste 4a1c279795 Correct log message typo: ended ad -> ended at
llvm-svn: 192897
2013-10-17 14:03:07 +00:00
Ed Maste 737e92b036 Remove unused DWARFCompileUnit::Extract variant
llvm-svn: 192893
2013-10-17 13:23:03 +00:00
Greg Clayton 312bcbe8b4 <rdar://problem/14972424>
- Made the dynamic register context for the GDB remote plug-in inherit from the generic DynamicRegisterInfo to avoid code duplication
- Finished up the target definition python setting stuff.
- Added a new "slice" key/value pair that can specify that a register is part of another register:
    { 'name':'eax', 'set':0, 'bitsize':32, 'encoding':eEncodingUint, 'format':eFormatHex, 'slice': 'rax[31:0]' },
- Added a new "composite" key/value pair that can specify that a register is made up of two or more registers:
    { 'name':'d0', 'set':0, 'bitsize':64 , 'encoding':eEncodingIEEE754, 'format':eFormatFloat, 'composite': ['s1', 's0'] },
- Added a new "invalidate-regs" key/value pair for when a register is modified, it can invalidate other registers:
    { 'name':'cpsr', 'set':0, 'bitsize':32 , 'encoding':eEncodingUint, 'format':eFormatHex, 'invalidate-regs': ['r8', 'r9', 'r10', 'r11', 'r12', 'r13', 'r14', 'r15']},
    
This now completes the feature that allows a GDB remote target to completely describe itself.

llvm-svn: 192858
2013-10-17 01:10:23 +00:00
Greg Clayton 8afa543737 Fixed the MacOSX non "Debug" builds so that "lldb-platform" doesn't fail to link.
llvm-svn: 192857
2013-10-17 00:27:14 +00:00
Sean Callanan 074c314ea0 Added the Windows platform to our .xcodeproj,
and alphabetized the contents of
Source:Plugins:Platform.  This fixes the Mac
OS X build.

llvm-svn: 192833
2013-10-16 19:40:50 +00:00
Sriram Murali 1aeda01c44 lui: enable tab completion in command window
llvm-svn: 192814
2013-10-16 17:08:55 +00:00
Sriram Murali 8a0386654a prevent lui from crashing with small source files
llvm-svn: 192811
2013-10-16 16:48:43 +00:00
Ed Maste e5f2139f68 Fix FreeBSD build after r192714 (Windows command line driver)
llvm-svn: 192789
2013-10-16 13:20:01 +00:00
Sylvestre Ledru 7a05000f18 Unbreak the gcc build (complain about duplicate definition of Initialize/Terminate (done in the cpp code)
llvm-svn: 192780
2013-10-16 09:12:15 +00:00
Ben Langmuir 4a665f1105 A couple of small visual improvements for lui
Change titles to white rather than green text to improve readability on blue
background, and use erase() instead of clear() to reduce flicker in the source
window.

llvm-svn: 192768
2013-10-16 03:01:04 +00:00
Ben Langmuir a084b33fb8 lui: clean up breakpoint window, and allow multi-line list items
* Clean the SBBreakpoint: id = out of the output
* clamp output to window width (eventually we should be able to scroll
left/right)
* On 'tab', expand a breakpoint to show its locations
* Allow enter/space to toggle breakpoints

llvm-svn: 192766
2013-10-16 02:01:41 +00:00
Ben Langmuir ac20991f1d Add a ListWin to cui to show scrollabled lists
Author: Paul Redmond <paul.redmond@intel.com>
llvm-svn: 192765
2013-10-16 02:00:21 +00:00
Enrico Granata ce451cc300 <rdar://problem/15235492>
Extend DummySyntheticProvider to actually use debug-info vended children as the source of information
Make Python synthetic children either be valid, or fallback to the dummy, like their C++ counterparts

This allows LLDB to actually stop bailing out upon encountering an invalid synthetic children provider front-end, and still displaying the non synthetized ivar info

llvm-svn: 192741
2013-10-15 22:42:14 +00:00
Enrico Granata 7dc67a16a4 string.h and clang headers are apparently no longer necessary for SBType to compile
llvm-svn: 192725
2013-10-15 18:14:34 +00:00
Enrico Granata 0e6004b5c9 Unbreak the build on OSX by defining Initialize() and Terminate() for the Windows platform plugin
llvm-svn: 192724
2013-10-15 18:11:29 +00:00
Deepak Panickal 429222c1f6 Patch enabling lldb command line driver to run on windows.
CHANGES:
- Thread locking switched from pthreads to C++11 standard library.
- Abstracted platform specific header includes into 'platform.h'.
- Create editline emulator for windows.
- Emulated various platform dependant functions on windows.
TODO:
- User input currently handled by gets_s(), work started on better handler:
    see _WIP_INPUT_METHOD define blocks in 'ELWrapper.cpp'.
    Aim is to handle 'tab' auto completion on windows.
- Tidy up 'getopt.inc' from lldbHostCommon to serve as LLDB Drivers getopt windows implementation.

llvm-svn: 192714
2013-10-15 15:46:40 +00:00
Deepak Panickal e3eadf0f3b Update makefiles to build PlatformWindows
llvm-svn: 192702
2013-10-15 13:52:20 +00:00
Deepak Panickal a0154f98db Patch to add PlatformWindows, based on Carlo Kok's version from the Windows branch.
llvm-svn: 192693
2013-10-15 12:32:12 +00:00
Greg Clayton ef8180a3f6 <rdar://problem/14972424>
When debugging with the GDB remote in LLDB, LLDB uses special packets to discover the
registers on the remote server. When those packets aren't supported, LLDB doesn't
know what the registers look like. This checkin implements a setting that can be used
to specify a python file that contains the registers definitions. The setting is:

(lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/module.py

Inside module there should be a function:

def get_dynamic_setting(target, setting_name):

This dynamic setting function is handed the "target" which is a SBTarget, and the 
"setting_name", which is the name of the dynamic setting to retrieve. For the GDB
remote target definition the setting name is 'gdb-server-target-definition'. The
return value is a dictionary that follows the same format as the OperatingSystem
plugins follow. I have checked in an example file that implements the x86_64 GDB
register set for people to see:

    examples/python/x86_64_target_definition.py
    
This allows LLDB to debug to any archticture that is support and allows users to
define the registers contexts when the discovery packets (qRegisterInfo, qHostInfo)
are not supported by the remote GDB server.

A few benefits of doing this in Python:
1 - The dynamic register context was already supported in the OperatingSystem plug-in
2 - Register contexts can use all of the LLDB enumerations and definitions for things
    like lldb::Format, lldb::Encoding, generic register numbers, invalid registers 
    numbers, etc.
3 - The code that generates the register context can use the program to calculate the
    register context contents (like offsets, register numbers, and more)
4 - True dynamic detection could be used where variables and types could be read from 
    the target program itself in order to determine which registers are available since
    the target is passed into the python function.
    
This is designed to be used instead of XML since it is more dynamic and code flow and
functions can be used to make the dictionary.

llvm-svn: 192646
2013-10-15 00:14:28 +00:00
Enrico Granata c0f8ca0e74 Add the capability for LLDB to query an arbitrary Python module (passed in as a file path) for target-specific settings
This is implemented by means of a get_dynamic_setting(target, setting_name) function vended by the Python module, which can respond to arbitrary string names with dynamically constructed
settings objects (most likely, some of those that PythonDataObjects supports) for LLDB to parse

This needs to be hooked up to the debugger via some setting to allow users to specify which module will vend the information they want to supply

llvm-svn: 192628
2013-10-14 21:39:38 +00:00
Sylvestre Ledru 6e2c7cbb26 Revert my commit 191617. It added a clang warning (Thanks to Ed Maste). Add a comment
llvm-svn: 192595
2013-10-14 14:06:28 +00:00
Deepak Panickal 421e884b31 Remove added file for the test commit
llvm-svn: 192580
2013-10-14 10:12:30 +00:00
Deepak Panickal 531912d8e4 Test commit
llvm-svn: 192579
2013-10-14 10:07:04 +00:00
Andy Gibbs 7f14630f4a Suppress "using extended field designator is an extension" warning in use of offsetof.
llvm-svn: 192578
2013-10-14 10:00:11 +00:00
Carlo Kok 7438912fb8 Set the architecture from the remote executable when it's not set so the register info can be loaded properly (and thus the callstacks work)
llvm-svn: 192571
2013-10-14 07:09:13 +00:00
Jim Ingham 05d7084ce9 Report the summed hit count in the breakpoint line.
<rdar://problem/15183226>

llvm-svn: 192518
2013-10-12 00:40:02 +00:00
Sean Callanan 3d01e4cf87 Updated IRExecutionUnit to reflect changes in
RTDYLDMemoryManager.

llvm-svn: 192516
2013-10-11 23:49:55 +00:00
Enrico Granata 98f134835f <rdar://problem/15192088>
gdb-format a (as in p/a) would fail as it needed to set a byte size (unsurprisingly enough)
This should be acknowledged by the condition check and not cause a failure

llvm-svn: 192511
2013-10-11 22:09:26 +00:00
Greg Clayton 93e2861b81 <rdar://problem/15191078>
Fixed Module::ResolveSymbolContextForAddress() to be able to also look in the SymbolVendor's SymbolFile's ObjectFile for a more meaningful symbol when a symbol lookup finds a synthetic symbol from the main object file. This will help lookups on MacOSX as the main executable might be stripped, but the dSYM file always has a full symbol table.

llvm-svn: 192510
2013-10-11 22:03:48 +00:00
Greg Clayton eb023e75dc <rdar://problem/13635174>
Added a way to set hardware breakpoints from the "breakpoint set" command with the new "--hardware" option. Hardware breakpoints are not a request, they currently are a requirement. So when breakpoints are specified as hardware breakpoints, they might fail to be set when they are able to be resolved and should be used sparingly. This is currently hooked up for GDB remote debugging. 

Linux and FreeBSD should quickly enable this feature if possible, or return an error for any breakpoints that are hardware breakpoint sites in the "virtual Error Process::EnableBreakpointSite (BreakpointSite *bp_site);" function.

llvm-svn: 192491
2013-10-11 19:48:25 +00:00
Sean Callanan 8c46baca65 Implemented TruncInst in the IRInterpreter.
<rdar://problem/15188389>

llvm-svn: 192489
2013-10-11 19:45:00 +00:00
Richard Mitton 00dec20f7d This reverts r192484, which I really shouldn't have checked in. Apologies.
llvm-svn: 192488
2013-10-11 19:44:23 +00:00
Ed Maste 52b6e8dac0 Use existing llvm::RoundUpToAlignment in ELF note parsing
llvm-svn: 192486
2013-10-11 19:39:42 +00:00
Richard Mitton b5637b62f2 Fixed bad return code, which would cause invalid expressions to silently fail.
llvm-svn: 192484
2013-10-11 19:16:28 +00:00
Ed Maste 5480365b25 Simplify indirect rld_map for mips (rework r192408).
Just pass a Target* into ObjectFileELF::GetImageInfoAddress so that
it can do the extra dereference necessary on MIPS, instead of passing
a flag back to the caller.

Review: http://llvm-reviews.chandlerc.com/D1899
llvm-svn: 192469
2013-10-11 17:39:07 +00:00
Ed Maste 795d2b9f95 Expected FreeBSD failure due to pr 17430
llvm-svn: 192467
2013-10-11 17:24:16 +00:00
Daniel Malea e33c4ba05c Add LLVM license headers to lldb ui frontend
llvm-svn: 192466
2013-10-11 17:13:07 +00:00
Ed Maste 27738bec75 Eliminate integer sign comparison warning
llvm-svn: 192462
2013-10-11 16:30:20 +00:00
Jason Molenda 7b54a4cfeb Expand some embedded tab chars to spaces - no changes other than whitespace.
llvm-svn: 192420
2013-10-11 04:29:38 +00:00
Ed Maste 04a8bab047 Support mips shared object debug info
MIPS's .dyanamic section is read-only.  Instead of using DT_DEBUG for
the pointer to dyld information it uses a separate tag DT_MIPS_RLD_MAP
which points to storage in the read-write .rld_map section, which in
turn points to the dyld information.

Review: http://llvm-reviews.chandlerc.com/D1890
llvm-svn: 192408
2013-10-11 01:16:08 +00:00
Jason Molenda e65c0feb76 Document the QEnvironmentHexEncoded packet, and explain why it is
often preferable to use this instead of QEnvironment.

llvm-svn: 192400
2013-10-10 22:02:09 +00:00
Ed Maste d616c97a81 Update comment (MIPS also has 32-bit opcodes)
llvm-svn: 192388
2013-10-10 19:17:07 +00:00
Ed Maste 1b475f1691 Initial FreeBSD mips64 ProcessMonitor support
Committing early to ease tracking other ongoing POSIX changes.

Review: http://llvm-reviews.chandlerc.com/D1886
llvm-svn: 192387
2013-10-10 19:14:55 +00:00
Greg Clayton 896005804d <rdar://problem/14146606>
Fixed an issue where environment variables that contained special characters '$' and '#' would hose up the GDB server packet. We now use the QEnvironmentHexEncoded packet that has existed for a long time when we need to. Also added code that will stop sending the QEnvironmentHexEncoded and QEnvironment packets if they aren't supported.

llvm-svn: 192373
2013-10-10 17:53:50 +00:00
Greg Clayton dd88bfd092 Removed the -t options from linking flags to avoid having the linker print out all .o files it was linking with.
llvm-svn: 192372
2013-10-10 17:51:57 +00:00
Ed Maste bb59e049ba POSIX dyld: handle extra MIPS link map field
On at least FreeBSD and NetBSD there is an extra field in the dyld link
map struct.  I've left an assert for other OSes (i.e., Linux/mips) until
it's determined if they do the same.

llvm-svn: 192358
2013-10-10 16:09:31 +00:00
Ed Maste d8cc39e653 POSIX RegisterContext for mips64
Based on the POSIX x86_64 register context.  This is sufficient for opening
a mips64 (big endian) core file.  Subsequent changes will connect the
disassembler, dynamic loader support, ABI, etc.

Review: http://llvm-reviews.chandlerc.com/D1873

(Missed "svn add" on this file in r192335)

llvm-svn: 192336
2013-10-10 01:04:21 +00:00
Ed Maste b73f844be3 POSIX RegisterContext for mips64
Based on the POSIX x86_64 register context.  This is sufficient for opening
a mips64 (big endian) core file.  Subsequent changes will connect the
disassembler, dynamic loader support, ABI, etc.

Review: http://llvm-reviews.chandlerc.com/D1873
llvm-svn: 192335
2013-10-10 00:59:47 +00:00
Sean Callanan 394e36dc81 Fixed a leak of ASTStructExtractors and also
made sure we don't keep around no-longer-valid
ASTTransformers.

<rdar://problem/15182379>

llvm-svn: 192333
2013-10-10 00:39:23 +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
Daniel Malea 4c3261d1b3 Initial checkin of curses-based LLDB UI (lui)
LLDB (Terminal) User Interface
==============================
This directory contains the curses user interface for LLDB. To use it, ensure Python can find your lldb module. You may have to modify PYTHONPATH for that purpose:

$ export PYTHONPATH=/path/to/lldb/module

Then, run the lui.py. To load a core file:
$ ./lui.py --core core

To create a target from an executable:
$ ./lui.py /bin/echo "hello world"

To attach to a running process:
$ ./lui.py --attach <pid>


Known Issues
============
1. Resizing the terminal will most likely cause lui to crash.
2. Missing paging in command-window
3. Only minimal testing (on Ubuntu Linux x86_64)

Missing Features
================
- stdin/stdout/stderr windows
- memory window
- backtrace window
- threads window
- tab-completion
- syntax-highlighting (via pygments library)
- (local) variables window
- registers window
- disassembly window
- custom layout

llvm-svn: 192326
2013-10-09 22:11:30 +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
Ed Maste 9715936d9e Add logging for POSIX DYLD failures
llvm-svn: 192322
2013-10-09 19:57:11 +00:00
Matt Kopec 718be877f8 Add exec support for Linux including common support for POSIX.
llvm-svn: 192319
2013-10-09 19:39:55 +00:00
Matt Kopec dc7c73c604 Add error checking to 'cmd' buffer as it may not be available (ie. in the case of exec).
llvm-svn: 192318
2013-10-09 19:23:34 +00:00
Ed Maste 63de98b0a0 Add missing space between words in comment
llvm-svn: 192307
2013-10-09 18:03:24 +00:00
Michael Sartain 15c07b90c0 Re-enable test_convenience_registers_16bit_with_process_attach test for Linux.
Remove 32-bit POSIX register hack in ConvertBetweenRegisterKinds.

llvm-svn: 192306
2013-10-09 17:44:52 +00:00
Daniel Malea 9e9919f043 Allow Process::WaitForProcessToStop to return immediately if process is already in the stopped state
- By default, the above function will wait for at least one event
- Set wait_always=false to make the function return immediately if the process is already stopped

llvm-svn: 192301
2013-10-09 16:56:28 +00:00
Ed Maste 76a3c33d41 Fix filenames in header comment blocks
llvm-svn: 192296
2013-10-09 14:18:45 +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
Sean Callanan c707f32fbe Fixed a bug where variables' byte sizes would not
respect their Clang types if the variables' values
were represented by DWARF constu values.

<rdar://problem/14636499>

llvm-svn: 192267
2013-10-09 02:32:37 +00:00
Sean Callanan 3e68903e58 Fixed a bug in the Materializer where we sent the
wrong information to ValueObjectConstResult.

<rdar://problem/15101795>

llvm-svn: 192264
2013-10-09 02:04:57 +00:00
Michael Sartain 704bf8912e Clean up RegisterContextPOSIX i386 code.
Use 32-bit register enums without gaps on 64-bit hosts.
Don't show 64-bit registers when debugging 32-bit targets.
Add psuedo gpr registers (ax, ah, al, etc.)
Add mmx registers.
Fix TestRegisters.py to not read ymm15 register on 32-bit targets.
Fill out and move gcc/dwarf/gdb register enums to RegisterContext_x86.h

llvm-svn: 192263
2013-10-09 01:28:57 +00:00
Enrico Granata b1c6c489ca <rdar://problem/14923930>
Constant ValueObjects should clear their description as well as their summary. Rationale being that both can depend on deeper-than-constified data
so both are subject to changes in "unpredictable" ways
To see this consider repeatedly po'ing a persistent variable of a type whose -description result changes at each invocation

llvm-svn: 192259
2013-10-09 00:33:55 +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
Enrico Granata 347c2aa3e3 <rdar://problem/14028923>
Implement SBTarget::CreateValueFromAddress() with a behavior equivalent to SBValue::CreateValueFromAddress()
(but without the need to grab an SBValue first just as a starting point to make up another SBValue out of whole cloth)

llvm-svn: 192239
2013-10-08 21:49:02 +00:00
Enrico Granata cf2412d41d Tweak documentation for formats in categories
llvm-svn: 192235
2013-10-08 21:07:22 +00:00
Enrico Granata 4cc21772f3 <rdar://problem/12632394>
Add a format for FourCharCode

This is now safe to do thanks to the "formats in categories" feature

llvm-svn: 192233
2013-10-08 20:59:02 +00:00
Enrico Granata 852cc954db <rdar://problem/11778815>
Formats (as in "type format") are now included in categories
The only bit missing is caching formats along with synthetic children and summaries, which might be now desirable

llvm-svn: 192217
2013-10-08 19:03:22 +00:00
Enrico Granata 64d2a2853b An example of data formatters that generate a summary for a Unicode UTF encoded string represented as a (pointer,length) pair
llvm-svn: 192206
2013-10-08 17:29:27 +00:00
Jason Molenda 64a11733c9 Add entries for arm6m to ArchSpec's g_macho_arch_entries.
<rdar://problem/15099306>

llvm-svn: 192161
2013-10-08 03:01:08 +00:00
Jason Molenda 9e4a006ec2 Clarify how to handle a thread register context with a gap
in the middle because of alignment rules.

llvm-svn: 192159
2013-10-08 02:42:39 +00:00
Richard Smith 8e45293b6d Fix build break: clang no longer supports -ast-dump-xml.
llvm-svn: 192155
2013-10-08 02:19:45 +00:00
Ed Maste 05f5a1d3df Mark tests failing on FreeBSD after r191996
llvm-svn: 192134
2013-10-07 21:25:48 +00:00
Ashok Thirumurthi 52fbac7d90 xfail for gcc tests due to pr17499 (regressions due to r191966).
llvm-svn: 192132
2013-10-07 21:00:29 +00:00
Enrico Granata 41b1653350 --raw was not always doing the right thing w.r.t. one-lining children. This checkin fixes that
llvm-svn: 192116
2013-10-07 17:59:03 +00:00
Sylvestre Ledru fd654c406e Value stored to 'pid' was never read. Found by scan-build http://buildd-clang.debian.net/scan-build/
llvm-svn: 192060
2013-10-06 09:51:02 +00:00
Jason Molenda 27148b3d37 Fix a few errors found when building lldb with newer versions of clang.
<rdar://problem/15148224> 

llvm-svn: 192024
2013-10-05 02:52:22 +00:00
Enrico Granata 938d1d67e8 Cleaner way to work around the lack of delegating constructors on some versions of GCC
llvm-svn: 192013
2013-10-05 00:20:27 +00:00
Enrico Granata 1c127dfbbe <rdar://problem/15154623>
Several CF* data formatters were in the AppKit category
This puts them back where they belong, i.e. in category CoreFoundation

llvm-svn: 192008
2013-10-05 00:03:07 +00:00
Enrico Granata a29cb0bada <rdar://problem/12042982>
This radar extends the notion of one-liner summaries to automagically apply in a few interesting cases

More specifically, this checkin changes the printout of ValueObjects to print on one-line (as if type summary add -c had been applied) iff:
this ValueObject does not have a summary
its children have no synthetic children
its children are not a non-empty base class without a summary
its children do not have a summary that asks for children to show up
the aggregate length of all the names of all the children is <= 50 characters
you did not ask to see the types during a printout
your pointer depth is 0

This is meant to simplify the way LLDB shows data on screen for small structs and similarly compact data types (e.g. std::pair<int,int> anyone?)

Feedback is especially welcome on how the feature feels and corner cases where we should apply this printout and don't (or viceversa, we are applying it when we shouldn't be)

llvm-svn: 191996
2013-10-04 23:14:13 +00:00
Sean Callanan 9076c0fffb Made all other "operator bool"s explicit and ensured
that all clients use them explicitly.  This will hopefully
prevent any future confusion where things get cast to types
we don't expect.

<rdar://problem/15146458>

llvm-svn: 191984
2013-10-04 21:35:29 +00:00
Michael Sartain ec2c9b8eba Remove unused local variable.
llvm-svn: 191974
2013-10-04 19:17:40 +00:00
Ed Maste d45f88b4d0 Correct typo: Intructions -> Instructions
llvm-svn: 191972
2013-10-04 19:01:18 +00:00
Ed Maste db3c60e388 Remove EOL whitespace and redundant break statement
llvm-svn: 191960
2013-10-04 15:29:20 +00:00
Michael Sartain e9dcfb30fb fix class/struct mismatch warning
llvm-svn: 191959
2013-10-04 15:28:56 +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
Daniel Malea 54e14615e7 Add missing GetBroadcasterClassName and event types enum to SBThread.i
llvm-svn: 191933
2013-10-03 22:21:09 +00:00
Enrico Granata 245b3caa57 A more thorough fix for the newlines issue
llvm-svn: 191919
2013-10-03 18:11:24 +00:00
Jason Molenda 82f5930db4 Change two new logging messages from verbose-only to non-verbose
in the unwinder - they're important to flag when debugging an
unwind problem.

llvm-svn: 191882
2013-10-03 07:58:37 +00:00
Enrico Granata 39938938cf <rdar://problem/15118409>
Fix an issue with the new ValueObjectPrinter where in some cases spurious \n would be printed

llvm-svn: 191869
2013-10-03 02:06:02 +00:00
Richard Mitton 5c98c9a216 Fixed TestSettings.py to correctly restore the frame format string.
This fixes TestBreakpointCommand.

llvm-svn: 191868
2013-10-03 01:50:35 +00:00
Jason Molenda 5bbc354edf Tweak logging messages from Ed's prev commit to make it a little more
clear what is happening in this case.

llvm-svn: 191860
2013-10-02 22:11:59 +00:00
Ed Maste 4ae2299b18 Avoid crash in unwinder if ABI isn't available
llvm-svn: 191837
2013-10-02 15:52:33 +00:00
Ed Maste 34f4be1ce6 Fix endianness issue with POSIX dyld plugin
To support cross-endian and big-endian debugging avoid copying target
memory directly into host variables.

llvm-svn: 191826
2013-10-02 14:14:05 +00:00
Filip Pizlo bfcff68516 Fix build after LLVM memory management API changes.
llvm-svn: 191806
2013-10-02 01:43:46 +00:00
Jason Molenda f2dd4ef157 Update RNBRemote to handle the new pseudo_regs field added to DNBRegisterInfo
back in r173096 by Greg.  When constructing a g packet or parsing a G packet,
and we're iterate over our register list, skip registers that are actually
just slices of other, real, registers.  For instance, eax is 32-bits of rax
on x86_64.
<rdar://problem/15104187> 

llvm-svn: 191802
2013-10-01 23:54:23 +00:00
Jason Molenda de111a425c Add a new qGDBServerVersion packet so lldb can query
the name of the remote gdb-protocol server, and get
a version number from it.  This can be useful if lldb
needs to interoperate with a gdb-protocol server with
a known issue or bug.

llvm-svn: 191729
2013-10-01 05:08:22 +00:00
Matt Kopec cc363a78ac Mark watchpoint test as still failing on i386 Linux.
llvm-svn: 191717
2013-10-01 00:02:41 +00:00
Matt Kopec 326bfc5a9e Enabling 32-bit tests for clang on Linux by default (ie. for the buildbot.).
llvm-svn: 191714
2013-09-30 23:33:43 +00:00
Daniel Malea 73435afda7 Fix build with GCC 4.6.2 (non-c++11 compilant compiler)
- delegating c'tors not supported

llvm-svn: 191709
2013-09-30 23:12:05 +00:00
Daniel Malea f6dfe33492 Fix race condition in TestConvenienceVariables.py
- test wasn't checking for a stop reason before issuing the 'script' command
- should resolve intermittent failure on the Linux GCC buildbot

llvm-svn: 191708
2013-09-30 22:54:27 +00:00
Daniel Malea f3903a5ced Disable TestStopHookMultipleThreads.py (on Linux) due to llvm.org/pr15037
- stop hooks sometimes fail to fire on Linux

llvm-svn: 191704
2013-09-30 21:32:25 +00:00
Daniel Malea dfc637b9de Fix CMake build by including ValueObjectPrinter.cpp in list of sources
llvm-svn: 191703
2013-09-30 21:30:44 +00:00
Enrico Granata 6ca84e3758 This test uses ObjC so it should not run on anything != Darwin
llvm-svn: 191698
2013-09-30 20:55:00 +00:00
Enrico Granata eff67bc49e Test case for the previous checkin
llvm-svn: 191697
2013-09-30 20:39:21 +00:00
Enrico Granata 4d93b8cdf3 <rdar://problem/14393032>
DumpValueObject() 2.0

This checkin restores pre-Xcode5 functionality to the "po" (expr -O) command:
- expr now has a new --description-verbosity (-v) argument, which takes either compact or full as a value (-v is the same as -vfull)
 When the full mode is on, "po" will show the extended output with type name, persistent variable name and value, as in
(lldb) expr -O -v -- foo
(id) $0 = 0x000000010010baf0 {
    1 = 2;
    2 = 3;
}

 When -v is omitted, or -vcompact is passed, the Xcode5-style output will be shown, as in
(lldb) expr -O -- foo
{
    1 = 2;
    2 = 3;
}

- for a non-ObjectiveC object, LLDB will still try to retrieve a summary and/or value to display
(lldb) po 5
5
-v also works in this mode
(lldb) expr -O -vfull -- 5
(int) $4 = 5 

On top of that, this is a major refactoring of the ValueObject printing code. The functionality is now factored into a ValueObjectPrinter class for easier maintenance in the future
DumpValueObject() was turned into an instance method ValueObject::Dump() which simply calls through to the printer code, Dump_Impl has been removed

Test case to follow

llvm-svn: 191694
2013-09-30 19:11:51 +00:00
Sylvestre Ledru fbf4a54a43 Update the build documentation for Debian & Ubuntu
llvm-svn: 191635
2013-09-29 10:46:25 +00:00
Sylvestre Ledru 789cefb83c Display the errno error message instead of the id
llvm-svn: 191621
2013-09-28 16:01:26 +00:00
Sylvestre Ledru faa63ce2a2 * Improve the wording (thanks to Ed Maste for the suggestion)
* Add a TODO item

llvm-svn: 191620
2013-09-28 15:57:37 +00:00
Sylvestre Ledru 6c9530b808 Fix a memory leak. Found by both scan-build and coverity. Close CID 1096442
llvm-svn: 191619
2013-09-28 15:50:23 +00:00
Sylvestre Ledru 77c87c0510 If setgid fails for any reason, exit lldb.
scan-build was complaining about:
The return value from the call to 'setgid' is not checked. If an error occurs in 'setgid', the following code may execute with unexpected privileges

llvm-svn: 191618
2013-09-28 15:47:38 +00:00
Sylvestre Ledru 30eff98e7e Remove useless declaration. If match_type == eNameMatchIgnore, we already left this function at the beginning of the method. Found by coverity. Fixes CID 1094188
llvm-svn: 191617
2013-09-28 15:35:02 +00:00
Sylvestre Ledru d28b99374f * mktemp is insecure as it always creates or uses insecure temporary file.
Switch to mkstemp.

* Get and display the error message when an error occurs while creating the temporary file

llvm-svn: 191616
2013-09-28 15:23:41 +00:00
Sylvestre Ledru b027bd212b Remove trailing spaces
llvm-svn: 191613
2013-09-28 14:35:00 +00:00
Jason Molenda c7cda27f79 Mark armv6m as "compatible" with armv7 - that's the
closest ISA.  armv6 wouldn't have the handful of
T32 instructions that the Cortex-M0 ISA specifies.
<rdar://problem/15099306> 

llvm-svn: 191588
2013-09-27 23:29:10 +00:00
Jason Molenda a3a0452831 Add definitions for "armv6m", which indicates a Cortex-M0 processor.
It uses the T16 and a few T32 instructions from the ARMv7-A ISA.
<rdar://problem/15099306> 

llvm-svn: 191587
2013-09-27 23:21:54 +00:00
Daniel Malea db52f34d7d Fix OS Version reporting bug detected by TestPlatform for some Linux 3.x kernels that do not report the update version
- should resolve the current failure on the Linux clang buildbot

llvm-svn: 191568
2013-09-27 21:34:03 +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 f642373cd5 Factor the code that was eliminating redundant breakpoint locations and moving
line breakpoints past the prologue of functions so it can be shared between the
file & line breakpoint resolver, and the source pattern breakpoint resolver,
and then share it.

llvm-svn: 191478
2013-09-27 01:16:58 +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
Jim Ingham e4483cf959 Remove unnecessary checks for thread_plan_sp (we check for this at the top of the function.)
llvm-svn: 191476
2013-09-27 01:13:01 +00:00
Matt Kopec ee969f9f27 Mark 32/64-bit tests as expected fail after root causing and referencing bugzilla.
Fix TestFrames.py error to check against a None pc value.

llvm-svn: 191470
2013-09-26 23:30:59 +00:00
Matt Kopec cc64cc1773 Fix the thread jump test case for 32-bit inferiors. A jump was going back to a function call using a source line number. However, the parameters being passed to the function were setup before the instruction we jumped to. In other words, the source line was associated with assembly after the function parameters had been setup for the function to be called.
llvm-svn: 191457
2013-09-26 20:54:17 +00:00
Carlo Kok bb5c5f8289 missed one Close () call in 191446 overload fix for Posix only code.
llvm-svn: 191455
2013-09-26 20:22:28 +00:00
Ben Langmuir edb3b21792 Fix the command name in the syntax text for _regexp-list
llvm-svn: 191454
2013-09-26 20:00:01 +00:00
Ben Langmuir bcf81ea4bf Fix a couple of typos in the help text for disassemble
llvm-svn: 191452
2013-09-26 19:53:03 +00:00
Carlo Kok b1a63bdf55 On Windows MapViewOfFile requires the offset to be aligned on the system dwAllocationGranularity
llvm-svn: 191447
2013-09-26 18:52:08 +00:00
Carlo Kok a46964f1bb On windows a socket and file descriptor aren't the same kind of handle, pass the type to Close so it uses the right api to close it.
llvm-svn: 191446
2013-09-26 18:49:53 +00:00
Ashok Thirumurthi 8b5773053b Fix the partial backtrace in a recursive inferior compiled with -fomit-frame-pointer.
- Removes the block in UnwindLLDB::AddOneMoreFrame that tests for a bad stack setup,
since it is neither correct (tests the FP GPR), complete (doesn't consider multi-frame
cycles), nor reachable (the construction of RegisterContextLLDB will fail in the case 
where either of the two (why just two?) previous frames have the same canonical frame
address as the frame that we propose adding to the stack).

llvm-svn: 191430
2013-09-26 14:35:59 +00:00
Richard Mitton 0d40120615 Changed fuzz tests to not print their values (we only need to test if access to them does not crash).
This fixes the 'No value' string appearing in the dotest results.

llvm-svn: 191399
2013-09-25 20:48:03 +00:00
Richard Mitton d36c8d23a5 Added a simple legend to the unit test 'dots' output, to aid understandability.
llvm-svn: 191398
2013-09-25 20:47:51 +00:00
Daniel Malea 46a72bb3bf Enable tests affected by llvm.org/pr14637
- to verify that r191392 has the desired effect

llvm-svn: 191396
2013-09-25 19:43:18 +00:00
Richard Mitton 25b092835e Fixed a race condition where the prompt would randomly go missing.
el_gets was using fflush to output it's string, but because we have our own filter running on the piped pty output, fflush only causes the prompt to be written into the pipe, and does not cause the filter code to run immediately.

The simplest fix is to manually block and wait for all editline output to be processed.

This fixes PR 14637.

llvm-svn: 191392
2013-09-25 18:45:59 +00:00
Joerg Sonnenberger 1d073feee0 When using va_list, include cstdarg/stdarg.h.
llvm-svn: 191390
2013-09-25 17:58:23 +00:00
Joerg Sonnenberger e5545ce577 editline headers are under readline/ for NetBSD.
llvm-svn: 191389
2013-09-25 17:57:20 +00:00
Joerg Sonnenberger ca965885e5 si_errno and friends are macros on NetBSD, so #undef them first.
llvm-svn: 191388
2013-09-25 17:56:48 +00:00
Joerg Sonnenberger 34ea0f8a34 NetBSD also has a size field in socket addresses.
llvm-svn: 191387
2013-09-25 17:56:00 +00:00
Joerg Sonnenberger 1e0621cea2 arpa/inet.h is the canonical source of htons and friends.
At least on NetBSD, none of the already included headers pulls it in.

llvm-svn: 191386
2013-09-25 17:53:34 +00:00
Joerg Sonnenberger c75987637b Handle ePathTypePythonDir even in the case of LLDB_DISABLE_PYTHON,
otherwise -Werror builds may fail.

llvm-svn: 191385
2013-09-25 17:52:18 +00:00
Matt Kopec 7663b3a9d0 Add support for TestPluginComands on Linux. Also, rework makefile dsym target.
llvm-svn: 191383
2013-09-25 17:44:00 +00:00
Ashok Thirumurthi bb82b84c34 Cache and restore the frame-format, so that test_set_frame_format doesn't modify the default, as required for TestInferiorAssert.py.
- Also fixes this test case to set/verify a non-default frame-format and explain the intent.

llvm-svn: 191378
2013-09-25 15:30:14 +00:00
Joerg Sonnenberger 340a17595e Convert to UNIX line endings.
llvm-svn: 191367
2013-09-25 10:37:32 +00:00
Enrico Granata 5d5f60c391 Target::m_suppress_synthetic_value was a hack required to disable synthetic values while passing an SBValue to a synthetic child provider, or incur an endless recursion
Now that SBValues can be setup to ignore synthetic values, this is no longer necessary, and so m_suppress_synthetic_value can go away

Another Hack Bites the Dust

llvm-svn: 191338
2013-09-24 22:58:37 +00:00
Ashok Thirumurthi 5e644d9737 Fix an xpass on the buildbots by relaxing a test for PC location in the disassembly.
llvm-svn: 191321
2013-09-24 18:03:57 +00:00
Ashok Thirumurthi 35729bb1f8 Adds an option to resolve a symbol from an address that can be used
to build out the symbol table as addresses are used, and implements
the mechanism for ELF to add stripped symbols from eh_frame.

Uses this mechanism to allow disassembly for addresses corresponding
to stripped symbols for ELF, and provide hooks to implement this for
PE COFF.

Also removes eSymbolContextTailCall in favor of an option for
ResolveSymbolContextForAddress for consistency with the documentation
for eSymbolContextEverything.  Essentially, this is just an option for
interpreting the so_addr.
                  

llvm-svn: 191307
2013-09-24 15:34:13 +00:00
Jason Molenda 378a462c1a Fix a bug where the x86 assembly instruction profiler would not correctly adjust
the CFA instructions when it was profiling an -fomit-frame-pointer function
and a "volatile" register was saved on the stack (e.g. an argument register).
<rdar://problem/15036546>

llvm-svn: 191267
2013-09-24 03:28:54 +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
Han Ming Ong d60982a01b <rdar://problem/14701270>
When logged in as root, just launch debugserver regularly.

llvm-svn: 191230
2013-09-23 22:09:17 +00:00
Virgile Bello 6957195ae5 Various small changes for build of LLDB on Visual Studio 2013 RC (MSVC12)
llvm-svn: 191116
2013-09-20 22:35:22 +00:00
Virgile Bello 1fd7ec75fc Add backslash as path separator for Win32.
llvm-svn: 191115
2013-09-20 22:31:10 +00:00
Virgile Bello 3036a8517f Remove unused friend class forward definitions (causing problem with MSVC anyway).
llvm-svn: 191114
2013-09-20 22:28:42 +00:00
Matt Kopec 2f98353099 Change posix thread so that it creates a breakpoint stop reason if the breakpoint isn't valid for the current thread but specify should stop to false. Also remove selecting a thread on a breakpoint hit.
llvm-svn: 191110
2013-09-20 21:28:39 +00:00
Ashok Thirumurthi 2568f45939 Fix lldb regressions due to r190812 in the case where debug info is present.
Specifically, allows the unwinder to handle the case where sc.function
gets resolved with a pc that is one past the address range of the function
(consistent with a tail call).  However, there is no matching symbol.

Adds eSymbolContextTailCall to provide callers with control over the scope
of symbol resolution and to allow ResolveSymbolContextForAddress to handle
tail calls since this routine is common to unwind and disassembly.

llvm-svn: 191102
2013-09-20 19:05:10 +00:00
Ashok Thirumurthi b742879c35 Add an xfail test as 'expr myfloat' can add digits consistent
with the closest available 32-bit floating point representation.

llvm-svn: 191101
2013-09-20 19:01:20 +00:00