Fry the onion in the butter with the salt, stirring frequently, until the onions are quite soft and brown, and there is the beginning of a hard brown crust forming on the base of the pan. .
If the pan begins to become dry before the onions are cooked, you can add a bit of stock at this point, to help move the onions along and add a bit more butter as well.
As the onions begin to become soft and start to brown, add the garlic.
Once the onions are browned and the crust is on the pan, add the port to deglaze the pan, stirring quickly to loosen the crust and incorporate it with the onion.
Add the stock and simmer gently for an hour with the lid slightly off.
Pour into oven-proof bowls and top with a slice of bread and then some grated Gruyere, then grill until the cheese is melted and it begins to brown.