codelldb icon indicating copy to clipboard operation
codelldb copied to clipboard

gdb-remote debugging crash

Open eatradish opened this issue 2 years ago • 2 comments

OS: AOSC OS (Linux 5.17) and Arch Linux (5.16.14) x86-64 VSCode version: 1.65.1 CodeLLDB version: 1.7.0 Compiler: gcc Debuggee: gdbserver

I tried to use codelldb to connect to the gdbserver debugger and my configuration file is as follows:

        {
            "type": "lldb",
            "request": "custom",
            "name": "launcher debug",
            "targetCreateCommands": [
                "target create ${fileDirname}/${fileBasenameNoExtension}"
            ],
            "processCreateCommands": [
                "gdb-remote 127.0.0.1:2333",
            ],
        }
,

After that, I tried to debug the program in VSCode with codelldb:


#include <stdio.h>

int main()
{
    int num = 0;
    while (num < 10000) {
        num += 1;
        printf("%d\n", num);
    }
    return 0;
}

This step will be followed by a crash:

555555555052: 49 89 D1                   movq   %rdx, %r9

VSCode output:

Stop reason: signal SIGTRAP
Stop reason: signal SIGSEGV
Process exited with code 0.

I noticed that journalctl outputs the following information:

systemd-coredump[35258]: [🡕] Process 35241 (hello) of user 1000 dumped core.
                                             
                                             Stack trace of thread 35241:
                                             #0  0x0000555555555051 n/a (/home/saki/test/hello + 0x1051)

And use objdump:

    1050:       31 ed                   xor    %ebp,%ebp
    1052:       49 89 d1              mov    %rdx,%r9

It seems to be because the wrong address was accessed? I noticed that the instruction was at 0x1052 but it tried to access 0x1051 and then raised this error.

But using lldb on the terminal to connect to gdb-remote debugging, everything works fine

eatradish avatar Mar 15 '22 01:03 eatradish

Probably same issue https://github.com/llvm/llvm-project/issues/56125

ByteNacked avatar Jun 20 '22 15:06 ByteNacked