Gilbert was cursing under his breath.
to say or think bad things about someone or something because they have made you angry:
He cursed his bad luck in arriving just after she'd left.
curse somebody/something for (doing) something
Elsa cursed herself for believing his lies.
to ask God or a magical power to harm someone