Commit Graph

5578 Commits

Author SHA1 Message Date
Enrico Granata 2b8fc66df2 Fix the GetArrayElementType() call so it will not crash when called on a non-array thing
Also, the stride is now a pointer so one can avoid passing it if it's not required

llvm-svn: 205782
2014-04-08 18:36:09 +00:00
Ed Maste 42c549b346 Revert r205769 as it breaks the build on FreeBSD:
error: declaration of constexpr static data member 'spec' requires an
initializer

llvm-svn: 205776
2014-04-08 17:02:25 +00:00
Ed Maste 4a06df95b9 Accept DWARF version 2 and 3 in debug_line tables
Issue reported by Matthew Gardiner.  Further work is necessary to
synchronize LLDB's DWARF classes with the derivatives now in LLVM.

llvm-svn: 205771
2014-04-08 15:12:07 +00:00
Virgile Bello 97a70e4f7e Added i686 architecture (ArchSpec::Core::eCore_x86_32_i686).
llvm-svn: 205770
2014-04-08 14:48:48 +00:00
Virgile Bello 8250ebdd8a Improve demangler to compile with MSVC.
llvm-svn: 205769
2014-04-08 14:46:44 +00:00
Greg Clayton 86e70cb3ac Fixed an issue where if you called:
SBTarget::AddModule(const char *path,
                    const char *triple,
                    const char *uuid_cstr,
                    const char *symfile);
                    
If "symfile" was filled in, it would cause us to not correctly add the module. Same goes for:

SBTarget::AddModule(SBModuleSpec ...)

Where you filled in the symfile.

<rdar://problem/16529799>

llvm-svn: 205750
2014-04-07 23:50:17 +00:00
Greg Clayton c7797accb8 Fixed a case where we could spin indefinitely if we got an error from fgets that isn't EINTR.
<rdar://problem/16535437>

llvm-svn: 205740
2014-04-07 21:37:59 +00:00
Greg Clayton 78d1019703 Cleanup the code a bit.
llvm-svn: 205739
2014-04-07 21:37:03 +00:00
Greg Clayton 521c2278ab Disable JITLoaderGDB on "vendor == apple" for now due to performance slowdowns for every first run process as a global name lookup in all shared libraries if performed.
<rdar://problem/16542894>

llvm-svn: 205734
2014-04-07 20:13:57 +00:00
Greg Clayton d20deac32d Xcode 5 crashes if lldb stops at breakpoint if long c++ template lists are present.
This fix reduces the stack size of SymbolFileDWARF::ParseType(). It seems that clang is not very good at sharing locations on the stack with local variables in large functions that have many blocks and each variable gets unique locations. The reduction in size was done by:
1 - removing some large locals that were default constructed by not used
2 - Placing some larger local variables into std::unique_ptr<> to make them on the heap
3 - removing local variables there were large and being populated but not being used
4 - reducing the size of some typedefs to llvm::SmallVector<T, N> so that N wasn’t excessively large


<rdar://problem/16431645>

llvm-svn: 205640
2014-04-04 18:15:18 +00:00
Greg Clayton c9cf579837 Don’t exit the command interpreter if we get interrupted by an EINTR when calling fgets().
llvm-svn: 205638
2014-04-04 18:11:31 +00:00
Jim Ingham 2e3881c0f5 Remember to clear the cached data for the OptionValueFileSpec in SetValueFromCString.
<rdar://problem/16179718> target.expr-prefix contents appear to be cached for an entire session

llvm-svn: 205636
2014-04-04 18:06:54 +00:00
Greg Clayton 7ec287cda3 Don’t crash when we get an invalid .debug_aranges set, just ignore it. Also print out warning messages if LLDB_CONFIGURATION_DEBUG is defined.
<rdar://problem/16516343>

llvm-svn: 205634
2014-04-04 17:53:30 +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
Ed Maste 0fdeb7158e Avoid crash if symbol returns a null name
llvm-svn: 205555
2014-04-03 19:27:39 +00:00
Jim Ingham 2f4693aa77 Get "dis -c -s" working again.
pr19324

llvm-svn: 205544
2014-04-03 17:16:17 +00:00
Jim Ingham 6c9ed91cca Make the fail messages
llvm-svn: 205497
2014-04-03 01:26:14 +00:00
Jason Molenda 987cbaa09b Add a missing arm64 idef.
llvm-svn: 205488
2014-04-02 23:52:55 +00:00
Jim Ingham 46d005dbc4 Workaround for collision between enum members in LLVM's MachO.h and system headers
on Mac OS X (in particular mach/machine.h).

<rdar://problem/16494607>

llvm-svn: 205480
2014-04-02 22:53:21 +00:00
Greg Clayton 711861fec5 Don’t #include "llvm/Support/MachO.h” as it isn’t needed here.
llvm-svn: 205462
2014-04-02 20:39:20 +00:00
Greg Clayton 3657e9c592 Don’t include “llvm/Support/MachO.h” as it isn’t needed here.
llvm-svn: 205461
2014-04-02 20:38:03 +00:00
Greg Clayton eadcca97cb Don’t #include “llvm/Support/MachO.h” in a header file if we can avoid it.
llvm-svn: 205460
2014-04-02 20:36:22 +00:00
Andrew MacPherson 82aae0d835 Use getpgid() with waitpid() in case the process pgid is not equal to its pid, as is the case with a forked subprocess. Also a couple of fixes for unit test failures from Todd Fiala.
llvm-svn: 205405
2014-04-02 06:57:45 +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
Jim Ingham d80102e420 Add the ability to set python breakpoint commands from the SBBreakpoint & SBBreakpointLocation API's.
You can either provide the function name, or function body text.
Also propagate the compilation error up from where it is checked so we can report compilation errors.

<rdar://problem/9898371>

llvm-svn: 205380
2014-04-02 01:04:55 +00:00
Ed Maste 4e0999bc22 Implement ProcessMonitor::Kill for Linux
On FreeBSD ptrace(PT_KILL) is used to terminate the traced process
(as if PT_CONTINUE had been used with SIGKILL as the signal to be
delivered), and is the desired behaviour for ProcessPOSIX::DoDestroy.

On Linux, after ptrace(PTRACE_KILL) the traced process still exists
and can be interrogated.  It is only upon resume that it exits as though
it received SIGKILL.

As the Linux PTRACE_KILL behaviour is not used by LLDB, rename
BringProcessIntoLimbo to Kill, and change the implementation to simply
call kill() instead of using ptrace.

Thanks to Todd F for testing (Ubuntu 12.04, gcc 4.8.2).

Sponsored by: DARPA, AFRL
Differential Revision: http://llvm-reviews.chandlerc.com/D3159

llvm-svn: 205337
2014-04-01 18:14:06 +00:00
Ed Maste a837576a2a Add mips64 to the list of 64-bit Host architectures
llvm-svn: 205333
2014-04-01 18:06:45 +00:00
Ed Maste af58e02d1c mips64: clean up register context storage
Store the gpr data in a DataBufferHeap and use a DataExtractor to
extract register values with appropriate endianness.  This avoids hard-
coding the register count, and with some further work would allow this
class to provide generic register context storage for any CPU.

llvm-svn: 205329
2014-04-01 17:27:25 +00:00
Ed Maste 70882939f1 Implement ProcessMonitor::Kill for FreeBSD
On FreeBSD ptrace(PT_KILL) is used to terminate the traced process
(as if PT_CONTINUE had been used with SIGKILL as the signal to be
delivered), and is the desired behaviour for ProcessPOSIX::DoDestroy.

On Linux, after ptrace(PTRACE_KILL) the traced process still exists
and can be interrogated.  It is only upon resume that it exits as though
it received SIGKILL.

For now I'm committing only the FreeBSD change, until the Linux change
(review D3159) is successfully tested.

http://llvm.org/pr18894

llvm-svn: 205315
2014-04-01 14:30:56 +00:00
Enrico Granata 7ca1c76520 <rdar://problem/16424592>
For some reason, the libc++ vector<bool> data formatter was essentially a costly no-up, doing everything required of it, except actually generating the child values!

This restores its functionality

llvm-svn: 205259
2014-03-31 23:02:25 +00:00
Ed Maste 801335cc64 Fix one thread timeout logic
This should fix the seemingly-random failures observed on the FreeBSD
buildbot.

llvm-svn: 205241
2014-03-31 19:28:14 +00:00
Jason Molenda f8310d40c8 Include string.h for memset() prototype. Thanks Dmitri.
llvm-svn: 205115
2014-03-29 19:29:04 +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
Jim Ingham 914f4e7092 Add the ability from the SB API's to set the "one thread" timeout
for expression evaluations that try one and then all threads.

