diff --git a/README.md b/README.md index 97c5c51..b22d3f8 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,10 @@ To run: Commands: linux generate ISF for Linux analysis mac generate ISF for macOS analysis + + Options: + -h, --help Show this screen. + -v, --version Show tool and output schema version. ``` Note: processing large DWARF files requires a minimum of 8GB RAM. diff --git a/main.go b/main.go index 6910a01..06e3f65 100644 --- a/main.go +++ b/main.go @@ -29,12 +29,14 @@ import ( ) const ( + DW_LANG_Rust = 0x001c + DW_OP_addr = 0x3 ) const ( TOOL_NAME = "dwarf2json" - TOOL_VERSION = "0.8.0" + TOOL_VERSION = "0.9.0" FORMAT_VERSION = "6.2.0" ) @@ -448,11 +450,17 @@ func (doc *vtypeJson) addDwarf(data *dwarf.Data, endian string, extract Extract) // fmt.Printf("Done!\n") break } - if err != nil { return err } + if entry.Tag == dwarf.TagCompileUnit || entry.Tag == dwarf.TagTypeUnit || entry.Tag == dwarf.TagPartialUnit { + if val, ok := entry.Val(dwarf.AttrLanguage).(int64); ok && val == DW_LANG_Rust { + reader.SkipChildren() + continue + } + } + for _, cb := range callBacks { err = cb(entry, reader.AddressSize()) if err != nil { @@ -672,6 +680,9 @@ Commands: linux generate ISF for Linux analysis mac generate ISF for macOS analysis +Options: + -h, --help Show this screen. + -v, --version Show tool and output schema version. `, os.Args[0]) } @@ -782,6 +793,10 @@ Commands: case "-h", "--help": pflag.Usage() os.Exit(0) + case "-v", "--version": + fmt.Printf("%s %s\n", TOOL_NAME, TOOL_VERSION) + fmt.Printf("output schema %s\n", FORMAT_VERSION) + os.Exit(0) default: fmt.Fprintf( os.Stderr,