Debugger (lldb or gdb) does not show variable value in swift code


(Sam Ding) #1

Hi,

I build swift compiler (v4.0) with debug mode ("-d"), however when
debugging compiler swift code, it can not
show the variable value. Here is an example:

         frame #0: 0x00007ffff761d50c
      libswiftCore.so`_allocateUninitializedArray<A>(builtinCount=1) at
      Arrays.swift:3347
         3344 func _allocateUninitializedArray<Element>(_ builtinCount:
      Builtin.Word)
         3345 -> (Array<Element>, Builtin.RawPointer) {
         3346 let count = Int(builtinCount)
      -> 3347 if count > 0 {
         3348 // Doing the actual buffer allocation outside of the
      array.uninitialized
         3349 // semantics function enables stack propagation of the
      buffer.
         3350 let bufferObject = Builtin.allocWithTailElems_1(
      Target 0: (ww) stopped.
      (lldb) p count
      error: in auto-import:
      failed to get module 'Builtin' from AST context
      (lldb)

This happens on both x86_64 and s390x platforms.
Is there any way to make the debugger show the variable values?

Thanks,

Sam Ding,
Linux on z Systems Open Source Ecosystem
IBM Toronto Lab,
email: samding@ca.ibm.com
phone: (905)413-2947


(Alex Blewitt) #2

Do you see the same issue if you build from master?

Alex

···

On 7 Oct 2017, at 00:30, Sam Ding via swift-dev <swift-dev@swift.org> wrote:

Hi,

I build swift compiler (v4.0) with debug mode ("-d"), however when debugging compiler swift code, it can not
show the variable value. Here is an example:
frame #0: 0x00007ffff761d50c libswiftCore.so`_allocateUninitializedArray<A>(builtinCount=1) at Arrays.swift:3347
3344 func _allocateUninitializedArray<Element>(_ builtinCount: Builtin.Word)
3345 -> (Array<Element>, Builtin.RawPointer) {
3346 let count = Int(builtinCount)
-> 3347 if count > 0 {
3348 // Doing the actual buffer allocation outside of the array.uninitialized
3349 // semantics function enables stack propagation of the buffer.
3350 let bufferObject = Builtin.allocWithTailElems_1(
Target 0: (ww) stopped.
(lldb) p count
error: in auto-import:
failed to get module 'Builtin' from AST context
(lldb)

This happens on both x86_64 and s390x platforms.
Is there any way to make the debugger show the variable values?

Thanks,

Sam Ding,
Linux on z Systems Open Source Ecosystem
IBM Toronto Lab,
email: samding@ca.ibm.com
phone: (905)413-2947
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev


(Sam Ding) #3

Hi Alex,

Tested the master branch, which has the same behavior as V4.0 branch.
Just wonder how to debug the compiler swift code if the debugger is not
able to show the values.

Thanks,

Sam Ding,
Linux on z Systems Open Source Ecosystem
IBM Toronto Lab,
email: samding@ca.ibm.com
phone: (905)413-2947

···

From: Alex Blewitt <alblue@apple.com>
To: Sam Ding <samding@ca.ibm.com>
Cc: swift-dev <swift-dev@swift.org>
Date: 10/07/2017 11:33 AM
Subject: Re: [swift-dev] Debugger (lldb or gdb) does not show variable
            value in swift code
Sent by: alblue@apple.com

Do you see the same issue if you build from master?

Alex

      On 7 Oct 2017, at 00:30, Sam Ding via swift-dev <swift-dev@swift.org> wrote:

      Hi,

      I build swift compiler (v4.0) with debug mode ("-d"), however when
      debugging compiler swift code, it can not
      show the variable value. Here is an example:

                  frame #0: 0x00007ffff761d50c
                  libswiftCore.so`_allocateUninitializedArray<A>
                  (builtinCount=1) at Arrays.swift:3347
                  3344 func _allocateUninitializedArray<Element>(_
                  builtinCount: Builtin.Word)
                  3345 -> (Array<Element>, Builtin.RawPointer) {
                  3346 let count = Int(builtinCount)
                  -> 3347 if count > 0 {
                  3348 // Doing the actual buffer allocation outside of the
                  array.uninitialized
                  3349 // semantics function enables stack propagation of
                  the buffer.
                  3350 let bufferObject = Builtin.allocWithTailElems_1(
                  Target 0: (ww) stopped.
                  (lldb) p count
                  error: in auto-import:
                  failed to get module 'Builtin' from AST context
                  (lldb)

      This happens on both x86_64 and s390x platforms.
      Is there any way to make the debugger show the variable values?

      Thanks,

      Sam Ding,
      Linux on z Systems Open Source Ecosystem
      IBM Toronto Lab,
      email: samding@ca.ibm.com
      phone: (905)413-2947
      _______________________________________________
      swift-dev mailing list
      swift-dev@swift.org
      https://lists.swift.org/mailman/listinfo/swift-dev