Racked with pain
This expression has been around since the mid-15th century and its association with the medieval torture device is obvious. See also rack one’s brains.