<rdar://problem/15598528>

llvm-svn: 205060
2014-03-28 21:58:28 +00:00
Jim Ingham 6c8824d216 Wait for the reply from the 'D' detach packet before tearing down the debugger. Avoids a race
condition where we could end up killing debugserver (and thus the target) before it had a chance
to detach.
Also fix debugserver to send the OK AFTER it detaches to avoid the same race condition.

<rdar://problem/16202713>

llvm-svn: 205043
2014-03-28 20:00:07 +00:00
Greg Clayton 241de26bdf Add the "lldb_complete" .editrc command back in case veteran users of LLDB had .editrc key mappings in their ~/.editrc.
<rdar://problem/16279283>

llvm-svn: 204870
2014-03-26 22:48:57 +00:00
Greg Clayton bc711e0575 Fixed a crasher when using 1 character type names in “type summary”, “type synthetic” and “type filter”.
Also fixed a missing return when making python summary functions on the fly.

<rdar://problem/16265491>

llvm-svn: 204867
2014-03-26 22:35:52 +00:00
Sean Callanan c4ca2c1d60 Made the Materializer not write back variables
if they didn't change, just like it does for
registers.  This makes life easier for kernel
debugging and any other situation where values
are read-only.

<rdar://problem/16367795>

llvm-svn: 204764
2014-03-25 22:30:19 +00:00
Enrico Granata 894f735953 <rdar://problem/14862302>
For small structs, the frame format now prints them as one-liners
This follows the same definition that frame variable does for deciding what a "small struct" is, and as such should be fairly consistent with the variable display in general

llvm-svn: 204762
2014-03-25 22:03:52 +00:00
Andrew MacPherson 6ef17b96aa Make ProcessLinux return true for DetachRequiresHalt() because PTRACE_DETACH requires this.
llvm-svn: 204759
2014-03-25 21:40:04 +00:00
Enrico Granata afcbdb1570 <rdar://problem/14515139>
Add a GetFoundationVersion() to AppleObjCRuntime
This API is used to return and cache the major version of Foundation.framework, which is potentially a useful piece of data to key off of to enable or disable certain ObjC related behaviors (especially in data formatters)

llvm-svn: 204756
2014-03-25 20:53:33 +00:00
Andrew MacPherson c3826b5ba6 Move calls to DisableAllBreakpointSites() and m_thread_list.DiscardThreadPlans() into base Process::Destroy() instead of in subclass DoDestroy() methods.
llvm-svn: 204752
2014-03-25 19:59:36 +00:00
Sean Callanan 9287289d66 Added a missing "break" to avoid falling through
when other cases get added.

llvm-svn: 204751
2014-03-25 19:47:07 +00:00
Sean Callanan 576a4374b7 Fixed the IRInterpreter to ignore call instructions
that call debug-information intrinsics.

llvm-svn: 204750
2014-03-25 19:33:15 +00:00
Todd Fiala 4339f3a434 Improve Elf object file UUID calculation performance.
This change makes significant improvements in the performance of
calculating a UUID within ObjectFileELF, and handles both running
processes and core files correctly. This does lazy evaluation of
UUID generation and caches the result when calculated.

Change by Piotr Rak.

llvm-svn: 204749
2014-03-25 19:29:09 +00:00
Greg Clayton fc03f8fcb6 A fix for: http://llvm.org/bugs/show_bug.cgi?id=19241
When there was no process, the expression options were set to not ignore breakpoints. This causes debug info to be generated and causes errors when evaluating simple expressions.

llvm-svn: 204745
2014-03-25 18:47:07 +00:00
Ed Maste b9fe0dd781 Add ObjectFileJIT library
llvm-svn: 204698
2014-03-25 02:03:28 +00:00
Jim Ingham 2f2c876e4f Make "disassemble -a" work when the target is not running yet. It will dump all the functions matching that address, just like "disassemble -n" does before running.
<rdar://problem/16406570>

llvm-svn: 204689
2014-03-25 00:15:47 +00:00
Greg Clayton 6f228bf965 Add ObjectFile/JIT to the makefile.
llvm-svn: 204685
2014-03-24 23:30:43 +00:00
Greg Clayton 8541258b4e Make cmake build the new ObjectFileJIT.
llvm-svn: 204683
2014-03-24 23:11:37 +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
Greg Clayton baf6e8e4b1 Include <mutex> for std::once.
llvm-svn: 204632
2014-03-24 18:08:18 +00:00
Hafiz Abid Qadeer b768fe5ea1 Renamed a struct from i386 to i386_.
It is to avoid build error when gcc defines i386.

llvm-svn: 204628
2014-03-24 17:33:09 +00:00
Greg Clayton 1d77a8203b Modified patch from Piotr Rak that makes GetSharedModuleList() more thread safe and also fixed a missed member initialization on the copy contractor and also makes the assignment operator safer.
llvm-svn: 204622
2014-03-24 16:50:33 +00:00
Arnaud A. de Grandmaison 62e5f4de3d Cleanup some dead assignements reported by scan-build
No functionnal change.

llvm-svn: 204545
2014-03-22 20:23:26 +00:00
Jim Ingham 7dabe1a1b6 If a single step ends on a breakpoint, it should be reported as a breakpoint hit
even though the underlying exception is a trace exception.

<rdar://problem/15243355>

llvm-svn: 204534
2014-03-22 00:44:41 +00:00
Andrew MacPherson ea77a5528d Suppress SIGSTOP under Linux and don't explicitly call SetResumeSignal() in POSIXThread, instead just let StopInfo handle it.
llvm-svn: 204504
2014-03-21 19:08:37 +00:00
Hafiz Abid Qadeer 8455c44e6c Don't build LLDBWrapPython.cpp for mingw.
Previous check relied on -DLLDB_DISABLE_PYTHON which was not valid as
it is defined in the top level LLDB Makefile which is included after the check.
If this check is moved after the inclusion of top level Makefile then 
BUILT_SOURCES is not properly handled. So I am using the scheme present
in the Host/Makefile.

llvm-svn: 204459
2014-03-21 12:53:28 +00:00
Greg Clayton 56b26a5707 Fixed case typo.
llvm-svn: 204402
2014-03-20 21:45:00 +00:00
Greg Clayton 906e9acf91 Switch over to use the ArchSpec::GetMachine() instead of ArchSpec::GetCore() to keep the code more portable as we add new core types to ArchSpec.
llvm-svn: 204400
2014-03-20 21:31:55 +00:00
Greg Clayton f587f8ec9a Add support for dumping DW_LNE_set_discriminator line table extended entries.
llvm-svn: 204369
2014-03-20 18:31:11 +00:00
Ed Maste d494b29596 Quiet Clang warning about signed/unsigned comparison
llvm-svn: 204360
2014-03-20 17:34:26 +00:00
Jim Ingham e1c34bf380 Guard against reading from host address of 0 in getting the data from a Value.
llvm-svn: 204359
2014-03-20 17:13:28 +00:00
Hafiz Abid Qadeer 10511b2a73 Change the type in va_arg call from char to int.
It is supposed to take fully promoted types.

llvm-svn: 204336
2014-03-20 11:24:44 +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
Saleem Abdulrasool 2643b9053e Core: preprocess out TestPromptFormats
TestPromptFormats appears as though it may be a useful unit test.
Unfortunately, there is no invocation mechanism in place right now.  It is
unclear how to add a unit test for this scenario to the existing tests.  It
would be ideal to remove this entirely, but I am hopeful that this can/will be
pulled out into a test still since it uses a user accessible interface.

llvm-svn: 204309
2014-03-20 06:08:21 +00:00
Enrico Granata fcd974a1ed rdar://16361422
Add NSMutableData to the list of types that the NSData formatter knows to represent

llvm-svn: 204289
2014-03-20 01:15:44 +00:00
Greg Clayton ec99086718 Change the backtrace view into a process tree view where you can expand the process, its threads and see all frames under each thread.
llvm-svn: 204251
2014-03-19 16:22:48 +00:00
Ed Maste a09ed03ce1 Fix expression parsing (on FreeBSD, at least)
This reverts part of r204112 (Expression: cleanup unused include).
It looks like MCJIT.h is required to force MCJIT to be linked.

llvm-svn: 204170
2014-03-18 18:55:06 +00:00
Saleem Abdulrasool 47a35dfd7c Expression: cleanup unused include
The standard JIT has been discarded in favour of MCJIT.  USE_STANDARD_JIT is no
longer defined.  Furthermore, the execution engine is now built in
IRExecutionUnit.  Simply remove inclusion of both JIT headers.

