Jump to content
Visual Boy Advance-M

Breakpoints and Steps with GDB

Recommended Posts

So I tried a myriad combinations of gdb and vba builds trying to get simple breakpoints and step throughs to work.


I think the closest I've got it to work is using VBA-SDL-H from romhacking.net and arm-elf-gdb from http://gnutoolchains.com/arm-elf/ (7.4; configured as "--host=i686-pc-mingw32 --target=arm-elf".)


Break Points kind of work, the program will stop but the debugger doesn't know which line it stopped at. However, if I do a command like backtrace then I get info other than 00s and ??s

-exec bt
#0  0x08000262 in main ()

Which is a huge improvement from everything else I tried. (Even Piping through GDB works)


Now, I read somewhere that there is a emulator called vba-sdl-h2 where the author fixed a bunch of stuff with stepping and break points.. which is exactly what I need. However, it was hosted at pokecommunity and is now a dead link. Google revealed in one of VBA-M's update logs that someone got the source of h2 and implemented the GDB functionality into VBA-M which is why I'm here trying to get GDB to work with VBA-M. As of now, it links to gdb, but I get no stops and garbage response from commands like backtrace.


My current setup is using VisualCode Studio and c++ tools with it. (I've attached my launch file). My goal is to get breakpoints and stepping working in windows.


I'm using DevKitArm to build my .gba and .elf file with minimal flags

ARCH	:=	-mthumb -mthumb-interwork

CFLAGS	:=	-g -Wall \
		-mcpu=arm7tdmi -mtune=arm7tdmi\


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

I was using the Insight GDB that is bundled with DevKitArm for a short while. However, it crashed and stopped reading any .elf files I give it. Even reinstalling it didn't help.


Overall, my question here is: Is GDB with VBA-M expected to work on windows? if so then with what version of GDB? if not is GDB with VBA-M expected to work in linux? Also, if it doesn't work on the latest version then is there a prior version with it working?


Maybe I'm completely off track and someone here can point me in the right direction xD

Quick Update: I got it working with VisualBoyAdvance-SDL-H and the latest GDB (https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads ; GNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q2-update) "--host=i686-w64-mingw32 --target=arm-none-eabi")


If anyone happens to have a copy of SDL-H2 Let me know :)

Share this post

Link to post
Share on other sites

The last time i tried to use GDB with VBA-M on windows it cause my GDB to stop responding >.< and i ended modifying the internal debugger on VBA-M svn1030e in order to put breakpoints (by address or value being written/read) to analyze wireless adapter data, but that was years ago, not sure about the latest one.


You can checkout checkout the Debugger on VBA-M 1030e (my mod) to see if it's helpfull :) but i didn't touch the GDB code though

it was on archive (before vba-m forum got rolled back) http://web.archive.org/web/20150309103216/http://vba-m.com/forum/Thread-vba-m-r1030e-sourcecode

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now