Press Y while playing a game to bring up the options/cheat menu.
There is a bug in gnuboy where you cannot enter any new codes until you already have a code entered/found. This means that you will have to go through a search/continue search process to come up with *anything* that you can add to the list. Once you have something added to the list, then you can press RS+LS to bring up the code-list menu and from there you can add codes. It will only allow you to enter the last 6 digits of the code, however, since the first two digits will be forced at 01. Don't worry about it. For example, if the gameshark code you want to enter is
C0999999
Then when you enter it in the emulator, it will look like
01999999
It will work just fine.
BTW - the save states are not interchangeable between gnuboy and XBA, but the SRAM files should be. You might want to give that a try.