Commit Graph

8259 Commits

Author SHA1 Message Date
Enrico Granata d9bd4ae77b Patch by Ari Grant
"Open LLDB and run:
(lldb) script print lldb.debugger.GetInputFileHandle()

This puts the debugger into a catatonic state and all interactions seem
to enter a black hole. The reason is that executing this commnand
actually *CLOSES* the input file handle and so all input is dropped on
the floor. Oof!

The fix is simple: flush a descriptor, instead of closing it, when
transferring ownership."

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

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

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

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

llvm-svn: 198809
2014-01-08 23:35:54 +00:00
Greg Clayton 76af996df8 Only check os version for POSIX_SPAWN_CLOEXEC_DEFAULT on desktop builds of LLDB.
llvm-svn: 198800
2014-01-08 22:12:52 +00:00
Greg Clayton 2210624d86 Fixed a kernel panic that would occur if you debug anything on MacOSX 10.7 or earlier due to the use of the POSIX_SPAWN_CLOEXEC_DEFAULT attribute flag that closes all file descriptors on exec. We now dyamically detect the OS version and do the right thing.
llvm-svn: 198776
2014-01-08 18:02:51 +00:00
Todd Fiala 1a63440953 Fixes a bug preventing reading of the python register file.
This change fixes a bug recently introduced in ProcessGDBRemote that
prevented the Python register definition file from getting loaded when
the qRegisterInfo0 response returned $00#.

Patch by Steve Pucci.

llvm-svn: 198742
2014-01-08 07:52:40 +00:00
Enrico Granata ddc793674f Undo test
llvm-svn: 198733
2014-01-08 03:20:06 +00:00
Enrico Granata a048917363 Test
llvm-svn: 198732
2014-01-08 03:19:56 +00:00
Enrico Granata 29726a94ce Alignment fix
llvm-svn: 198731
2014-01-08 03:14:18 +00:00
Enrico Granata af76481caf <rdar://problem/15453076>
When determining the type of array members, do not see-through typedefs
For instance, in BOOL arr[4], we want the elements to be typed as BOOL, not signed char

llvm-svn: 198729
2014-01-08 03:02:33 +00:00
Enrico Granata 6b6ea7ac17 __CFString should also format as an NSString
llvm-svn: 198727
2014-01-08 02:34:42 +00:00
Enrico Granata 0dba9b33f0 New and improved data formatter for std::shared_ptr<> and std::weak_ptr<>
llvm-svn: 198724
2014-01-08 01:36:59 +00:00
Sean Callanan 65b320f783 Fixed a bug where the expression parser doesn't
materialize a variable in a register correctly
if the variable is a pointer.  This fixes a
regression introduced by my commit of Oct. 22nd
(r193191).

llvm-svn: 198718
2014-01-07 23:15:26 +00:00
Greg Clayton 3d5bb3266f Fixed an issue when attaching to a process without specifying a file where we wouldn't set the dyld gdb image notifier breakpoint correctly.
<rdar://problem/15720040>

llvm-svn: 198717
2014-01-07 23:15:02 +00:00
Greg Clayton 966c6f6ddf Fixed issues with ptr_refs:
- If there is only 1 frame ptr_refs now works (fixed issue with stack detection)
- Fixed test for result now that it isn't a pointer anymore

llvm-svn: 198712
2014-01-07 21:55:00 +00:00
Jason Molenda 5a87c0fb37 Update the checks in EmulateInstructionARM::GetFramePointerRegisterNumber
and EmulateInstructionARM::GetFramePointerDWARFRegisterNumber to recognize
the Apple arm convention (of using r7 for the frame pointer, regardless of
thumb or arm) even if the OS does not match Darwin/MacOSX/iOS.  Also 
corrects the behavior for thumb code on non-Apple platforms.
<rdar://problem/14661537> 

llvm-svn: 198648
2014-01-06 23:39:35 +00:00
Todd Fiala fb10118bfa Fix lldb build break due to TypedefNameDecl member signature change.
Patch by Steve Pucci.

llvm-svn: 198635
2014-01-06 20:25:42 +00:00
Jason Molenda 83f1149b30 Use Address::SetLoadAddress() instead of SectionLoadList::ResolveLoadAddress().
The former will set the Address object's offset to the load address value if
it is not present in any section; the latter will only set the Address object
if the load addr is contained in one of its sections.
<rdar://problem/15135987> 

llvm-svn: 198469
2014-01-04 01:37:52 +00:00
Jason Molenda 4b79247750 Don't enforce ABI stack alignment rules on the sigtramp frame --
its stack frame is a constructed, fake thing that may not conform
correctly to these rules.  This fixes a problem where lldb couldn't
backtrace past an asynchronous signal handler (_sigtramp) frame on
a stack on Mac OS X.
<rdar://problem/15035673> 

