In a Dutch oven or large stockpot, melt butter over medium heat. Add onion; cook, stirring occasionally, until softened, about 15 minutes. Stir in salt, sugar, and pepper; cook, stirring occasionally, until onion is deep golden brown, 30 to 40 minutes.