Page 1 of 1

locate my code

Posted: Sat Feb 13, 2016 12:48 am
by KanedaFr
Hi,

When I write some asm code, I often use

Code: Select all

dc.w 0xDEAD
myfunc:
...
rts
dc.w 0xBEEF
to locate my code on the rom.bin when debugging/optimizing

I know i could use NM and all others tools for binary analysis or debug but I like this one, only needed a hex editor to check code


I wonder if something exist on C ?
Could I add "dead code" ?

Code: Select all

void func()
{
deadcode1;
....
deadcode2;
}

Re: locate my code

Posted: Sat Feb 13, 2016 5:34 am
by Sik
That's what the debugging information is for, it keeps track of the addresses of all the functions (heck, the individual lines even).

Also in asm you can use listings for the same effect. Got accustomed to it after I got tired of Regen crashing every single time I actually need the debugger :P (now I just look at the BSOD screen and look for the address in the listing)

Re: locate my code

Posted: Sat Feb 13, 2016 9:45 am
by cero
Well, you could write to a global, but the compiler may reorder your write.

global_u32 = 0xdeadbeef;

Re: locate my code

Posted: Sat Feb 13, 2016 10:40 pm
by KanedaFr
@sik : I know ;)
Like i said, i was looking for a very easy and limited option, when all you have is a compiler and a text editor (which support hexa)
I'll try to see if nm could extract me a easy to read listing.....

@cero : yep, this code could be anywhere, not on start/end of func