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.

ASM > Outputing C as comments in ASM

#3171 - Haribo - Wed Feb 19, 2003 11:47 am

Hi there,

Using GCC / DevKitAdv is it possible to write out an ASM file with the C code still in it (or as comments in it), looking for something similar to debugging in MSVC++ when the translated opcodes are shown between the lines of C.

Anybody seen something like this?

#3173 - ampz - Wed Feb 19, 2003 12:43 pm

GDB might have thoose kind of features?

#3219 - I.C.E - Thu Feb 20, 2003 3:32 pm

I don't know what exactly you want, but with GDB you can view your C source and your machine code. You can even step through every ASM instruction with GDB and not just every C instruction.
_________________
To this day, many C programmers believe that "strong typing" just means pounding extra hard on the keyboard.
- Peter van der Linden

#3255 - peebrain - Fri Feb 21, 2003 6:10 am

Try...

Code:

int myfunction(int whatever)
{
    asm("@ inside myfunction()");
    asm("@ that = whatever + 4");
    int that = whatever + 4;
    asm("@ return that");
    return that;
}


Basically, just put asm("@ your comment here");.

~Sean
_________________
http://www.pbwhere.com

#3270 - col - Fri Feb 21, 2003 2:38 pm

peebrain wrote:
Try...

Code:

int myfunction(int whatever)
{
    asm("@ inside myfunction()");
    asm("@ that = whatever + 4");
    int that = whatever + 4;
    asm("@ return that");
    return that;
}


Basically, just put asm("@ your comment here");.

~Sean


Thanks for that peabrain, it could be very useful :)

cheers

col

#3362 - Haribo - Sun Feb 23, 2003 4:26 pm

Thanks for all the replys, Peebrain's suggestion was exactly what I was looking for.

Cheers!

#3408 - J - Mon Feb 24, 2003 5:13 am

By placing that code in my rom, how am I able to view it in boyCottAdvaced debug?

Running on a windows platform, and wasn't able to find any compatible GDB utilities.

Is there any way to ouput logging of this type to file during runtime ( using boycott?

Thanks
J

#3416 - ampz - Mon Feb 24, 2003 11:09 am

J wrote:
By placing that code in my rom, how am I able to view it in boyCottAdvaced debug?

You are not.
J wrote:

Running on a windows platform, and wasn't able to find any compatible GDB utilities.
Is there any way to ouput logging of this type to file during runtime ( using boycott?

Thanks
J

No.

I think you are missing the point. col's sugestion put asm comments in the assembly output of the compiler. That's it.