llvm-svn: 204112
2014-03-18 04:43:53 +00:00
Saleem Abdulrasool 44edda0af7 create constants for multichar constants
Multichar constants are not portable as the byte order is undefined.  Use a
constant value instead.  This avoids a warning when compiling with gcc 4.8+
(-Wmultichar) and makes the code more portable.

llvm-svn: 204110
2014-03-18 04:43:47 +00:00
Jim Ingham 0eed738008 Get "ThreadPlanShouldStopHere" to handle auto-stepping through line number 0 code.
llvm-svn: 204087
2014-03-17 23:03:34 +00:00
Ed Maste 263c9280b3 Correct copy-and-pasted comments for DetachOperation
llvm-svn: 204064
2014-03-17 17:45:53 +00:00
Ed Maste b3a5333b07 Update copy-and-pasted log message
llvm-svn: 204057
2014-03-17 17:05:22 +00:00
Greg Clayton 26c1fe3568 Parse DW_AT_ranges for compile units on Darwin when .debug_aranges is not available for the current compile unit.
<rdar://problem/16321434> 

llvm-svn: 203985
2014-03-14 23:36:38 +00:00
Saleem Abdulrasool eb4592b18d build: fix libxml2 detection via CMake
libxml2's include path was unconditionally set to /usr/include/libxml2.  This
would work previously, however, Mavericks removed the /usr/include directory.
Since LLDB already requires clang, which via LLVM's build infrastructure
searches for libxml2, we have a proper include path for libxml2.  If
LIBXML2_FOUND is set, do not touch the libxml2 search path.  Instead, allow the
clang's definition to propagate throughout the LLVM build.  Otherwise, switch to
find_package(LibXml2) as clang does.  This will ensure that the correct path is
used for libxml2 irrespective of the platform.

Furthermore, treat libxml2 as a system provided library.  It is not part of the
LLVM source base so it is of little value to enable all warnings on its headers.
This unifies the treatment of libxml2 across clang and LLDB.

llvm-svn: 203955
2014-03-14 18:23:07 +00:00
Greg Clayton 05da458caf One more time. Multi-line expressions when there is no valid expression that follow “expr [options] —“.
llvm-svn: 203874
2014-03-13 23:48:40 +00:00
Greg Clayton 487143fdd3 Fixed crasher when “expr” was NULL due to no characters following the terminating "--".
llvm-svn: 203873
2014-03-13 23:46:26 +00:00
Greg Clayton cf28a8b7cd Allow a multi-line expression to follow expression commands with options when there is no expression following the option terminating “—“.
llvm-svn: 203872
2014-03-13 23:42:30 +00:00
Todd Fiala 8a5c5a016c Fix cmake build issues on Darwin.
llvm-svn: 203850
2014-03-13 21:16:13 +00:00
Hafiz Abid Qadeer b4bc64962a Changed "Windows.h" to "windows.h".
I missed this one in my earlier commit a few days ago.

llvm-svn: 203787
2014-03-13 11:39:01 +00:00
Hafiz Abid Qadeer a1b42ec0f2 Change type of a few members of a struct from unsigned to signed.
They are used in Windows APIs which expect a signed argument and
cause a build failure on Mingw.

llvm-svn: 203783
2014-03-13 10:47:49 +00:00
Andrew MacPherson eb4d0607bf Create a Process::ModulesDidLoad() method to handle process-related tasks, as suggested by Jim Ingham. Make JITLoader instances use this to probe only new modules for relevant JIT symbols. Also re-enable the JITLoader hooks in Process.
llvm-svn: 203774
2014-03-13 09:37:02 +00:00
Jason Molenda aac16e0f80 Add a SBQueue::GetKind() method to retrieve the type of libdispatch queue (serial or concurrent).
<rdar://problem/7964505>

