Skip to content

Commit 280a7dc

Browse files
committed
Make the dwarf version setable by the user
1 parent 4a884e3 commit 280a7dc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/cmd/dwarf.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use syntect::{
1717
highlighting::{Color, HighlightIterator, HighlightState, Highlighter, Theme, ThemeSet},
1818
parsing::{ParseState, ScopeStack, SyntaxReference, SyntaxSet},
1919
};
20-
use typed_path::{Utf8NativePathBuf};
20+
use typed_path::Utf8NativePathBuf;
2121

2222
use crate::{
2323
util::{
@@ -64,6 +64,9 @@ pub struct ConvertArgs {
6464
#[argp(switch)]
6565
/// Add PowerPC specific hacks which import better into Ghidra.
6666
ppc_hacks: bool,
67+
#[argp(option, default = "4")]
68+
/// Specify the dwarf version. 4 by default.
69+
dwarf_version: u16,
6770
#[argp(switch)]
6871
/// Attempt to reconstruct tags that have been removed by the linker, e.g.
6972
/// tags from unused functions or functions that have been inlined away.
@@ -167,7 +170,7 @@ where
167170
let mut reader = Cursor::new(&*data);
168171
let encoding = gimli::Encoding {
169172
format: if obj_file.is_64() { gimli::Format::Dwarf64 } else { gimli::Format::Dwarf32 },
170-
version: 2,
173+
version: args.dwarf_version,
171174
address_size: if obj_file.is_64() { 8 } else { 4 }, // TODO "weird" platforms?
172175
};
173176
let mut info =

0 commit comments

Comments
 (0)