Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# dev

* Enhancement: Unified logging on stdout/stderr. Added option `--silent`. Printed text is colored only when output is a terminal ([#791](https://github.com/avast/retdec/issues/791).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @s3rvac suggested in some other place, it is better to add these entries after the merge to master. It is then possible to reference the PR.

Copy link
Member

@s3rvac s3rvac Jul 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus the risk of running into conflicts is much lower 🙂

* Enhancement: Support all the CMake build types (i.e. `Debug`, `Release`, `RelWithDebInfo` and `MinSizeRel`) on all systems ([#774](https://github.com/avast/retdec/issues/774)).
* Enhancement: YARA updated to version 4.0.1 ([#758](https://github.com/avast/retdec/issues/758)), fixed Mach-O parsing issue ([#283](https://github.com/avast/retdec/issues/283)).
* Enhancement: Improved detection of many packers/installers/compilers in `retdec-fileinfo`, including Armadillo ([#733](https://github.com/avast/retdec/pull/733)), VMProtect ([#734](https://github.com/avast/retdec/pull/734), [#778](https://github.com/avast/retdec/pull/778)), Petite ([#735](https://github.com/avast/retdec/pull/735)), Enigma ([#741](https://github.com/avast/retdec/pull/741)), ASPack ([#743](https://github.com/avast/retdec/pull/743)), Eziriz ([#746](https://github.com/avast/retdec/pull/746)), PyInstaller ([#748](https://github.com/avast/retdec/pull/748)), Astrum InstallWizard ([#753](https://github.com/avast/retdec/pull/753)), AutoHotKey ([#756](https://github.com/avast/retdec/pull/756)), AutoIt ([#757](https://github.com/avast/retdec/pull/757)), BAT to PE-EXE script compilers ([#761](https://github.com/avast/retdec/pull/761)), Bero ([#764](https://github.com/avast/retdec/pull/764)), CExe ([#781](https://github.com/avast/retdec/pull/781)), MoleBox ([#815](https://github.com/avast/retdec/pull/815)), and other improvements ([#804](https://github.com/avast/retdec/pull/804)).
Expand Down
1 change: 0 additions & 1 deletion cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ foreach(t ${RETDEC_ENABLE})
set_if_equal(${t} "fileinfo" RETDEC_ENABLE_FILEINFO)
set_if_equal(${t} "getsig" RETDEC_ENABLE_GETSIG)
set_if_equal(${t} "idr2pat" RETDEC_ENABLE_IDR2PAT)
set_if_equal(${t} "llvm-support" RETDEC_ENABLE_LLVM_SUPPORT)
set_if_equal(${t} "llvmir-emul" RETDEC_ENABLE_LLVMIR_EMUL)
set_if_equal(${t} "llvmir2hll" RETDEC_ENABLE_LLVMIR2HLL)
set_if_equal(${t} "loader" RETDEC_ENABLE_LOADER)
Expand Down
8 changes: 7 additions & 1 deletion include/retdec/config/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class Parameters
void setOutputConfigFile(const std::string& file);
void setOutputUnpackedFile(const std::string& file);
void setOutputFormat(const std::string& format);
void setLogFile(const std::string& file);
void setErrFile(const std::string& file);
void setMaxMemoryLimit(uint64_t limit);
void setIsMaxMemoryLimitHalfRam(bool f);
void setTimeout(uint64_t seconds);
Expand Down Expand Up @@ -95,6 +97,8 @@ class Parameters
const std::string& getOutputConfigFile() const;
const std::string& getOutputUnpackedFile() const;
const std::string& getOutputFormat() const;
const std::string& getLogFile() const;
const std::string& getErrFile() const;
uint64_t getMaxMemoryLimit() const;
uint64_t getTimeout() const;
retdec::common::Address getEntryPoint() const;
Expand Down Expand Up @@ -136,7 +140,7 @@ class Parameters
private:
/// Decompilation will verbosely inform about the
/// decompilation process.
bool _verboseOutput = false;
bool _verboseOutput = true;

/// Keep all functions in the decompiler's output.
/// Otherwise, only functions reachable from main are kept.
Expand All @@ -158,6 +162,8 @@ class Parameters
std::string _outputConfigFile;
std::string _outputUnpackedFile;
std::string _outputFormat;
std::string _logFile;
std::string _errFile;
uint64_t _maxMemoryLimit = 0;
bool _maxMemoryLimitHalfRam = true;
uint64_t _timeout = 0;
Expand Down
132 changes: 0 additions & 132 deletions include/retdec/llvm-support/diagnostics.h

This file was deleted.

1 change: 0 additions & 1 deletion include/retdec/llvmir2hll/llvmir2hll.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
#include "retdec/llvmir2hll/var_name_gen/var_name_gens/num_var_name_gen.h"
#include "retdec/llvmir2hll/var_renamer/var_renamer.h"
#include "retdec/llvmir2hll/var_renamer/var_renamer_factory.h"
#include "retdec/llvm-support/diagnostics.h"
#include "retdec/utils/container.h"
#include "retdec/utils/conversion.h"
#include "retdec/utils/memory.h"
Expand Down
1 change: 0 additions & 1 deletion include/retdec/llvmir2hll/optimizer/optimizer_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "retdec/llvmir2hll/optimizer/optimizer.h"
#include "retdec/llvmir2hll/support/smart_ptr.h"
#include "retdec/llvmir2hll/support/types.h"
#include "retdec/llvm-support/diagnostics.h"
#include "retdec/utils/non_copyable.h"

namespace retdec {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <vector>

#include "retdec/llvmir2hll/pattern/pattern_finder_runner.h"
#include "retdec/utils/io/log.h"

namespace retdec {
namespace llvmir2hll {
Expand All @@ -23,7 +24,7 @@ namespace llvmir2hll {
*/
class CLIPatternFinderRunner: public PatternFinderRunner {
public:
CLIPatternFinderRunner(llvm::raw_ostream &os);
CLIPatternFinderRunner(utils::io::Logger &os);

private:
virtual void doActionsBeforePatternFinderRuns(ShPtr<PatternFinder> pf) override;
Expand All @@ -34,7 +35,7 @@ class CLIPatternFinderRunner: public PatternFinderRunner {

private:
/// Output stream, into which the patterns will be emitted.
llvm::raw_ostream &os;
utils::io::Logger &os;
};

} // namespace llvmir2hll
Expand Down
10 changes: 5 additions & 5 deletions include/retdec/llvmir2hll/validator/validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

#include "retdec/llvmir2hll/support/smart_ptr.h"
#include "retdec/llvmir2hll/support/visitors/ordered_all_visitor.h"
#include "retdec/llvm-support/diagnostics.h"
#include "retdec/utils/io/log.h"

using namespace retdec::utils::io;

namespace retdec {
namespace llvmir2hll {
Expand Down Expand Up @@ -45,12 +47,10 @@ class Validator: protected OrderedAllVisitor {
/**
* @brief Function to be called when there is a validation error.
*/
template<typename... Args>
void validationError(const std::string &warningMessage, Args &&... args) {
void validationError(const std::string &warningMessage) {
moduleIsCorrect = false;
if (printMessageOnError) {
retdec::llvm_support::printWarningMessage(warningMessage,
std::forward<Args>(args)...);
Log::error() << Log::Warning << warningMessage << std::endl;
}
}

Expand Down
12 changes: 7 additions & 5 deletions include/retdec/unpacker/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
#ifndef RETDEC_UNPACKER_PLUGIN_H
#define RETDEC_UNPACKER_PLUGIN_H

#include <iostream>
#include <memory>
#include <sstream>
#include <string>

#include "retdec/utils/io/log.h"
#include "retdec/unpacker/unpacker_exception.h"

#define plugin(T) retdec::unpackertool::Plugin::instance<T>()

using namespace retdec::utils::io;

namespace retdec {
namespace unpackertool {

Expand Down Expand Up @@ -171,7 +173,7 @@ class Plugin
*/
template <typename... Args> void log(const Args&... args)
{
Plugin::logImpl(std::cout, "[", getInfo()->name, "] ", args...);
Plugin::logImpl(Log::get(Log::Type::Info), "[", getInfo()->name, "] ", args...);
}

/**
Expand All @@ -184,7 +186,7 @@ class Plugin
*/
template <typename... Args> void error(const Args&... args)
{
Plugin::logImpl(std::cerr, "[ERROR] [", getInfo()->name, "] ", args...);
Plugin::logImpl(Log::get(Log::Type::Error), "[ERROR] [", getInfo()->name, "] ", args...);
}

/**
Expand All @@ -211,13 +213,13 @@ class Plugin
private:
PluginExitCode _cachedExitCode; ///< Cached exit code of the plugin for the unpacked file.

template <typename T, typename... Args> static void logImpl(std::ostream& out, const T& data, const Args&... args)
template <typename T, typename... Args> static void logImpl(Logger& out, const T& data, const Args&... args)
{
out << data;
logImpl(out, args...);
}

static void logImpl(std::ostream& out)
static void logImpl(Logger& out)
{
out << std::endl;
}
Expand Down
Loading