llvm-svn: 203748
2014-03-13 02:54:54 +00:00
Jim Ingham 4b4b2478fc This commit reworks how the thread plan's ShouldStopHere mechanism works, so that it is useful not only
for customizing "step-in" behavior (e.g. step-in doesn't step into code with no debug info), but also 
the behavior of step-in/step-out and step-over when they step out of the frame they started in.

I also added as a proof of concept of this reworking a mode for stepping where stepping out of a frame
into a frame with no debug information will continue stepping out till it arrives at a frame that does
have debug information.  This is useful when you are debugging callback based code where the callbacks
are separated from the code that initiated them by some library glue you don't care about, among other
things.

llvm-svn: 203747
2014-03-13 02:47:14 +00:00
Jim Ingham 23b95f06e1 Don’t put Radar numbers in code.
llvm-svn: 203737
2014-03-12 23:43:15 +00:00
Jim Ingham 157831313d When clearing a breakpoint site, make sure the owning process still exists before asking it to remove the breakpoint site the rest of the way.
<rdar://problem/16303500>

llvm-svn: 203724
2014-03-12 22:03:13 +00:00
Greg Clayton 88e193a053 If DWARF debug info and verbose mode is enabled ("log enable dwarf info verbose"), then dump all DIEs for a compile unit after all DIEs have been parsed for a compile unit.
llvm-svn: 203692
2014-03-12 18:26:18 +00:00
Greg Clayton 181405d3c2 Allow verbose logging in the "dwarf" log channel.
llvm-svn: 203684
2014-03-12 17:58:29 +00:00
Ed Maste 16860ec640 Add Process/Utility include directory on FreeBSD
Needed after r203667

llvm-svn: 203672
2014-03-12 16:21:57 +00:00
Virgile Bello 3e699d419e Moved various RegisterContext files from Process/POSIX to Process/Utility for easier sharing.
Fix Windows build by adding JITLoaderGDB and ProcessElfCore.
RegisterContext: fixes for Windows build: sizeof(GPR::register) didn't work, switched to sizeof(((GPR*)NULL)->register).

llvm-svn: 203667
2014-03-12 16:04:29 +00:00
Hafiz Abid Qadeer 487767cfc8 Replace some Windows specific string functions with std::string.
llvm-svn: 203654
2014-03-12 10:53:50 +00:00
Hafiz Abid Qadeer 1c03005664 Moved a check in HostGetOpt.h.
It can be used in multiple files now.

llvm-svn: 203652
2014-03-12 10:48:19 +00:00
Hafiz Abid Qadeer 6eff101926 Replace some _MSC_VER with _WIN32.
This allows to use some code for mingw which was previously only
used for MSVC.

llvm-svn: 203651
2014-03-12 10:45:23 +00:00
Hafiz Abid Qadeer bdb515916c Added some missing header files.
They help fix mingw build.

llvm-svn: 203650
2014-03-12 10:39:46 +00:00
Hafiz Abid Qadeer 581eb95983 Add some missing defines that are already present in the cmake side.
This is to help fix mingw build.

llvm-svn: 203649
2014-03-12 10:35:00 +00:00
Sean Callanan e3236a1882 Fixed a problem where the expression parser was
erroneously completing Objective-C classes sourced
from the Objective-C runtime without checking if
there was an authoritative version in the debug
information.

<rdar://problem/16065049>

llvm-svn: 203600
2014-03-11 19:34:04 +00:00
Sean Callanan 339f61549f Followed up on Ed Maste's patch with a few more
User fixes.  Also changed our iterations across
global variables and instruction operands to
reflect the new C++11 approach.

llvm-svn: 203599
2014-03-11 19:19:16 +00:00
Jim Ingham f164d9404d After doing all the work to compute the target ValueObject we want to evaluate, make sure
we actually got something before proceeding.

<rdar://problem/16282875>

llvm-svn: 203591
2014-03-11 18:17:23 +00:00
Saleem Abdulrasool 1108cb3682 update for renaming in LLVM
llvm-svn: 203533
2014-03-11 03:09:08 +00:00
Saleem Abdulrasool 12390847fb build: fix bleeding whitespace
llvm-svn: 203531
2014-03-11 03:08:47 +00:00
Jason Molenda 2528631f12 Minor fix for a logging message.
llvm-svn: 203512
2014-03-10 23:18:34 +00:00
Hafiz Abid Qadeer a667875fb9 Fix Mingw build error by using lower case name for windows header files.
llvm-svn: 203505
2014-03-10 22:31:39 +00:00
Ed Maste bde27d2451 Fix #if 0'd code after range-based for loop change
llvm-svn: 203487
2014-03-10 20:49:37 +00:00
Ed Maste a855309bcd Update LLDB for LLVM iterator change in r203364
What was use_iterator is now user_iterator.  Also switch to range-based
APIs, as in Clang r203365.

(This part of the change was missed in r203463)

Differential Revision: http://llvm-reviews.chandlerc.com/D3030

llvm-svn: 203475
2014-03-10 17:24:16 +00:00
Ed Maste 80e8cc6dee Update LLDB for LLVM iterator change in r203364
What was use_iterator is now user_iterator.  Also switch to range-based
APIs, as in Clang r203365.

llvm-svn: 203463
2014-03-10 14:23:10 +00:00
Jason Molenda e32cd191f0 Correctly add the QueueID to a pending block's extended thread backtrace thread.
Seed the QueueItem objects with the item_refs and addresses when they are fetched
in one batch.  If additional information is needed from the QueueItem, fetch it
lazily one pending item per function call.
<rdar://problem/16270007>, <rdar://problem/16032150> 

llvm-svn: 203449
2014-03-10 08:42:03 +00:00
Jason Molenda 37e9b5ab38 libBacktraceRecording __introspection_dispatch_queue_get_pending_items is
changing the data it returns; this change accepts either the old format or
the new format.  It doesn't yet benefit from the new format's additions -
but I need to get this checked in so we aren't rev-locked.
Also add a missing .i entry for SBQueue::GetNumRunningItems() missing from
the last checkin.
<rdar://problem/16272115> 

llvm-svn: 203421
2014-03-09 21:17:08 +00:00
Jason Molenda fe95dc95b5 SBQueue::GetNumPendingItems() should not force a fetch of the pending
items; the backing Queue object has the number of pending items
already cached.  Also, add SBQueue::GetNumRunningItems() to provide
that information.
<rdar://problem/16272016> 

llvm-svn: 203420
2014-03-09 19:41:30 +00:00
Virgile Bello 2641e383a2 Fix unwind_plan test conditions (could result in NULL memory access).
llvm-svn: 203385
2014-03-09 10:01:25 +00:00
Virgile Bello be6ddab060 PlatformWindows: Fix ObjectFile presence test conditions (could result in NULL memory access)
llvm-svn: 203384
2014-03-09 10:00:40 +00:00
Virgile Bello 89eb1baea3 Implement ObjectFilePECOFF::GetModuleSpecifications().
llvm-svn: 203383
2014-03-09 09:59:36 +00:00
Saleem Abdulrasool 9174593d09 POSIX: fix possible API misuse
memcpy cannot be passed NULL.  Ensuring that the destination pointer is non-NULL
requires checking success.  Rather than performing the success check at that
point, increasing indentation an additional level, fold it into the previous
statement.

llvm-svn: 203359
2014-03-08 20:47:12 +00:00
Saleem Abdulrasool d41fca11af POSIX: fix possible invalid API usage
strcmp cannot be passed a NULL.  Add a short-circuiting check to avoid the
possible API misuse.

llvm-svn: 203358
2014-03-08 20:47:07 +00:00
Saleem Abdulrasool 03700ded1b POSIX: add missing curly braces
It seems that the original commit missed the curly braces for the scope, always
doing the string comparision.

llvm-svn: 203357
2014-03-08 20:47:03 +00:00
Virgile Bello 2756adf377 Implement ObjectFilePECOFF::SetLoadAddress().
llvm-svn: 203350
2014-03-08 17:17:20 +00:00
Virgile Bello ffeba25652 Remove %zx in printf (only GCC supports it, not MSVC).
llvm-svn: 203349
2014-03-08 17:15:35 +00:00
Virgile Bello da0fc76e7f Add inttypes.h to SBQueue.cpp (MSVC compilation error with PRIx32).
llvm-svn: 203348
2014-03-08 16:22:55 +00:00
Jason Molenda ac605f4a3a Add API logging to the SBQueue/SBQueueItem/SBThread calls.
llvm-svn: 203330
2014-03-08 01:34:55 +00:00
Jason Molenda 0d6a1ff23d Fix a small inferior process memory leak in SystemRuntimeMacOSX::PopulatePendingItemsForQueue().
llvm-svn: 203312
2014-03-07 23:28:54 +00:00
Jason Molenda 790b4e527b Re-enable ProcessElfCore for non-FreeBSD/Linux builds; with Greg's fix in r203274
this is not installing itself for Mach-O binaries.

llvm-svn: 203310
2014-03-07 23:23:10 +00:00
Greg Clayton 289dde27a2 Remove unused code.
llvm-svn: 203292
2014-03-07 21:51:19 +00:00
Greg Clayton 9cbd3c628c Verify we have a correct ELF or Mach core file before we return a valid instace of ProcessElfCore or ProcessMachCore respectively.
llvm-svn: 203274
2014-03-07 19:24:39 +00:00
Jim Ingham 4a65fb1f25 Don't hold the ThreadList lock over calls to the GetStatus (Process or Thread) calls
or the lower levels of the Process won't be able to restart.

<rdar://problem/16244835>

llvm-svn: 203233
2014-03-07 11:20:03 +00:00
Jim Ingham a04ef756d4 If you are disabling a hardware breakpoint, use z1 not z0.
<rdar://problem/16256532>

llvm-svn: 203232
2014-03-07 11:18:02 +00:00
Jim Ingham 0ff099f10c The ThreadPlanCallFunction needs to pass its "StopOthers" to its run to address subplan.
llvm-svn: 203231
2014-03-07 11:16:37 +00:00
Ben Langmuir 9f0bac5cd1 Update for clang r203213
llvm-svn: 203217
2014-03-07 08:31:36 +00:00
Jason Molenda e4ea6f5901 Todd points out that my change to ProcessElfCore is probably
not going to key off of the ELF object file like I'd intended.
Revert my change in r203205; also revert Greg's change in
r203107 which builds ProcessElfCore on non-Linux/FreeBSD systems
for the moment until we can straighten this out.

llvm-svn: 203207
2014-03-07 06:28:29 +00:00
Jason Molenda 75fb3d70e2 Only enable ProcessElfCore if this is an ELF file. Right now this plugin is winning over
ProcessMachCore because it doesn't check the format of the file up front.  (this is only now
happening because of Greg's change in r203178 to build ProcessElfCore for non-Linux/FreeBSD
hosts).
<rdar://problem/16257533> 

llvm-svn: 203205
2014-03-07 06:15:24 +00:00
Ahmed Charles 8f926ad0d9 Replace uses of OwningPtr<T> with std::unique_ptr<T>.
llvm-svn: 203200
2014-03-07 04:45:22 +00:00
Greg Clayton f6913cd7af Allow line numbers to be shown in multi-line expressions.
llvm-svn: 203185
2014-03-07 00:53:24 +00:00
Greg Clayton 0e4b605e47 Re-enable the JITLoaderGDB and ProcessElfCore that were disabled by:
Author: ace2001ac
Date: Thu Mar  6 05:30:34 2014
New Revision: 203107

URL: http://llvm.org/viewvc/llvm-project?rev=203107&view=rev
Log:
Fix Windows build break introduced in r203035.

Add '#if defined(__linux__) || defined(__FreeBSD__)' around JITLoaderGDB
and ProcessElfCore, which are only built on Linux and FreeBSD.

Modified:
   lldb/trunk/source/lldb.cpp

Windows will need to start building all files necessary so that JITLoaderGDB and ProcessElfCore can build since they should work on all platforms.

llvm-svn: 203178
2014-03-06 23:29:58 +00:00
Ahmed Charles 943d4a6896 Fix Windows build break introduced in r203035.
Add '#if defined(__linux__) || defined(__FreeBSD__)' around JITLoaderGDB
and ProcessElfCore, which are only built on Linux and FreeBSD.

llvm-svn: 203107
2014-03-06 11:30:34 +00:00
Jason Molenda a8ff543c28 When a client asks for a queue pending item's extended backtrace,
hold a strong pointer to that extended backtrace thread in the Process
just like we do for asking a thread's extended backtrace.
Also, give extended backtrace threads an invalid ThreadIndexID number.
We'll still give them valid thread_id's.  Clients who want to know the
original thread's IndexID can call GetExtendedBacktraceOriginatingIndexID().
<rdar://problem/16126034> 

llvm-svn: 203088
2014-03-06 06:31:18 +00:00
Jim Ingham 82536bdbbf Temporarily disable the JIT loading detector till we figure out why it crashes when lldb follows through exec's...
llvm-svn: 203068
2014-03-06 03:47:34 +00:00
Greg Clayton 4b047f2378 Moved JITLoader.cpp and JITLoaderList.cpp over into "source/Target" since the header files were in "include/lldb/Target".
Also enabled the ELF Core file support in all builds since the header files have been properly separated from ProcessMonitor.

llvm-svn: 203035
2014-03-06 00:14:12 +00:00
Jason Molenda b509a414f0 Add the new JITLoader plugin files to the lldb xcode project file.
Add a cast for a size_t / PRIu64 printf formatter.

