A GameShark is a standard console cheat device, but it differs from a PC trainer in that it's usually a physical device. This idea became popular for consoles with the release of the Game Genie, which a cartridge could plug into, and the whole bit could plug neatly into the gaming machine. Aside from the legalities, game companies raised a stink about the delicateness of some components, although in fact if left in place the genie protected your machine by virtue of having a more robust design. In addition, this forced a rule into many old gaming magazines that any time you entered a contest for a high score in a video game, you had to send in a single picture that showed both the television with the game and score on display, and also the gaming console itself, to show that it was unadulterated.
Court cases on this issue would side in favor of the device maker, on the grounds that you bought the console and the game, you have every right to decide how you wanted to play it, including through the use of an external device.
However, Game Genies type devices can cause save files to be corrupted, rendering some games broken. This can be seen on Animal Crossing on the Nintendo DS, where if a save is messed up the game will not load period, because your town is called at startup for the intro.
The switch to disc-based console games saw the GameShark proper, Action Replay MAX, and Code Breaker: sleeker devices with self-booting capabilities and even some multimedia tricks, with the assurance of not messing with saves directly. These devices have generally complied with companies' worries, although dedicated hackers can still use a fair amount of 'grey area' for tinkering.
Aside from the usual concerns about cheating, it's usually recommended to create backup saves in case a cheat inadvertently creates some problem later, or save immediately after a relevant cheat works and then restart to prevent unpredictable glitches.
There is also a small subset of games that are rather infamous for being "immune" to the devices, or difficult to play with them without locking up the game. tri-Ace games such as Star Ocean: The Second Story or Valkyrie Profile can be cited, mainly because the coding values in these games aren't static. These can often be defeated with the use of an "activator code" on the cheat device (the Star Ocean 2 one was about 29 lines long).
A rare few games have unimplemented (and usually unfinished) content that can be accessed with one of these, including a sort of makeshift two-player mode in Final Fantasy Tactics (both parties are player-controlled, and two players can pass the controller back and forth; the first party winning is a "win" with the usual consequences and the second party winning is a "loss"), unfinished characters in several fighting games, the almost-finished Bottle's Revenge two-player mode in Banjo-Tooie, and the infamous sex minigame in one of the Grand Theft Auto games.
More common are games released in multiple regions that have content which is unlockable in one region but not another, or is simply inaccessible through normal play. The Pokémon games, for example, typically have at least one Mon that's available only through use of a glitch, through a Wi-Fi/company-licensed event, or the use of a GameShark. Exactly whether or not using the GameShark for this purpose is considered cheating is still up for debate.
With the other cheat device manufacturers falling out of the market after the Sixth Generation, Datel, makers of the Action Replay line, is the last company standing, though as noted on the Game Genie article, the changing paradigm of console gaming, with its focus on online connectivity, may mark the end of an era. Datel has produced Action Replays for the PSP, Nintendo DS, and Wii, but software updates to those consoles can render a Replay device unusable. Datel skipped over the Xbox 360 and PS3 altogether for similar reason. They've released an Action Replay for the 3DS, it's only for use with DS games, and also has its own compatibility issues.
One for the 3DS games has been made, however. It plugs into your computer, and you insert the game into it. The game gets loaded with the codes, and then you go from there. It's anyone's guess how long it'll last, however. It works with both physical and downloaded games, though downloaded games require an additional SD card reader to be used.