title: error: use of undeclared type '$__lldb_context' in NSAttributedString extension
body: <p>Given the following Swift code, saved in bug.swift, and using Xcode 8.2.1 or Xcode 8.3 beta 2:</p>
  
  <pre><code>import Foundation
  
  protocol MyProtocol {
      func foo() -&gt; String
  }
  
  extension MyProtocol {
      func foo() -&gt; String {
          return "\(self)"
      }
  }
  
  extension String: MyProtocol {}
  extension NSAttributedString: MyProtocol {}
  
  let normal = "normal".foo()
  let attributed = NSAttributedString(string: "attributed", attributes: [:]).foo()
  </code></pre>
  
  <p>Run the following commands:</p>
  
  <pre><code>swiftc -g bug.swift
  lldb bug
  </code></pre>
  
  <p>LLDB launches. Now, run these commands, and observe the output. Where I pass <code>9</code>, pass the line in your <code>bug.swift</code> that contains <code>return "\(self)"</code>:</p>
  
  <pre><code>(lldb) target create "bug"
  Current executable set to 'bug' (x86_64).
  (lldb) b 9
  Breakpoint 1: where = bug`(extension in bug):bug.MyProtocol.foo () -&gt; Swift.String + 19 at bug.swift:9, address = 0x0000000100001e53
  (lldb) run
  Process 16370 launched: '/Users/zev/Desktop/bug' (x86_64)
  Process 16370 stopped
  * thread #1: tid = 0x31730e, 0x0000000100001e53 bug`MyProtocol.foo(self="normal") -&gt; String + 19 at bug.swift:9, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
      frame #0: 0x0000000100001e53 bug`MyProtocol.foo(self="normal") -&gt; String + 19 at bug.swift:9
     6    
     7    extension MyProtocol {
     8        func foo() -&gt; String {
  -&gt; 9            return "\(self)"
     10       }
     11   }
     12   
  (lldb) po self
  "normal"
  
  
  (lldb) c
  Process 16370 resuming
  Process 16370 stopped
  * thread #1: tid = 0x31730e, 0x0000000100001e53 bug`MyProtocol.foo(self=0x00007fff5fbff480) -&gt; String + 19 at bug.swift:9, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
      frame #0: 0x0000000100001e53 bug`MyProtocol.foo(self=0x00007fff5fbff480) -&gt; String + 19 at bug.swift:9
     6    
     7    extension MyProtocol {
     8        func foo() -&gt; String {
  -&gt; 9            return "\(self)"
     10       }
     11   }
     12   
  (lldb) po self
  error: &lt;EXPR&gt;:1:11: error: use of undeclared type '$__lldb_context'
  extension $__lldb_context {                            
            ^~~~~~~~~~~~~~~
  
  error: &lt;EXPR&gt;:18:5: error: use of unresolved identifier '$__lldb_injected_self'
      $__lldb_injected_self.$__lldb_wrapped_expr_2(     
      ^~~~~~~~~~~~~~~~~~~~~
  </code></pre>
  
  <p>The first time we hit the breakpoint, we're in <code>String</code>'s conformance to <code>MyProtocol</code>, and we can successfully <code>po self</code>.</p>
  
  <p>However, the second time we hit the breakpoint, we're in <code>NSAttributedString</code>'s conformance to <code>MyProtocol</code>, and LLDB prints gibberish instead of the expected output from <code>po self</code>.</p>
  
  <p>Why does LLDB sometimes fail to print anything useful? This is a contrived example, but I run into this all the time in my day-to-day use of LLDB.</p>