llvm-svn: 203030
2014-03-05 23:48:15 +00:00
Ed Maste 32aa12b86c Build JITLoader on FreeBSD also
llvm-svn: 202980
2014-03-05 13:57:24 +00:00
Ed Maste 29150c1731 Put "jit" in alpha order in log category list
llvm-svn: 202976
2014-03-05 13:43:23 +00:00
Andrew MacPherson 17220c1886 Add support for JIT debugging on Linux using the GDB JIT interface. Patch written with Keno Fischer.
llvm-svn: 202956
2014-03-05 10:12:43 +00:00
Jason Molenda 0ddfe7f8dc Small fix to DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule needed
with Greg's change to how we load modules in r202890.

llvm-svn: 202933
2014-03-05 03:33:01 +00:00
Steve Pucci 03904accc0 Add ProcessGDBRemote::GetAuxvData() and fix multiple-packet concatenation for binary data.
ProcessGDBRemote::GetAuxvData obtains the auxv from a remote gdbserver (via a binary-data packet), and returns the data as a DataBufferSP.

The patch includes a small fix to GDBRemoteCommunicationClient::SendPacketsAndConcatenateResponses() to support binary file format packet returns (by not assuming each binary packet is a null-terminated string when concatenating them).

llvm-svn: 202907
2014-03-04 23:18:46 +00:00
Sean Callanan 9bbf3cd3d7 Hardened against reads in the IRMemoryMap that
exceed the bounds of the backing memory.

<rdar://problem/16088322>

llvm-svn: 202899
2014-03-04 21:56:11 +00:00
Greg Clayton 34f1159bbd Fixed SBDebugger.CreateTarget("filename") and also make sure remote targets don't pickup bogus locally cached files.
<rdar://problem/16217254>
<rdar://problem/16078651>

llvm-svn: 202890
2014-03-04 21:20:23 +00:00
Todd Fiala 1251053e04 Get Linux i386 running.
This change uses a fixed known offset for the Linux i386 DR0 register.
This change also undoes the 32-bit wordsize change from r169645 that
revolved around being 32-bit/64-bit friendly in
WriteRegOperation::Execute within the Linux ProcessMonitor.cpp. I ran
all the tests on x86_64 Linux with no failures. I also ran some simple
tests with 32-bit Linux exe on x86_64 host and 32-bit linux exe on
i686 32-bit host and these worked fine.

Note (from Todd): the UserData struct in the Linux i386 register
context (only used by Linux i386 host running Linux 32-bit inferior)
is out of sync with what shows up in the sys/user.h for an 32-bit
Linux build (per an earlier change of mine to make it look more like
x86_64 host running x86 exe). I think we should (1) make i386 Linux
targets run using the same register context (and correct ones) on i386
and x86_64 linux hosts if that is possible, and (2) we could use some
tests around the register handling, particularly to verify things like
DR0 registers are in the right spots on host/target combos that we can
verify vs. known correct values.

Change by Matthew Gardiner.

llvm-svn: 202887
2014-03-04 20:46:32 +00:00
Jim Ingham 8f63266569 Fix a couple of typo's in breakpoint descriptions.
llvm-svn: 202782
2014-03-04 03:09:00 +00:00
Jason Molenda 8d08a78c30 Temporarily revert part of Greg's changes in r202738 which are causing problems with the testsuite and SBDebugger::CreateTarget().
llvm-svn: 202776
2014-03-04 02:07:24 +00:00
Greg Clayton e556a4230c Stop messages from being emitted out of order when detaching.
llvm-svn: 202756
2014-03-03 20:29:02 +00:00
Jim Ingham 8225d59b3f Only require thread scope when we're about to run the function on a thread.
llvm-svn: 202740
2014-03-03 19:16:45 +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 6419e98ee1 Check if the terminal is interactive and set the flags accordingly
llvm-svn: 202726
2014-03-03 15:53:37 +00:00
Deepak Panickal d582f69469 Move Windows getopt for building the DLL
llvm-svn: 202725
2014-03-03 15:52:27 +00:00
Deepak Panickal 627f4ae811 Build liblldb.dll in Windows
llvm-svn: 202724
2014-03-03 15:50:36 +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
Ed Maste 6fa32b6f54 Don't require a valid thread if expr can be evaluated statically
This seems reasonable and the BackticksWithNoTargetTestCase suggests it
should be this way.

llvm-svn: 202722
2014-03-03 15:37:30 +00:00
Jim Ingham 36a02e0655 Make sure the exe_ctx passed to ClangUserExpression::Execute has a valid thread.
<rdar://problem/15949113>

llvm-svn: 202561
2014-03-01 00:17:06 +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
Ed Maste 111387c47b Simplify POSIXThread register context handling
This seems a little more straightforward and is equivalent to r201457
for ELF core files.  A case for FreeBSD i386 is also added (it was
incorrectly using the 64-bit register context and corrupting mememory).

Better (user-facing) error handling is still needed.

Review: http://llvm-reviews.chandlerc.com/D2765
llvm-svn: 202549
2014-02-28 22:15:58 +00:00
Todd Fiala 620ea83926 Fixed configure-based build on OS X.
This change adds a missing include path to the
ObjC LanguageRuntime path to the MacOSX SystemRuntime
plugin's Makefile.

It also adds the panel and curses library to the liblldb
shared library linkage step.

Changes by Jevin Sweval with a minor tweak.

llvm-svn: 202547
2014-02-28 21:55:46 +00:00
Greg Clayton 3121fde41a Be sure to propagate the error back out SBTarget::Attach() when we fail to launch debugserver as root.
<rdar://problem/15669788>

llvm-svn: 202536
2014-02-28 20:47:08 +00:00
Greg Clayton ec67ab1e0c Fixed "process launch --tty" on MacOSX.
llvm-svn: 202535
2014-02-28 20:25:41 +00:00
Greg Clayton b4874f1a70 Fixed all overlapping prompt issues.
I carefully reviewed exactly how the IOHandlers interact and found places where we weren't properly controlling things. There should be no overlapping prompts and all output should now come out in a controlled fashion.

<rdar://problem/16111293>

llvm-svn: 202525
2014-02-28 18:22:24 +00:00
Ed Maste c71f60f4a1 Restore signal delivery to the inferior on FreeBSD
This was broken in the threaded inferior implementation for FreeBSD
(r196787) and caused FreeBSD to resume always with no signal.

llvm-svn: 202513
2014-02-28 17:13:39 +00:00
Ed Maste 2c2f83ef07 Fix types to eliminate compiler warnings in FreeBSD host class
llvm-svn: 202498
2014-02-28 13:46:51 +00:00
Jim Ingham 286fb1ef32 Plumb the EvaluateExpressionOptions::{Set,Get}StopOthers through the SB API, and make it work in RunThreadPlan.
Also remove SetStopOthers from the ThreadPlanCallFunction, because if the value you have doesn't match what is
in the EvaluateExpressionOptions the plan was passed when created it won't work correctly.

llvm-svn: 202464
2014-02-28 02:52:06 +00:00
Sylvestre Ledru 451ca2924c remove useless declarations found thanks to scan-build
llvm-svn: 202440
2014-02-27 22:46:23 +00:00
Todd Fiala 4507f06aaa Fix linux x86 debugging on a linux x86 host (32-bit on 32-bit).
This change fixes up issues with specifying the size of the i386
register infos for FPU registers.  The bug was that for the i386
register context, the size of the FPU registers were still being
computed based on the x86_64 FXSAVE structure.

This change permits the FPR_SIZE macro to optionally be defined
outside of RegisterInfos_i386.h, which RegisterContextLinux_i386.cpp
does properly. It redefines the FPR_i386 structure with all the
accessible parts that RegisterInfos_i386.h wants to see, which we had
not done before when we made the overall size of the structure
properly sized a recently.

This change also modifies POSIXThread to create a
RegisterContextLinux_i386 only when the host is 32-bit; otherwise, it
uses the RegisterContextLinux_x86_64, which works properly for 32-bit
and 64-bit inferiors on a 64-bit host.

I tested this debugging a Linux x86 exe on an x86 host (Ubuntu 13.10
x86), and debugging a Linux x86 exe and a Linux x86-64 exe on an
x86-64 host (Ubuntu 12.04 LTS).  Those cases all worked.

Thanks to Matthew Gardiner who discoverd may key insights into
tracking down the issue. The motivation for this change and some of
the code originates from him via this thread:

http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140224/010554.html

llvm-svn: 202428
2014-02-27 20:46:12 +00:00
Jim Ingham d6efa2a977 Check call to fgetc for EINTR.
<rdar://problem/16140277>

llvm-svn: 202426
2014-02-27 19:48:13 +00:00
Greg Clayton 1681092f96 Remove an assertion that was being hit due to slow DNS name lookups on MacOSX for "localhost".
Changed all "localhost" to "127.0.0.1" to prevent potentially long name lookups.

