gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Insight/GDB Debug Problem

#120328 - notunusual - Fri Mar 02, 2007 10:54 pm

I've downloaded/installed devkitpro using the 1.4.2 updater program.

I then downloaded the VBA SDL version 1.7.1.

Also from the same page, I've downloaded version 6.4.50 of the insight/gdb, which it says works with this version of VBA to debug.

I've set vba running and waiting on tcp port 55555, then I load the elf file (just trying this with one of the included examples, ansi_console in this case), and set insight to run the program and get the following message in my vba window:

Quote:
VisualBoyAdvance-SDL version 1.7.1
Windows version
Seaching for file VisualBoyAdvance.cfg
Searching current dir: C:\devkitPro\VBA_SDL_1.7.1
Searching PATH
Configuration file NOT FOUND (using defaults)
Listening for a connection at port 55555
Got a connection from 127.0.0.1 2968
Color depth: 32
Unknown packet pf#d6
Shutting down
Closing remote socket
Closing listen socket


I'm not sure what I'm doing wrong, i've searched high and low for an answer and had no luck.

Also if I try and use the version of insight that is downloaded/installed with the devkitpro updater, which I believe is version 6.5, the arm-eabi-insight.exe doesn't even load when attemping to execute it.

Any and all help is appreciated.[/quote]

#120330 - gmiller - Fri Mar 02, 2007 11:22 pm

It would be help full to see how you startup the insight code. The startup of insight will control what gets sent to and from the VBA code. Just so you are aware most of the SDL version of VBA have a number of problems dealing with the debugger. If you are interested there is a fixed version that has most of the debugging issues cleared up available. I use this version every month in my classes with a good number of students so it is pretty stable.

I will come back and post my startup of insight and the SDL version of VBA so you can see how I do it.

#120333 - notunusual - Fri Mar 02, 2007 11:56 pm

gmiller wrote:
It would be help full to see how you startup the insight code. The startup of insight will control what gets sent to and from the VBA code. Just so you are aware most of the SDL version of VBA have a number of problems dealing with the debugger. If you are interested there is a fixed version that has most of the debugging issues cleared up available. I use this version every month in my classes with a good number of students so it is pretty stable.

I will come back and post my startup of insight and the SDL version of VBA so you can see how I do it.


Not sure what you're asking me for... I used the gui to load the .elf file output, setup the target using the example on http://www.devkitpro.org/debugging-with-vba-and-insight.shtml , then tried to hit run.

I've also tried to use gdb by hand, setting the target, then "load my.elf", and the same thing happens...

I appreciate you taking the time to help.

#120344 - gmiller - Sat Mar 03, 2007 1:56 am

I start the insight as part of my make file and here is the section:

Code:

#---------------------------------------------------------------------------------
startsdl:
   $(DEVKITPRO)/tools/win32/vbaSDL/vba.exe -3 -Gtcp:44444 &

#---------------------------------------------------------------------------------
makeini:
   echo "File $(TARGET).elf" > insight.ini
   echo "target remote 127.0.0.1:44444" >>insight.ini
   echo "load $(TARGET).elf" >>insight.ini
   echo "b main" >>insight.ini
   echo "directory $(GDB_DIRS)">>insight.ini
   echo "c" >>insight.ini

#---------------------------------------------------------------------------------
startinsight:
   $(DEVKITPRO)/insight/insight-6.4.50/bin/arm-elf-insight.exe --command=insight.ini $(TARGET).elf

#---------------------------------------------------------------------------------
rungdb: startsdl makeini startinsight




To start debugging I use the following:

make rungdb

NOTE:
My setup uses port 44444 just because I had issues with the default but that was because of another piece of software which you may not be running.

#120380 - notunusual - Sat Mar 03, 2007 2:06 pm

Great using that and modifying the make file works like a charm, strange that it would affect things... (also had a huge fight with my editor not inserting real tabs which screwed with the make file for a while).

Thanks again for the help!

#120383 - gmiller - Sat Mar 03, 2007 2:14 pm

You can do it by hand by using commands like those but I hate retyping things that I can automate.

#126887 - RickA - Fri Apr 27, 2007 10:06 pm

