how to add debugger option to the build script

Chan Kim ckim at etri.re.kr
Wed Sep 3 00:55:27 UTC 2014


> On 9/2/2014 4:12 AM, Chan Kim wrote:
> > Hi,
> > Is there any option for build-rtems.sh by which I can add '-g'(debugger) to
> CFLAGS in the result Makefile?
> > (I run '../build-rtems.sh' under build-rtems directory. The --
> enable_rtems_debug is for enabling RTEMS_DEBUG macro in the sources.
> > I want -g option to be added for gcc so that I can use debugger.)
> 
> Where did this script come from? It doesn't ring a bell and I don't see it in my
> working tree.

I received it from a company collaborating with us through my colleage. 
I'll ask them how this directory structure was made later.

> What BSP are you building?

it's sparc/leon2

> Most BSPs have -g on by default since it doesn't impact code generation.
> It is in the CFLAGS settings specified in
> c/src/lib/libbsp/CPU/BSP/make/custom/BSP.cfg

That file looks like this :

include $(RTEMS_ROOT)/make/custom/default.cfg
RTEMS_CPU=sparc
RTEMS_CPU_MODEL=leon2
#  This contains the compiler options necessary to select the CPU model
#  and (hopefully) optimize for it.
############################################
# Build Option for Software Floating Point #
############################################
# CPU_CFLAGS = -mtune=v7 -msoft-float -fcommon
# CFLAGS_OPTIMIZE_V = -O2 -g
# LDFLAGS =  -L/opt/rtems-4.11/lib/gcc/sparc-rtems4.11/4.8.2/soft
# LDFLAGS += -L/opt/rtems-4.11/sparc-rtems4.11/lib/soft
############################################
# Build Option for Hardware Floating Point #
############################################
CPU_CFLAGS = -mtune=v8 -mhard-float -fcommon -DTARGET_QEMU
#CPU_CFLAGS = -mtune=v8 -mhard-float -fcommon -DTARGET_ALDEBARAN
CFLAGS_OPTIMIZE_V = -O2 -g

Do you mean this CFLAGS_OPTIMIZE_V is added to the CFLAGS so I already have '-g' option?
The reason I thought -g option is missing is that the debugger (I tried using DDD with sparc-snake-elf-gdb )
doesn't show the source files correctly. Having said that, I realize the debugger command (break, continue, next,..)
worked and this means -g option has been already applied. 
So I guess my job is to figure out why the file location was not correctly displayed on the DDD window.
Thank you!

Chan




보낸 사람 : "Joel Sherrill" <joel.sherrill at oarcorp.com>
보낸 날짜 : 2014-09-02 23:24:41 ( +09:00 )
받는 사람 : 김찬 <ckim at etri.re.kr>, users at rtems.org <users at rtems.org>
참조 : 
제목 : Re: how to add debugger option to the build script


On 9/2/2014 4:12 AM, Chan Kim wrote:
> Hi,
> Is there any option for build-rtems.sh by which I can add '-g'(debugger) to CFLAGS in the result Makefile?
> (I run '../build-rtems.sh' under build-rtems directory. The --enable_rtems_debug is for enabling RTEMS_DEBUG macro in the sources.
> I want -g option to be added for gcc so that I can use debugger.)

Where did this script come from? It doesn't ring a bell and I don't see it
in my working tree.

What BSP are you building?

Most BSPs have -g on by default since it doesn't impact code generation.
It is in the CFLAGS settings specified in
c/src/lib/libbsp/CPU/BSP/make/custom/BSP.cfg
> Any suggestion will be appreciated.
> Chan Kim
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users

-- 
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985


More information about the users mailing list