<rdar://problem/16154630>

llvm-svn: 202424
2014-02-27 19:38:18 +00:00
Greg Clayton fdbad6d5d8 Improve logging a bit by printing the exception or signal type description.
llvm-svn: 202423
2014-02-27 19:35:12 +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
Sylvestre Ledru 7ba631f651 update the declaration from llvm::OwningPtr to llvm::IntrusiveRefCntPtr to match the clang update (r202346) on ASTContext
llvm-svn: 202376
2014-02-27 10:46:57 +00:00
Greg Clayton 19e1135108 A better long term fix for stopping the process when it is running by writing to the pipe that was used for cancel.
We now write a 'q' to indicate to exit the IOHandlerProcessSTDIO::Run(), and a 'i' to interrupt the process. This should make this code safer to use in a signal handler function.

llvm-svn: 202311
2014-02-26 22:47:33 +00:00
Jason Molenda d84f606deb Small fix for i386 extended backtraces; wasn't skipping a
4-byte reserved area when reading the libBacktraceRecording API results.
Also, add a little logging about queues being created.
<rdar://problem/16127752> 

llvm-svn: 202306
2014-02-26 22:27:09 +00:00
Todd Fiala 994f63dc00 Fix x86 32-bit register context definition to build properly on 32 and 64-bit hosts.
This fix changes thee x86 32-bit floating point register area to be
the proper size independent of the host platform.

Note as of this change list, this register context is not yet used
since selecting it exposes issues with watchpoint assertions.

Change by Matthew Gardiner.

llvm-svn: 202285
2014-02-26 18:51:03 +00:00
Ed Maste 0121e43b5b Add libexecinfo for backtrace() on FreeBSD
llvm-svn: 202284
2014-02-26 18:21:42 +00:00
Todd Fiala 86dccb39c2 Fixed lldb cmake build to include missing libpanel/libncurses.
These libraries became necessary recently to link properly.
I think they are needed everywhere non-Windows, but if they
end up breaking on a given platform, we can conditionalize this
further.

llvm-svn: 202282
2014-02-26 17:44:00 +00:00
Sylvestre Ledru 91d2101722 remove useless declaration
llvm-svn: 202281
2014-02-26 17:28:21 +00:00
Todd Fiala 9bb71b73d9 Suppress python readline module under Linux to fix a seg fault.
Bug fix for pr18841:
http://llvm.org/bugs/show_bug.cgi?id=18841

This change creates a stub Python readline.so module that does almost
nothing. Its whole purpose is to prevent Python from loading the real
module, something it does during the embedded Python interpreter's
initialization sequence (and way before lldb ever requests it within
embedded_interpreter.py).

On Ubuntu 12.04 and 13.10 x86_64, and in the Python 2.7.6 tree, the
stock Python readline module links against the GNU readline library.
This appears to be the case on all Pythons except where __APPLE__ is
defined. LLDB now requires linking against the libedit library.
Something about having both libedit.so and libreadline.so linked into
the same process space is causing the Python readline.so to trigger a
NULL memory access. I have put in a separate patch to python.org.

This suppression of embedded interpreter readline support can be
removed if at least any one of the following happens:

1. The stock python distribution accepts a patch similar to what I
submitted to Python 2.7.6's Modules/readline.c file.

2. The stock python distribution implements Modules/readline.c in
terms of libedit's readline compatibility mode (i.e. essentially
compiles it the way __APPLE__ compiles that module) under Linux.

3. a clean-room implementation of the python readline module is
implemented against libedit (either readline compatibility mode or
native libedit). This could be implemented within the readline.cpp
file that this change introduces. It cannot be a fork of python's
readline.c module due to llvm licensing.

The net effect of this change on Linux is that the embedded python's
readline support will not exist.

llvm-svn: 202243
2014-02-26 07:39:20 +00:00
Enrico Granata c6f0a6ac27 <rdar://problem/15593026>
Fix the algorithm used to detect a loop in a std::list

llvm-svn: 202205
2014-02-25 23:34:40 +00:00
Ed Maste 96e51b890b Reapply r184270 by Jim Ingham to avoid abort on FreeBSD
Don't actually Halt in the Interrupt handler for the Process, just
  send an AsyncInterrupt.  That's actually not async-signal-clean, but
  it is a lot safer than Halt...

The underlying problem is actually a nested pthread_cond_wait from the
signal handler.  Note frames 4, 13, 18 in the backtrace of the aborting
path below.

    frame #1: 0x000000080715fff9 libc.so.7`abort + 73 at abort.c:65
    frame #2: 0x0000000805d20fda libthr.so.3`_thread_exit(fname=<unavailable>, lineno=<unavailable>, msg=<unavailable>) + 58 at thr_exit.c:182
    frame #3: 0x0000000805d1fdc8 libthr.so.3`cond_wait_common [inlined] cond_wait_user(mp=<unavailable>, abstime=<unavailable>, cancel=<unavailable>) + 936 at thr_cond.c:223
    frame #4: 0x0000000805d1fd5b libthr.so.3`cond_wait_common(cond=<unavailable>, mutex=<unavailable>, abstime=<unavailable>, cancel=<unavailable>) + 827 at thr_cond.c:311
    frame #5: 0x00000008013450b5 liblldb.so.3.5`lldb_private::Condition::Wait(lldb_private::Mutex&, lldb_private::TimeValue const*, bool*) + 117
    frame #6: 0x00000008013411e8 liblldb.so.3.5`lldb_private::Predicate<bool>::WaitForValueEqualTo(bool, lldb_private::TimeValue const*, bool*) + 200
    frame #7: 0x00000008013eb34c liblldb.so.3.5`lldb_private::Listener::WaitForEventsInternal(lldb_private::TimeValue const*, lldb_private::Broadcaster*, lldb_private::ConstString const*, unsigned int, unsigned int, std::__1::shared_ptr<lldb_private::Event>&) + 876
    frame #8: 0x00000008013eb751 liblldb.so.3.5`lldb_private::Listener::WaitForEvent(lldb_private::TimeValue const*, std::__1::shared_ptr<lldb_private::Event>&) + 81
    frame #9: 0x00000008017c5bcf liblldb.so.3.5`lldb_private::Process::Halt(bool) + 783
    frame #10: 0x00000008017def3a liblldb.so.3.5`IOHandlerProcessSTDIO::Interrupt() + 74
    frame #11: 0x00000008013823d3 liblldb.so.3.5`lldb_private::Debugger::DispatchInputInterrupt() + 115
    frame #12: 0x00000008011d69c5 liblldb.so.3.5`lldb::SBDebugger::DispatchInputInterrupt() + 69
    frame #13: 0x000000000040b254 lldb`sigint_handler(int) + 68
    frame #14: 0x0000000805d1b3da libthr.so.3`handle_signal(actp=<unavailable>, sig=<unavailable>, info=<unavailable>, ucp=<unavailable>) + 234 at thr_sig.c:240
    frame #15: 0x0000000805d1afc2 libthr.so.3`thr_sighandler(sig=<unavailable>, info=<unavailable>, _ucp=<unavailable>) + 306 at thr_sig.c:183
    frame #16: 0x00007ffffffff003
    frame #17: 0x0000000805d1fc7e libthr.so.3`cond_wait_common [inlined] cond_wait_user(mp=<unavailable>, abstime=<unavailable>, cancel=1) + 239 at thr_cond.c:255
    frame #18: 0x0000000805d1fb8f libthr.so.3`cond_wait_common(cond=<unavailable>, mutex=<unavailable>, abstime=0x0000000000000000, cancel=1) + 367 at thr_cond.c:311
    frame #19: 0x00000008013450d2 liblldb.so.3.5`lldb_private::Condition::Wait(lldb_private::Mutex&, lldb_private::TimeValue const*, bool*) + 146

llvm-svn: 202154
2014-02-25 14:20:14 +00:00
Greg Clayton e68f5d6b69 Fixed the command line LLDB so that "CTRL+C" will interrupt a running process again.
llvm-svn: 202086
2014-02-24 22:50:57 +00:00
Jim Ingham 40083a4326 Don’t process the stop reply packet as a generic signal if we already figured out what it was from other data in the packet.
llvm-svn: 202066
2014-02-24 19:49:46 +00:00
Steve Pucci 3c5d3339be Fix handling of gdbserver binary packets with escape characters.
We were not properly handling the escape character 0x7d ('}') in responses
from gdbserver which used the binary protocol.

llvm-svn: 202062
2014-02-24 19:07:29 +00:00
Greg Clayton 039697513e LLDB now handles DW_TAG_unspecified_parameters nested inside function prototypes and we now mark the function prototypes as being variadic.
<rdar://problem/16149526> 

