Page 1 of 1
Getting assembled code
Posted: Sat Jul 18, 2015 6:41 pm
by tryphon
Hello,
for debugging purposes, I'd like to be able to locate the addresses of my compiled functions in the ROM (so I could set breakpoints in Gens, for example).
Is there a way to change the "make.exe -f makefile.gen" command to do that ?
Posted: Sat Jul 18, 2015 11:09 pm
by Stef
you can modify the makefile.gen to produce symbol list for instance.
In the next SGDK version i will add a "debug" target to produce debug symbols

Posted: Sat Jul 18, 2015 11:25 pm
by KanedaFr
you can use NM for that.
It's what I'm using to generate watchers for KMod,like in this makefile
https://bitbucket.org/SpritesMind/genre ... ile?at=dev
command :
Code: Select all
$(NM) -n -S -t x $(ROM).out >$(ROM).nm
I think you'll need to generate the binary with -g flag, to keep symbols[/code]
Posted: Sun Jul 19, 2015 8:17 am
by tryphon
Thanks for anwers !
you can modify the makefile.gen to produce symbol list for instance.
Sorry, I'm new to makefiles and GCC command line options (and the least that can be said is that the man page is dense

).
I suppose I must add a flag in :
Code: Select all
release: FLAGS= $(DEFAULT_FLAGS) -O1 -fomit-frame-pointer
but which one ? (-g ?)
I think you'll need to generate the binary with -g flag, to keep symbols
Seems interesting. What's the exact name of it (because NM search on Google gives gazillions of results, none of them related to coding

) ?
Posted: Sun Jul 19, 2015 10:04 am
by Stef
In the makefile.gen fle you can replace this line :
by
Code: Select all
out/rom.bin: out/rom.out out/symbol.txt
and you will always have a symbol.txt file produced along the rom.bin file so you know the address of your variables and functions.
Posted: Sun Jul 19, 2015 12:41 pm
by tryphon
In fact you already did it, I just didn't notice
Sorry for bothering

Posted: Sun Jul 19, 2015 2:57 pm
by Stef
Almost, you just need to modify a bit the makefile.gen file. In next SGDK version using the "debug" target will automatically produce the symbol file.
Posted: Sun Jul 19, 2015 8:44 pm
by tryphon
Nope :
generated a symbol.txt.
There's these lines in makefile.gen :
Code: Select all
debug: FLAGS= $(DEFAULT_FLAGS) -O1 -ggdb -DDEBUG=1
debug: out/rom.bin out/rom.out out/symbol.txt
I suppose they are the one responsibles for that, and I assume they are yours

Posted: Sun Jul 19, 2015 8:51 pm
by Stef
Ohhh indeed i though it was not yet available ^^