Correct the files' directory index when downgrading DWARF5 -> 4 (#1989)
* correct the files' directory index when downgrading DWARF5 -> 4
This commit is contained in:
@@ -121,8 +121,11 @@ where
|
||||
dirs.push(dir_id);
|
||||
}
|
||||
let mut files = Vec::new();
|
||||
// Since we are outputting DWARF-4, perform base change.
|
||||
let directory_index_correction = if header.version() >= 5 { 1 } else { 0 };
|
||||
for file_entry in header.file_names() {
|
||||
let dir_id = dirs[file_entry.directory_index() as usize];
|
||||
let dir_index = file_entry.directory_index() + directory_index_correction;
|
||||
let dir_id = dirs[dir_index as usize];
|
||||
let file_id = out_program.add_file(
|
||||
clone_attr_string(
|
||||
&file_entry.path_name(),
|
||||
|
||||
Reference in New Issue
Block a user