llvm-svn: 202061
2014-02-24 18:53:11 +00:00
Ed Maste c099c958bc Fix ptrace log on i386 and include return value
Patch by Matthew Gardiner

llvm-svn: 202036
2014-02-24 14:07:45 +00:00
Deepak Panickal b98a2bb7a8 Patch for fixing the handling of hardware breakpoints.
Differential Revision: http://llvm-reviews.chandlerc.com/D2826

llvm-svn: 202028
2014-02-24 11:50:46 +00:00
Jim Ingham eac0aa47b4 Oops, probably ought to turn on that fix...
llvm-svn: 201897
2014-02-21 22:36:11 +00:00
Jim Ingham 9d67cc59c4 We have to call waitpid on the lldb side for Mac OS X (even though we've successfully called it
on the debugserver side) when we kill a process or it leaves a zombie around.

llvm-svn: 201896
2014-02-21 22:35:29 +00:00
Greg Clayton 700e5085eb Improved the GDBRemoteCommunicationClient::TestPacketSpeed() function so it tests how long it takes to send a 4MB buffer from the REMOTE GDB server to LLDB.
llvm-svn: 201875
2014-02-21 19:11:28 +00:00
Greg Clayton b922aa9efc Remove the packet speed lines that were "#if 0"'ed out.
llvm-svn: 201873
2014-02-21 19:07:27 +00:00
Greg Clayton 8fe3d4779d Don't crash when we build with python enabled, yet we don't link in the lldb::SB* API layer.
Previously the lldb-platform and lldb-gdbserver would crash.

llvm-svn: 201872
2014-02-21 19:06:44 +00:00
Sylvestre Ledru f561a01a12 remove dead code + simplify a little
llvm-svn: 201865
2014-02-21 18:08:09 +00:00
Jason Molenda 31d7ad4ecf Add a new idea of a "fallback" UnwindPlan to the RegisterContextLLDB
class.  If we try to unwind a stack frame to find a caller stack
frame, and we fail to get a valid-looking frame, AND if the UnwindPlan
we used is an assembly-inspection based UnwindPlan, then we should 
throw away the assembly-inspection UnwindPlan and try unwinding with 
the architectural default UnwindPlan.  

This code path won't be taken if eh_frame unwind instructions are available -
lldb will always prefer those once it's off the zeroth frame.

The problem I'm trying to fix here is the class of unwind failures that
happen when we have hand-written assembly on the stack, with no eh_frame,
and lldb's assembly parser fails to understand the assembly.  People usually
write their hand-written assembly to follow the frame-pointer-preserving
conventions of the platform so the architectural default UnwindPlan will 
often work.  We won't have the spill location for most of the non-volatile
registers if we fall back to this, but it's better than stopping the unwind
prematurely.

This is a bit of a tricky change that I believe is correct, but if we get
unwinds that go of into the weeds / unwind bogus frames at the end of the
stack, I'll need to revisit it.

<rdar://problem/16099440> 

llvm-svn: 201839
2014-02-21 05:20:25 +00:00
Jim Ingham 90331d5cf4 There’s no need to call posix_spawnp_setbinpref_np when we are launching in the shell. That only sets the architecture of the shell, we use “arch —arch” to actually pick the binary we actually want to launch’s architecture.
<rdar://problem/16103187>

llvm-svn: 201831
2014-02-21 01:25:21 +00:00
Hafiz Abid Qadeer 673b4a3fd1 Improve the handling of stop-reply packet when it does not contain
thread information.

llvm-svn: 201773
2014-02-20 10:23:20 +00:00
Juergen Ributzka a864ce741e Revert "Track Clang virtualFileSystem change (r201618)"
This reverts commit r201671, because the clang changes have been reverted.

llvm-svn: 201759
2014-02-20 06:49:12 +00:00
Jim Ingham ff26163768 Don't have both lldb and debugserver call waitpid on the target process. This sets up a race condition,
and if lldb wins, then debugserver won't get the correct error status to lldb.

<rdar://problem/16030008>

llvm-svn: 201744
2014-02-20 00:52:37 +00:00
Sean Callanan 92cdbc8f2d Emit a warning diagnostic if a symbol was promoted
to a variable.  This helps people figure out what
happened if they tried to do something to the variable
and it didn't work because we gave it the default type
of void*.

llvm-svn: 201737
2014-02-19 23:37:25 +00:00
Ed Maste dc97e23b02 Disable breakpoint sites upon detach on FreeBSD
llvm.org/pr18894

llvm-svn: 201724
2014-02-19 22:12:57 +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
Ed Maste a4be2c5dcd FreeBSD hardware watchpoint implementation
Implement x86_64 debug register read/write in support of hardware
watchpoints. Hoist LinuxThread::TraceNotify code back into
POSIXThread::TraceNotify()

Patch by John Wolfe.

We still need to rework this later to avoid the #ifdef FreeBSD.

llvm-reviews.chandlerc.com/D2572
llvm.org/pr16706

llvm-svn: 201706
2014-02-19 18:34:06 +00:00
Ed Maste 954e4b9259 Track Clang virtualFileSystem change (r201618)
Clang now requires calling CompilerInstance::createVirtualFileSystem
before CompilerInstance::createFileManager.

llvm-svn: 201671
2014-02-19 13:00:08 +00:00
Deepak Panickal 6d3df420d2 Initial patch for supporting Hexagon DSP
llvm-svn: 201665
2014-02-19 11:16:46 +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
Enrico Granata bdab3dee8f <rdar://problem/15906684>
The way in which we were determining whether a python module had already been imported in the current session stopped working due to the IOHandler changes
As a result, importing in a new debug session a module which had been imported in a previous session did not work
This commit restores that functionality by checking for the module's presence in the session dictionary (which should be more correct anyway)

llvm-svn: 201623
2014-02-19 01:45:22 +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
Jason Molenda 7b535d5453 Also recognize interrupt as a possible trap handler name.
llvm-svn: 201611
2014-02-18 22:48:27 +00:00
Jason Molenda 33489c1678 Add two additional trap handler names for PlatformDarwinKernel.
<rdar://problem/15246793> 

llvm-svn: 201609
2014-02-18 22:35:38 +00:00
Ed Maste 330fd535f8 elf-core: support 32- and 64-bit x86 registers
This way the same RegisterContext class can support i386 and
amd64/x86_64 core files.

With some further refinement we should be able to merge all of the
processor-specific RegisterContextPOSIX_* classes into a single shared
one.

llvm-svn: 201577
2014-02-18 15:12:35 +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
Deepak Panickal ff4ac8a6e7 Replaced custom variable arguments to standard library for correcting 64 bit Windows build
llvm-svn: 201523
2014-02-17 17:52:22 +00:00
Deepak Panickal 94667bcf70 Fix Windows build, broken by the inclusion of sys/ioctl.h and isatty()
llvm-svn: 201522
2014-02-17 17:43:39 +00:00
Deepak Panickal 0db9d32ff7 Fix the LLDB prompt for older Editline versions, specifically running on Ubuntu 12.04
llvm-svn: 201521
2014-02-17 17:42:25 +00:00
Deepak Panickal f275d09a34 Remove nativecodegen as it forces the native target libraries to be linked in regardless of whether the target was specified in LLVM_TARGETS_TO_BUILD
llvm-svn: 201519
2014-02-17 17:39:27 +00:00
Ed Maste ff8e5f2587 elf-core: Plug latent memory leak
ProcessElfCore::ParseThreadContextsFromNoteSegment was leaking
ThreadData for each ELF note found in core file.  We now allocate it
only once and use std::unique_ptr to ensure it is always being freed.

While at it make ParseFreeBSDThrMisc and ParseFreeBSDPrStatus take
ThreadData by reference, rather than pointer, since those arguments are
not optional.

Patch by Piotr Rak.

http://llvm-reviews.chandlerc.com/D2813

llvm-svn: 201473
2014-02-16 04:01:54 +00:00
Ed Maste 8b5e46a159 Simplify core file register context handling
This seems like a more straightforward approach for instantiating the
appropriate RegisterContext* class, made possible by Michael Sartain's
cleanup of the POSIX RegisterContext class hierarchy in r190647.

Better (user-facing) error handling is still needed.

llvm-svn: 201457
2014-02-15 02:31:22 +00:00
Enrico Granata 465f4bc287 <rdar://problem/16006373>
Revert the spirit of r199857 - a convincing case can be made that overriding a summary's format markers behind its back is not the right thing to do
This commit reverts the behavior of the code to the previous model, and changes the test case to validate the opposite of what it was validating before