gmiller: I've tried to use your fixed version of VBA, but am unable to even get that running with the -Gtcp option. Running vbawin.exe works, but that doesn't take any command options. Running vba.exe crashes, asking me if I want to debug it (I've got Visual Studio installed).

I'm running on WinXP, and have tried to follow the same tutorial notunusual has, with similar succes. For some reason, I'm unable to add new targets to my makefile, so I can't actually test your makefile directly. The following is my current makefile:

Code:
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
endif
include $(DEVKITARM)/gba_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output, if this ends with _mb generates a multiboot image
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET      :=   spritetest
BUILD      :=   build
SOURCES      :=   source font
INCLUDES   :=

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH   :=   -mthumb -mthumb-interwork

CFLAGS   :=   -g -Wall -O3\
         -mcpu=arm7tdmi -mtune=arm7tdmi\
          -fomit-frame-pointer\
         -ffast-math \
         $(ARCH)

CFLAGS   +=   $(INCLUDE)
CXXFLAGS   = $(CFLAGS)

ASFLAGS   :=   $(ARCH)
LDFLAGS   =   -g $(ARCH) -Wl,-Map,$(notdir $@).map

#---------------------------------------------------------------------------------
# path to tools - this can be deleted if you set the path in windows
#---------------------------------------------------------------------------------
export PATH      :=   $(DEVKITARM)/bin:$(PATH)

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS   :=   -lgba

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS   :=   $(LIBGBA)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT   :=   $(CURDIR)/$(TARGET)

export VPATH   :=   $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
export PATH   :=   $(DEVKITARM)/bin:$(PATH)
export DEPSDIR   :=   $(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES      :=   $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES   :=   $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES      :=   $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES   :=   $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bin)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
   export LD   :=   $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
   export LD   :=   $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

export OFILES   := $(BINFILES:.bin=.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)

#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE   :=   $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
               $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
               -I$(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS   :=   $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
   @[ -d $@ ] || mkdir -p $@
   @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
   @echo clean ...
   @rm -fr $(BUILD) $(TARGET).elf $(TARGET).gba

#---------------------------------------------------------------------------------
else

DEPENDS   :=   $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).gba   :   $(OUTPUT).elf

$(OUTPUT).elf   :   $(OFILES) $(LIBGBA)/lib/libgba.a

test:
   echo hello
   
#---------------------------------------------------------------------------------
startsdl:
   $(DEVKITPRO)/tools/win32/vbaSDL/vba.exe -3 -Gtcp:44444 &

#---------------------------------------------------------------------------------
makeini:
   echo "File $(TARGET).elf" > insight.ini
   echo "target remote 127.0.0.1:44444" >>insight.ini
   echo "load $(TARGET).elf" >>insight.ini
   echo "b main" >>insight.ini
   echo "directory $(GDB_DIRS)">>insight.ini
   echo "c" >>insight.ini

#---------------------------------------------------------------------------------
startinsight:
   $(DEVKITPRO)/insight/bin/arm-elf-insight.exe --command=insight.ini $(TARGET).elf

#---------------------------------------------------------------------------------
rungdb: startsdl makeini startinsight

%.o   :   %.bin
   @echo   $(notdir $<)
   @$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

Neither your targets, nor my own 'test' target work: No rule to make target 'test' pops up. I have converted all spaces to tabs (although it took me a while to realize that as well).

Any tips you can give me would be much appreciated, as I don't know assembly, so a source-level debugger would be much appreciated.

#126895 - wintermute - Fri Apr 27, 2007 11:00 pm

RickA: could you zip up your problematic project and mail it to me please?

I'll have a look & see what I can do.

Gmiller: If you're still paying attention to this thread I'd like to look at using your vba 1.8.0 in preference to the 1.7.1 I have on the devkitpro site at present.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#126913 - gmiller - Sat Apr 28, 2007 12:45 am

I can post a link to the vba code or PM you a link to it. I tried to post a message on the devkitPRO site but got no reply.

RickA you can only debug in the SDL version the vbawin version's debug is useless (in my opinion).

#127481 - RickA - Wed May 02, 2007 9:46 pm

wintermute wrote:
RickA: could you zip up your problematic project and mail it to me please?


Much appreciated. I've uploaded it to http://www.daedalus-development.net/ricka/spritetest.zip.

gmiller: I gathered such might be the case. Unfortunately, I'm also unable to get the SDL version working correctly.