View Single Post
Old 16 January 2020, 11:33   #1212
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 62
I had partial success with debugging in VSCode. I can set breakpoints and step through the code, but variables aren't displayed properly, yet.

E.g. an uninitialized member variable is pointing to something random, ok. Then there's a line of code where this variable is set to NULL. When I step over it still points to the same something random.

Then I re-read te thread post and found that I've missed an hint:

Quote:
Originally Posted by jotd View Post
Link with "-Wl,--amiga-debug-hunk -ldebug"
I added these options to the makefile. But after 'make debug' the created binary has the same size and content as before.

So I'm wondering if there's something wrong in the makefile:

Code:
# Setting up application name and directories
APPNAME=MyNewApp
APPNAME_DEBUG=MyNewApp_Debug

SRC_ROOT=src

OBJ_DIR=obj_release
OBJ_DIR_DEBUG=obj_debug

# Change some values for debug build
ifeq ($(BUILD),debug)
OBJ_DIR=$(OBJ_DIR_DEBUG)
APPNAME=$(APPNAME_DEBUG)
endif

# Specify the files and includes
DEPS=$(SRC_ROOT)/exampleclass.h

_OBJ=$(SRC_ROOT)/main.cpp \
                /exampleclass.cpp
 
INCLUDE=-I$(SRC_ROOT)

# Setting up compiler, flags and tools
CXX=/opt/amiga/bin/m68k-amigaos-c++
CXXFLAGS=-Wall -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -noixemul
LD=/opt/amiga/bin/m68k-amigaos-ld
LDFLAGS=

ifeq ($(BUILD),debug)
# "Debug" build - no optimization, and debugging symbols
CXXFLAGS += -O0 -g -Wl,--amiga-debug-hunk -ldebug
#LDFLAGS += -Wl,--amiga-debug-hunk -ldebug
else
# "Release" build - optimization and no debug symbols
CXXFLAGS += -Os -s
endif

# Replace prefix SRC_ROOT with OBJ_DIR for object file target
OBJ=$(patsubst $(SRC_ROOT)/%,$(OBJ_DIR)/%,$(_OBJ))

# Building the .o files
# Note: the mkdir line creates the needed subdirectories in OB_DIR 
$(OBJ_DIR)/%.o: $(SRC_ROOT)/%.cpp $(DEPS)
	mkdir -p $(@D)
	$(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $< 


$(APPNAME): $(OBJ)
	$(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ $^

release:
	make

debug:
	make "BUILD=debug"

# Cleaning build directory and executable
.PHONY: clean
clean:
	rm -rf $(OBJ_DIR) $(OBJ_DIR_DEBUG) $(APPNAME) $(APPNAME_DEBUG)
Anybody got an idea?
thyslo is offline  
 
Page generated in 0.04083 seconds with 11 queries