retdec
Enumerations | Functions | Variables
ar_extractor.cpp File Reference

New frontend replacing llvm-ar. More...

#include <limits>
#include <vector>
#include <rapidjson/document.h>
#include <rapidjson/prettywriter.h>
#include "retdec/utils/filesystem.h"
#include "retdec/utils/io/log.h"
#include "retdec/ar-extractor/archive_wrapper.h"
#include "retdec/ar-extractor/detection.h"

Enumerations

enum class  ACTION {
  LIST , EXTRACT_ALL , EXTRACT_NAME , EXTRACT_INDEX ,
  CHECK_AR , CHECK_THIN , CHECK_NORMAL , OBJECT_COUNT
}
 

Functions

void printUsage (Logger &log)
 
void printErrorPlainText (const std::string &message)
 
void printErrorJson (const std::string &message)
 
int printErrorAndReturn (const std::string &message)
 
int printTable (const ArchiveWrapper &archive, bool fixNames=true, bool isNum=true)
 
bool getArgFromArgs (const std::size_t index, const std::vector< std::string > &args, std::string &result)
 
int processArguments (const std::vector< std::string > &args)
 
int main (int argc, char **argv)
 

Variables

bool isJson = false
 

Detailed Description

New frontend replacing llvm-ar.

Enumeration Type Documentation

◆ ACTION

enum ACTION
strong

Possible actions.

Enumerator
LIST 

List object files in archive.

EXTRACT_ALL 

Extract all objects in file.

EXTRACT_NAME 

Extract first object with given name.

EXTRACT_INDEX 

Extract object with given index.

CHECK_AR 

Check if file is an archive.

CHECK_THIN 

Check if file is a thin archive.

CHECK_NORMAL 

Check if file is a normal archive.

OBJECT_COUNT 

Get object count.

Function Documentation

◆ getArgFromArgs()

bool getArgFromArgs ( const std::size_t  index,
const std::vector< std::string > &  args,
std::string &  result 
)

Get argument on given position.

Parameters
indexargument position
argsvector with arguments
resultargument on position
Returns
true if argument exists, false otherwise

◆ main()

int main ( int  argc,
char **  argv 
)

◆ printErrorAndReturn()

int printErrorAndReturn ( const std::string &  message)

Print error and return non-zero.

Parameters
messageerror message
Returns
non-zero

◆ printErrorJson()

void printErrorJson ( const std::string &  message)

Print error in JSON format.

Parameters
messageerror message

◆ printErrorPlainText()

void printErrorPlainText ( const std::string &  message)

Print error in plain-text.

Parameters
messageerror message

◆ printTable()

int printTable ( const ArchiveWrapper archive,
bool  fixNames = true,
bool  isNum = true 
)

Print archive table.

Parameters
archivetarget archive
fixNamesnames will be fixed if true
isNumlist will be numbered if true
Returns
application error code

◆ printUsage()

void printUsage ( Logger log)

Print usage.

Parameters
logusage logger object

◆ processArguments()

int processArguments ( const std::vector< std::string > &  args)

Process inputs.

Parameters
argsvector with command line arguments
Returns
application error code

Variable Documentation

◆ isJson

bool isJson = false

Output style selector.

Made this global so it does not have to be passed around.