UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 19126

6.1 EDK mb-gcc - How do I generate an ELF file with debugging information for both C and ASM portions?

Description

Keywords: gcc, -g, -gstabs

Urgency: Standard

General Description:
Currently (in EDK 6.1), I cannot run a single GCC command to compile, assemble, and link C code with extra assembly code and debug both in GDB. If I use both the -g switch for C code debugging with the -gstabs code for assembler listings, GDB might crash.

Solution

To work around this issue, compile and assemble the C code separately from assembling the assembly code; the two objects are then passed to the linker. Using this method, the -g and -gstabs switches are set correctly for C and ASM code.

In the following example of a C main.c file with assembly code foo.s file, the intended results are produced with these command line commands:
mb-gcc -c -g main.c
mb-gcc -c -Wall -Wa,-gstabs foo.s
mb-gcc main.o foo.o -o test.elf
mb-gdb test.elf

A change request has been filed on this issue.
AR# 19126
Date Created 03/11/2004
Last Updated 04/28/2006
Status Archive
Type General Article