vadimcn / codelldb

A native debugger extension for VSCode based on LLDB
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
MIT License
2.54k stars 245 forks source link

Debugger show panel momentarily and skip all break points #108

Closed yehielliv closed 6 years ago

yehielliv commented 6 years ago

Which OS: High Sierra 10.13.4+ Which extension version: 0.8.6 Which LLDB version: lldb-902.0.79.2 Which VSCode version: 1.23.1 What is the problem and how did you get there: I try simple program with 2 breakpoints. I get in the debug console 3 locations added to breakpoint 2 Hello, world! Hello, world! Process exited with code 0. No error was reported and at the breakpoint window the lines c++ on throw and C++ on catch are marks as well as the breakpoints. What did you expect to have happened instead: The lower status line of VS Code was flashing orange and then back to blue. The debug panel show momentarly and disappear without the debugger stop at the first breakpoint.

I send the output though no error report was displayed.

Starting new session with: { type: 'lldb', request: 'launch', name: 'Debug', program: '${workspaceFolder}/rusty/src/main', args: [], cwd: '${workspaceFolder}' } (lldb) command script import '/Users/elivnat/.vscode/extensions/vadimcn.vscode-lldb-0.8.6/adapter' (lldb) script adapter.main.run_tcp_session(0, 'e30=') Listening on port 51457
vadimcn commented 6 years ago

Try setting "stopOnEntry": true. When it breaks, examine state of breakpoints with break list. Are they resolved?

Do breakpoints work in command line lldb?

BTW, which language are you debugging?

yehielliv commented 6 years ago

When use stopOnEntry it stop and display assembly. I use break list with throw and I got break list Current breakpoints: 1: file = 'main.rs', line = 2, exact_match = 0, locations = 0 (pending) 2: file = 'main.rs', line = 3, exact_match = 0, locations = 0 (pending) 2: Exception breakpoint (catch: on throw: on) using: names = {'cxa_begin_catch', 'cxa_throw', '__cxa_rethrow'}, modules(2) = libc++abi.dylib, libSystem.B.dylib without throw Current breakpoints: 1: file = 'main.rs', line = 2, exact_match = 0, locations = 0 (pending) 2: file = 'main.rs', line = 3, exact_match = 0, locations = 0 (pending)

I can advance through the assembly code. the code is: ; id = {0x00000003}, range = [0x000000000000119c-0x000000000000120f), mangled="_dyld_start" ; Source location: unknown 10009019C: 5F popq %rdi 10009019D: 6A 00 pushq $0x0 10009019F: 48 89 E5 movq %rsp, %rbp 1000901A2: 48 83 E4 F0 andq $-0x10, %rsp 1000901A6: 48 83 EC 10 subq $0x10, %rsp 1000901AA: 8B 75 08 movl 0x8(%rbp), %esi 1000901AD: 48 8D 55 10 leaq 0x10(%rbp), %rdx 1000901B1: 4C 8B 05 08 C4 04 00 movq 0x4c408(%rip), %r8 ; _dyld_start_static 1000901B8: 48 8D 0D DD FF FF FF leaq -0x23(%rip), %rcx ; <+0> 1000901BF: 4C 29 C1 subq %r8, %rcx 1000901C2: 4C 8D 05 37 EE FF FF leaq -0x11c9(%rip), %r8 1000901C9: 4C 8D 4D F8 leaq -0x8(%rbp), %r9 1000901CD: E8 3D 00 00 00 callq 0x10009020f ; dyldbootstrap::start(macho_header const*, int, char const*, long, macho_header const, unsigned long) 1000901D2: 48 8B 7D F8 movq -0x8(%rbp), %rdi 1000901D6: 48 83 FF 00 cmpq $0x0, %rdi 1000901DA: 75 10 jne 0x1000901ec ; <+80> 1000901DC: 48 89 EC movq %rbp, %rsp 1000901DF: 48 83 C4 08 addq $0x8, %rsp 1000901E3: 48 C7 C5 00 00 00 00 movq $0x0, %rbp 1000901EA: FF E0 jmpq %rax 1000901EC: 48 83 C4 10 addq $0x10, %rsp 1000901F0: 57 pushq %rdi 1000901F1: 48 8B 7D 08 movq 0x8(%rbp), %rdi 1000901F5: 48 8D 75 10 leaq 0x10(%rbp), %rsi 1000901F9: 48 8D 54 FE 08 leaq 0x8(%rsi,%rdi,8), %rdx 1000901FE: 48 89 D1 movq %rdx, %rcx 100090201: 4C 8B 01 movq (%rcx), %r8 100090204: 48 83 C1 08 addq $0x8, %rcx 100090208: 4D 85 C0 testq %r8, %r8 10009020B: 75 F4 jne 0x100090201 ; <+101> 10009020D: FF E0 jmpq *%rax I use rust language with a simple file with 2 lines just to check the lldb.

