Does arm-none-eabi-gdb work with overlays?

Asked by KD

I followed https://sourceware.org/binutils/docs/ld/Overlay-Description.html#Overlay-Description and gotten overlays building and verified working when I step through the code. I then followed https://www.sourceware.org/gdb/onlinedocs/gdb.html#Overlays to get the gdb client working with overlays (e.g. after loading a new overlay, have gdb display the correct associated source) but this causes gdb to disconnect (or crash?).

To test, after loading an overlay into memory I stop at a breakpoint just before stepping into a function in the overlay. I then do "overlay manual". Then "overlay map .overlay_section_name". If I "overlay list-overlays" it properly displays the load and vma addresses of the just mapped overlay. However, as soon as I do a single machine instruction step gdb disconnects (or crashes?). If I don't do the previous gdb commands it single steps fine. Even just doing "overlay manual" without the other commands will cause gdb to disconnect after single step.

Has anyone gotten overlays working with gdb? I've tried on 7-2018-q2 and 8-2018-q4 with the same results.

Thanks in advance for any help.
-Kevin

Question information

Language:
English Edit question
Status:
Expired
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Alan Hayward (ahayward) said :
#1

Hi Kevin,

Are you able to provide the binary and/or the source you were trying to debug?

Is GDB (or anything else) creating a core file? You may need to run “ulimit -c unlimited” in the same terminal before running.

Is GDB still running after the disconnect? And what exactly is the error it prints.

Thanks,
Alan.

Revision history for this message
KD (buckfobb) said :
#2

Hi Alan

Thanks for you response. It is much appreciated.

I'm not able to provide the binary and/or source at this time.

However, I did try various scenarios to repro.

I started by trying gdb's overlay test (https://sourceware.org/gdb/download/onlinedocs/gdb/Overlay-Sample-Program.html#Overlay-Sample-Program) on QEMU since that would be a straightforward way for others to repro. I got it building for Cortex-M4 and running on the QEMU STM32F4-Discovery board target but was not able to repro the issue. This was tested with arm-none-eabi 8-2018-q4 and Eclipse 2019-06 CDT (OSX)

I then tried to repro using the "bad" elf, my hardware target (iMXRT1020), and stand-alone gdb. I'm not used to using gdb standalone, so I'm no expert, but I was not able to get it to crash.

I verified that the same "bad" elf, hardware target, and Eclipse does cause gdb to crash.

I then implemented the gdb overlay test above for my target hardware, and Eclipse does not cause gdb to crash.

I then implemented an extremely simplified version of my "bad" elf for my target hardware, and Eclipse does not cause gdb to crash.

I verified that gdb is in fact crashing when it disconnects. There are arm-none-eabi-gdb crash logs in ~/Library/Logs/DiagnosticReports that correlate to the crashes. It looks like it is crashing in memory_xfer_partial_1() as part of stack frame unwinding.

I'd try "ulimit" but don't know how to do this from Eclipse.

I'm not sure how much this helps but thanks for any insight.

-Kevin

Revision history for this message
KD (buckfobb) said :
#3

I forgot to ask - it seems like "overlay auto" is not supported in arm-none-eabi-gdb? Basically, there's no way to get gdb to recognize a new overlay is being used per gdb's overlay test code? Gdb overlay remapping has to be done manually?

-Kevin

Revision history for this message
Launchpad Janitor (janitor) said :
#4

This question was expired because it remained in the 'Open' state without activity for the last 15 days.