This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: crt0.S debug


Mark Yang wrote:
> 
> Hi,
>    Anyone knows how I could change the newlib makefile
> so I can debug crt0.S using GDB? I know there is some
> place I could add a "-g" for adding debug symbols, I
> just don't know where it is, I am compiling the gdb
> for my arm7 board.
>     Appreciate your help!
> Mark
> 

The problem is that the assembler needs to use the --gdwarf2 or
--gstabs options to generate debug symbol information.  The code
is compiled with the -g option but the gcc compiler does not translate
this into an appropriate assembler option when compiling a .S file.
It would be nice if the gcc compiler would do this, but this is not
an issue for this forum.

Try the attached patch which overrides the rule for .S.o and adds the -Wa,--gdwarf2 option.

In the debugger, you may have to use the "directory" command to specify
where the crt0.S source directory is.

-- Jeff J.
Index: Makefile.am
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/arm/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- Makefile.am	12 Mar 2002 21:25:12 -0000	1.2
+++ Makefile.am	14 Aug 2002 18:31:57 -0000
@@ -10,5 +10,10 @@
 
 all: crt0.o
 
+ASFLAGS_FOR_TARGET = -Wa,-gdwarf2
+
+.S.o:
+	$(COMPILE) $(ASFLAGS_FOR_TARGET) -c $<
+
 ACLOCAL_AMFLAGS = -I ../../..
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/arm/Makefile.in,v
retrieving revision 1.6
diff -u -r1.6 Makefile.in
--- Makefile.in	4 Jul 2002 19:57:44 -0000	1.6
+++ Makefile.in	14 Aug 2002 18:31:57 -0000
@@ -91,6 +91,8 @@
 
 lib_a_SOURCES = access.c syscalls.c libcfunc.c trap.S setjmp.S
 
+ASFLAGS_FOR_TARGET = -Wa,-gdwarf2
+
 ACLOCAL_AMFLAGS = -I ../../..
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -153,9 +155,6 @@
 .s.o:
 	$(COMPILE) -c $<
 
-.S.o:
-	$(COMPILE) -c $<
-
 mostlyclean-compile:
 	-rm -f *.o core *.core
 
@@ -323,6 +322,9 @@
 
 
 all: crt0.o
+
+.S.o:
+	$(COMPILE) $(ASFLAGS_FOR_TARGET) -c $<
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]