Gdbserver fails while debugging

Home Forums Conduit: mLinux Model Gdbserver fails while debugging

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #20835
    Yoshihiro Imamura
    Participant

    Hi,

    I’m developing a gateway (MTCDT-LAT1) software written in C/C++.

    To debug the source code, I have installed gdbserver into a gateway
    from the following link.

    > opkg install http://multitech.net/mlinux/feeds/3.3.7/arm926ejste/gdbserver_7.6.2_r0.0_arm926ejste.ipk

    Installing has been successful. But when I try to set a few breakpoints
    and issue “run/continue” commands from a gdb side, the gdbserver is failed
    to execute the specified commands.

    I have tried the following procedures.

    1. Run gdbserver at the gateway device as follows.
    > gdbserver :9001 /tmp/target-debug

    2. Run gdb at the PC side, and load symbols
    > gdb
    (gdb) file target-debug

    3. And connect with the gateway via Ethernet.
    (gdb) target remote 192.168.1.100:9001
    Remote debugging using 192.168.1.100:9001
    warning: A handler for the OS ABI “GNU/Linux” is not built into this configuration
    of GDB. Attempting to continue with the default armv5te settings.
    0xb6fd8d40 in ?? ()

    4. Setup some of the breakpoints.
    (gdb) break test.c:11
    Breakpoint 1 at 0x83f8: file ../src/test.c, line 11.
    (gdb) break test.c:12
    Breakpoint 2 at 0x8400: file ../src/test.c, line 12.
    (gdb) break test.c:13
    Breakpoint 3 at 0x8408: file ../src/test.c, line 13.

    5. Issue “continue” command to break at the line 11. This process is successful.
    (gdb) continue
    Continuing.
    Breakpoint 1, main () at ../src/test.c:11
    warning: Source file is more recent than executable.
    11 a = 10;

    6. But “continue” command again, the gdbserver is failed. I expect to break at line 12.
    (gdb) continue
    Continuing.
    warning: Remote failure reply: E01

    When gdbserver is failed, the following messages are shown.
    ptrace: Input/output error.
    input_interrupt, count = 1 c = 36 (‘$’)

    Does anyone know why the gdbserver reports these messages ?

    Thanks,

    #20836
    Jeff Hatch
    Keymaster

    Yoshihiro,

    Without your test.c code I can only speculate. As to why it didn’t break at line 12, there are a couple of possibilities: A statement at line 11 caused the execution to skip line 12, or it is quite possible that line 12 was optimized out.

    As for the gdb server error, it appears to think that the incorrect target for the host side. Make sure that the correct target is being specified when building the gdbserver for the target.

    Jeff

    #20840
    Yoshihiro Imamura
    Participant

    Jeff,

    Thank you for a quick response. Here’s source code of test.c.
    It’s created for a test purpose to confirm gdb/gdbserver behavior.

    1:
    2:#include <stdio.h>
    3:
    4:
    5:int main(void)
    6:{
    7: int a;
    8: int b;
    9: int c;
    10:
    11: a = 10;
    12: b = 20;
    13: c = a * b;
    14:
    15: printf(“Hello World (%d).\n”, c);
    16:
    17: return 0;
    18:}

    All of optimizing options passed to the gcc and linker are disabled
    while compiling, like this.

    > gcc -march=armv5te -mtune=xscale -funit-at-a-time -msoft-float -fno-short-enums -ggdb3 -O0 -c test.c -o test.o
    > gcc test.o -o target-debug

    If target-debug is directly executed without gdb, it works fine.

    > ./target-debug
    Hello World (200).

    So, I have two questions.

    1. Is the architecture depend options (-march=armv5te and -mtune=xscale)
    are correct ? My target machine is MTCDT-LAT1 and gcc version is 6.3.1.

    2. Do I need to build gdbserver from its source code to specify the target ?
    I’ve tried to install it from ipk written in the following documentation.

    Debugging a C/C++ Application

    However, “opkg update” was not working due to broken link.
    So, I have specified another link and execute the following command instead.

    > opkg install http://multitech.net/mlinux/feeds/3.3.7/arm926ejste/gdbserver_7.6.2_r0.0_arm926ejste

    Thanks,

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.