Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDB can't read compiled artifacts #35

Open
eproxus opened this issue Nov 25, 2021 · 6 comments
Open

GDB can't read compiled artifacts #35

eproxus opened this issue Nov 25, 2021 · 6 comments

Comments

@eproxus
Copy link
Member

eproxus commented Nov 25, 2021

I'm trying to open a program compiled for either GRiSP 1 or 2, but always receive the same error:

$ /opt/grisp/grisp2-rtems-toolchain/master/rtems/5/bin/arm-rtems5-gdb _grisp/grisp_base/otp/23.3.4.9/install/erts-11.2.2.8/bin/beam.smp
GNU gdb (GDB) 10.1.90.20210409-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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-apple-darwin21.1.0 --target=arm-rtems5".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from _grisp/grisp_base/otp/23.3.4.9/install/erts-11.2.2.8/bin/beam.smp...
I'm sorry, Dave, I can't do that.  Symbol format `elf32-littlearm' unknown.

We had this working sometime in the past, I think, but it was a long time since I tried it because GDB never worked on macOS.

@c-mauderer Any hints on what is wrong here?

@c-mauderer
Copy link
Collaborator

I'm not entirely sure what the "beam.smp" is. Is that a normal ELF file?
If I do a "file" on one of the executables in the demo, I get the following type information:

> file demo/b-imx7/demo.exe
demo/b-imx7/demo.exe: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped

You are using a gdb 10.1 now. Did you try whether it works on Linux? Maybe compiling this gdb missed some options so that it can't read elf32-littlearm.

@eproxus
Copy link
Member Author

eproxus commented Nov 25, 2021

When we compile with the Erlang build system we get beam.smp as the executable and then we do run objcopy on that to get beam which is what we boot from on the board:

$ file _grisp/grisp_base/otp/23.3.4.9/install/erts-11.2.2.8/bin/beam.smp 
_grisp/grisp_base/otp/23.3.4.9/install/erts-11.2.2.8/bin/beam.smp: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped
$ file _grisp/grisp_base/otp/23.3.4.9/install/erts-11.2.2.8/bin/beam
_grisp/grisp_base/otp/23.3.4.9/install/erts-11.2.2.8/bin/beam: data

(The objcopy command is arm-rtems5-objcopy -O binary beam.smp beam)

@eproxus
Copy link
Member Author

eproxus commented Nov 25, 2021

@sylane Can you confirm this works on Linux?

@eproxus
Copy link
Member Author

eproxus commented Nov 25, 2021

@c-mauderer Here's the beam.smp binary itself if you want to try on Linux: beam.smp.zip

@eproxus
Copy link
Member Author

eproxus commented Nov 25, 2021

Maybe compiling this gdb missed some options so that it can't read elf32-littlearm.

@c-mauderer Any hints on how to add these options?

@c-mauderer
Copy link
Collaborator

Hm. Nothing obvious. When gdb-10 was added to RSB, there have been updates to gcc and binutils too. But I wouldn't expect these to have a big influence on gdb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants