[BOLT][DWARF] Refactor helper functions that update DW_AT_comp_dir/DW_AT_dwo_name (#91237)

We need to update DW_AT_comp_dir/DW_AT_dwo_name TU in the
.debug_info.dwo section so that the path is correct. Refactored helper
functions to make it easier for next step.
14 jobs for main
in 0 seconds and was queued for 0 seconds