gdb GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-32.el5_6.2)
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
Compiling with the following cflags:
CFLAGS = -Wall -Wextra -Wunreachable-code -ggdb -O0
I have also tried using just -g as well, but that didn't work either.
I have a file call demo.cpp and I am trying to create a break point in that file.
My executable target is called demo_app. I run gdb using the following:
gdb demo_app
I try and create the break point
b demo.cpp:997
gdb returns the following message:
No source file named demo.cpp.
Make breakpoint pending on future shared library load? (y or [n]) n
The executable file properties:
ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
However, I have another file called video.cpp and I can create break points in that file.
Many thanks for any advice,
================== UPDATE I have done the following:
(gdb) start
Temporary breakpoint 1 at 0x804ba44
Starting program: /home/user/video_demo/demo
warning: .dynamic section for "/lib/libc.so.6" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
warning: .dynamic section for "/lib/libuuid.so.1" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
[Thread debugging using libthread_db enabled]
[New Thread 0x1ab7b90 (LWP 5123)]
(gdb) b demo.cpp:1038
No source file named demo.cpp.
Make breakpoint pending on future shared library load? (y or [n]) n
================= MAKEFILE ========
OBJECT_FILES = demo.o video.o
CFLAGS = -Wall -Wextra -Wunreachable-code -ggdb -O0
CC = g++ -m32
TARGET = demo
# Include path
INC_PATH = -I /usr/network/inc
INC_PATH+= -I sdp/inc
# Library path
LIB_PATH = -L /usr/network/lib
LIB_PATH+= -L sdp/lib
# Libraries to include
LIBS = -lnetwork -lsdpAPI -lpthread
# Linker run-time path
LDFLAGS = -Wl,-rpath=/usr/network/lib
LDFLAGS+= -Wl,-rpath=sdp/lib
$(TARGET): $(OBJECT_FILES)
$(CC) $(CFLAGS) $(LDFLAGS) $(INC_PATH) $(OBJECT_FILES) $(LIB_PATH) $(LIBS) -o $(TARGET)
demo.o: demo.cpp video.cpp
$(CC) $(CLFAGS) $(INC_PATH) $(LIB_PATH) $(SDP_LIB) -c demo.cpp
video.o: video.cpp
$(CC) $(CFLAGS) $(INC_PATH) $(LIB_PATH) -c video.cpp
clean:
rm -f $(OBJECT_FILES) $(TARGET) *~