Skip to content

gdbserver hangs on ARC HS3x/4x Linux targets #213

@kolerov

Description

@kolerov

A sample program:

#include <stdio.h>

int main()
{
        printf("Hello, World!\n");
        return 0;
}

First, build Linux image using Buildroot, arc-2023.09 branch (don't forget to select building GDB in toolchain's configuration and then gdbserver package itself). I did it in build-hs4x-glibc subdirectory of Buildroot source tree. Then run Linux image using QEMU:

qemu-system-arc -M virt -cpu archs -m 2G -kernel images/vmlinux \
                -display none -nographic -monitor none \
                -device virtio-rng-pci \
                -netdev user,id=net0,hostfwd=tcp::2022-:22,hostfwd=tcp::12345-:12345 \
                -device virtio-net-device,netdev=net0

Run gdbserver on target:

# gdbserver :12345 main-hs4x-glibc

Run GDB:

$ ./build-hs4x-glibc/host/bin/arc-buildroot-linux-gnu-gdb -q \
        -ex "set sysroot build-hs4x-glibc/host/arc-buildroot-linux-gnu/sysroot" \
        -ex "target remote :12345" \
        overlay/root/main-hs4x-glibc
Reading symbols from overlay/root/main-hs4x-glibc...
Remote debugging using :12345
Reading symbols from build-hs4x-glibc/host/arc-buildroot-linux-gnu/sysroot/lib/ld-linux-arc.so.2...
0x2000d47c in __start () from build-hs4x-glibc/host/arc-buildroot-linux-gnu/sysroot/lib/ld-linux-arc.so.2
(gdb) b main
Breakpoint 1 at 0x40000540: file main.c, line 5.
(gdb) c
Continuing.

gdbserver output:

Process /root/main-hs4x-glibc created; pid = 96
Listening on port 12345
Remote debugging from host 10.0.2.2, port 34430

Then nothing happens. Sometimes that issue does not happen, but in most cases it does. The same issue does not happen on ARCv3 targets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions