I believe there is an issue also as to what should be done with the firearm when a pilot is hitching a ride.
I think a firearm in the cockpit should be viewed as a last option.
Should that option come before or after shooting down hijacked commercial airliners?
What about imposter air marshalls? They don't even have uniforms, they are undercover. How hard can it be to fake an air marshall ID? How does the crew decide between the real air marshall and the fake one who is a suicide bomber?