Makefile need debug option

J

Joseph

Hi gurus,

Can someone quickly remind me how I can add a -g (to generate the
debug table inside the core file) so I can run it against GDB and find
out whats happening. I tried to put it in the right after the $(CC)
as in $(CC) -g .... But it didn't work. The core file shows no
stack in GDB
By the way, I am compiling on a Linux box. This is a makefile from a
piece of code that i need to maintain. TIA




========================== THE MAKEFILE FOLLOWS ====================

I=$(CUST)/src/include
MAKEINCDIR=$(I)/Makefiles
DIRNAME=SendFtir
CATALOG=SendFtir_text.t
CDEBUGFLAGS=-g

include $(MAKEINCDIR)/$(shell uname)/vets.variables
include $(MAKEINCDIR)/$(shell uname)/ANSI.compiler
include $(MAKEINCDIR)/vets.rules
include $(MAKEINCDIR)/NLS.rules


all: catalogs progs

LIBS=\
$(LIB)/libvets.a \
$(LIB)/libphrases.a \
$(LIB)/libftir.a \
$(LIB)/libio.a \
$(LIB)/libinifile.a \
$(LIB)/libstr.a \
$(LIB)/libXXX.a

SYSLIB= $(SYSNLSLIB)

# --------------------------------------------------------------------
# CATALOGS
#
include $(MAKEINCDIR)/catalogs.progs



# --------------------------------------------------------------------
# PROGS
#
..PHONY progs: SendFtir

SENDFTIR=\
$(OBJDIR)GetData.o \
$(OBJDIR)PrintData.o \
$(OBJDIR)SendFtir.o

SendFtir: $(BIN)/SendFtir6k
$(BIN)/SendFtir6k: $(SENDFTIR) $(LIBS)
$(CC) $(LDFLAGS) -o $(@F) $(SENDFTIR) $(LIBS) $(SYSLIB)
$(INSTALL)
$(CLEANUP)



# --------------------------------------------------------------------
include $(MAKEINCDIR)/clean.rules

#
# Include file dependencies
#


include $(addprefix depends/,$(SENDFTIR:.o=.d))
include $(addprefix depends/,$(CATALOG:.t=.d))
 
R

Richard Tobin

Joseph said:
Can someone quickly remind me how I can add a -g (to generate the
debug table inside the core file) so I can run it against GDB and find
out whats happening.

Try setting CFLAGS to -g in your makefile.
I tried to put it in the right after the $(CC)
as in $(CC) -g

That should work.
The core file shows no stack in GDB

Do you really mean it shows no stack? Or just that it doesn't show
the names of functions on the stack? If there's no stack, it probably
means that the bug has completely screwed up the stack pointer.

-- Richard
 
K

Keith Thompson

Joseph said:
Can someone quickly remind me how I can add a -g (to generate the
debug table inside the core file) so I can run it against GDB and find
out whats happening. I tried to put it in the right after the $(CC)
as in $(CC) -g .... But it didn't work. The core file shows no
stack in GDB
By the way, I am compiling on a Linux box. This is a makefile from a
piece of code that i need to maintain. TIA
[snip]

This isn't a C question. comp.unix.programmer is probably your best
bet, or possibly one of the Linux groups.
 
K

Kenny McCormack

Joseph said:
Can someone quickly remind me how I can add a -g (to generate the
debug table inside the core file) so I can run it against GDB and find
out whats happening. I tried to put it in the right after the $(CC)
as in $(CC) -g .... But it didn't work. The core file shows no
stack in GDB
By the way, I am compiling on a Linux box. This is a makefile from a
piece of code that i need to maintain. TIA
[snip]

This isn't a C question. comp.unix.programmer is probably your best
bet, or possibly one of the Linux groups.

IOW:

Off topic. Not portable. Cant discuss it here. Blah, blah, blah.

--
Useful clc-related links:

http://en.wikipedia.org/wiki/Aspergers
http://en.wikipedia.org/wiki/Clique
http://en.wikipedia.org/wiki/C_programming_language
 
K

karthikbalaguru

Hi gurus,

Can someone quickly remind me how I can add a -g (to generate the
debug table inside the core file) so I can run it against GDB and find
out whats happening. I tried to put it in the right after the $(CC)
as in $(CC) -g .... But it didn't work. The core file shows no
stack in GDB
By the way, I am compiling on a Linux box. This is a makefile from a
piece of code that i need to maintain. TIA

========================== THE MAKEFILE FOLLOWS ====================

I=$(CUST)/src/include
MAKEINCDIR=$(I)/Makefiles
DIRNAME=SendFtir
CATALOG=SendFtir_text.t
CDEBUGFLAGS=-g

include $(MAKEINCDIR)/$(shell uname)/vets.variables
include $(MAKEINCDIR)/$(shell uname)/ANSI.compiler
include $(MAKEINCDIR)/vets.rules
include $(MAKEINCDIR)/NLS.rules

all: catalogs progs

LIBS=\
$(LIB)/libvets.a \
$(LIB)/libphrases.a \
$(LIB)/libftir.a \
$(LIB)/libio.a \
$(LIB)/libinifile.a \
$(LIB)/libstr.a \
$(LIB)/libXXX.a

SYSLIB= $(SYSNLSLIB)

# --------------------------------------------------------------------
# CATALOGS
#
include $(MAKEINCDIR)/catalogs.progs

# --------------------------------------------------------------------
# PROGS
#
.PHONY progs: SendFtir

SENDFTIR=\
$(OBJDIR)GetData.o \
$(OBJDIR)PrintData.o \
$(OBJDIR)SendFtir.o

SendFtir: $(BIN)/SendFtir6k
$(BIN)/SendFtir6k: $(SENDFTIR) $(LIBS)
$(CC) $(LDFLAGS) -o $(@F) $(SENDFTIR) $(LIBS) $(SYSLIB)
$(INSTALL)
$(CLEANUP)

# --------------------------------------------------------------------
include $(MAKEINCDIR)/clean.rules

#
# Include file dependencies
#

include $(addprefix depends/,$(SENDFTIR:.o=.d))
include $(addprefix depends/,$(CATALOG:.t=.d))


Try:
CFLAGS = $(CDEBUGFLAGS)
CDEBUGFLAGS = -g

I think, you have not linked the CFLAGS with CDEBUGFLAGS. Did you
cross-check that .
Else, try directly the CFLAGS = -g in the makefile.

The -g option should make it work .

Karthik Balaguru
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top