Can't seem to debug D apps on Mac OS Mojave

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Jun 8 10:15:23 UTC 2019


Hi,

I'm trying out using LLDB with both the shipped version on Mac OS 
Mojave (lldb-1001.0.13.3), and also the one provided by Homebrew 
(lldb version 8.0.0), however I have issues:

I can't seem to print out any variables. It works for C++ apps 
built with -g, but not for D apps, e.g.:

Code:

-----
~/dev/d master * $ cat test.d
module test;
void main ( )
{
     int x = 1;

     int y = 2;

     int z = x + y;
}

$ /dev/d master * $ dmd --version
DMD64 D Compiler v2.086.0

$ dmd -g test.d -oftest
-----

With built-in LLDB:

-----
$ ~/dev/d master * $ lldb --version
lldb-1001.0.13.3

$ ~/dev/d master * $ lldb ./test

(lldb) target create "./test"
Current executable set to './test' (x86_64).

(lldb) b test.d : 7
Breakpoint 1: where = test`_Dmain + 24, address = 
0x0000000100000e90

(lldb) r
Process 19968 launched: '/Users/andrejmitrovic/dev/d/test' 
(x86_64)
Process 19968 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = 
breakpoint 1.1
     frame #0: 0x0000000100000e90 test`_Dmain at test.d:8
    5
    6   	    int y = 2;
    7
-> 8   	    int z = x + y;
    9   	}
Target 0: (test) stopped.

(lldb) p x
error: use of undeclared identifier 'x'

(lldb) p y
error: use of undeclared identifier 'y'

(lldb) frame variable
(lldb)
-----

With the one provided by homebrew:

-----
$ export PATH="/usr/local/opt/llvm/bin:$PATH"

$ lldb --version
lldb version 8.0.0

~/dev/d master * $ lldb ./test

(lldb) target create "./test"
Current executable set to './test' (x86_64).

(lldb) b test.d : 7
Breakpoint 1: where = test`_Dmain + 24, address = 
0x0000000100000e90

(lldb) r
Process 20098 launched: '/Users/andrejmitrovic/dev/d/test' 
(x86_64)
Process 20098 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = 
breakpoint 1.1
     frame #0: 0x0000000100000e90 test`_Dmain at test.d:8
    5
    6   	    int y = 2;
    7
-> 8   	    int z = x + y;
    9   	}

(lldb) p x
error: use of undeclared identifier 'x'

(lldb) p y
error: use of undeclared identifier 'y'

(lldb) frame variable
(lldb)
-----

Is there some extra step that's needed to get it working on Mac 
OS? I'm having the same issue trying to use GDB (after going 
through all the certificate stuff..)


More information about the digitalmars-d-ldc mailing list