When I tried to use the Toggle Disassembly command I got this error Internal debugger error: Traceback (most recent call last): File "/Users/elivnat/.vscode/extensions/vadimcn.vscode-lldb-0.8.6/adapter/debugsession.py", line 1257, in handle_message result = handler(args) File "/Users/elivnat/.vscode/extensions/vadimcn.vscode-lldb-0.8.6/adapter/debugsession.py", line 1193, in DEBUG_displaySettings self.update_display_settings(args) File "/Users/elivnat/.vscode/extensions/vadimcn.vscode-lldb-0.8.6/adapter/debugsession.py", line 1201, in update_display_settings format = settings['displayFormat'] KeyError: 'displayFormat'

vadimcn commented 6 years ago

How did you compile your program? If you are using rustc directly, you need to pass -g to have it generate the debug info.

yehielliv commented 6 years ago

I'm using Cargo to build and run. I'm using VS Code as IDE.

yehielliv commented 6 years ago

I also tried with cargo build -v command and still it shows only assembly. I used the the switch command for assembly and still it shows assembly.

yehielliv commented 6 years ago

I also tried rustic with -g switch and got the same issue like cargo. cargo build -v Compiling rusty v0.1.0 (file:///Users/elivnat/Documents/VSCode/workspace%20rust) Running `rustc --crate-name rusty rusty/src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=b81939394a3d1b8c -C extra-filename=-b81939394a3d1b8c --out-dir '/Users/elivnat/Documents/VSCode/workspace rust/target/debug/deps' -C 'incremental=/Users/elivnat/Documents/VSCode/workspace rust/target/debug/incremental' -L 'dependency=/Users/elivnat/Documents/VSCode/workspace rust/target/debug/

vadimcn commented 6 years ago

What is the output of image lookup -v -n main ?

yehielliv commented 6 years ago

This command does not for me.Can you elaborate more?

On Monday, May 14, 2018, 3:25:12 PM PDT, Vadim Chugunov <notifications@github.com> wrote:  

What is the output of image lookup -v -n main ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

vadimcn commented 6 years ago

You'll need to enter this command in the debug console once debugger has stopped on entry.

yehielliv commented 6 years ago

Thanks. I got this image lookup -v -n main 1 match found in /Users/elivnat/Documents/VSCode/workspace rust/rusty/src/main:         Address: main[0x0000000100001580] (main.TEXT.text + 416)         Summary: main`main          Module: file = "/Users/elivnat/Documents/VSCode/workspace rust/rusty/src/main", arch = "x86_64"          Symbol: id = {0x00001292}, range = [0x0000000100001580-0x00000001000015c0), name="main"

On Tuesday, May 15, 2018, 9:22:32 AM PDT, Vadim Chugunov <notifications@github.com> wrote:  

You'll need to enter this command in the debug console once debugger has stopped on entry.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

vadimcn commented 6 years ago

Looks to me like your executable does not have debug info. Is there main.dSYM directory next to it?

Also, that's a strange path for a cargo-built project. Normally it'd be something like .../workspace rust/rusty/target/debug/main. Did you move it from the build location? That'd explain why the debugger cannot find debug symbols.

yehielliv commented 6 years ago

Yes there is a there is a main.dSTM directory next to it. No, I have not move any file.

yehielliv commented 6 years ago

All works now.