Xcode 7 breakpoint log message doesn't reliably include expression results

Originator:tschmelter
Number:rdar://23464082 Date Originated:11/9/2015
Status:Open Resolved:
Product:Developer Tools Product Version:7.1
Classification: Reproducible:
 
Summary:
I'm using Xcode 7.1 to develop a project that I'm trying to debug, and have attempted to do so using breakpoint log messages while invoking my functions via unit tests. However, it appears that I've either misunderstood something about breakpoint logging, or uncovered a bug in Xcode: when I attempt to use breakpoint logging within a function, the log message does not include the value of the incoming parameter, although it does include a local variable.

Steps to Reproduce:
Given this struct:


    struct Foo: CustomStringConvertible  {
        var s: String
    
        func printAFoo(fooToPrint: Foo) {
            let i=1
            // Breakpoint message text:
            //   %B From debugger: fooToPrint=@fooToPrint@; i=@i@
            print("printAFoo: From code: \(fooToPrint); i:\(i)")
        }
    
    }
    
    // MARK: - CustomStringConvertible
    extension Foo {
        var description: String {
            return "\(s)"
        }
    }

I set a breakpoint debugging message at the indicated line and invoke as follows:

    let foo = Foo(s: "Original string")
    foo.printAFoo(foo)


And get the output:

    printAFoo(_:) From debugger: fooToPrint=; i=1
    printAFoo: From code: Original string; i:1



Expected Results:
I expect to see in the log console: 

    printAFoo(_:) From debugger: fooToPrint=Original string; i=1
    printAFoo: From code: Original string; i:1


Actual Results:
I see in the log console:

    printAFoo(_:) From debugger: fooToPrint=; i=1
    printAFoo: From code: Original string; i:1


Version:
Xcode 7.1, OS X 10.11.1

Notes:
I've noticed this behavior is inconsistent: I originally was troubleshooting this issue against a mutating function and noticed that the breakpoint log message wasn't printing any @expr@ tagged values (including the local i variable), but was printing all of them as expected in a non-mutating function. As I continued to poke around, I saw that the incoming parameter expression stopped logging for the non-mutating function as well.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!