llvm-svn: 198450
2014-01-03 22:06:25 +00:00
Jason Molenda 1b101ef364 Fix a mistake in the last change I made to ProcessMachCore.cpp.
<rdar://problem/15745397> 

llvm-svn: 198447
2014-01-03 20:46:16 +00:00
Jean-Daniel Dupas de5094ba00 Fix a couple of memory leaks.
llvm-svn: 198178
2013-12-29 20:18:15 +00:00
Jean-Daniel Dupas c6f26f8542 Stop leaking MCRegisterInfo.
llvm-svn: 198177
2013-12-29 20:17:26 +00:00
Enrico Granata 30f287fde5 Add a new way to bind a format to a type: by enum type
The "type format add" command gets a new flag --type (-t). If you pass -t <sometype>, upon fetching the value for an object of your type,
LLDB will display it as-if it was of enumeration type <sometype>
This is useful in cases of non-contiguous enums where there are empty gaps of unspecified values, and as such one cannot type their variables as the enum type,
but users would still like to see them as-if they were of the enum type (e.g. DWARF field types with their user-reserved ranges)

The SB API has also been improved to handle both types of formats, and a test case is added

llvm-svn: 198105
2013-12-28 08:44:02 +00:00
Enrico Granata cb0c85e166 Fix sidebar links
llvm-svn: 198039
2013-12-26 07:23:52 +00:00
Enrico Granata 0e0e9f531f Adding a document that describes the architecture of data formatters. Suggestions and ideas for improvements most welcome
llvm-svn: 198038
2013-12-26 07:21:41 +00:00
Jason Molenda 703a45616c Add a new setting (currently fixed) for how to
interpret core files that contain both a user
process dyld and a kernel executable in them.
Fix an additional method that needs to be 
adjusted depending on this preference as well.
<rdar://problem/15721409> 

llvm-svn: 197931
2013-12-24 02:57:50 +00:00
Jean-Daniel Dupas 9c517c0dd9 Remove wait_for_launch parameter from DoAttachToProcessWithName(). This parameter is redundant as this information is already provided by the ProcessAttachInfo parameter.
CC: lldb-commits

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

llvm-svn: 197923
2013-12-23 22:32:54 +00:00
Ed Maste 4d31d5499f Add decorator for GDB connect test failing on FreeBSD
llvm.org/pr18313

llvm-svn: 197910
2013-12-23 15:22:07 +00:00
Enrico Granata 4939b98a2c Centralize the code for GetValueAsCString() in TypeFormatImpl (the implementing class of "type format ...")
TypeFormatImpl used to just wrap a Format (and Flags for matching), and then ValueObject itself would do the printing deed
With this checkin, the responsibility of generating a value string is centralized in the data formatter (as it should, and already is for summaries) 

This change is good practice per se, and should also enable us to extend the type format mechanism in a cleaner way

llvm-svn: 197874
2013-12-22 09:24:22 +00:00
Enrico Granata 16f35ea9bb <rdar://problem/14822563> - Do not attempt to use a null VariableList or crashes will ensue
llvm-svn: 197862
2013-12-21 08:44:28 +00:00
Enrico Granata 0c0f9dcd91 Add a new-line
llvm-svn: 197860
2013-12-21 08:24:28 +00:00
Enrico Granata 922dd82e09 The one-line printing facility is used by StringSummaryFormat, but that's no reason to have it be part of the public interface of ValueObjectPrinter
That's what friendship is for

llvm-svn: 197859
2013-12-21 08:19:44 +00:00
Enrico Granata 473316f4ea There is no need to use the expression parser to generate true and false - writing in a buffer is good enough
llvm-svn: 197858
2013-12-21 08:09:49 +00:00
Jason Molenda c62bd7bd24 Any time ProcessGDBRemote tries to get the remote's ProcessArchitecture,
it needs to fall back to using the HostArchitecture if a valid one is not
returned.  When doing low-level system debugging we may not have a process
(or the remote stub may not support the qProcessInfo packet) in which case
we should fall back to the architecture we determined via qHostInfo.
<rdar://problem/15713180> 

llvm-svn: 197857
2013-12-21 05:20:36 +00:00
Sean Callanan fd1ca95331 Harden the Objective-C runtime against weird method
signatures.

<rdar://problem/15631996>

llvm-svn: 197843
2013-12-20 23:07:12 +00:00
Sean Callanan 439dcae4a2 Updated our IR processing to reflect best practices
for making pointer-valued constants.

llvm-svn: 197829
2013-12-20 19:55:02 +00:00
Enrico Granata cbbaf7585f All data formatters come in "match exact" and "match regex" styles
This refactoring makes it less error-prone to define formatter types with the correct match schemes

llvm-svn: 197800
2013-12-20 11:32:26 +00:00
Enrico Granata b72a501d86 FormatNavigator has long stopped navigating anything - the generation of possible formatters matches is now done elsewhere
So, rename the class for what it truly is: a FormattersContainer
Also do a bunch of related text substitutions in the interest of overall naming clarity

