Gandalf found Glamdring in the troll's cave. He continued to use until the end of the war of the ring.
Glamdring was a sword, forged for the Elf Turgon in the First Age. For several thousand years it went missing, until Gandalf (and company) found it (along with Sting and Orcrist) in the trolls' cave in The Hobbit and claimed it for himself. He continued to use Glamdring through the events of The Lord of the Rings.