(bv_arch: &str)
| 600 | } |
| 601 | |
| 602 | fn present_form(bv_arch: &str) -> Vec<FormResponses> { |
| 603 | // TODO : Verify inputs (like save location) so that we can fail early |
| 604 | // TODO : Add Language field |
| 605 | // TODO : Choose to export types/functions/etc |
| 606 | let archs = [ |
| 607 | "Unknown", |
| 608 | "AArch64", |
| 609 | "AArch64_Ilp32", |
| 610 | "Arm", |
| 611 | "Avr", |
| 612 | "Bpf", |
| 613 | "I386", |
| 614 | "X86_64", |
| 615 | "X86_64_X32", |
| 616 | "Hexagon", |
| 617 | "LoongArch64", |
| 618 | "Mips", |
| 619 | "Mips64", |
| 620 | "Msp430", |
| 621 | "PowerPc", |
| 622 | "PowerPc64", |
| 623 | "Riscv32", |
| 624 | "Riscv64", |
| 625 | "S390x", |
| 626 | "Sbf", |
| 627 | "Sparc64", |
| 628 | "Wasm32", |
| 629 | "Xtensa", |
| 630 | ]; |
| 631 | interaction::FormInputBuilder::new() |
| 632 | .save_file_field( |
| 633 | "Save Location", |
| 634 | Some("Debug Files (*.dwo *.debug);;All Files (*)"), |
| 635 | None, |
| 636 | None, |
| 637 | ) |
| 638 | .choice_field( |
| 639 | "Architecture", |
| 640 | &archs, |
| 641 | archs |
| 642 | .iter() |
| 643 | .enumerate() |
| 644 | .min_by(|&(_, arch_name_1), &(_, arch_name_2)| { |
| 645 | edit_distance::distance(bv_arch, arch_name_1) |
| 646 | .cmp(&edit_distance::distance(bv_arch, arch_name_2)) |
| 647 | }) |
| 648 | .map(|(index, _)| index), |
| 649 | ) |
| 650 | // Add actual / better support for formats other than elf? |
| 651 | // .choice_field( |
| 652 | // "Container Format", |
| 653 | // &["Coff", "Elf", "MachO", "Pe", "Wasm", "Xcoff"], |
| 654 | // None, |
| 655 | // ) |
| 656 | .get_form_input("Export as DWARF") |
| 657 | } |
| 658 | |
| 659 | fn write_dwarf<T: gimli::Endianity>( |
no test coverage detected