ROSE  0.10.5.0
AsmUnparser.h
1 #ifndef ROSE_AsmUnparser_H
2 #define ROSE_AsmUnparser_H
3 
4 #include <rosePublicConfig.h>
5 #ifdef ROSE_BUILD_BINARY_ANALYSIS_SUPPORT
6 
7 #include <ostream>
8 
9 #include "callbacks.h" // Needed for Rose::Callbacks::List<>
10 #include "BinaryControlFlow.h"
11 #include "BinaryFunctionCall.h"
12 #include "BaseSemantics2.h"
13 
14 class SgAsmInstruction;
15 class SgAsmBlock;
16 class SgAsmFunction;
18 
19 namespace Rose {
20 namespace BinaryAnalysis {
21 
22 class Disassembler;
23 
252 class ROSE_DLL_API AsmUnparser {
253 public:
255  ORGANIZED_BY_AST,
260  ORGANIZED_BY_ADDRESS
264  };
265 
269  typedef boost::graph_traits<CFG>::vertex_descriptor CFG_Vertex;
270  typedef std::map<SgAsmBlock*, CFG_Vertex> CFG_BlockMap;
272  typedef boost::graph_traits<CG>::vertex_descriptor CG_Vertex;
273  typedef std::map<SgAsmFunction*, CG_Vertex> CG_FunctionMap;
274 
276  public:
278  struct GeneralArgs {
279  GeneralArgs(AsmUnparser *unparser, std::ostream &output)
280  : unparser(unparser), output(output) {}
282  std::ostream &output;
283  };
284 
286  struct InsnArgs: public GeneralArgs {
287  InsnArgs(AsmUnparser *unparser, std::ostream &output, SgAsmInstruction *insn, size_t position_in_block)
288  : GeneralArgs(unparser, output), insn(insn), position_in_block(position_in_block) {}
289  SgAsmInstruction *get_node() const { return insn; }
292  };
293 
295  struct BasicBlockArgs: public GeneralArgs {
296  BasicBlockArgs(AsmUnparser *unparser, std::ostream &output, SgAsmBlock *block,
297  const std::vector<SgAsmInstruction*> &insns)
298  : GeneralArgs(unparser, output), block(block), insns(insns) {}
299  SgAsmBlock *get_node() const { return block; }
301  const std::vector<SgAsmInstruction*> &insns;
302  };
303 
305  struct StaticDataArgs: public GeneralArgs {
306  StaticDataArgs(AsmUnparser *unparser, std::ostream &output, SgAsmStaticData *data, size_t position_in_block)
307  : GeneralArgs(unparser, output), data(data), position_in_block(position_in_block) {}
308  SgAsmStaticData *get_node() const { return data; }
311  };
312 
314  struct DataBlockArgs: public GeneralArgs {
315  DataBlockArgs(AsmUnparser *unparser, std::ostream &output, SgAsmBlock *block,
316  const std::vector<SgAsmStaticData*> &datalist)
317  : GeneralArgs(unparser, output), block(block), datalist(datalist) {}
318  SgAsmBlock *get_node() const { return block; }
320  const std::vector<SgAsmStaticData*> &datalist;
321  };
322 
324  struct FunctionArgs: public GeneralArgs {
325  FunctionArgs(AsmUnparser *unparser, std::ostream &output, SgAsmFunction *func)
326  : GeneralArgs(unparser, output), func(func) {}
327  SgAsmFunction *get_node() const { return func; }
329  };
330 
333  InterpretationArgs(AsmUnparser *unparser, std::ostream &output, SgAsmInterpretation *interp)
334  : GeneralArgs(unparser, output), interp(interp) {}
335  SgAsmInterpretation *get_node() const { return interp; }
337  };
338 
339  virtual ~UnparserCallback() {}
340 
351  virtual bool operator()(bool /*enabled*/, const InsnArgs&) { abort(); return false; }
352  virtual bool operator()(bool /*enabled*/, const BasicBlockArgs&) { abort(); return false; }
353  virtual bool operator()(bool /*enabled*/, const StaticDataArgs&) { abort(); return false; }
354  virtual bool operator()(bool /*enabled*/, const DataBlockArgs&) { abort(); return false; }
355  virtual bool operator()(bool /*enabled*/, const FunctionArgs&) { abort(); return false; }
356  virtual bool operator()(bool /*enabled*/, const InterpretationArgs&) { abort(); return false; }
358  };
359 
360  /**************************************************************************************************************************
361  * Instruction Callbacks
362  **************************************************************************************************************************/
363 
369  public:
370  virtual bool operator()(bool enabled, const InsnArgs &args);
371  };
372 
376  public:
377  SgAsmBlock *prev_block;
378  InsnBlockSeparation(): prev_block(NULL) {}
379  virtual bool operator()(bool enabled, const InsnArgs &args);
380  };
381 
385  public:
386  virtual bool operator()(bool enabled, const InsnArgs &args);
387  };
388 
391  public:
392  virtual bool operator()(bool enabled, const InsnArgs &args);
393  };
394 
399  public:
400  HexdumpFormat fmt;
401  InsnRawBytes() {
402  fmt.width = 8; /* Max instruction bytes per line of output. */
403  fmt.pad_chars = true; /* Show ASCII characters as well as bytes. */
404  }
405  virtual bool operator()(bool enabled, const InsnArgs &args);
406  };
407 
413  public:
416  InsnBlockEntry(): show_function(true), show_reasons(true) {}
417  virtual bool operator()(bool enabled, const InsnArgs &args);
418  };
419 
422  public:
423  virtual bool operator()(bool enabled, const InsnArgs &args);
424  };
425 
427  class InsnBody: public UnparserCallback {
428  public:
429  virtual bool operator()(bool enabled, const InsnArgs &args);
430  };
431 
435  public:
436  virtual bool operator()(bool enabled, const InsnArgs &args);
437  };
438 
441  public:
442  virtual bool operator()(bool enabled, const InsnArgs &args);
443  };
444 
447  public:
448  virtual bool operator()(bool enabled, const InsnArgs &args);
449  };
450 
455  public:
456  virtual bool operator()(bool enabled, const InsnArgs &args);
457  };
458 
459  /**************************************************************************************************************************
460  * Basic Block Callbacks
461  **************************************************************************************************************************/
462 
465  public:
466  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
467  };
468 
472  public:
473  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
474  };
475 
478  public:
479  bool debug;
480  BasicBlockNoopUpdater(): debug(false) {}
481  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
482  };
483 
486  public:
487  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
488  };
489 
493  public:
494  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
495  };
496 
499  public:
500  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
501  };
502 
508  public:
509  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
510  };
511 
514  public:
515  virtual bool operator()(bool enabled, const BasicBlockArgs &args);
516  };
517 
521  public:
522  virtual bool operator()(bool enabled/*ignored*/, const BasicBlockArgs &args);
523  };
524 
525  /**************************************************************************************************************************
526  * Static Data Callbacks
527  **************************************************************************************************************************/
528 
534  public:
535  virtual bool operator()(bool enabled, const StaticDataArgs &args);
536  };
537 
541  public:
542  SgAsmBlock *prev_block;
543  StaticDataBlockSeparation(): prev_block(NULL) {}
544  virtual bool operator()(bool enabled, const StaticDataArgs &args);
545  };
546 
549  public:
550  bool show_address; /* Should we show the address in the left margin? */
551  bool show_offset; /* If show_address is true, then should we display START+OFFSET or just an address? */
552 
553  HexdumpFormat fmt;
555  show_address = true;
556  show_offset = false;
557  fmt.prefix = ""; /* Adjusted by the callback each time called. */
558  fmt.multiline = false; /* Do not emit prefix before first line and linefeed after last line. */
559  fmt.width = 8; /* Max data bytes per line of output. */
560  fmt.pad_chars = true; /* Show ASCII characters as well as bytes. */
561  }
562  virtual bool operator()(bool enabled, const StaticDataArgs &args);
563  };
564 
570  public:
573  StaticDataBlockEntry(): show_function(true), show_reasons(true) {}
574  virtual bool operator()(bool enabled, const StaticDataArgs &args);
575  };
576 
579  public:
580  virtual bool operator()(bool enabled, const StaticDataArgs &args);
581  };
582 
585  public:
586  virtual bool operator()(bool enabled, const StaticDataArgs &args);
587  };
588 
591  public:
592  virtual bool operator()(bool enabled, const StaticDataArgs &args);
593  };
594 
600  public:
601  class DataNote: public UnparserCallback {
602  public:
603  virtual bool operator()(bool enabled, const InsnArgs &args) {
604  if (enabled)
605  args.output <<" (data)";
606  return enabled;
607  }
608  };
609 
610  DataNote data_note;
611  Disassembler *disassembler;
612  AsmUnparser *unparser;
613  bool unparser_allocated_here;
614  StaticDataDisassembler(): disassembler(NULL), unparser(NULL), unparser_allocated_here(false) {}
615  ~StaticDataDisassembler() { reset(); }
616  virtual void reset();
617  virtual void init(Disassembler *disassembler, AsmUnparser *unparser=NULL);
618  virtual bool operator()(bool enabled, const StaticDataArgs &args);
619  };
620 
625  public:
626  virtual bool operator()(bool enabled, const StaticDataArgs &args);
627  };
628 
629  /**************************************************************************************************************************
630  * Data Block Callbacks
631  **************************************************************************************************************************/
632 
635  public:
636  virtual bool operator()(bool enabled, const StaticDataArgs &args);
637  };
638 
641  public:
642  virtual bool operator()(bool enabled, const DataBlockArgs &args);
643  };
644 
647  public:
648  virtual bool operator()(bool enabled, const DataBlockArgs &args);
649  };
650 
651  /**************************************************************************************************************************
652  * Function Callbacks
653  **************************************************************************************************************************/
654 
657  public:
658  virtual bool operator()(bool enabled, const FunctionArgs &args);
659  };
660 
663  public:
664  virtual bool operator()(bool enabled, const FunctionArgs &args);
665  };
666 
669  public:
670  virtual bool operator()(bool enabled, const FunctionArgs &args);
671  };
672 
675  public:
676  virtual bool operator()(bool enabled, const FunctionArgs &args);
677  };
678 
681  public:
682  virtual bool operator()(bool enabled, const FunctionArgs &args);
683  };
684 
687  public:
688  virtual bool operator()(bool enabled, const FunctionArgs &args);
689  };
690 
694  public:
695  virtual bool operator()(bool enabled, const FunctionArgs &args);
696  };
697 
701  public:
702  virtual bool operator()(bool enabled, const FunctionArgs &args);
703  };
704 
709  public:
710  virtual bool operator()(bool enabled, const FunctionArgs &args);
711  };
712 
715  public:
716  virtual bool operator()(bool enabled, const FunctionArgs &args);
717  };
718 
719  /**************************************************************************************************************************
720  * Interpretation Callbacks
721  **************************************************************************************************************************/
722 
724  class InterpName: public UnparserCallback {
725  public:
726  virtual bool operator()(bool enabled, const InterpretationArgs &args);
727  };
728 
730  class InterpBody: public UnparserCallback {
731  public:
732  virtual bool operator()(bool enabled, const InterpretationArgs &args);
733  };
734 
735  /**************************************************************************************************************************
736  * Built-in Callbacks
737  * Don't forget to modify init() to actually add these to callback lists if desired.
738  **************************************************************************************************************************/
739 
748  InsnSkipBackBegin insnSkipBackBegin;
749  InsnBlockSeparation insnBlockSeparation;
750  InsnFuncEntry insnFuncEntry;
751  InsnAddress insnAddress;
752  InsnRawBytes insnRawBytes;
753  InsnBlockEntry insnBlockEntry;
754  InsnStackDelta insnStackDelta;
755  InsnBody insnBody;
756  InsnNoEffect insnNoEffect;
757  InsnComment insnComment;
758  InsnLineTermination insnLineTermination;
759  InsnSkipBackEnd insnSkipBackEnd;
760 
761  BasicBlockReasons basicBlockReasons;
762  BasicBlockPredecessors basicBlockPredecessors;
763  BasicBlockNoopUpdater basicBlockNoopUpdater;
764  BasicBlockNoopWarning basicBlockNoopWarning;
765  BasicBlockBody basicBlockBody;
766  BasicBlockOutgoingStackDelta basicBlockOutgoingStackDelta;
767  BasicBlockSuccessors basicBlockSuccessors;
768  BasicBlockLineTermination basicBlockLineTermination;
769  BasicBlockCleanup basicBlockCleanup;
770 
771  StaticDataSkipBackBegin staticDataSkipBackBegin;
772  StaticDataBlockSeparation staticDataBlockSeparation;
773  StaticDataRawBytes staticDataRawBytes;
774  StaticDataBlockEntry staticDataBlockEntry;
775  StaticDataDetails staticDataDetails;
776  StaticDataComment staticDataComment;
777  StaticDataLineTermination staticDataLineTermination;
778  StaticDataDisassembler staticDataDisassembler;
779  StaticDataSkipBackEnd staticDataSkipBackEnd;
780 
781  DataBlockBody dataBlockBody;
782  DataBlockLineTermination dataBlockLineTermination;
783 
784  FunctionEntryAddress functionEntryAddress;
785  FunctionSeparator functionSeparator;
786  FunctionReasons functionReasons;
787  FunctionName functionName;
788  FunctionLineTermination functionLineTermination;
789  FunctionComment functionComment;
790  FunctionPredecessors functionPredecessors;
791  FunctionSuccessors functionSuccessors;
792  FunctionAttributes functionAttributes;
793  FunctionBody functionBody;
794 
795  InterpName interpName;
796  InterpBody interpBody;
799  /**************************************************************************************************************************
800  * Public methods
801  **************************************************************************************************************************/
802 
804  AsmUnparser(): user_registers(NULL), interp_registers(NULL) {
805  init();
806  }
807 
808  virtual ~AsmUnparser() {}
809 
815  virtual Organization get_organization() const { return organization; }
816  virtual void set_organization(Organization organization) { this->organization = organization; }
824  virtual bool is_unparsable_node(SgNode *node);
825 
831  virtual SgNode *find_unparsable_node(SgNode *ast);
832 
837  virtual std::vector<SgNode*> find_unparsable_nodes(SgNode *ast);
838 
849  virtual const RegisterDictionary *get_registers() const;
850  virtual void set_registers(const RegisterDictionary *registers) { user_registers = registers; }
861  std::vector<bool> insn_is_noop;
862 
873  virtual size_t unparse(std::ostream&, SgNode *ast);
874 
878  std::string to_string(SgNode *ast);
879 
886  virtual bool unparse_one_node(std::ostream&, SgNode*);
887 
891  virtual bool unparse_insn(bool enabled, std::ostream&, SgAsmInstruction*, size_t position_in_block=(size_t)-1);
892  virtual bool unparse_basicblock(bool enabled, std::ostream&, SgAsmBlock*);
893  virtual bool unparse_staticdata(bool enabled, std::ostream&, SgAsmStaticData*, size_t position_in_block=(size_t)-1);
894  virtual bool unparse_datablock(bool enabled, std::ostream&, SgAsmBlock*);
895  virtual bool unparse_function(bool enabled, std::ostream&, SgAsmFunction*);
896  virtual bool unparse_interpretation(bool enabled, std::ostream&, SgAsmInterpretation*);
900  typedef std::map<uint64_t, std::string> LabelMap;
901 
906  void add_function_labels(SgNode *ast);
907 
911  void add_control_flow_graph(const Rose::BinaryAnalysis::ControlFlow::Graph &cfg);
912 
919  void set_skipback_reporting(bool b=true) { skipback.active=b; skipback.triggered=false; }
920  void clear_skipback_reporting() { set_skipback_reporting(false); }
921  bool get_skipback_reporting() const { return skipback.active; }
922  void reset_skipback() { skipback.triggered=false; skipback.va=0; }
923  void start_of_object(rose_addr_t, std::ostream&);
924  void end_of_object(rose_addr_t);
941  virtual void set_prefix_format(const std::string &format) { lineprefix.format = format; }
942  virtual const std::string& get_prefix_format() const { return lineprefix.format; }
943  virtual void set_prefix_address(rose_addr_t va) { lineprefix.address = va; }
944  virtual rose_addr_t get_prefix_address() const { return lineprefix.address; }
945  virtual std::string line_prefix() const;
946  virtual std::string blank_prefix() const { return std::string(line_prefix().size(), ' '); }
952  static std::string invalid_register(SgAsmInstruction*, RegisterDescriptor, const RegisterDictionary*);
953 
954 public:
955  static void initDiagnostics();
958 protected:
959  struct CallbackLists {
965  void clear() {
966  unparse.clear();
967  pre.clear();
968  post.clear();
969  }
970  };
971 
998  LabelMap labels;
999 
1002 
1004  const RegisterDictionary *user_registers; // registers set by set_registers()
1005  const RegisterDictionary *interp_registers; // registers obtained from the SgAsmInterpretation
1006 
1008  virtual void init();
1009 
1011  CFG cfg;
1012 
1015  CFG_BlockMap cfg_blockmap;
1016 
1018  CG cg;
1019 
1022  CG_FunctionMap cg_functionmap;
1023 
1025  struct SkipBack {
1026  SkipBack(): active(true), triggered(false), va(0) {}
1027  bool active;
1028  bool triggered;
1029  rose_addr_t va;
1030  } skipback;
1031 
1033  struct LinePrefix {
1034  LinePrefix(): format("0x%08" PRIx64 ": "), address(0) {}
1035  std::string format;
1036  rose_addr_t address;
1037  } lineprefix;
1038 };
1039 
1040 } // namespace
1041 } // namespace
1042 
1043 #endif
1044 #endif
size_t position_in_block
The index position of the instruction within the basic block, or -1 if unknown.
Definition: AsmUnparser.h:291
virtual std::string blank_prefix() const
Controls printing of line prefixes.
Definition: AsmUnparser.h:946
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:919
const std::vector< SgAsmStaticData * > & datalist
The data items contained in this data block.
Definition: AsmUnparser.h:320
Functor to emit function information at entry points.
Definition: AsmUnparser.h:384
Functor to emit info about the first instruction of a block.
Definition: AsmUnparser.h:412
Functor to emit a blank line after every basic block.
Definition: AsmUnparser.h:513
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:1028
Functor to unparse the function body.
Definition: AsmUnparser.h:714
bool show_reasons
If true (the default) show block reason bits.
Definition: AsmUnparser.h:415
AsmUnparser * unparser
The object doing the unparsing, from which this callback is invoked.
Definition: AsmUnparser.h:281
Update instruction end address for skip/back reporting.
Definition: AsmUnparser.h:454
Functor to update unparser's is_noop array.
Definition: AsmUnparser.h:477
rose_addr_t va
Virtual address for previous end_of_object() call.
Definition: AsmUnparser.h:1029
SgAsmInstruction * insn
The instruction being unparsed.
Definition: AsmUnparser.h:290
SgAsmBlock * block
The block of data being unparsed.
Definition: AsmUnparser.h:319
virtual void set_prefix_address(rose_addr_t va)
Controls printing of line prefixes.
Definition: AsmUnparser.h:943
Instruction basic block.
CallbackLists insn_callbacks
Callbacks for instruction unparsing.
Definition: AsmUnparser.h:972
const std::vector< SgAsmInstruction * > & insns
The instructions contained in this basic block.
Definition: AsmUnparser.h:301
virtual void set_prefix_format(const std::string &format)
Controls printing of line prefixes.
Definition: AsmUnparser.h:941
Functor to print skip/back information when an instruction is entered.
Definition: AsmUnparser.h:368
Functor to emit instruction bytes.
Definition: AsmUnparser.h:398
Functor to print function comments followed by a linefeed if necessary.
Definition: AsmUnparser.h:686
Base class for machine instructions.
Disassembles static data as if it were code.
Definition: AsmUnparser.h:599
Collection of streams.
Definition: Message.h:1600
std::vector< bool > insn_is_noop
Optional information about no-op sequences.
Definition: AsmUnparser.h:861
Functor to emit the instructions that belong to a basic block.
Definition: AsmUnparser.h:492
bool multiline
Emit prefix at beginning and line feed at end of output.
Definition: Cxx_Grammar.h:7743
Functor to clean up after basic block.
Definition: AsmUnparser.h:520
Functor to emit data block separation in output organized by address.
Definition: AsmUnparser.h:540
virtual bool operator()(bool enabled, const InsnArgs &args)
Default callbacks.
Definition: AsmUnparser.h:603
Update static data end address for skip/back reporting.
Definition: AsmUnparser.h:624
Arguments passed to data unparsing callbacks.
Definition: AsmUnparser.h:305
std::ostream & output
Where output should be sent.
Definition: AsmUnparser.h:282
Functor to emit function line termination.
Definition: AsmUnparser.h:680
std::string format
Printf-style format string.
Definition: AsmUnparser.h:1035
void clear_skipback_reporting()
Controls printing of skip/back messages during linear output.
Definition: AsmUnparser.h:920
bool show_function
If true (the default) show entry address of function owning block.
Definition: AsmUnparser.h:571
Functor to emit basic block separation in output organized by address.
Definition: AsmUnparser.h:375
Callbacks::List< UnparserCallback > post
Callbacks invoked after 'unparse' callbacks.
Definition: AsmUnparser.h:962
Functor to print callee addresses.
Definition: AsmUnparser.h:700
Settings that control how the lowest-level SgAsmExecutableFileFormat::hexdump function behaves...
Definition: Cxx_Grammar.h:7733
Represents a synthesized function.
size_t width
Bytes per line of output (default 16).
Definition: Cxx_Grammar.h:7740
Functor to emit instruction comment, if any.
Definition: AsmUnparser.h:440
Main namespace for the ROSE library.
Arguments passed to data block unparsing callbacks.
Definition: AsmUnparser.h:314
Rose::BinaryAnalysis::ControlFlow::Graph CFG
Control Flow Graph type.
Definition: AsmUnparser.h:268
size_t position_in_block
The index position of the data within the data block, or -1 if unknown.
Definition: AsmUnparser.h:310
CallbackLists basicblock_callbacks
Callbacks for basic block unparsing.
Definition: AsmUnparser.h:973
CallbackLists interp_callbacks
Callbacks for interpretation unparsing.
Definition: AsmUnparser.h:977
rose_addr_t address
Address to use when generating a prefix string.
Definition: AsmUnparser.h:1036
virtual bool operator()(bool, const StaticDataArgs &)
Default callbacks.
Definition: AsmUnparser.h:353
void reset_skipback()
Controls printing of skip/back messages during linear output.
Definition: AsmUnparser.h:922
Unparses binary AST into text.
Definition: AsmUnparser.h:252
bool show_reasons
If true (the default) show block reason bits.
Definition: AsmUnparser.h:572
virtual rose_addr_t get_prefix_address() const
Controls printing of line prefixes.
Definition: AsmUnparser.h:944
Functor to emit instruction address.
Definition: AsmUnparser.h:390
bool debug
If set, then emit information about the no-op subsequences.
Definition: AsmUnparser.h:479
std::string prefix
Characters to emit after internal linefeeds.
Definition: Cxx_Grammar.h:7739
Functor to emit function entry address.
Definition: AsmUnparser.h:656
virtual bool operator()(bool, const InterpretationArgs &)
Default callbacks.
Definition: AsmUnparser.h:356
LabelMap labels
This map is consulted whenever a constant is encountered.
Definition: AsmUnparser.h:998
Functor to print skip/back information when a static data block is entered.
Definition: AsmUnparser.h:533
Organization organization
How output will be organized.
Definition: AsmUnparser.h:1001
CallbackLists function_callbacks
Callbacks for function unparsing.
Definition: AsmUnparser.h:976
Arguments passed to interpretation unparsing callbacks.
Definition: AsmUnparser.h:332
Functor to emit optional static data comment.
Definition: AsmUnparser.h:584
SgAsmInterpretation * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:335
SgAsmStaticData * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:308
Functor to emit a warning if the block contains any no-effect sequences.
Definition: AsmUnparser.h:485
SgAsmInstruction * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:289
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:730
Functor to emit instruction line termination.
Definition: AsmUnparser.h:446
Functor to emit basic block outgoing stack delta.
Definition: AsmUnparser.h:498
Functor to emit a blank line after every data block.
Definition: AsmUnparser.h:646
Describes (part of) a physical CPU register.
CG cg
Function call graph.
Definition: AsmUnparser.h:1018
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:9176
SgAsmInterpretation * interp
The interpretation being unparsed.
Definition: AsmUnparser.h:336
bool pad_chars
Pad character part of output with spaces for partial final line (default true).
Definition: Cxx_Grammar.h:7754
virtual Organization get_organization() const
Get/set how output is organized.
Definition: AsmUnparser.h:815
Functor to emit details about static data.
Definition: AsmUnparser.h:578
CFG_BlockMap cfg_blockmap
A mapping from SgAsmBlock to control flow graph vertex.
Definition: AsmUnparser.h:1015
virtual void set_registers(const RegisterDictionary *registers)
Register dictionaries.
Definition: AsmUnparser.h:850
Functor to emit the bytes of the data block.
Definition: AsmUnparser.h:548
SgAsmBlock * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:299
Functor to emit control flow predecessor addresses.
Definition: AsmUnparser.h:471
Represents static data in an executable.
CG_FunctionMap cg_functionmap
A mapping from SgAsmFunction to call graph vertex.
Definition: AsmUnparser.h:1022
Functor to emit the entire instruction.
Definition: AsmUnparser.h:427
void clear()
Clears all the callback lists.
Definition: AsmUnparser.h:965
Functor to emit interpretation name.
Definition: AsmUnparser.h:724
Details for skip/back reporting.
Definition: AsmUnparser.h:1025
const RegisterDictionary * user_registers
Dictionaries used to convert register descriptors to register names.
Definition: AsmUnparser.h:1004
AsmUnparser()
Constructor that intializes the "unparser" callback lists with some useful functors.
Definition: AsmUnparser.h:804
virtual bool operator()(bool, const InsnArgs &)
Default callbacks.
Definition: AsmUnparser.h:351
Functor to emit function separator.
Definition: AsmUnparser.h:662
static Sawyer::Message::Facility mlog
Diagnostic messages.
Definition: AsmUnparser.h:956
Functor to emit a blank line after every data block.
Definition: AsmUnparser.h:590
std::map< uint64_t, std::string > LabelMap
Maps integers to labels.
Definition: AsmUnparser.h:900
virtual const std::string & get_prefix_format() const
Controls printing of line prefixes.
Definition: AsmUnparser.h:942
Functor to emit info about the first data node of a block.
Definition: AsmUnparser.h:569
List & clear()
Remove all callbacks from list without destroying them.
Definition: callbacks.h:244
Functor to emit function reasons.
Definition: AsmUnparser.h:668
virtual bool operator()(bool, const FunctionArgs &)
Default callbacks.
Definition: AsmUnparser.h:355
Functor to emit the numeric stack delta at each instruction.
Definition: AsmUnparser.h:421
bool get_skipback_reporting() const
Controls printing of skip/back messages during linear output.
Definition: AsmUnparser.h:921
SgAsmBlock * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:318
bool show_function
If true (the default) show entry address of function owning block.
Definition: AsmUnparser.h:414
Arguments common to all unparser callback lists.
Definition: AsmUnparser.h:278
CallbackLists datablock_callbacks
Callbacks for data block unparsing.
Definition: AsmUnparser.h:975
virtual bool operator()(bool, const DataBlockArgs &)
Default callbacks.
Definition: AsmUnparser.h:354
Functor to print some information at the beginning of a data block.
Definition: AsmUnparser.h:634
SgAsmFunction * func
The function being unparsed.
Definition: AsmUnparser.h:328
Functor to emit each data statement of the block.
Definition: AsmUnparser.h:640
virtual bool operator()(bool, const BasicBlockArgs &)
Default callbacks.
Definition: AsmUnparser.h:352
Defines registers available for a particular architecture.
Definition: Registers.h:38
Functor to emit a note about instructions that have no effect.
Definition: AsmUnparser.h:434
SgAsmBlock * block
The basic block being unparsed.
Definition: AsmUnparser.h:300
Callbacks::List< UnparserCallback > pre
Callbacks invoked before 'unparse' callbacks.
Definition: AsmUnparser.h:961
Arguments passed to instruction unparsing callbacks.
Definition: AsmUnparser.h:286
SgAsmFunction * get_node() const
Return the node being unparsed.
Definition: AsmUnparser.h:327
virtual void set_organization(Organization organization)
Get/set how output is organized.
Definition: AsmUnparser.h:816
Virtual base class for instruction disassemblers.
Definition: Disassembler.h:50
Represents an interpretation of a binary container.
Callbacks::List< UnparserCallback > unparse
The main unparsing callbacks.
Definition: AsmUnparser.h:960
CFG cfg
Control flow graph.
Definition: AsmUnparser.h:1011
Functor to emit function attributes.
Definition: AsmUnparser.h:708
Arguments passed to function unparsing callbacks.
Definition: AsmUnparser.h:324
Functor to emit function name.
Definition: AsmUnparser.h:674
Functor to emit block successor list.
Definition: AsmUnparser.h:507
Functor to emit reasons this block is part of a function.
Definition: AsmUnparser.h:464
CallbackLists staticdata_callbacks
Callbacks for static data unparsing.
Definition: AsmUnparser.h:974
Arguments passed to basic block unparsing callbacks.
Definition: AsmUnparser.h:295