llvm-svn: 201455
2014-02-15 01:24:44 +00:00
Jason Molenda 2a6c252df2 Add some additional logging to the Mac OS X SystemRuntime. Fix a bug where lldb could free an inferior's vm_page.
llvm-svn: 201447
2014-02-15 00:20:40 +00:00
Ed Maste 92b1f7e4f9 Allow FreeBSD/i386 core files to be loaded
llvm-svn: 201435
2014-02-14 21:57:27 +00:00
Ed Maste 8b4a283234 Correct offset calculation for FreeBSD i386 core NT_PRSTATUS
llvm-svn: 201434
2014-02-14 21:29:05 +00:00
Jason Molenda 026f389117 Fix minor build warning on Mac OS X x86_64.
llvm-svn: 201387
2014-02-14 05:16:17 +00:00
Jason Molenda a4bea72ee7 Add a new target setting, trap-handler-names, where a user can
specify a list of functions which should be treated as trap handlers.
This will be primarily useful to people working in non-user-level
process debugging - kernels and other standalone environments.
For most people, the trap handler functions provided by the Platform
plugin will be sufficient.

<rdar://problem/15835846>, <rdar://problem/15982682> 

llvm-svn: 201386
2014-02-14 05:06:49 +00:00
Greg Clayton e98008cc58 Fixed deadlocks that could occur when using python for breakpoints, operating system plugins, and other async python usage.
<rdar://problem/16054348>
<rdar://problem/16040833>

llvm-svn: 201372
2014-02-13 23:34:38 +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 2094dbf4e7 Change the way the m_trap_handlers Platform base class ivar is initialized;
add a new pure virtual CalculateTrapHandlerSymbolNames() that Platform 
subclasses must implement which fills in the function name list with any
trap handlers that are expected on that platform.

llvm-svn: 201364
2014-02-13 23:11:45 +00:00
Ed Maste 800e12ac81 Avoid undesired variable shadowing
Michael Sartain refactored RegisterContextPOSIX_* in r192332, and I must
have missed the now-shadowed variable when I rebased the FreeBSD MIPS64
register context after that.

llvm-svn: 201334
2014-02-13 15:12:57 +00:00
Jason Molenda 6223db2778 The Platform base class now maintains a list of trap handlers
aka asynchronous signal handlers, which subclasses should fill
in as appropriate.  For most Unix user process environments,
the one entry in this list is _sigtramp.  For bare-board and
kernel environments, there will be different sets of trap 
handlers.

The unwinder needs to know when a frame is a trap handler 
because the rules it enforces for the frame "above" the
trap handler is different from most middle-of-the-stack frames.

<rdar://problem/15835846> 

llvm-svn: 201300
2014-02-13 07:11:08 +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
Greg Clayton 7a1bd0baa1 Add support for DW_OP_piece and DW_OP_bit_piece.
llvm-svn: 201268
2014-02-12 23:16:19 +00:00
Todd Fiala 729c001ec3 Fix elf core file VMA-contiguous region collapsing.
Elf core files were collapsing core segments when the virtual memory
addresses were contiguous without checking if the core-file-backed
memory region was the same size as the segment's VMA region. Without
this extra check, any time regions were collapsed but the core-backed
region was smaller (and thus had a zero-filled hole at the end), the
collapse operation would break VMA to core file lookups for subsequent
collapsed regions.

This change fixes the following bug:
http://llvm.org/bugs/show_bug.cgi?id=18769

llvm-svn: 201214
2014-02-12 07:29:44 +00:00
Enrico Granata 67530b694c Avoid leaking namebuf in case of an early exit
llvm-svn: 201206
2014-02-12 03:37:33 +00:00
Filipe Cabecinhas 89372e99ba Fix cmake compilation on Mac OS X.
llvm-svn: 201200
2014-02-12 00:57:20 +00:00
Greg Clayton b6892508a6 When a multiline expression produces output, the multi-line help message is printed twice.
<rdar://problem/16031890> 

llvm-svn: 201171
2014-02-11 19:11:11 +00:00
Jason Molenda da276f9013 Adjust the calls to __introspection_dispatch_thread_get_item_info to
use a system-wide unique thread ID instead of a pthread_t to identify
the thread we want debug info for.  Also, free some more memory regions
that needed to be freed.

llvm-svn: 201117
2014-02-11 00:36:18 +00:00
Han Ming Ong a6cad47207 <rdar://problem/15996848>
Made sure we pass along the file action paths for stdin/stdout/stderr to the XPC service.
[Reviewed by Greg Clayton]

llvm-svn: 201103
2014-02-10 19:23:28 +00:00
Saleem Abdulrasool 78c135942d Host: unconstify editline paramters
Although the interface to el_push should be a constant parameter (as it is on
Darwin), certain Linux distributions currently ship a header which does not
provide proper const correctness.  This causes compilation failures on Linux.
Strip the constness on the parameter, which whilst incorrect, is mostly
harmless.  The parameter will not be changed by the interface and so it is
acceptable to do this.  When distributions have updated to a more correct
declaration, it would be nice to revert this change.

Addresses PR18784.

llvm-svn: 201092
2014-02-10 16:10:42 +00:00
Jean-Daniel Dupas 3c6774a172 hostname is guarantee to never be null in this branch.
llvm-svn: 201027
2014-02-08 20:29:40 +00:00
Jean-Daniel Dupas ef37711f85 Fix null dereference if address is NULL.
llvm-svn: 201026
2014-02-08 20:22:05 +00:00
Sylvestre Ledru bfc57f8370 Only set EL_PROMPT_ESC when existing - fix typo
llvm-svn: 201024
2014-02-08 13:26:24 +00:00
Sylvestre Ledru 54e7a77690 Only set EL_PROMPT_ESC when existing
llvm-svn: 201023
2014-02-08 13:25:47 +00:00
Greg Clayton 751caf65c2 Modified ObjectFile::SetLoadAddress() to now be:
ObjectFile::SetLoadAddress (Target &target,
                            lldb::addr_t value,
                            bool value_is_offset);

Now "value" is a slide if "value_is_offset" is true, and "value" is an image base address otherwise. All previous usage of this API was using slides.

Updated the ObjectFileELF and ObjectFileMachO SetLoadAddress methods to do the right thing.

Also updated the ObjectFileMachO::SetLoadAddress() function to not load __LINKEDIT when it isn't needed and to only load sections that belong to the executable object file.

llvm-svn: 201003
2014-02-07 22:54:47 +00:00
Greg Clayton 9b5442aed9 Now that the command interpreter runs in a separate thread in Xcode, we need to lock the target API lock instead of trying to lock it.
What was happening was:
1 - Xcode ran and stopped and was doing work on thread 2
2 - Users would type something in Xcode console on thread 1
3 - thread 3 would be running command interpreter thread and try to execute command but get "failed to get API lock" error for any command that wanted the target API lock (like "expression")

<rdar://problem/15775016>

llvm-svn: 200997
2014-02-07 22:31:20 +00:00
Enrico Granata 41c440fbfe <rdar://problem/12857181>
When a user says

type formatter add ... unsigned int

he most probably means to deal with the "unsigned int" type. However, given how the LLDB command parser works, that command will try to add the formatter to the TWO types 'unsigned' AND 'int'

Since this is unlikely to be what the user wants, warn about it, and suggest they can use quotes to override the debugger's understanding

llvm-svn: 200996
2014-02-07 22:12:55 +00:00
Sean Callanan 3d6ae767a0 When writing data back into a register, accept
values whose size differs from the register's
size.

llvm-svn: 200991
2014-02-07 20:42:44 +00:00
Greg Clayton 4c484ecb31 Fix a bug where we will crash if we have a class "B" that is contained inside a class "A" in the DWARF where "A" is a forward declaration.
<rdar://problem/14673945>
<rdar://problem/15682781>

llvm-svn: 200985
2014-02-07 19:21:56 +00:00
Enrico Granata 1d736c31d6 rdar://15648942
Provide a filter for libc++ std::atomic<T>
This just hides some implementation clutter and promotes the actual content to only child status

llvm-svn: 200984
2014-02-07 19:21:09 +00:00
Sean Callanan 7c435a5ede Lock the JIT before using it.
<rdar://problem/15958296>

llvm-svn: 200951
2014-02-06 22:25:20 +00:00
Sean Callanan d6be7085c2 Removed spurious lookup of the $__lldb_expr
selector when compiling an expression in an
Objective-C context.

<rdar://problem/15797390>

llvm-svn: 200950
2014-02-06 22:24:11 +00:00
Greg Clayton 7524e090e9 Implement ObjectFileMachO::SetLoadAddress().
llvm-svn: 200943
2014-02-06 20:10:16 +00:00