External GDB for VisualGDB compiled binary? File format not recognized

Sysprogs forums Forums VisualGDB External GDB for VisualGDB compiled binary? File format not recognized

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #11126
    gojimmypi
    Participant

    Greetings. I’m trying to use an Ubuntu GDB to debug a binary compiled in Visual Studio 2017 / Visual GDB.

    The “regular” GDB that I tried first was this one:

    Copyright (C) 2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt;
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type “show copying”
    and “show warranty” for details.
    This GDB was configured as “x86_64-linux-gnu”.

    Which I later found that different GDB’s are needed for different target platforms… So I did a ” sudo apt-get install gdb-arm-none-eabi” and tried this one (after copying the entire project from Windows to Linux via samba share):

    gojimmypi@ubuntu:~/workspace/STM32-ST7735-standalone/VisualGDB$ /usr/bin/arm/bin/arm-none-eabi-gdb -d ./
    GNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q1-update) 7.12.1.20170215-git
    Copyright (C) 2017 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt;
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type “show copying”
    and “show warranty” for details.
    This GDB was configured as “–host=x86_64-linux-gnu –target=arm-none-eabi“.
    Type “show configuration” for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/&gt;.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/&gt;.
    For help, type “help”.
    Type “apropos word” to search for commands related to “word”.
    (gdb)  file ~/workspace/STM32-ST7735-standalone/VisualGDB/Debug/STM32-ST7735.bin
    “/home/gojimmypi/workspace/STM32-ST7735-standalone/VisualGDB/Debug/STM32-ST7735.bin”: not in executable format: File format not recognized
    (gdb)

    As you can see, I am still getting the same “file format not recognized” error.  Any suggestions as to what I might do to make this work? This is the same binary image that gets flashed to the device, right?

    In this case, I am targeting the STM32F103 found in the “STM32_Smart_V2”  using a J-Link

    https://github.com/gojimmypi/STM32-ST7735

    http://wiki.stm32duino.com/index.php?title=STM32_Smart_V2.0

    Everything works fine from within Visual Studio… I’m just trying to see if “alternate debug” methods are possible 🙂

    Thanks in advance. Cheers.

     

     

     

    #11127
    gojimmypi
    Participant

    actually, disregard: I found that the “.bin” is not the file to use… rather the same-name, no extension file:

    gojimmypi@ubuntu:~/workspace/STM32-ST7735-standalone/VisualGDB$ /usr/bin/arm/bin/arm-none-eabi-gdb -d ./ -f Debug/STM32-ST7735
    GNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q1-update) 7.12.1.20170215-git
    Copyright (C) 2017 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt;
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type “show copying”
    and “show warranty” for details.
    This GDB was configured as “–host=x86_64-linux-gnu –target=arm-none-eabi”.
    Type “show configuration” for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/&gt;.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/&gt;.
    For help, type “help”.
    Type “apropos word” to search for commands related to “word”…
    Reading symbols from Debug/STM32-ST7735…done.

    This helped:

    C:\SysGCC\arm-eabi\bin\arm-eabi-readelf.exe -a STM32-ST7735

     

    #11131
    gojimmypi
    Participant

    (I don’t know why I can sometimes edit my prior posts, and sometimes not).

    In case someone wants to do something similar:

    start OpenOCD (in this case using JLink and stm32f100):

    sudo openocd -f /usr/local/share/openocd/scripts/interface/jlink.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg

    launch GDB:

    /usr/bin/arm/bin/arm-none-eabi-gdb -d ./ -f ~/workspace/STM32-ST7735-standalone/VisualGDB/Debug/STM32-ST7735

    then from (gdb) prompt, select elf file (no elf extension!) and connect to OpenOCD port 3333:

    file ~/workspace/STM32-ST7735-standalone/VisualGDB/Debug/STM32-ST7735
    target remote localhost:3333

     

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