Commit Graph

8236 Commits

Author SHA1 Message Date
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
Jim Ingham a6195b732d Fix a bug introduced in asynchronous packet sends. We were not setting the packet result, and so
it looked like the async packet send always failed.

<rdar://problem/15657157>

llvm-svn: 197543
2013-12-18 01:24:33 +00:00
Jason Molenda b97f44d9ef Fix how Queue/QueueItem weak pointers are initialized in the ctors.
llvm-svn: 197541
2013-12-18 00:58:23 +00:00
Greg Clayton 2553e49a5d Added missing header files to the Xcode project.
llvm-svn: 197527
2013-12-17 21:42:58 +00:00
Todd Fiala 3d782a5410 Test commit: added comment to tools makefile.
Comment indicates where linux x86_64 lldb-gdbserver
will soon be added to Makefile builds.

llvm-svn: 197318
2013-12-14 07:21:51 +00:00
Jason Molenda c8064ac626 Move the ivars / logic of SBQueue into a QueueImpl class and
change SBQueue to have a shared pointer to its corresponding
QueueImpl object for binary compatibility.
<rdar://problem/15657926> 

llvm-svn: 197300
2013-12-14 01:14:45 +00:00
Greg Clayton c694751a06 Correctly set the working directory when launching processes for both local and remote targets.
llvm-svn: 197266
2013-12-13 19:18:59 +00:00
Greg Clayton 8e9026eee2 Remove #include "lldb/Core/Address.h" from SBQueueItem.h.
llvm-svn: 197265
2013-12-13 19:16:52 +00:00
Greg Clayton 67690bb098 There can be no #includes of and internal headers in lldb::SB* classes, only "lldb/API/SB*" and "lldb/lldb*" headers.
llvm-svn: 197264
2013-12-13 19:14:12 +00:00
Greg Clayton b09c5384b0 Centralized the launching of a process into Target::Launch()
While investigating test suite failures when running the test suite remotely, I noticed we had 3 copies of code that launched a process:
1 - in "process launch" command 
2 - SBTarget::Launch() with args
3 - SBTarget::Launch() with SBLaunchInfo

"process launch" was launching through the platform if it was supported (this is needed for remote debugging) and the 2 and 3 were not.

Now all code is in one place.

llvm-svn: 197247
2013-12-13 17:20:18 +00:00
Sylvestre Ledru a4cc7dec70 Fixes an issue where a signum => name mapping function has multiple case statements that define to the same integral value on my Linux (Ubuntu 12.04, x86_64). It's for SIGIO and SIGPOLL.
In the case that they are both defined the same.
Patch by Todd Fiala (but typos are mine)

llvm-svn: 197221
2013-12-13 09:51:39 +00:00
Greg Clayton d3b16b3c03 Fixed the size of the malloc buffer to match the size of the string that is memcpy'ed so we don't crash in a fiery ball of death when running the test suite on darwin.
llvm-svn: 197200
2013-12-13 02:02:44 +00:00
Greg Clayton 25eec2cc75 Fix to only update the offset for concrete registers (ones that don't have 'slice' or 'composite' key/value pairs).
llvm-svn: 197191
2013-12-13 00:35:21 +00:00
Jason Molenda 5e8dce4dbf Add new Queue, QueueItem, Queuelist, SBQueue, SBQueueItem classes to represent
libdispatch aka Grand Central Dispatch (GCD) queues.  Still fleshing out the
documentation and testing of these but the overall API is settling down so it's
a good time to check it in.
<rdar://problem/15600370> 

llvm-svn: 197190
2013-12-13 00:29:16 +00:00
Greg Clayton 5d9cd184e6 Remove stuff from debugserver Xcode project that didn't belong.
llvm-svn: 197188
2013-12-12 23:45:07 +00:00
Han Ming Ong 3a7c3d1bf8 <rdar://problem/15639995>
debugserver's launch info was cleared unnecessarily. It has important user ID set. Reviewed by Greg Clayton.

llvm-svn: 197182
2013-12-12 22:14:52 +00:00
Ed Maste ccc2ebcc83 test: Skip failure on FreeBSD from test infrastructure issue
test_convenience_registers_16bit_with_process_attach fails due to
pr18200.  The test has a @expectedFailureFreeBSD decorator, but it
appears this does not catch a RuntimError exception raised in the test
infrastructure, so the test still reports failure.  For now just skip
it.

llvm-svn: 197174
2013-12-12 20:26:08 +00:00
Jean-Daniel Dupas 13698b2714 Don't try to guess sys header conditions, and simply check if each signal is defined.
CC: lldb-commits

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

llvm-svn: 197173
2013-12-12 18:12:16 +00:00
Greg Clayton b73a31efe6 Pickup fixes for demangling crashers.
<rdar://problem/15600471>

llvm-svn: 197171
2013-12-12 17:39:39 +00:00
Sylvestre Ledru 6215685ab9 sin_len is not available in the structure sockaddr_in under GNU/Linux. Fix the build failure. Patch by Todd Fiala (and many other who proposed similar patches)
llvm-svn: 197155
2013-12-12 13:45:47 +00:00
Jean-Daniel Dupas b2065ecdd6 Remove useless includes
llvm-svn: 197147
2013-12-12 11:52:05 +00:00
Greg Clayton 4705f8d842 LLDB can crash if given DWARF debug info for a class that has a base class which isn't a complete definition.
<rdar://problem/15594781>

We need to not crash at any cost. We currently detect if any base classes are forward declarations, emit an error string that directs the use to file a compiler bug, and continues by completing the class with no contents. This avoids a clang crash that would usually follow when we call setBase().

llvm-svn: 197108
2013-12-12 01:54:04 +00:00
Enrico Granata 601ec50ac9 Actually initialize the magic pointer to NULL safely
llvm-svn: 197107
2013-12-12 01:47:35 +00:00
Enrico Granata 739050236e Having binary files in a repository is not a good thing
With this checkin, we use the installed clang compiler to build crashinfo.so from crashinfo.c upon every test suite execution
We also try to cleanup after ourselves, which of course will only work if the test suite does not actually crash

llvm-svn: 197106
2013-12-12 01:42:17 +00:00