This commit adds the binary analyser code to the toolchain. This binary analyser adds various features such as gathering ELF information (e.g., functions, symbols, ...), micro-libs inspection, ELF comparison, ELF pages division, ... Note that it was developped with Unikraft structure in mind. The binary analyser can be used as an external tool with the '--binary' argument. A specific json file should be provided which contains specific fields (see 'bin_analysis_example.json'). Please, see the wiki for further information. Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
// Copyright 2019 The UNICORE Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file
|
|
//
|
|
// Author: Gaulthier Gain <gaulthier.gain@uliege.be>
|
|
|
|
package binarytool
|
|
|
|
import (
|
|
"github.com/akamensky/argparse"
|
|
"os"
|
|
u "tools/srcs/common"
|
|
)
|
|
|
|
const (
|
|
filesArg = "file"
|
|
mappingArg = "mapping"
|
|
listArg = "list"
|
|
)
|
|
|
|
// ParseArguments parses arguments of the application.
|
|
//
|
|
// It returns an error if any, otherwise it returns nil.
|
|
func parseLocalArguments(p *argparse.Parser, args *u.Arguments) error {
|
|
|
|
args.InitArgParse(p, args, u.BOOL, "m", mappingArg,
|
|
&argparse.Options{Required: false, Default: false,
|
|
Help: "Display libraries mapping (required -l argument)"})
|
|
|
|
args.InitArgParse(p, args, u.STRING, "l", listArg,
|
|
&argparse.Options{Required: false, Help: "A list of build directories " +
|
|
"to analyse (sep: ,)"})
|
|
args.InitArgParse(p, args, u.STRING, "f", filesArg,
|
|
&argparse.Options{Required: false, Help: "Json file that contains " +
|
|
"the information for the binary analyser"})
|
|
|
|
return u.ParserWrapper(p, os.Args)
|
|
}
|