llvm-svn: 197795
2013-12-20 09:38:13 +00:00
Sean Callanan f4c0a221bc Fixed the AST importer to ensure that base classes
of Objective-C classes are completed, and that
variables of Objective-C types have their types
completed when the variables are reported.

This fixes a long-standing issue where ivars did
not show up correctly on 32-bit OS X.

<rdar://problem/12184093> 

llvm-svn: 197775
2013-12-20 04:09:05 +00:00
Sean Callanan 090e11975d Adjust to the new way LLVM emits modules: it doesn't
specify a pointer size until code gen.  So we just
make all our pointer-sized integer literals 64-bit.
That doesn't seem to hurt anything.

llvm-svn: 197774
2013-12-20 04:07:43 +00:00
Jason Molenda 3d21975a44 Partially revert a patch from Ashok Thirumurthi in r191430.
The original code was not completely correct, but a form of
this check is necessary to avoid an infinite recursion on
some unwind cases where a function unwinds to itself with the
same CFA.  Ashok thought the recursion would be caught in
RegisterContextLLDB but this one isn't - we still need it here.
<rdar://problem/15664282> 

llvm-svn: 197761
2013-12-20 01:05:11 +00:00
Jason Molenda 91e428bc90 Revert one part of Ashok Thirumurthi's patch from September 16, r190812.
In those set of patches, Ashok changed Module::ResolveSymbolContextForAddress 
so that if it failed to find a symbol for a pc, it could back up
the pc value by 1 and re-search for a symbol.

His change to RegisterContextLLDB.cpp partially duplicates that
behavior but it also removes the separate case where we find a
Symbol for the pc address but it's the wrong symbol -- we need to
handle this as well as the lookup-by-pc-finds-no-symbol case.

The most obvious fallout from this regression was that lldb on
Mac OS X couldn't backtrace past __assert_rtn() which tail-calls 
abort().  e.g.

(lldb) bt
* thread #1: tid = 0x5d6ea1, 0x00007fff8ee80866 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fff8ee80866 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff8eb5835c libsystem_pthread.dylib`pthread_kill + 92
    frame #2: 0x00007fff8852ab1a libsystem_c.dylib`abort + 125
    frame #3: 0x00007fff884f49bf libsystem_c.dylib`__assert_rtn + 321
    frame #4: 0x0000000100000f2c a.out`main + 124

(lldb) dis -c 3 -s 0x7fff884f49b3
libsystem_c.dylib`__assert_rtn + 309:
   0x7fff884f49b3:  movq   %rax, -0x11b96242(%rip)   ; gCRAnnotations + 8
   0x7fff884f49ba:  callq  0x7fff8854fd2c            ; symbol stub for: abort

libsystem_c.dylib`basename:
   0x7fff884f49bf:  pushq  %rbp
(lldb) 

in this case, __assert_rtn() is immediately followed by basename() and 
the changes in r190812 didn't back up the pc value to get the correct
function name / unwind info.

<rdar://problem/15367233> 

llvm-svn: 197655
2013-12-19 04:32:42 +00:00
Han Ming Ong 4b5a63cd54 <rdar://problem/15639995>
Allow the root XPC launcher to launch any target as root.

llvm-svn: 197634
2013-12-19 00:35:40 +00:00
Jason Molenda 23f2fcaed8 Fix return type of ReadLibdispatchOffsetsAddress.
llvm-svn: 197632
2013-12-19 00:10:23 +00:00
Jason Molenda 4a5ec88f0d Fix std::string initialization in Queue ctor.
<rdar://problem/15694319> 

llvm-svn: 197631
2013-12-19 00:09:13 +00:00
Jason Molenda 64de91522f Code reorganization in PlatformDarwin for how the libdispatch
offsets structure is read & saved in the platform object -- soon
we'll be getting more than the queue name offset out of this
structure so we'll need to reuse the information in other methods.

llvm-svn: 197620
2013-12-18 22:52:34 +00:00
Ed Maste 48f986faee Workaround QEMU GDB server issue.
During testing I observed QEMU send "$T02thread:01;#04" upon connection,
before any command from LLDB.  This change from gclayton accepts (and
discards) a packet immediately after sending the initial ack, to flush
the GDB remote pipeline.

llvm-svn: 197579
2013-12-18 15:31:45 +00:00
Greg Clayton 6b32f1ec18 <rdar://problem/15668743>
Fixed a crasher that would only occur if Xcode attaches to a remote process first, then launches. 

llvm-svn: 197546
2013-12-18 02:06:45 +00:00
Jason Molenda eadd2cb459 When ProcessMachCore::DoLoadCore() finds *BOTH* a user process dyld and a mach kernel
binary, change to prefer the mach kernel binary by default.

llvm-svn: 197545
2013-12-18 01:56:30 +00:00