debuginfo: Improve commandline option handling for debuginfo (fixes #12811)