ROSE  0.9.9.139
AsmUnparser.h
1 #ifndef ROSE_AsmUnparser_H
2 #define ROSE_AsmUnparser_H
3 
4 #include <ostream>
5 
6 #include "callbacks.h" /* Needed for ROSE_Callbacks::List<> */
7 #include "BinaryControlFlow.h"
8 #include "BinaryFunctionCall.h"
9 #include "BaseSemantics2.h"
10 
11 class SgAsmInstruction;
12 class SgAsmBlock;
13 class SgAsmFunction;
15 
16 namespace Rose {
17 namespace BinaryAnalysis {
18 
19 class Disassembler;
20 
249 class ROSE_DLL_API AsmUnparser {
250 public:
252  ORGANIZED_BY_AST,
257  ORGANIZED_BY_ADDRESS
261  };
262 
266  typedef boost::graph_traits<CFG>::vertex_descriptor CFG_Vertex;
267  typedef std::map<SgAsmBlock*, CFG_Vertex> CFG_BlockMap;
269  typedef boost::graph_traits<CG>::vertex_descriptor CG_Vertex;
270  typedef std::map<SgAsmFunction*, CG_Vertex> CG_FunctionMap;
271 
273  public:
275  struct GeneralArgs {
276  GeneralArgs(AsmUnparser *unparser, std::ostream &output)
277  : unparser(unparser), output(output) {}
279  std::ostream &output;
280  };
281 
283  struct InsnArgs: public GeneralArgs {
284  InsnArgs(AsmUnparser *unparser, std::ostream &output, SgAsmInstruction *insn, size_t position_in_block)
285  : GeneralArgs(unparser, output), insn(insn), position_in_block(position_in_block) {}
286  SgAsmInstruction *get_node() const { return insn; }
289  };
290 
292  struct BasicBlockArgs: public GeneralArgs {
293  BasicBlockArgs(AsmUnparser *unparser, std::ostream &output, SgAsmBlock *block,
294  const std::vector<SgAsmInstruction*> &insns)
295  : GeneralArgs(unparser, output), block(block), insns(insns) {}
296  SgAsmBlock *get_node() const { return block; }
298  const std::vector<SgAsmInstruction*> &insns;
299  };
300 
302  struct StaticDataArgs: public GeneralArgs {
303  StaticDataArgs(AsmUnparser *unparser, std::ostream &output, SgAsmStaticData *data, size_t position_in_block)
304  : GeneralArgs(unparser, output), data(data), position_in_block(position_in_block) {}
305  SgAsmStaticData *get_node() const { return data; }
308  };
309 
311  struct DataBlockArgs: public GeneralArgs {
312  DataBlockArgs(AsmUnparser *unparser, std::ostream &output, SgAsmBlock *block,
313  const std::vector<SgAsmStaticData*> &datalist)
314  : GeneralArgs(unparser, output), block(block), datalist(datalist) {}
315  SgAsmBlock *get_node() const { return block; }
317  const std::vector<SgAsmStaticData*> &datalist;
318  };
319 
321  struct FunctionArgs: public GeneralArgs {
322  FunctionArgs(AsmUnparser *unparser, std::ostream &output, SgAsmFunction *func)
323  : GeneralArgs(unparser, output), func(func) {}
324  SgAsmFunction *get_node() const { return func; }
326  };
327 
330  InterpretationArgs(AsmUnparser *unparser, std::ostream &output, SgAsmInterpretation *interp)
331  : GeneralArgs(unparser, output), interp(interp) {}
332  SgAsmInterpretation *get_node() const { return interp; }
334  };
335 
336  virtual ~UnparserCallback() {}
337 
348  virtual bool operator()(bool enabled, const InsnArgs&) { abort(); return false; }
349  virtual bool operator()(bool enabled, const BasicBlockArgs&) { abort(); return false; }
350  virtual bool operator()(bool enabled, const StaticDataArgs&) { abort(); return false; }
351  virtual bool operator()(bool enabled, const DataBlockArgs&) { abort(); return false; }
352  virtual bool operator()(bool enabled, const FunctionArgs&) { abort(); return false; }
353  virtual bool operator()(bool enabled, const InterpretationArgs&) { abort(); return false; }
355  };
356 
357  /**************************************************************************************************************************
358  * Instruction Callbacks
359  **************************************************************************************************************************/
360 
366  public:
367  virtual bool operator()(bool enabled, const InsnArgs &args);
368  };
369 
373  public:
374  SgAsmBlock *prev_block;
375  InsnBlockSeparation(): prev_block(NULL) {}
376  virtual bool operator()(bool enabled, const InsnArgs &args);
377  };
378 
382  public:
383  virtual bool operator()(bool enabled, const InsnArgs &args);
384  };
385 
388  public:
389  virtual bool operator()(bool enabled, const InsnArgs &args);
390  };
391 
396  public:
397  HexdumpFormat fmt;
398  InsnRawBytes() {
399  fmt.width = 8; /* Max instruction bytes per line of output. */
400  fmt.pad_chars = true; /* Show ASCII characters as well as bytes. */
401  }
402  virtual bool operator()(bool enabled, const InsnArgs &args);
403  };
404 
410  public:
413  InsnBlockEntry(): show_function(true), show_reasons(true) {}
414  virtual bool operator()(bool enabled, const InsnArgs &args);
415  };
416 
419  public:
420  virtual bool operator()(bool enabled, const InsnArgs &args);
421  };
422 
424  class InsnBody: public UnparserCallback {
425  public:
426  virtual bool operator()(bool enabled, const InsnArgs &args);
427  };
428 
432  public:
433  virtual bool operator()(bool enabled, const InsnArgs &args);
434  };
435 
438  public:
439  virtual bool operator()(bool enabled, const InsnArgs &args);
440  };
441 
444  public:
445  virtual bool operator()(bool enabled, const InsnArgs &args);
446  };
447 
452  public:
453  virtual bool operator()(bool enabled, const InsnArgs &args);
454  };
455 
456  /**************************************************************************************************************************
457  * Basic Block Callbacks
458  **************************************************************************************************************************/
459 
462  public:
463  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
464  };
465 
469  public:
470  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
471  };
472 
475  public:
476  bool debug;
477  BasicBlockNoopUpdater(): debug(false) {}
478  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
479  };
480 
483  public:
484  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
485  };
486 
490  public:
491  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
492  };
493 
496  public:
497  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
498  };
499 
505  public:
506  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
507  };
508 
511  public:
512  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
513  };
514 
518  public:
519  virtual bool operator()(bool enabled/*ignored*/, const BasicBlockArgs &args);
520  };
521 
522  /**************************************************************************************************************************
523  * Static Data Callbacks
524  **************************************************************************************************************************/
525 
531  public:
532  virtual bool operator()(bool enabled, const StaticDataArgs &args);
533  };
534 
538  public:
539  SgAsmBlock *prev_block;
540  StaticDataBlockSeparation(): prev_block(NULL) {}
541  virtual bool operator()(bool enabled, const StaticDataArgs &args);
542  };
543 
546  public:
547  bool show_address; /* Should we show the address in the left margin? */
548  bool show_offset; /* If show_address is true, then should we display START+OFFSET or just an address? */
549 
550  HexdumpFormat fmt;
552  show_address = true;
553  show_offset = false;
554  fmt.prefix = NULL; /* Adjusted by the callback each time called. */
555  fmt.multiline = false; /* Do not emit prefix before first line and linefeed after last line. */
556  fmt.width = 8; /* Max data bytes per line of output. */
557  fmt.pad_chars = true; /* Show ASCII characters as well as bytes. */
558  }
559  virtual bool operator()(bool enabled, const StaticDataArgs &args);
560  };
561 
567  public:
570  StaticDataBlockEntry(): show_function(true), show_reasons(true) {}
571  virtual bool operator()(bool enabled, const StaticDataArgs &args);
572  };
573 
576  public:
577  virtual bool operator()(bool enabled, const StaticDataArgs &args);
578  };
579 
582  public:
583  virtual bool operator()(bool enabled, const StaticDataArgs &args);
584  };
585 
588  public:
589  virtual bool operator()(bool enabled, const StaticDataArgs &args);
590  };
591 
597  public:
598  class DataNote: public UnparserCallback {
599  public:
600  virtual bool operator()(bool enabled, const InsnArgs &args) {
601  if (enabled)
602  args.output <<" (data)";
603  return enabled;
604  }
605  };
606 
607  DataNote data_note;
608  Disassembler *disassembler;
609  AsmUnparser *unparser;
610  bool unparser_allocated_here;
611  StaticDataDisassembler(): disassembler(NULL), unparser(NULL), unparser_allocated_here(false) {}
612  ~StaticDataDisassembler() { reset(); }
613  virtual void reset();
614  virtual void init(Disassembler *disassembler, AsmUnparser *unparser=NULL);
615  virtual bool operator()(bool enabled, const StaticDataArgs &args);
616  };
617 
622  public:
623  virtual bool operator()(bool enabled, const StaticDataArgs &args);
624  };
625 
626  /**************************************************************************************************************************
627  * Data Block Callbacks
628  **************************************************************************************************************************/
629 
632  public:
633  virtual bool operator()(bool enabled, const StaticDataArgs &args);
634  };
635 
638  public:
639  virtual bool operator()(bool enabled, const DataBlockArgs &args);
640  };
641 
644  public:
645  virtual bool operator()(bool enabled, const DataBlockArgs &args);
646  };
647 
648  /**************************************************************************************************************************
649  * Function Callbacks
650  **************************************************************************************************************************/
651 
654  public:
655  virtual bool operator()(bool enabled, const FunctionArgs &args);
656  };
657 
660  public:
661  virtual bool operator()(bool enabled, const FunctionArgs &args);
662  };
663 
666  public:
667  virtual bool operator()(bool enabled, const FunctionArgs &args);
668  };
669 
672  public:
673  virtual bool operator()(bool enabled, const FunctionArgs &args);
674  };
675 
678  public:
679  virtual bool operator()(bool enabled, const FunctionArgs &args);
680  };
681 
684  public:
685  virtual bool operator()(bool enabled, const FunctionArgs &args);
686  };
687 
691  public:
692  virtual bool operator()(bool enabled, const FunctionArgs &args);
693  };
694 
698  public:
699  virtual bool operator()(bool enabled, const FunctionArgs &args);
700  };
701 
706  public:
707  virtual bool operator()(bool enabled, const FunctionArgs &args);
708  };
709 
712  public:
713  virtual bool operator()(bool enabled, const FunctionArgs &args);
714  };
715 
716  /**************************************************************************************************************************
717  * Interpretation Callbacks
718  **************************************************************************************************************************/
719 
721  class InterpName: public UnparserCallback {
722  public:
723  virtual bool operator()(bool enabled, const InterpretationArgs &args);
724  };
725 
727  class InterpBody: public UnparserCallback {
728  public:
729  virtual bool operator()(bool enabled, const InterpretationArgs &args);
730  };
731 
732  /**************************************************************************************************************************
733  * Built-in Callbacks
734  * Don't forget to modify init() to actually add these to callback lists if desired.
735  **************************************************************************************************************************/
736 
745  InsnSkipBackBegin insnSkipBackBegin;
746  InsnBlockSeparation insnBlockSeparation;
747  InsnFuncEntry insnFuncEntry;
748  InsnAddress insnAddress;
749  InsnRawBytes insnRawBytes;
750  InsnBlockEntry insnBlockEntry;
751  InsnStackDelta insnStackDelta;
752  InsnBody insnBody;
753  InsnNoEffect insnNoEffect;
754  InsnComment insnComment;
755  InsnLineTermination insnLineTermination;
756  InsnSkipBackEnd insnSkipBackEnd;
757 
758  BasicBlockReasons basicBlockReasons;
759  BasicBlockPredecessors basicBlockPredecessors;
760  BasicBlockNoopUpdater basicBlockNoopUpdater;
761  BasicBlockNoopWarning basicBlockNoopWarning;
762  BasicBlockBody basicBlockBody;
763  BasicBlockOutgoingStackDelta basicBlockOutgoingStackDelta;
764  BasicBlockSuccessors basicBlockSuccessors;
765  BasicBlockLineTermination basicBlockLineTermination;
766  BasicBlockCleanup basicBlockCleanup;
767 
768  StaticDataSkipBackBegin staticDataSkipBackBegin;
769  StaticDataBlockSeparation staticDataBlockSeparation;
770  StaticDataRawBytes staticDataRawBytes;
771  StaticDataBlockEntry staticDataBlockEntry;
772  StaticDataDetails staticDataDetails;
773  StaticDataComment staticDataComment;
774  StaticDataLineTermination staticDataLineTermination;
775  StaticDataDisassembler staticDataDisassembler;
776  StaticDataSkipBackEnd staticDataSkipBackEnd;
777 
778  DataBlockBody dataBlockBody;
779  DataBlockLineTermination dataBlockLineTermination;
780 
781  FunctionEntryAddress functionEntryAddress;
782  FunctionSeparator functionSeparator;
783  FunctionReasons functionReasons;
784  FunctionName functionName;
785  FunctionLineTermination functionLineTermination;
786  FunctionComment functionComment;
787  FunctionPredecessors functionPredecessors;
788  FunctionSuccessors functionSuccessors;
789  FunctionAttributes functionAttributes;
790  FunctionBody functionBody;
791 
792  InterpName interpName;
793  InterpBody interpBody;
796  /**************************************************************************************************************************
797  * Public methods
798  **************************************************************************************************************************/
799 
801  AsmUnparser(): user_registers(NULL), interp_registers(NULL) {
802  init();
803  }
804 
805  virtual ~AsmUnparser() {}
806 
812  virtual Organization get_organization() const { return organization; }
813  virtual void set_organization(Organization organization) { this->organization = organization; }
821  virtual bool is_unparsable_node(SgNode *node);
822 
828  virtual SgNode *find_unparsable_node(SgNode *ast);
829 
834  virtual std::vector<SgNode*> find_unparsable_nodes(SgNode *ast);
835 
846  virtual const RegisterDictionary *get_registers() const;
847  virtual void set_registers(const RegisterDictionary *registers) { user_registers = registers; }
858  std::vector<bool> insn_is_noop;
859 
870  virtual size_t unparse(std::ostream&, SgNode *ast);
871 
875  std::string to_string(SgNode *ast);
876 
883  virtual bool unparse_one_node(std::ostream&, SgNode*);
884 
888  virtual bool unparse_insn(bool enabled, std::ostream&, SgAsmInstruction*, size_t position_in_block=(size_t)-1);
889  virtual bool unparse_basicblock(bool enabled, std::ostream&, SgAsmBlock*);
890  virtual bool unparse_staticdata(bool enabled, std::ostream&, SgAsmStaticData*, size_t position_in_block=(size_t)-1);
891  virtual bool unparse_datablock(bool enabled, std::ostream&, SgAsmBlock*);
892  virtual bool unparse_function(bool enabled, std::ostream&, SgAsmFunction*);
893  virtual bool unparse_interpretation(bool enabled, std::ostream&, SgAsmInterpretation*);
897  typedef std::map<uint64_t, std::string> LabelMap;
898 
903  void add_function_labels(SgNode *ast);
904 
908  void add_control_flow_graph(const Rose::BinaryAnalysis::ControlFlow::Graph &cfg);
909 
916  void set_skipback_reporting(bool b=true) { skipback.active=b; skipback.triggered=false; }
917  void clear_skipback_reporting() { set_skipback_reporting(false); }
918  bool get_skipback_reporting() const { return skipback.active; }
919  void reset_skipback() { skipback.triggered=false; skipback.va=0; }
920  void start_of_object(rose_addr_t, std::ostream&);
921  void end_of_object(rose_addr_t);
938  virtual void set_prefix_format(const std::string &format) { lineprefix.format = format; }
939  virtual const std::string& get_prefix_format() const { return lineprefix.format; }
940  virtual void set_prefix_address(rose_addr_t va) { lineprefix.address = va; }
941  virtual rose_addr_t get_prefix_address() const { return lineprefix.address; }
942  virtual std::string line_prefix() const;
943  virtual std::string blank_prefix() const { return std::string(line_prefix().size(), ' '); }
949  static std::string invalid_register(SgAsmInstruction*, RegisterDescriptor, const RegisterDictionary*);
950 
951 public:
952  static void initDiagnostics();
955 protected:
956  struct CallbackLists {
962  void clear() {
963  unparse.clear();
964  pre.clear();
965  post.clear();
966  }
967  };
968 
995  LabelMap labels;
996 
999 
1001  const RegisterDictionary *user_registers; // registers set by set_registers()
1002  const RegisterDictionary *interp_registers; // registers obtained from the SgAsmInterpretation
1003 
1005  virtual void init();
1006 
1008  CFG cfg;
1009 
1012  CFG_BlockMap cfg_blockmap;
1013 
1015  CG cg;
1016 
1019  CG_FunctionMap cg_functionmap;
1020 
1022  struct SkipBack {
1023  SkipBack(): active(true), triggered(false), va(0) {}
1024  bool active;
1025  bool triggered;
1026  rose_addr_t va;
1027  } skipback;
1028 
1030  struct LinePrefix {
1031  LinePrefix(): format("0x%08" PRIx64 ": "), address(0) {}
1032  std::string format;
1033  rose_addr_t address;
1034  } lineprefix;
1035 };
1036 
1037 } // namespace
1038 } // namespace
1039 
1040 #endif
size_t position_in_block
The index position of the instruction within the basic block, or -1 if unknown.
Definition: AsmUnparser.h:288
virtual std::string blank_prefix() const
Controls printing of line prefixes.
Definition: AsmUnparser.h:943
BlockGraph Graph
Default control flow graph.
void set_skipback_reporting(bool b=true)
Controls printing of skip/back messages during linear output.
Definition: AsmUnparser.h:916
const std::vector< SgAsmStaticData * > & datalist
The data items contained in this data block.
Definition: AsmUnparser.h:317
Functor to emit function information at entry points.
Definition: AsmUnparser.h:381
Functor to emit info about the first instruction of a block.
Definition: AsmUnparser.h:409
Functor to emit a blank line after every basic block.
Definition: AsmUnparser.h:510
bool triggered
Have we seen the first object yet? Is the 'va' member valid?
Definition: AsmUnparser.h:1025
Functor to unparse the function body.
Definition: AsmUnparser.h:711
bool show_reasons
If true (the default) show block reason bits.
Definition: AsmUnparser.h:412
AsmUnparser * unparser
The object doing the unparsing, from which this callback is invoked.
Definition: AsmUnparser.h:278
Update instruction end address for skip/back reporting.
Definition: AsmUnparser.h:451
Functor to update unparser's is_noop array.
Definition: AsmUnparser.h:474
rose_addr_t va
Virtual address for previous end_of_object() call.
Definition: AsmUnparser.h:1026
SgAsmInstruction * insn
The instruction being unparsed.
Definition: AsmUnparser.h:287
ROSE_Callbacks::List< UnparserCallback > post
Callbacks invoked after 'unparse' callbacks.
Definition: AsmUnparser.h:959
SgAsmBlock * block
The block of data being unparsed.
Definition: AsmUnparser.h:316
virtual void set_prefix_address(rose_addr_t va)
Controls printing of line prefixes.
Definition: AsmUnparser.h:940
Instruction basic block.
CallbackLists insn_callbacks
Callbacks for instruction unparsing.
Definition: AsmUnparser.h:969
const std::vector< SgAsmInstruction * > & insns
The instructions contained in this basic block.
Definition: AsmUnparser.h:298
virtual bool operator()(bool enabled, const StaticDataArgs &)
Default callbacks.
Definition: AsmUnparser.h:350
virtual void set_prefix_format(const std::string &format)
Controls printing of line prefixes.
Definition: AsmUnparser.h:938
Functor to print skip/back information when an instruction is entered.
Definition: AsmUnparser.h:365
Functor to emit instruction bytes.
Definition: AsmUnparser.h:395
Functor to print function comments followed by a linefeed if necessary.
Definition: AsmUnparser.h:683
Base class for machine instructions.
Disassembles static data as if it were code.
Definition: AsmUnparser.h:596
Collection of streams.
Definition: Message.h:1579
std::vector< bool > insn_is_noop
Optional information about no-op sequences.
Definition: AsmUnparser.h:858
List & clear()
Remove all callbacks from list without destroying them.
Definition: callbacks.h:233
Functor to emit the instructions that belong to a basic block.
Definition: AsmUnparser.h:489
bool multiline
Emit prefix at beginning and line feed at end of output.
Definition: Cxx_Grammar.h:6921
Functor to clean up after basic block.
Definition: AsmUnparser.h:517
Functor to emit data block separation in output organized by address.
Definition: AsmUnparser.h:537
virtual bool operator()(bool enabled, const InsnArgs &args)
Default callbacks.
Definition: AsmUnparser.h:600
Update static data end address for skip/back reporting.
Definition: AsmUnparser.h:621
Arguments passed to data unparsing callbacks.
Definition: AsmUnparser.h:302
std::ostream & output
Where output should be sent.
Definition: AsmUnparser.h:279
Functor to emit function line termination.
Definition: AsmUnparser.h:677
std::string format
Printf-style format string.
Definition: AsmUnparser.h:1032
void clear_skipback_reporting()
Controls printing of skip/back messages during linear output.
Definition: AsmUnparser.h:917
bool show_function
If true (the default) show entry address of function owning block.
Definition: AsmUnparser.h:568
Functor to emit basic block separation in output organized by address.
Definition: AsmUnparser.h:372
Functor to print callee addresses.
Definition: AsmUnparser.h:697
Settings that control how the lowest-level SgAsmExecutableFileFormat::hexdump function behaves...
Definition: Cxx_Grammar.h:6910
Represents a synthesized function.
size_t width
Bytes per line of output (default 16).
Definition: Cxx_Grammar.h:6918
virtual bool operator()(bool enabled, const DataBlockArgs &)
Default callbacks.
Definition: AsmUnparser.h:351
Functor to emit instruction comment, if any.
Definition: AsmUnparser.h:437
List of callback functors.
Definition: callbacks.h:80
Main namespace for the ROSE library.
Arguments passed to data block unparsing callbacks.
Definition: AsmUnparser.h:311
Describes (part of) a physical CPU register.
Rose::BinaryAnalysis::ControlFlow::Graph CFG
Control Flow Graph type.
Definition: AsmUnparser.h:265
size_t position_in_block
The index position of the data within the data block, or -1 if unknown.
Definition: AsmUnparser.h:307
CallbackLists basicblock_callbacks
Callbacks for basic block unparsing.
Definition: AsmUnparser.h:970
CallbackLists interp_callbacks
Callbacks for interpretation unparsing.
Definition: AsmUnparser.h:974
rose_addr_t address
Address to use when generating a prefix string.
Definition: AsmUnparser.h:1033
void reset_skipback()
Controls printing of skip/back messages during linear output.
Definition: AsmUnparser.h:919
Unparses binary AST into text.
Definition: AsmUnparser.h:249
bool show_reasons
If true (the default) show block reason bits.
Definition: AsmUnparser.h:569
virtual rose_addr_t get_prefix_address() const
Controls printing of line prefixes.
Definition: AsmUnparser.h:941
Functor to emit instruction address.
Definition: AsmUnparser.h:387
bool debug
If set, then emit information about the no-op subsequences.
Definition: AsmUnparser.h:476
Functor to emit function entry address.
Definition: AsmUnparser.h:653
LabelMap labels
This map is consulted whenever a constant is encountered.
Definition: AsmUnparser.h:995
virtual bool operator()(bool enabled, const InsnArgs &)
Default callbacks.
Definition: AsmUnparser.h:348
Functor to print skip/back information when a static data block is entered.
Definition: AsmUnparser.h:530
Organization organization
How output will be organized.
Definition: AsmUnparser.h:998
CallbackLists function_callbacks
Callbacks for function unparsing.
Definition: AsmUnparser.h:973
Arguments passed to interpretation unparsing callbacks.
Definition: AsmUnparser.h:329
Functor to emit optional static data comment.
Definition: AsmUnparser.h:581
virtual bool operator()(bool enabled, const InterpretationArgs &)
Default callbacks.
Definition: AsmUnparser.h:353
SgAsmInterpretation * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:332
SgAsmStaticData * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:305
Functor to emit a warning if the block contains any no-effect sequences.
Definition: AsmUnparser.h:482
SgAsmInstruction * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:286
boost::adjacency_list< boost::setS, boost::vecS, boost::bidirectionalS, boost::property< boost::vertex_name_t, SgAsmFunction * > > Graph
The default function call graph type.
Functor to emit the functions in an interpretation.
Definition: AsmUnparser.h:727
Functor to emit instruction line termination.
Definition: AsmUnparser.h:443
Functor to emit basic block outgoing stack delta.
Definition: AsmUnparser.h:495
Functor to emit a blank line after every data block.
Definition: AsmUnparser.h:643
CG cg
Function call graph.
Definition: AsmUnparser.h:1015
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:8322
SgAsmInterpretation * interp
The interpretation being unparsed.
Definition: AsmUnparser.h:333
bool pad_chars
Pad character part of output with spaces for partial final line (default true).
Definition: Cxx_Grammar.h:6932
virtual Organization get_organization() const
Get/set how output is organized.
Definition: AsmUnparser.h:812
Functor to emit details about static data.
Definition: AsmUnparser.h:575
CFG_BlockMap cfg_blockmap
A mapping from SgAsmBlock to control flow graph vertex.
Definition: AsmUnparser.h:1012
virtual void set_registers(const RegisterDictionary *registers)
Register dictionaries.
Definition: AsmUnparser.h:847
Functor to emit the bytes of the data block.
Definition: AsmUnparser.h:545
SgAsmBlock * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:296
Functor to emit control flow predecessor addresses.
Definition: AsmUnparser.h:468
virtual bool operator()(bool enabled, const BasicBlockArgs &)
Default callbacks.
Definition: AsmUnparser.h:349
Represents static data in an executable.
Defines registers available for a particular architecture.
Definition: Registers.h:32
CG_FunctionMap cg_functionmap
A mapping from SgAsmFunction to call graph vertex.
Definition: AsmUnparser.h:1019
Functor to emit the entire instruction.
Definition: AsmUnparser.h:424
void clear()
Clears all the callback lists.
Definition: AsmUnparser.h:962
Functor to emit interpretation name.
Definition: AsmUnparser.h:721
Details for skip/back reporting.
Definition: AsmUnparser.h:1022
const RegisterDictionary * user_registers
Dictionaries used to convert register descriptors to register names.
Definition: AsmUnparser.h:1001
AsmUnparser()
Constructor that intializes the "unparser" callback lists with some useful functors.
Definition: AsmUnparser.h:801
Functor to emit function separator.
Definition: AsmUnparser.h:659
static Sawyer::Message::Facility mlog
Diagnostic messages.
Definition: AsmUnparser.h:953
Functor to emit a blank line after every data block.
Definition: AsmUnparser.h:587
std::map< uint64_t, std::string > LabelMap
Maps integers to labels.
Definition: AsmUnparser.h:897
virtual const std::string & get_prefix_format() const
Controls printing of line prefixes.
Definition: AsmUnparser.h:939
Functor to emit info about the first data node of a block.
Definition: AsmUnparser.h:566
Functor to emit function reasons.
Definition: AsmUnparser.h:665
Functor to emit the numeric stack delta at each instruction.
Definition: AsmUnparser.h:418
bool get_skipback_reporting() const
Controls printing of skip/back messages during linear output.
Definition: AsmUnparser.h:918
SgAsmBlock * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:315
bool show_function
If true (the default) show entry address of function owning block.
Definition: AsmUnparser.h:411
Arguments common to all unparser callback lists.
Definition: AsmUnparser.h:275
CallbackLists datablock_callbacks
Callbacks for data block unparsing.
Definition: AsmUnparser.h:972
const char * prefix
Characters to emit after internal linefeeds.
Definition: Cxx_Grammar.h:6917
Functor to print some information at the beginning of a data block.
Definition: AsmUnparser.h:631
SgAsmFunction * func
The function being unparsed.
Definition: AsmUnparser.h:325
Functor to emit each data statement of the block.
Definition: AsmUnparser.h:637
Functor to emit a note about instructions that have no effect.
Definition: AsmUnparser.h:431
SgAsmBlock * block
The basic block being unparsed.
Definition: AsmUnparser.h:297
Arguments passed to instruction unparsing callbacks.
Definition: AsmUnparser.h:283
SgAsmFunction * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:324
virtual void set_organization(Organization organization)
Get/set how output is organized.
Definition: AsmUnparser.h:813
ROSE_Callbacks::List< UnparserCallback > unparse
The main unparsing callbacks.
Definition: AsmUnparser.h:957
Virtual base class for instruction disassemblers.
Definition: Disassembler.h:41
Represents an interpretation of a binary container.
ROSE_Callbacks::List< UnparserCallback > pre
Callbacks invoked before 'unparse' callbacks.
Definition: AsmUnparser.h:958
CFG cfg
Control flow graph.
Definition: AsmUnparser.h:1008
virtual bool operator()(bool enabled, const FunctionArgs &)
Default callbacks.
Definition: AsmUnparser.h:352
Functor to emit function attributes.
Definition: AsmUnparser.h:705
Arguments passed to function unparsing callbacks.
Definition: AsmUnparser.h:321
Functor to emit function name.
Definition: AsmUnparser.h:671
Functor to emit block successor list.
Definition: AsmUnparser.h:504
Functor to emit reasons this block is part of a function.
Definition: AsmUnparser.h:461
CallbackLists staticdata_callbacks
Callbacks for static data unparsing.
Definition: AsmUnparser.h:971
Arguments passed to basic block unparsing callbacks.
Definition: AsmUnparser.h:292