Shabbos, Chapter 17, Mishnah 2. This mishnah deals with a category of utensils called a kli shemelachto le'issur - a utensil whose primary use is for something involving a forbidden labor.
The rule for a kli shemelachto le'issur:
It may not be moved, except in one of two ways:
For the sake of the object itself - when a person needs the item itself for a use that is permitted on Shabbos (for example, picking up a tape recorder or a radio and using it as a doorstop).
For the sake of its place - when a person needs the space that the utensil is occupying.
And this is the halachah as it is decided in practice.
The words of the mishnah:
"Notel adam kurnas liftzoa bo es ha'egozim" - a kurnas is a hammer, normally used for building, and one may use it to crack open nuts.
"Kardom lachtoch bo es hadeveilah" - a kardom is an axe used for chopping wood, and one may use it to cut a cake of pressed figs.
"Megeirah ligror bah es hagevinah" - a megeirah is a saw, and even though it is used for building purposes, one may use it to cut pieces of cheese.
"Magreifah ligrof bah es hagerogaros" - a magreifah is a shovel, and one may use it to gather up a shovelful of dried figs.
"Es harachas ve'es hamazleg laseis alav lakatan" - the rachas is a winnowing fork, and alongside it the mazleg. One may place food on them for a child: for example, when one's hands are tamei and the food is tahor, since it is Terumah and he does not want to touch it, or when the child is on the other side of a stream and the food has to be passed across to him.
"Es hakush ve'es hakarkar linkov bo" - the kush is used in the process of spinning wool, and the karkar in the process of weaving, and both have a sharp point. One may use them for piercing: for instance, when one wants to feed a person berries, and uses them to spear the fruit.
"Machat shel yad litol bo es hakotz" - a hand needle, which one may use on Shabbos to remove a thorn that has become lodged in the skin.
"Veshel saka'im liftoach bo es hadeles" - the needle of sack makers, which is much larger. When there is no key and a lock has to be forced open, one may make use of this somewhat larger, sharp implement.
In summary: all of these cases involve a kli shemelachto le'issur, a utensil whose primary use is for something forbidden on Shabbos, and nevertheless one may pick it up and use it for a permitted purpose.