Can't get into debugger in vscode on macOS

Daniel Zuncke daniel.zuncke at gmail.com
Fri Oct 20 05:40:04 UTC 2023


On Thursday, 19 October 2023 at 15:25:36 UTC, ryuukk_ wrote:
> ```
>         "stopOnEntry": true,
> ```

Thanks, my bad I missed that. The entry point I get is a dynamic 
link error and the program exits after trying to do a single step 
(I've put the asm below).

Since calling `./bin/dfmt` works in the terminal and from lldb in 
the terminal I don't see how any linker error makes sense or why 
calling it from code lldb should be different.

The only maybe related thing I can think of is that dmd produces 
linker error too (below). I have both ldc2 and dmd installed but 
dmd doesn't work for me (dmd neither functions if installed with 
brew or the install.sh). I had problems with the debugger already 
when dmd wasn't installed but RemedyBG debugger has problems with 
debugging llvm executables and dmd works so I wanted to try both 
here.

I have found that the cpp debugger works to step around which 
might be enough for now so I am not wasting more time here if I 
don't have to. Thanks for the suggestions though. If you want me 
to try something I can do that.

`stopOnEntry` brings me here:
```asm
; Symbol: _dyld_start
; Source: unknown
1006BD040: 48 89 E7                movq   %rsp, %rdi
1006BD043: 48 83 E4 F0             andq   $-0x10, %rsp
1006BD047: 48 C7 C5 00 00 00 00    movq   $0x0, %rbp
1006BD04E: 6A 00                   pushq  $0x0
1006BD050: E9 BB 0B 00 00          jmp    0x1006bdc10  ; start
```

dmd linker error running `dub build --build debug --compiler 
dmd`; dub.json has  `"lflags": ["-ld_classic", "-v"]` specified 
so I don't know why clang suggests to specify `-v`.
```
@(#)PROGRAM:ld  PROJECT:dyld-1015.7
BUILD 18:48:43 Aug 22 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e 
arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m 
armv7k armv7m armv7em
LTO support using: LLVM version 15.0.0 (static support for 29, 
runtime is 29)
TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.3)
Library search paths:
         /usr/local/opt/dmd/lib
         /usr/local/lib
Framework search paths:
ld: multiple errors: symbol count from symbol table and dynamic 
symbol table differ in 
'/Users/dz/.dub/cache/dfmt/~master/build/application-debug-tVygsEVCB8Pzk4_L3pjNiA/dfmt.o' in '/Users/dz/.dub/cache/dfmt/~master/build/application-debug-tVygsEVCB8Pzk4_L3pjNiA/dfmt.o'; address=0x0 points to section(2) with no content in '/usr/local/opt/dmd/lib/libphobos2.a[3177](config_a68_4c3.o)'
clang: error: linker command failed with exit code 1 (use -v to 
see invocation)
Error: linker exited with status 1
Error dmd failed with exit code 1.
```


More information about the Digitalmars-d-learn mailing list