<commit_before>#include <sstream>

#include <boost/format.hpp>

#include "Colors.h"
#include "Trace.h"


Trace::Trace()
{
}


Trace::~Trace()
{
}


/* Add an instruction in the trace */
void Trace::addInstruction(Inst *instruction)
{
  this->instructions.push_back(instruction);
}


/* Returns the instructions list in the trace */
std::list<Inst *> &Trace::getInstructions()
{
  return this->instructions;
}


void Trace::display(std::ostream &os)
{
  boost::format outputInstruction("%1% %|15t| %2% %|55t|");

  for (auto inst : this->instructions){
    uint64_t count = 0;
    if (inst != nullptr) {
      std::stringstream expr(""), colr(ENDC);

      for (auto se : inst->getSymbolicElements()){

        if (count == 0) expr << se->getExpression()->str();
        else            expr << std::endl << boost::format(outputInstruction) % "" % "" << se->getExpression()->str();

        if (se->isTainted)
          colr.str(GREEN);

        count++;
      }

      os << colr.str()
         << boost::format(outputInstruction)
          % boost::io::group(std::hex, std::showbase, inst->getAddress())
          % inst->getDisassembly()
         << expr.str()
         << ENDC
         << std::endl;
    }
  }
}<commit_msg>Add the threadID viewing in the output<commit_after>#include <sstream>

#include <boost/format.hpp>

#include "Colors.h"
#include "Trace.h"


Trace::Trace()
{
}


Trace::~Trace()
{
}


/* Add an instruction in the trace */
void Trace::addInstruction(Inst *instruction)
{
  this->instructions.push_back(instruction);
}


/* Returns the instructions list in the trace */
std::list<Inst *> &Trace::getInstructions()
{
  return this->instructions;
}


void Trace::display(std::ostream &os)
{
  boost::format outputInstruction("[%1%] %|3t| %2% %|21t| %3% %|61t|");
  boost::format outputExpression("%|61t|");

  for (auto inst : this->instructions){
    uint64_t count = 0;
    if (inst != nullptr) {
      std::stringstream expr(""), colr(ENDC);

      for (auto se : inst->getSymbolicElements()){

        if (count == 0) expr << se->getExpression()->str();
        else            expr << std::endl << boost::format(outputExpression) << se->getExpression()->str();

        if (se->isTainted)
          colr.str(GREEN);

        count++;
      }

      os << colr.str()
         << boost::format(outputInstruction)
          % std::to_string(inst->getThreadId())
          % boost::io::group(std::hex, std::showbase, inst->getAddress())
          % inst->getDisassembly()
         << expr.str()
         << ENDC
         << std::endl;
    }
  }
}
{'fraction_non_alphanumeric': 0.18365758754863815, 'fraction_numerical': 0.00933852140077821, 'mean_word_length': 2.9553846153846153, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2193916', 'n_tokens_mistral': 857, 'n_tokens_neox': 832, 'n_words': 171}