Вопрос

After many years of using Windows tools for embedded development I've decided to return to my Unix/Linux roots and create a build/debug environment for OS X. What has kept me away is a good "visual" debugger. I'm also fan of languages like Python and Ruby. Since Python is a language that I know very well it is my hope that writing Python extensions for GDB will be superior than bouncing between windows for the disparate pieces of information you get in a so-called visual editor.

So I have this question: In OS X v10.9 (Mavericks) GDB is no longer supported, but Homebrew saved the day, and I built GDB effortlessly. I was able to connect to a GDB server on OS X (Segger JLink) which in turn was communicating successfully with the ubiquitous STM32F4 Discovery evaluation board.

Python extensions were enabled. I could reset and issue monitor commands to peek and poke memory. But it failed to load my ELF file:

$ gdb
GNU gdb (GDB) 7.7
Copyright (C) 2014 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 "x86_64-apple-darwin13.1.0".

warning: while parsing target description (at line 10): Target description specified unknown architecture "arm"

warning: Could not load XML target description; ignoring
0x00000000 in ?? ()
(gdb) load Faircharge-Flash.elf
"Faircharge-Flash.elf" is not an object file: File format not recognized

The ARM version does not complain:

$ arm-none-eabi-gdb
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20131129-cvs
Copyright (C) 2013 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-darwin10 --target=arm-none-eabi".
0x08000000 in ?? ()
(gdb) load Faircharge-Flash.elf
Loading section .text, size 0x3e4 lma 0x8000000
Loading section .rodata, size 0x8 lma 0x80003e4
Loading section .ARM, size 0x8 lma 0x80003ec
Loading section .init_array, size 0x8 lma 0x80003f4
Loading section .fini_array, size 0x4 lma 0x80003fc
Loading section .data, size 0x434 lma 0x8000400
Loading section .jcr, size 0x4 lma 0x8000834
Start address 0x8000000, load size 2104
Transfer rate: 2054 KB/sec, 300 bytes/write.

So I can rebuild the ARM version to include the Python extensions, but why doesn't GDB/Homebrew speak ELF?

Это было полезно?

Решение

I'm told that the OS X version of GDB built by Homebrew supports x86/64 object code by default and ELF support is simply not baked in. Specifically it wasn't built with target=arm-none-eabi.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top