In order to understand a program for data compression, I'm trying to step through a program using GDB, and am having a problem setting a breakpoint.The code is all in a single directory, and the Makefile is as follows:
Code:
############################################################################
#
# Makefile for huffman encode/decode programs
#
############################################################################
CC = gcc
LD = gcc
CFLAGS = -ggdb -O3 -Wall -Wextra -ansi -pedantic -c
LDFLAGS = -O3 -o
# libraries
LIBS = -L. -lhuffman -loptlist
# Treat NT and non-NT windows the same
ifeq ($(OS),Windows_NT)
OS = Windows
endif
ifeq ($(OS),Windows)
EXE = .exe
DEL = del
else #assume Linux/Unix
EXE =
DEL = rm
endif
all: sample$(EXE)
sample$(EXE): sample.o libhuffman.a liboptlist.a
$(LD) $^ $(LIBS) $(LDFLAGS) $@
sample.o: sample.c huffman.h optlist.h
$(CC) $(CFLAGS) $<
libhuffman.a: huffman.o canonical.o huflocal.o bitarray.o bitfile.o
ar crv libhuffman.a huffman.o canonical.o huflocal.o\
bitarray.o bitfile.o
ranlib libhuffman.a
huffman.o: huffman.c huflocal.h bitarray.h bitfile.h
$(CC) $(CFLAGS) $<
canonical.o: canonical.c huflocal.h bitarray.h bitfile.h
$(CC) $(CFLAGS) $<
huflocal.o: huflocal.c huflocal.h
$(CC) $(CFLAGS) $<
bitarray.o: bitarray.c bitarray.h
$(CC) $(CFLAGS) $<
bitfile.o: bitfile.c bitfile.h
$(CC) $(CFLAGS) $<
liboptlist.a: optlist.o
ar crv liboptlist.a optlist.o
ranlib liboptlist.a
optlist.o: optlist.c optlist.h
$(CC) $(CFLAGS) $<
clean:
$(DEL) *.o
$(DEL) *.a
$(DEL) sample$(EXE)
I'd like to set a breakpoint to step through HuffmanEncodeFile(), which is found in huffman.c:90 and called at sample.c:210
When I try running gdb with such a breakpoint, I get the following terminal output:
Code:
Breakpoint 3 at 0x8048ca0<function, no debug info> HuffmanEncodeFile;
I've checked the manual (which I'm not real clear on), and given a try to hbreak, but that didn't help.
Do I have to make any changes to Makefile? Am I writing my breakpoints incorrectly?
[I'm using a virtual machine running linux, with a clang compiler, if that matters]