Page 1 of 1

Breakpoints and Steps with GDB

Posted: Tue Jul 11, 2017 8:32 pm
by izackp

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

Code: Select all

-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

Code: Select all

ARCH	:=	-mthumb -mthumb-interwork

CFLAGS	:=	-g -Wall \
		-mcpu=arm7tdmi -mtune=arm7tdmi\
		$(ARCH)

CFLAGS	+=	$(INCLUDE)

ASFLAGS	:=	$(ARCH)
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 [img]<fileStore.core_Emoticons>/emoticons/laugh.png[/img]/emoticons/laugh@2x.png 2x" width="20" height="20" />


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) 7.12.1.20170417-git "--host=i686-w64-mingw32 --target=arm-none-eabi")

 

If anyone happens to have a copy of SDL-H2 Let me know [img]<fileStore.core_Emoticons>/emoticons/smile.png[/img]/emoticons/smile@2x.png 2x" width="20" height="20" />


Breakpoints and Steps with GDB

Posted: Fri Jul 14, 2017 8:38 am
by AdamN

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 [img]<fileStore.core_Emoticons>/emoticons/smile.png[/img]/emoticons/smile@2x.png 2x" width="20" height="20" /> 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