Saute onions and garlic in butter. Add flour and stir until smooth. Add chicken stock and cook and stir until slightly thickened. Chop canned tomatoes and add them with their juice to the onion mixture. Stir in the chicken meat, soup, Cheddar cheese, salt and pepper.
Cook spaghetti as package directs. Place in a large lightly greased baking dish. Pour sauce over spaghetti and sprinkle with Parmesan cheese. Bake 30 minutes at 300 degrees.