Debugging files in deeper directories with gdb

Hi all,

I'm working on a Roguelike game in cygwin using g++ and Code::Blocks, and have a directory structure that looks like:

jrcpp
jrcpp/display/include
jrcpp/display/source
jrcpp/engine/include
jrcpp/engine/source
jrcpp/world/include
jrcpp/world/source

Basically, there's a couple of main files in the jrcpp directory. The game logic is split across the three main subdirectories: display, engine, and world.

I'm starting to glue together my various classes, and want to use gdb to step through the code. I can attach to the main function, and step into functions/classes in other files within the main jrcpp directory. However, I can't step into any code defined in display, engine, or world. I get errors like:

1
2
3
4
Breakpoint 1, XMLParser::initialize_parser (this=0x27cc7c)
    at XMLDataStructures.cpp:90
90      XMLDataStructures.cpp: No such file or directory.
        in XMLDataStructures.cpp


I've ensured that I'm building all my files with -g, no optimizations are taking place, and symbols aren't being stripped. I think the relevant section of my makefile is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...

all: SavageLands

ENGINE_OBJS  := $(patsubst %.cpp,%.o,$(wildcard engine/source/*.cpp))
ENGINE_GENERATORS_OBJS := $(patsubst %.cpp,%.o,$(wildcard engine/generators/source/*.cpp))
WORLD_OBJS   := $(patsubst %.cpp,%.o,$(wildcard world/source/*.cpp))
WORLD_TILES_OBJS := $(patsubst %.cpp,%.o,$(wildcard world/tiles/source/*.cpp))
DISPLAY_OBJS := $(patsubst %.cpp,%.o,$(wildcard display/source/*.cpp))
BASE_OBJ     := $(patsubst %.cpp,%.o,$(wildcard *.cpp))
BASE_OBJS    := $(filter-out MapTester.o, $(BASE_OBJ))

SavageLands: SavageLands.o global_functions.o
	cd ./world/source ; make world
	cd ./engine/source ; make engine
	cd ./display/source ; make display
	$(CPP) $(CPP_FLAGS) $(BASE_OBJS) $(ENGINE_OBJS) $(ENGINE_GENERATORS_OBJS) $(DISPLAY_OBJS) $(WORLD_OBJS) $(WORLD_TILES_OBJS) $(POST) -o SavageLands -lncurses -lxerces-c

SavageLands.o: SavageLands.cpp
	$(CPP) -c $(CPP_FLAGS) SavageLands.cpp
	
global_functions.o: global_functions.cpp
	$(CPP) -c $(CPP_FLAGS) global_functions.cpp
 */


As an example, I can step into functions in global_functions.cpp (within the jrcpp directory), but not classes within the engine directory.

I'm sure I'm doing something obviously wrong. Any ideas?

Thank you!
Last edited on
I think the problem may be solved by the information here:

http://www.delorie.com/gnu/docs/gdb/gdb_169.html

Likely I have not set up my cygwin environment correctly. I didn't realize that I would have to set additional directories - I had assumed, incorrectly, that gdb would be able to figure out where the files were. I expect once I add the various directories, I should be good to go.

Hopefully someone finds the above info useful!
Topic archived. No new replies allowed.