ROSE  0.11.98.0
AsmUnparser.h
1 #ifndef ROSE_AsmUnparser_H
2 #define ROSE_AsmUnparser_H
3 
4 #include <featureTests.h>
5 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 
7 #include <ostream>
8 
9 #include "callbacks.h" // Needed for Rose::Callbacks::List<>
10 #include <Rose/BinaryAnalysis/BasicTypes.h>
11 #include <Rose/BinaryAnalysis/ControlFlow.h>
12 #include <Rose/BinaryAnalysis/Disassembler/BasicTypes.h>
13 #include <Rose/BinaryAnalysis/FunctionCall.h>
14 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics.h>
15 
16 class SgAsmInstruction;
17 class SgAsmBlock;
18 class SgAsmFunction;
20 
21 namespace Rose {
22 namespace BinaryAnalysis {
23 
24 namespace Disassembler {
25 class Base;
26 } // namespace
27 
256 class ROSE_DLL_API AsmUnparser {
257 public:
259  ORGANIZED_BY_AST,
264  ORGANIZED_BY_ADDRESS
268  };
269 
273  typedef boost::graph_traits<CFG>::vertex_descriptor CFG_Vertex;
274  typedef std::map<SgAsmBlock*, CFG_Vertex> CFG_BlockMap;
276  typedef boost::graph_traits<CG>::vertex_descriptor CG_Vertex;
277  typedef std::map<SgAsmFunction*, CG_Vertex> CG_FunctionMap;
278 
280  public:
282  struct GeneralArgs {
283  GeneralArgs(AsmUnparser *unparser, std::ostream &output)
284  : unparser(unparser), output(output) {}
286  std::ostream &output;
287  };
288 
290  struct InsnArgs: public GeneralArgs {
291  InsnArgs(AsmUnparser *unparser, std::ostream &output, SgAsmInstruction *insn, size_t position_in_block)
292  : GeneralArgs(unparser, output), insn(insn), position_in_block(position_in_block) {}
293  SgAsmInstruction *get_node() const { return insn; }
296  };
297 
299  struct BasicBlockArgs: public GeneralArgs {
300  BasicBlockArgs(AsmUnparser *unparser, std::ostream &output, SgAsmBlock *block,
301  const std::vector<SgAsmInstruction*> &insns)
302  : GeneralArgs(unparser, output), block(block), insns(insns) {}
303  SgAsmBlock *get_node() const { return block; }
305  const std::vector<SgAsmInstruction*> &insns;
306  };
307 
309  struct StaticDataArgs: public GeneralArgs {
310  StaticDataArgs(AsmUnparser *unparser, std::ostream &output, SgAsmStaticData *data, size_t position_in_block)
311  : GeneralArgs(unparser, output), data(data), position_in_block(position_in_block) {}
312  SgAsmStaticData *get_node() const { return data; }
315  };
316 
318  struct DataBlockArgs: public GeneralArgs {
319  DataBlockArgs(AsmUnparser *unparser, std::ostream &output, SgAsmBlock *block,
320  const std::vector<SgAsmStaticData*> &datalist)
321  : GeneralArgs(unparser, output), block(block), datalist(datalist) {}
322  SgAsmBlock *get_node() const { return block; }
324  const std::vector<SgAsmStaticData*> &datalist;
325  };
326 
328  struct FunctionArgs: public GeneralArgs {
329  FunctionArgs(AsmUnparser *unparser, std::ostream &output, SgAsmFunction *func)
330  : GeneralArgs(unparser, output), func(func) {}
331  SgAsmFunction *get_node() const { return func; }
333  };
334 
337  InterpretationArgs(AsmUnparser *unparser, std::ostream &output, SgAsmInterpretation *interp)
338  : GeneralArgs(unparser, output), interp(interp) {}
339  SgAsmInterpretation *get_node() const { return interp; }
341  };
342 
343  virtual ~UnparserCallback() {}
344 
355  virtual bool operator()(bool /*enabled*/, const InsnArgs&) { abort(); return false; }
356  virtual bool operator()(bool /*enabled*/, const BasicBlockArgs&) { abort(); return false; }
357  virtual bool operator()(bool /*enabled*/, const StaticDataArgs&) { abort(); return false; }
358  virtual bool operator()(bool /*enabled*/, const DataBlockArgs&) { abort(); return false; }
359  virtual bool operator()(bool /*enabled*/, const FunctionArgs&) { abort(); return false; }
360  virtual bool operator()(bool /*enabled*/, const InterpretationArgs&) { abort(); return false; }
362  };
363 
364  /**************************************************************************************************************************
365  * Instruction Callbacks
366  **************************************************************************************************************************/
367 
373  public:
374  virtual bool operator()(bool enabled, const InsnArgs &args);
375  };
376 
380  public:
381  SgAsmBlock *prev_block;
382  InsnBlockSeparation(): prev_block(NULL) {}
383  virtual bool operator()(bool enabled, const InsnArgs &args);
384  };
385 
389  public:
390  virtual bool operator()(bool enabled, const InsnArgs &args);
391  };
392 
395  public:
396  virtual bool operator()(bool enabled, const InsnArgs &args);
397  };
398 
403  public:
404  HexdumpFormat fmt;
405  InsnRawBytes() {
406  fmt.width = 8; /* Max instruction bytes per line of output. */
407  fmt.pad_chars = true; /* Show ASCII characters as well as bytes. */
408  }
409  virtual bool operator()(bool enabled, const InsnArgs &args);
410  };
411 
417  public:
420  InsnBlockEntry(): show_function(true), show_reasons(true) {}
421  virtual bool operator()(bool enabled, const InsnArgs &args);
422  };
423 
426  public:
427  virtual bool operator()(bool enabled, const InsnArgs &args);
428  };
429 
431  class InsnBody: public UnparserCallback {
432  public:
433  virtual bool operator()(bool enabled, const InsnArgs &args);
434  };
435 
439  public:
440  virtual bool operator()(bool enabled, const InsnArgs &args);
441  };
442 
445  public:
446  virtual bool operator()(bool enabled, const InsnArgs &args);
447  };
448 
451  public:
452  virtual bool operator()(bool enabled, const InsnArgs &args);
453  };
454 
459  public:
460  virtual bool operator()(bool enabled, const InsnArgs &args);
461  };
462 
463  /**************************************************************************************************************************
464  * Basic Block Callbacks
465  **************************************************************************************************************************/
466 
469  public:
470  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
471  };
472 
476  public:
477  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
478  };
479 
482  public:
483  bool debug;
484  BasicBlockNoopUpdater(): debug(false) {}
485  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
486  };
487 
490  public:
491  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
492  };
493 
497  public:
498  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
499  };
500 
503  public:
504  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
505  };
506 
512  public:
513  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
514  };
515 
518  public:
519  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
520  };
521 
525  public:
526  virtual bool operator()(bool enabled/*ignored*/, const BasicBlockArgs &args);
527  };
528 
529  /**************************************************************************************************************************
530  * Static Data Callbacks
531  **************************************************************************************************************************/
532 
538  public:
539  virtual bool operator()(bool enabled, const StaticDataArgs &args);
540  };
541 
545  public:
546  SgAsmBlock *prev_block;
547  StaticDataBlockSeparation(): prev_block(NULL) {}
548  virtual bool operator()(bool enabled, const StaticDataArgs &args);
549  };
550 
553  public:
554  bool show_address; /* Should we show the address in the left margin? */
555  bool show_offset; /* If show_address is true, then should we display START+OFFSET or just an address? */
556 
557  HexdumpFormat fmt;
559  show_address = true;
560  show_offset = false;
561  fmt.prefix = ""; /* Adjusted by the callback each time called. */
562  fmt.multiline = false; /* Do not emit prefix before first line and linefeed after last line. */
563  fmt.width = 8; /* Max data bytes per line of output. */
564  fmt.pad_chars = true; /* Show ASCII characters as well as bytes. */
565  }
566  virtual bool operator()(bool enabled, const StaticDataArgs &args);
567  };
568 
574  public:
577  StaticDataBlockEntry(): show_function(true), show_reasons(true) {}
578  virtual bool operator()(bool enabled, const StaticDataArgs &args);
579  };
580 
583  public:
584  virtual bool operator()(bool enabled, const StaticDataArgs &args);
585  };
586 
589  public:
590  virtual bool operator()(bool enabled, const StaticDataArgs &args);
591  };
592 
595  public:
596  virtual bool operator()(bool enabled, const StaticDataArgs &args);
597  };
598 
604  public:
605  class DataNote: public UnparserCallback {
606  public:
607  virtual bool operator()(bool enabled, const InsnArgs &args) {
608  if (enabled)
609  args.output <<" (data)";
610  return enabled;
611  }
612  };
613 
614  DataNote data_note;
615  Disassembler::BasePtr disassembler;
616  AsmUnparser *unparser = nullptr;
617  bool unparser_allocated_here = false;
620  virtual void reset();
621  virtual void init(const Disassembler::BasePtr &disassembler, AsmUnparser *unparser=NULL);
622  virtual bool operator()(bool enabled, const StaticDataArgs &args);
623  };
624 
629  public:
630  virtual bool operator()(bool enabled, const StaticDataArgs &args);
631  };
632 
633  /**************************************************************************************************************************
634  * Data Block Callbacks
635  **************************************************************************************************************************/
636 
639  public:
640  virtual bool operator()(bool enabled, const StaticDataArgs &args);
641  };
642 
645  public:
646  virtual bool operator()(bool enabled, const DataBlockArgs &args);
647  };
648 
651  public:
652  virtual bool operator()(bool enabled, const DataBlockArgs &args);
653  };
654 
655  /**************************************************************************************************************************
656  * Function Callbacks
657  **************************************************************************************************************************/
658 
661  public:
662  virtual bool operator()(bool enabled, const FunctionArgs &args);
663  };
664 
667  public:
668  virtual bool operator()(bool enabled, const FunctionArgs &args);
669  };
670 
673  public:
674  virtual bool operator()(bool enabled, const FunctionArgs &args);
675  };
676 
679  public:
680  virtual bool operator()(bool enabled, const FunctionArgs &args);
681  };
682 
685  public:
686  virtual bool operator()(bool enabled, const FunctionArgs &args);
687  };
688 
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 
705  public:
706  virtual bool operator()(bool enabled, const FunctionArgs &args);
707  };
708 
713  public:
714  virtual bool operator()(bool enabled, const FunctionArgs &args);
715  };
716 
719  public:
720  virtual bool operator()(bool enabled, const FunctionArgs &args);
721  };
722 
723  /**************************************************************************************************************************
724  * Interpretation Callbacks
725  **************************************************************************************************************************/
726 
728  class InterpName: public UnparserCallback {
729  public:
730  virtual bool operator()(bool enabled, const InterpretationArgs &args);
731  };
732 
734  class InterpBody: public UnparserCallback {
735  public:
736  virtual bool operator()(bool enabled, const InterpretationArgs &args);
737  };
738 
739  /**************************************************************************************************************************
740  * Built-in Callbacks
741  * Don't forget to modify init() to actually add these to callback lists if desired.
742  **************************************************************************************************************************/
743 
752  InsnSkipBackBegin insnSkipBackBegin;
753  InsnBlockSeparation insnBlockSeparation;
754  InsnFuncEntry insnFuncEntry;
755  InsnAddress insnAddress;
756  InsnRawBytes insnRawBytes;
757  InsnBlockEntry insnBlockEntry;
758  InsnStackDelta insnStackDelta;
759  InsnBody insnBody;
760  InsnNoEffect insnNoEffect;
761  InsnComment insnComment;
762  InsnLineTermination insnLineTermination;
763  InsnSkipBackEnd insnSkipBackEnd;
764 
765  BasicBlockReasons basicBlockReasons;
766  BasicBlockPredecessors basicBlockPredecessors;
767  BasicBlockNoopUpdater basicBlockNoopUpdater;
768  BasicBlockNoopWarning basicBlockNoopWarning;
769  BasicBlockBody basicBlockBody;
770  BasicBlockOutgoingStackDelta basicBlockOutgoingStackDelta;
771  BasicBlockSuccessors basicBlockSuccessors;
772  BasicBlockLineTermination basicBlockLineTermination;
773  BasicBlockCleanup basicBlockCleanup;
774 
775  StaticDataSkipBackBegin staticDataSkipBackBegin;
776  StaticDataBlockSeparation staticDataBlockSeparation;
777  StaticDataRawBytes staticDataRawBytes;
778  StaticDataBlockEntry staticDataBlockEntry;
779  StaticDataDetails staticDataDetails;
780  StaticDataComment staticDataComment;
781  StaticDataLineTermination staticDataLineTermination;
782  StaticDataDisassembler staticDataDisassembler;
783  StaticDataSkipBackEnd staticDataSkipBackEnd;
784 
785  DataBlockBody dataBlockBody;
786  DataBlockLineTermination dataBlockLineTermination;
787 
788  FunctionEntryAddress functionEntryAddress;
789  FunctionSeparator functionSeparator;
790  FunctionReasons functionReasons;
791  FunctionName functionName;
792  FunctionLineTermination functionLineTermination;
793  FunctionComment functionComment;
794  FunctionPredecessors functionPredecessors;
795  FunctionSuccessors functionSuccessors;
796  FunctionAttributes functionAttributes;
797  FunctionBody functionBody;
798 
799  InterpName interpName;
800  InterpBody interpBody;
803  /**************************************************************************************************************************
804  * Public methods
805  **************************************************************************************************************************/
806 
808  AsmUnparser();
809  virtual ~AsmUnparser();
810 
816  virtual Organization get_organization() const { return organization; }
817  virtual void set_organization(Organization organization) { this->organization = organization; }
825  virtual bool is_unparsable_node(SgNode *node);
826 
832  virtual SgNode *find_unparsable_node(SgNode *ast);
833 
838  virtual std::vector<SgNode*> find_unparsable_nodes(SgNode *ast);
839 
850  virtual RegisterDictionaryPtr get_registers() const;
851  virtual void set_registers(const RegisterDictionaryPtr &registers);
862  std::vector<bool> insn_is_noop;
863 
874  virtual size_t unparse(std::ostream&, SgNode *ast);
875 
879  std::string to_string(SgNode *ast);
880 
887  virtual bool unparse_one_node(std::ostream&, SgNode*);
888 
892  virtual bool unparse_insn(bool enabled, std::ostream&, SgAsmInstruction*, size_t position_in_block=(size_t)-1);
893  virtual bool unparse_basicblock(bool enabled, std::ostream&, SgAsmBlock*);
894  virtual bool unparse_staticdata(bool enabled, std::ostream&, SgAsmStaticData*, size_t position_in_block=(size_t)-1);
895  virtual bool unparse_datablock(bool enabled, std::ostream&, SgAsmBlock*);
896  virtual bool unparse_function(bool enabled, std::ostream&, SgAsmFunction*);
897  virtual bool unparse_interpretation(bool enabled, std::ostream&, SgAsmInterpretation*);
901  typedef std::map<uint64_t, std::string> LabelMap;
902 
907  void add_function_labels(SgNode *ast);
908 
912  void add_control_flow_graph(const Rose::BinaryAnalysis::ControlFlow::Graph &cfg);
913 
920  void set_skipback_reporting(bool b=true) { skipback.active=b; skipback.triggered=false; }
921  void clear_skipback_reporting() { set_skipback_reporting(false); }
922  bool get_skipback_reporting() const { return skipback.active; }
923  void reset_skipback() { skipback.triggered=false; skipback.va=0; }
924  void start_of_object(rose_addr_t, std::ostream&);
925  void end_of_object(rose_addr_t);
942  virtual void set_prefix_format(const std::string &format) { lineprefix.format = format; }
943  virtual const std::string& get_prefix_format() const { return lineprefix.format; }
944  virtual void set_prefix_address(rose_addr_t va) { lineprefix.address = va; }
945  virtual rose_addr_t get_prefix_address() const { return lineprefix.address; }
946  virtual std::string line_prefix() const;
947  virtual std::string blank_prefix() const { return std::string(line_prefix().size(), ' '); }
950 public:
951  static void initDiagnostics();
954 protected:
955  struct CallbackLists {
961  void clear() {
962  unparse.clear();
963  pre.clear();
964  post.clear();
965  }
966  };
967 
994  LabelMap labels;
995 
998 
1000  RegisterDictionaryPtr user_registers; // registers set by set_registers()
1001  RegisterDictionaryPtr interp_registers; // registers obtained from the SgAsmInterpretation
1002 
1004  virtual void init();
1005 
1007  CFG cfg;
1008 
1011  CFG_BlockMap cfg_blockmap;
1012 
1014  CG cg;
1015 
1018  CG_FunctionMap cg_functionmap;
1019 
1021  struct SkipBack {
1022  SkipBack(): active(true), triggered(false), va(0) {}
1023  bool active;
1024  bool triggered;
1025  rose_addr_t va;
1026  } skipback;
1027 
1029  struct LinePrefix {
1030  LinePrefix(): format("0x%08" PRIx64 ": "), address(0) {}
1031  std::string format;
1032  rose_addr_t address;
1033  } lineprefix;
1034 };
1035 
1036 } // namespace
1037 } // namespace
1038 
1039 #endif
1040 #endif
size_t position_in_block
The index position of the instruction within the basic block, or -1 if unknown.
Definition: AsmUnparser.h:295
virtual std::string blank_prefix() const
Controls printing of line prefixes.
Definition: AsmUnparser.h:947
BlockGraph Graph
Default control flow graph.
Definition: ControlFlow.h:187
void set_skipback_reporting(bool b=true)
Controls printing of skip/back messages during linear output.
Definition: AsmUnparser.h:920
const std::vector< SgAsmStaticData * > & datalist
The data items contained in this data block.
Definition: AsmUnparser.h:324
Functor to emit function information at entry points.
Definition: AsmUnparser.h:388
Functor to emit info about the first instruction of a block.
Definition: AsmUnparser.h:416
Functor to emit a blank line after every basic block.
Definition: AsmUnparser.h:517
List of callback functors.
Definition: callbacks.h:82
bool triggered
Have we seen the first object yet? Is the 'va' member valid?
Definition: AsmUnparser.h:1024
Functor to unparse the function body.
Definition: AsmUnparser.h:718
bool show_reasons
If true (the default) show block reason bits.
Definition: AsmUnparser.h:419
AsmUnparser * unparser
The object doing the unparsing, from which this callback is invoked.
Definition: AsmUnparser.h:285
Update instruction end address for skip/back reporting.
Definition: AsmUnparser.h:458
Functor to update unparser's is_noop array.
Definition: AsmUnparser.h:481
rose_addr_t va
Virtual address for previous end_of_object() call.
Definition: AsmUnparser.h:1025
SgAsmInstruction * insn
The instruction being unparsed.
Definition: AsmUnparser.h:294
SgAsmBlock * block
The block of data being unparsed.
Definition: AsmUnparser.h:323
virtual void set_prefix_address(rose_addr_t va)
Controls printing of line prefixes.
Definition: AsmUnparser.h:944
Instruction basic block.
CallbackLists insn_callbacks
Callbacks for instruction unparsing.
Definition: AsmUnparser.h:968
const std::vector< SgAsmInstruction * > & insns
The instructions contained in this basic block.
Definition: AsmUnparser.h:305
virtual void set_prefix_format(const std::string &format)
Controls printing of line prefixes.
Definition: AsmUnparser.h:942
Functor to print skip/back information when an instruction is entered.
Definition: AsmUnparser.h:372
Functor to emit instruction bytes.
Definition: AsmUnparser.h:402
Functor to print function comments followed by a linefeed if necessary.
Definition: AsmUnparser.h:690
Base class for machine instructions.
Disassembles static data as if it were code.
Definition: AsmUnparser.h:603
Collection of streams.
Definition: Message.h:1606
std::vector< bool > insn_is_noop
Optional information about no-op sequences.
Definition: AsmUnparser.h:862
Functor to emit the instructions that belong to a basic block.
Definition: AsmUnparser.h:496
bool multiline
Emit prefix at beginning and line feed at end of output.
Definition: Cxx_Grammar.h:8126
Functor to clean up after basic block.
Definition: AsmUnparser.h:524
Functor to emit data block separation in output organized by address.
Definition: AsmUnparser.h:544
virtual bool operator()(bool enabled, const InsnArgs &args)
Default callbacks.
Definition: AsmUnparser.h:607
Update static data end address for skip/back reporting.
Definition: AsmUnparser.h:628
Arguments passed to data unparsing callbacks.
Definition: AsmUnparser.h:309
std::ostream & output
Where output should be sent.
Definition: AsmUnparser.h:286
Functor to emit function line termination.
Definition: AsmUnparser.h:684
std::string format
Printf-style format string.
Definition: AsmUnparser.h:1031
void clear_skipback_reporting()
Controls printing of skip/back messages during linear output.
Definition: AsmUnparser.h:921
bool show_function
If true (the default) show entry address of function owning block.
Definition: AsmUnparser.h:575
Functor to emit basic block separation in output organized by address.
Definition: AsmUnparser.h:379
Callbacks::List< UnparserCallback > post
Callbacks invoked after 'unparse' callbacks.
Definition: AsmUnparser.h:958
Functor to print callee addresses.
Definition: AsmUnparser.h:704
Settings that control how the lowest-level SgAsmExecutableFileFormat::hexdump function behaves...
Definition: Cxx_Grammar.h:8116
Represents a synthesized function.
size_t width
Bytes per line of output (default 16).
Definition: Cxx_Grammar.h:8123
Functor to emit instruction comment, if any.
Definition: AsmUnparser.h:444
Main namespace for the ROSE library.
Arguments passed to data block unparsing callbacks.
Definition: AsmUnparser.h:318
Rose::BinaryAnalysis::ControlFlow::Graph CFG
Control Flow Graph type.
Definition: AsmUnparser.h:272
size_t position_in_block
The index position of the data within the data block, or -1 if unknown.
Definition: AsmUnparser.h:314
CallbackLists basicblock_callbacks
Callbacks for basic block unparsing.
Definition: AsmUnparser.h:969
CallbackLists interp_callbacks
Callbacks for interpretation unparsing.
Definition: AsmUnparser.h:973
rose_addr_t address
Address to use when generating a prefix string.
Definition: AsmUnparser.h:1032
virtual bool operator()(bool, const StaticDataArgs &)
Default callbacks.
Definition: AsmUnparser.h:357
void reset_skipback()
Controls printing of skip/back messages during linear output.
Definition: AsmUnparser.h:923
Unparses binary AST into text.
Definition: AsmUnparser.h:256
bool show_reasons
If true (the default) show block reason bits.
Definition: AsmUnparser.h:576
virtual rose_addr_t get_prefix_address() const
Controls printing of line prefixes.
Definition: AsmUnparser.h:945
Functor to emit instruction address.
Definition: AsmUnparser.h:394
bool debug
If set, then emit information about the no-op subsequences.
Definition: AsmUnparser.h:483
std::string prefix
Characters to emit after internal linefeeds.
Definition: Cxx_Grammar.h:8122
Functor to emit function entry address.
Definition: AsmUnparser.h:660
virtual bool operator()(bool, const InterpretationArgs &)
Default callbacks.
Definition: AsmUnparser.h:360
LabelMap labels
This map is consulted whenever a constant is encountered.
Definition: AsmUnparser.h:994
Functor to print skip/back information when a static data block is entered.
Definition: AsmUnparser.h:537
Organization organization
How output will be organized.
Definition: AsmUnparser.h:997
CallbackLists function_callbacks
Callbacks for function unparsing.
Definition: AsmUnparser.h:972
Arguments passed to interpretation unparsing callbacks.
Definition: AsmUnparser.h:336
Functor to emit optional static data comment.
Definition: AsmUnparser.h:588
SgAsmInterpretation * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:339
SgAsmStaticData * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:312
Functor to emit a warning if the block contains any no-effect sequences.
Definition: AsmUnparser.h:489
SgAsmInstruction * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:293
boost::adjacency_list< boost::setS, boost::vecS, boost::bidirectionalS, boost::property< boost::vertex_name_t, SgAsmFunction * > > Graph
The default function call graph type.
Definition: FunctionCall.h:56
Functor to emit the functions in an interpretation.
Definition: AsmUnparser.h:734
Functor to emit instruction line termination.
Definition: AsmUnparser.h:450
Functor to emit basic block outgoing stack delta.
Definition: AsmUnparser.h:502
Functor to emit a blank line after every data block.
Definition: AsmUnparser.h:650
CG cg
Function call graph.
Definition: AsmUnparser.h:1014
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:9559
SgAsmInterpretation * interp
The interpretation being unparsed.
Definition: AsmUnparser.h:340
bool pad_chars
Pad character part of output with spaces for partial final line (default true).
Definition: Cxx_Grammar.h:8137
virtual Organization get_organization() const
Get/set how output is organized.
Definition: AsmUnparser.h:816
Functor to emit details about static data.
Definition: AsmUnparser.h:582
CFG_BlockMap cfg_blockmap
A mapping from SgAsmBlock to control flow graph vertex.
Definition: AsmUnparser.h:1011
Functor to emit the bytes of the data block.
Definition: AsmUnparser.h:552
RegisterDictionaryPtr user_registers
Dictionaries used to convert register descriptors to register names.
Definition: AsmUnparser.h:1000
SgAsmBlock * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:303
Functor to emit control flow predecessor addresses.
Definition: AsmUnparser.h:475
Represents static data in an executable.
CG_FunctionMap cg_functionmap
A mapping from SgAsmFunction to call graph vertex.
Definition: AsmUnparser.h:1018
Functor to emit the entire instruction.
Definition: AsmUnparser.h:431
void clear()
Clears all the callback lists.
Definition: AsmUnparser.h:961
Functor to emit interpretation name.
Definition: AsmUnparser.h:728
Binary analysis.
Details for skip/back reporting.
Definition: AsmUnparser.h:1021
virtual bool operator()(bool, const InsnArgs &)
Default callbacks.
Definition: AsmUnparser.h:355
Functor to emit function separator.
Definition: AsmUnparser.h:666
static Sawyer::Message::Facility mlog
Diagnostic messages.
Definition: AsmUnparser.h:952
Functor to emit a blank line after every data block.
Definition: AsmUnparser.h:594
std::map< uint64_t, std::string > LabelMap
Maps integers to labels.
Definition: AsmUnparser.h:901
virtual const std::string & get_prefix_format() const
Controls printing of line prefixes.
Definition: AsmUnparser.h:943
Functor to emit info about the first data node of a block.
Definition: AsmUnparser.h:573
List & clear()
Remove all callbacks from list without destroying them.
Definition: callbacks.h:244
Functor to emit function reasons.
Definition: AsmUnparser.h:672
virtual bool operator()(bool, const FunctionArgs &)
Default callbacks.
Definition: AsmUnparser.h:359
Functor to emit the numeric stack delta at each instruction.
Definition: AsmUnparser.h:425
bool get_skipback_reporting() const
Controls printing of skip/back messages during linear output.
Definition: AsmUnparser.h:922
SgAsmBlock * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:322
bool show_function
If true (the default) show entry address of function owning block.
Definition: AsmUnparser.h:418
Arguments common to all unparser callback lists.
Definition: AsmUnparser.h:282
CallbackLists datablock_callbacks
Callbacks for data block unparsing.
Definition: AsmUnparser.h:971
virtual bool operator()(bool, const DataBlockArgs &)
Default callbacks.
Definition: AsmUnparser.h:358
Functor to print some information at the beginning of a data block.
Definition: AsmUnparser.h:638
SgAsmFunction * func
The function being unparsed.
Definition: AsmUnparser.h:332
Functor to emit each data statement of the block.
Definition: AsmUnparser.h:644
virtual bool operator()(bool, const BasicBlockArgs &)
Default callbacks.
Definition: AsmUnparser.h:356
Functor to emit a note about instructions that have no effect.
Definition: AsmUnparser.h:438
SgAsmBlock * block
The basic block being unparsed.
Definition: AsmUnparser.h:304
Callbacks::List< UnparserCallback > pre
Callbacks invoked before 'unparse' callbacks.
Definition: AsmUnparser.h:957
Arguments passed to instruction unparsing callbacks.
Definition: AsmUnparser.h:290
SgAsmFunction * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:331
virtual void set_organization(Organization organization)
Get/set how output is organized.
Definition: AsmUnparser.h:817
Represents an interpretation of a binary container.
Callbacks::List< UnparserCallback > unparse
The main unparsing callbacks.
Definition: AsmUnparser.h:956
CFG cfg
Control flow graph.
Definition: AsmUnparser.h:1007
Functor to emit function attributes.
Definition: AsmUnparser.h:712
Arguments passed to function unparsing callbacks.
Definition: AsmUnparser.h:328
Functor to emit function name.
Definition: AsmUnparser.h:678
Functor to emit block successor list.
Definition: AsmUnparser.h:511
Functor to emit reasons this block is part of a function.
Definition: AsmUnparser.h:468
CallbackLists staticdata_callbacks
Callbacks for static data unparsing.
Definition: AsmUnparser.h:970
Arguments passed to basic block unparsing callbacks.
Definition: AsmUnparser.h:299