HPCToolkit
LM.hpp
Go to the documentation of this file.
1 // -*-Mode: C++;-*-
2 
3 // * BeginRiceCopyright *****************************************************
4 //
5 // $HeadURL$
6 // $Id$
7 //
8 // --------------------------------------------------------------------------
9 // Part of HPCToolkit (hpctoolkit.org)
10 //
11 // Information about sources of support for research and development of
12 // HPCToolkit is at 'hpctoolkit.org' and in 'README.Acknowledgments'.
13 // --------------------------------------------------------------------------
14 //
15 // Copyright ((c)) 2002-2019, Rice University
16 // All rights reserved.
17 //
18 // Redistribution and use in source and binary forms, with or without
19 // modification, are permitted provided that the following conditions are
20 // met:
21 //
22 // * Redistributions of source code must retain the above copyright
23 // notice, this list of conditions and the following disclaimer.
24 //
25 // * Redistributions in binary form must reproduce the above copyright
26 // notice, this list of conditions and the following disclaimer in the
27 // documentation and/or other materials provided with the distribution.
28 //
29 // * Neither the name of Rice University (RICE) nor the names of its
30 // contributors may be used to endorse or promote products derived from
31 // this software without specific prior written permission.
32 //
33 // This software is provided by RICE and contributors "as is" and any
34 // express or implied warranties, including, but not limited to, the
35 // implied warranties of merchantability and fitness for a particular
36 // purpose are disclaimed. In no event shall RICE or contributors be
37 // liable for any direct, indirect, incidental, special, exemplary, or
38 // consequential damages (including, but not limited to, procurement of
39 // substitute goods or services; loss of use, data, or profits; or
40 // business interruption) however caused and on any theory of liability,
41 // whether in contract, strict liability, or tort (including negligence
42 // or otherwise) arising in any way out of the use of this software, even
43 // if advised of the possibility of such damage.
44 //
45 // ******************************************************* EndRiceCopyright *
46 
47 //***************************************************************************
48 //
49 // File:
50 // $HeadURL$
51 //
52 // Purpose:
53 // [The purpose of this file]
54 //
55 // Description:
56 // [The set of functions, macros, etc. defined in the file]
57 //
58 //***************************************************************************
59 
60 #ifndef BinUtil_LM_hpp
61 #define BinUtil_LM_hpp
62 
63 //************************* System Include Files ****************************
64 
65 #include <string>
66 #include <deque>
67 #include <map>
68 #include <iostream>
69 
70 #include <string.h>
71 
72 //*************************** User Include Files ****************************
73 
74 #include <include/gcc-attr.h>
75 #include <include/uint.h>
76 #include <include/gnu_bfd.h>
77 
78 #include "Dbg-LM.hpp"
79 #include "VMAInterval.hpp"
80 #include "BinUtils.hpp"
81 #include "SimpleSymbols.hpp"
82 
83 #include <lib/isa/ISATypes.hpp>
84 #include <lib/isa/ISA.hpp>
85 
88 #include <lib/support/SrcFile.hpp>
89 
90 #include <include/linux_info.h> // linux kernel macros
91 
92 //*************************** Forward Declarations **************************
93 
94 class ISA;
95 
96 //***************************************************************************
97 // LM (LoadModule)
98 //***************************************************************************
99 
100 namespace BinUtil {
101 
102 class Seg;
103 class Proc;
104 class Insn;
105 //class LMImpl;
106 class NoReturns;
107 
108 // --------------------------------------------------------------------------
109 // 'LM' represents a load module, a binary loaded into memory
110 //
111 //
112 // Note: Most references to VMA (virtual memory address) could be
113 // replaced with 'PC' (program counter) or IP (instruction pointer).
114 // --------------------------------------------------------------------------
115 
116 class LM {
117 public:
118  enum Type { TypeNULL = 0, TypeExe, TypeDSO };
119 
120  // Read flags: forms an inverse hierarchy where a smaller scope
121  // implies all the larger scopes. E.g. ReadFlg_Insn implies
122  // ReadFlg_Proc and ReadFlg_Seg.
123  enum ReadFlg {
125 
126  // individual flags
127  ReadFlg_fSeg = 0x0001, // always read: permits source code lookup
128  ReadFlg_fProc = 0x0010,
129  ReadFlg_fInsn = 0x0100,
130 
131  // composite flags
135  };
136 
139  typedef std::map<VMA, Insn*> InsnMap;
140 
141 public:
142  // -------------------------------------------------------
143  // Constructor/Destructor
144  // -------------------------------------------------------
145 
146  // Constructor allocates an empty data structure
147  LM(bool useBinutils=false);
148 
149  virtual ~LM();
150 
151  // -------------------------------------------------------
152  // open/read (cf. istreams)
153  // -------------------------------------------------------
154 
155  // open: If 'moduleName' is not already open, attempt to do so;
156  // throw an exception on error. If a file is already, do nothing.
157  // (Segs, Procs and Insns are not constructed yet.)
158  virtual void
159  open(const char* filenm);
160 
161  // read: If module has not already been read, attempt to do so;
162  // return an exception on error. If a file has already been read do
163  // nothing.
164  virtual void
165  read(const std::set<std::string> &directorySet, ReadFlg readflg/* = ReadFlg_Seg*/);
166 
167 
168  // name: Return name of load module
169  const std::string&
170  name() const
171  { return m_simpleSymbols ? m_simpleSymbols->name() : m_name; }
172 
173  // type: Return type of load module
174  Type
175  type() const
176  { return m_type; }
177 
178  ReadFlg
180  { return m_readFlags; }
181 
182  // textBeg, textEnd: (Unrelocated) Text begin and end.
183  // FIXME: only guaranteed on alpha at present
184  VMA
185  textBeg() const
186  { return m_txtBeg; }
187 
188  VMA
189  textEnd() const
190  { return m_txtEnd; }
191 
192  // FIXME: should be automatically set... (cf. Alpha/Tru64)
193  void
195  { m_txtBeg = x; }
196 
197  void
199  { m_txtEnd = x; }
200 
201  VMA
202  firstVMA() const
203  { return m_begVMA; }
204 
205  void
207  { m_begVMA = x; }
208 
209 
210  // after reading the binary, get the smallest begin VMA and largest end VMA
211  // of all the text m_sections
212  void
213  textBegEndVMA(VMA* begVMA, VMA* endVMA);
214 
215  // relocate: 'Relocate' the text section to the supplied text begin
216  // address. All member functions that take VMAs will assume they
217  // receive *relocated* values. A value of 0 unrelocates the module.
218  void
219  relocate(VMA textBegReloc);
220 
221  bool
222  isRelocated() const
223  { return (m_textBegReloc != 0); }
224 
225  // doUnrelocate: is unrelocation necessary?
226  bool
227  doUnrelocate(VMA loadAddr) const
228  { return ((type() == TypeDSO) && (textBeg() < loadAddr)); }
229 
230 
231  // -------------------------------------------------------
232  // Segments:
233  // -------------------------------------------------------
234 
235  SegMap&
237  { return m_segMap; }
238 
239  const SegMap&
240  segs() const
241  { return m_segMap; }
242 
243  Seg*
244  findSeg(VMA vma) const
245  {
246  VMA vma_ur = unrelocate(vma);
247  VMAInterval ival_ur(vma_ur, vma_ur + 1); // size must be > 0
248  SegMap::const_iterator it = m_segMap.find(ival_ur);
249  Seg* seg = (it != m_segMap.end()) ? it->second : NULL;
250  return seg;
251  }
252 
253  // returns false if an overlapping segment already exists
254  bool
256  {
257  VMAInterval ival_ur(unrelocate(ival.beg()), unrelocate(ival.end()));
258  std::pair<SegMap::iterator, bool> ret =
259  m_segMap.insert(SegMap::value_type(ival_ur, seg));
260  return ret.second;
261  }
262 
263  uint
264  numSegs() const
265  { return m_segMap.size(); }
266 
267 
268  // -------------------------------------------------------
269  // Procedures: All procedures may be accessed here.
270  // -------------------------------------------------------
271 
272  ProcMap&
274  { return m_procMap; }
275 
276  const ProcMap&
277  procs() const
278  { return m_procMap; }
279 
280  Proc*
281  findProc(VMA vma) const
282  {
283  VMA vma_ur = unrelocate(vma);
284  VMAInterval ival_ur(vma_ur, vma_ur + 1); // size must be > 0
285  ProcMap::const_iterator it = m_procMap.find(ival_ur);
286  Proc* proc = (it != m_procMap.end()) ? it->second : NULL;
287  return proc;
288  }
289 
290  bool
292  {
293  VMAInterval ival_ur(unrelocate(ival.beg()), unrelocate(ival.end()));
294  std::pair<ProcMap::iterator, bool> ret =
295  m_procMap.insert(ProcMap::value_type(ival_ur, proc));
296  return ret.second;
297  }
298 
299 
300  // -------------------------------------------------------
301  // Instructions: All instructions found in text sections may be
302  // accessed here, or through other classes (such as a 'Proc').
303  //
304  // For the sake of generality, all instructions are viewed as
305  // (potentially) variable sized instruction packets. VLIW
306  // instructions are 'unpacked' so that each operation is an
307  // 'Insn' that may be accessed by the combination of its vma and
308  // operation index.
309  //
310  // findMachInsn: Return a pointer to beginning of the instrution
311  // bits at virtual memory address 'vma'; NULL if invalid instruction
312  // or invalid 'vma'. Sets 'size' to the size (bytes) of the
313  // instruction.
314  //
315  // findInsn: Similar to the above except returns an 'Insn',
316  // not the bits.
317  //
318  // findInsnNear: find the first instruction equal or greater than
319  // given 'vma'
320  //
321  // insertInsn: Add an instruction to the map
322  // -------------------------------------------------------
323  MachInsn*
324  findMachInsn(VMA vma, ushort &size) const;
325 
326  InsnMap&
328  { return m_insnMap; }
329 
330  const InsnMap&
331  insns() const
332  { return m_insnMap; }
333 
334  Insn*
335  findInsn(VMA vma, ushort opIndex) const
336  {
337  if (m_simpleSymbols) return NULL;
338  VMA vma_ur = unrelocate(vma);
339  VMA opvma = isa->convertVMAToOpVMA(vma_ur, opIndex);
340 
341  InsnMap::const_iterator it = m_insnMap.find(opvma);
342  Insn* insn = (it != m_insnMap.end()) ? it->second : NULL;
343  return insn;
344  }
345 
346  Insn*
347  findInsnNear(VMA vma, ushort opIndex) const
348  {
349  VMA vma_ur = unrelocate(vma);
350  VMA opvma = isa->convertVMAToOpVMA(vma_ur, opIndex);
351 
352  InsnMap::const_iterator it = m_insnMap.lower_bound(opvma);
353  Insn* insn = (it != m_insnMap.end()) ? it->second : NULL;
354  return insn;
355  }
356 
357  // NOTE: does not check for duplicates
358  void
359  insertInsn(VMA vma, ushort opIndex, Insn* insn)
360  {
361  VMA vma_ur = unrelocate(vma);
362  VMA opvma = isa->convertVMAToOpVMA(vma_ur, opIndex);
363  m_insnMap.insert(InsnMap::value_type(opvma, insn));
364  }
365 
366  bool
368 
369  const char*
371 
372  bool
374 
375  // -------------------------------------------------------
376  // findSrcCodeInfo: If possible, find the source file, function
377  // name and line number that corresponds to the operation at
378  // 'vma + opIndex'. If it is possible to find all information without
379  // errors, return true; otherwise false.
380  //
381  // For convenience, another version is provided that takes a
382  // 'begVMA + begOpIndex' and 'endVMA + endOpIndex'. Note that the
383  // following condition is enforced:
384  // 'begVMA + opIndex' <= 'endVMA + opIndex'.
385  // All virtual memory address vma values should point to the
386  // *beginning* of instructions (not at the end or middle).
387  //
388  // Note that this second version attempts to select the best
389  // function, file and line information from both individual calls to
390  // the first version, correcting as best it can for errors. In
391  // particular:
392  // - If 'file' is NULL, both 'begLine' and 'endLine' will be 0.
393  // - If 'file' is not NULL, *both* line numbers may or may not be non-0;
394  // never will only one line number be 0.
395  // - It is an error for either the file or function to be
396  // different accross the individual calls. In this case
397  // information from 'begVMA' is used.
398  //
399  // If 'flags' is set to 1, then beg/end line swapping is performed.
400  //
401  // The second version only returns true when all information is
402  // found and no error is detected.
403  // -------------------------------------------------------
404  bool
405  findSrcCodeInfo(VMA vma, ushort opIndex,
406  std::string& func,
407  std::string& file, SrcFile::ln& line) /*const*/;
408 
409  bool
410  findSrcCodeInfo(VMA begVMA, ushort bOpIndex,
411  VMA endVMA, ushort eOpIndex,
412  std::string& func, std::string& file,
413  SrcFile::ln& begLine, SrcFile::ln& endLine,
414  unsigned flags = 1) /*const*/;
415 
416  bool
417  findProcSrcCodeInfo(VMA vma, ushort opIndex, SrcFile::ln& line) const;
418 
419  // Normalize 'filenm' directly with RealPathMgr, outside of
420  // findSrcCodeInfo().
421  bool
422  realpath(std::string & filenm)
423  {
424  return m_realpathMgr.realpath(filenm);
425  }
426 
427 
428  // -------------------------------------------------------
429  // BFD details
430  // -------------------------------------------------------
431  bfd*
432  abfd() const
433  { return m_bfd; }
434 
435  asymbol**
436  bfdSymTab() const
437  { return m_bfdSymTabSort; }
438 
439  uint
440  bfdSymTabSz() const
441  { return m_bfdSymTabSortSz; }
442 
443 
444  // -------------------------------------------------------
445  // debugging
446  // -------------------------------------------------------
447  enum DumpTy {
448  // Shorthand notation
449  DUMP_Short = 0x00000000,
450  DUMP_Mid = 0x00000110,
451  DUMP_Mid_decode = 0x00000130,
452  DUMP_Long = 0x11111111,
453  DUMP_Long_decode = 0x11111131,
454 
455  // Shorthand meanings
456  DUMP_Flg_SymTab = 0x00000001, // print sym-tab
457  DUMP_Flg_Insn_ty = 0x00000010, // print insn (type)
458  DUMP_Flg_Insn_decode = 0x00000020, // print insn (decoded)
459  DUMP_Flg_Sym = 0x00000100 // print symbolic info
460  };
461 
462  std::string
463  toString(int flags = DUMP_Short, const char* pre = "") const;
464 
465  virtual void
466  dump(std::ostream& o = std::cerr, int flags = DUMP_Short,
467  const char* pre = "") const;
468 
469  void
470  ddump(int code = DUMP_Long_decode) const;
471 
472  // dump helpers
473  virtual void
474  dumpme(std::ostream& o = std::cerr, const char* pre = "") const;
475 
476  virtual void
477  dumpProcMap(std::ostream& o = std::cerr, unsigned flag = 0,
478  const char* pre = "") const;
479 
480  void
481  ddumpProcMap(unsigned flag) const;
482 
483  // -------------------------------------------------------
484  // It is a little unfortunate to have to make 'isa' global across
485  // all intances since it implies that while multiple 'LMs'
486  // from the ISA may coexist, only one ISA may be used at a time.
487  // The issue is that allowing many types of ISA's to exist at the
488  // same time would significantly complicate things and we do not
489  // anticiapte such generality being very useful. For example,
490  // having multiple load modules open at the same time is generally
491  // not a good idea anyway.
492  // -------------------------------------------------------
493  static ISA* isa; // current ISA
494 
495  friend class ProcInsnIterator;
496 
497 protected:
498  // Should not be used
499  LM(const LM& GCC_ATTR_UNUSED lm)
500  : m_realpathMgr(RealPathMgr::singleton())
501  { }
502 
503  LM&
505  { return *this; }
506 
507 private:
508  // Constructing routines: return true on success; false on error
509  void
511 
512  void
513  readSegs();
514 
515  void
517 
518  // unrelocate: Given a relocated VMA, returns a non-relocated version.
519  VMA
520  unrelocate(VMA relocVMA) const
521  { return (relocVMA + m_unrelocDelta); }
522 
523  // Comparison routines for QuickSort.
524  static int
525  cmpBFDSymByVMA(const void* s1, const void* s2);
526 
527  // Dump helper routines
528  void
529  dumpModuleInfo(std::ostream& o = std::cerr, const char* pre = "") const;
530 
531  void
532  dumpSymTab(std::ostream& o = std::cerr, const char* pre = "") const;
533 
534  friend class TextSeg; // for TextSeg::Create_InitializeProcs();
535 
538  { return &m_dbgInfo; }
539 
540 private:
541  std::string m_name;
542 
545 
546  VMA m_txtBeg, m_txtEnd; // text begin and end
547  VMA m_begVMA; // shared library load address begin
548 
549  VMA m_textBegReloc; // relocated text begin
550  VMASigned m_unrelocDelta; // offset to unrelocate relocated VMAs
551 
552  // - m_segMapm, m_procMap: Segments and procedures are indexed by an
553  // interval [begVMA endVMA)
554  //
555  // - m_insnMap: note that 'VMA' is not necessarily the true vma
556  // value; rather, it is the address of the individual operation
557  // (ISA::convertVMAToOpVMA).
558  SegMap m_segMap; // owns all Seg*
559  ProcMap m_procMap;
560  InsnMap m_insnMap; // owns all Insn*
561 
562  // symbolic info used in building procedures
564 
565  // Note: the sorted table includes both regular and synthetic
566  // symbols and thus may be larger than m_bfdSymTab. Size is the
567  // size of the sorted table. Also, the synthetic table is an array
568  // of asymbol structs, not pointers.
569 
570  bfd* m_bfd; // BFD of this module.
571  asymbol** m_bfdSymTab; // Unmodified BFD symbol table
572  asymbol** m_bfdDynSymTab; // Unmodified BFD dynamic symbol table
573  asymbol* m_bfdSynthTab; // Synthetic BFD symbol table.
574  asymbol** m_bfdSymTabSort; // Sorted BFD symbol table
575  long m_bfdSymTabSz; // Number of syms unmodified BFD symbol table.
576  long m_bfdDynSymTabSz; // Number of dynamic syms.
577  long m_bfdSymTabSortSz; // Number of syms in the sorted table.
578  long m_bfdSynthTabSz; // Number of synthetic syms.
579 
581 
583 
586 };
587 
588 } // namespace BinUtil
589 
590 
591 //***************************************************************************
592 // Executable
593 //***************************************************************************
594 
595 namespace BinUtil {
596 
597 // --------------------------------------------------------------------------
598 // 'Executable' represents an executable binary
599 // --------------------------------------------------------------------------
600 
601 class Exe : public LM {
602 public:
603  // -------------------------------------------------------
604  // Constructor/Destructor
605  // -------------------------------------------------------
606  Exe();
607 
608  virtual ~Exe();
609 
610  // -------------------------------------------------------
611  //
612  // -------------------------------------------------------
613 
614  // See LM::Open comments
615  virtual void
616  open(const char* filenm);
617 
618  VMA
619  getStartVMA() const
620  { return m_startVMA; }
621 
622  // -------------------------------------------------------
623  // debugging
624  // -------------------------------------------------------
625  virtual void
626  dump(std::ostream& o = std::cerr,
627  int flags = DUMP_Short, const char* pre = "") const;
628 
629  virtual void
630  dumpme(std::ostream& o = std::cerr, const char* pre = "") const;
631 
632 private:
633  // Should not be used
634  Exe(const Exe& e); // { }
635  Exe& operator=(const Exe& e); // { return *this; }
636 
637 protected:
638 private:
640 };
641 
642 } // namespace BinUtil
643 
644 
645 //***************************************************************************
646 // Exception
647 //***************************************************************************
648 
649 #define BINUTIL_Throw(streamArgs) DIAG_ThrowX(BinUtil::Exception, streamArgs)
650 
651 namespace BinUtil {
652 
654 public:
655  Exception(const std::string x, const char* filenm = NULL, uint lineno = 0)
656  : Diagnostics::Exception(x, filenm, lineno)
657  { }
658 
659  virtual std::string
660  message() const
661  { return "[BinUtil]: " + what(); }
662 
663 private:
664 };
665 
666 } // namespace BinUtil
667 
668 
669 //***************************************************************************
670 
671 #endif // BinUtil_LM_hpp
virtual ~LM()
Definition: LM.cpp:354
bool m_useBinutils
Definition: LM.hpp:584
std::string toString(int flags=DUMP_Short, const char *pre="") const
Definition: LM.cpp:706
Exception(const std::string x, const char *filenm=NULL, uint lineno=0)
Definition: LM.hpp:655
ProcMap & procs()
Definition: LM.hpp:273
virtual VMA convertVMAToOpVMA(VMA vma, ushort GCC_ATTR_UNUSED opIndex) const
Definition: ISA.hpp:471
bool findProcSrcCodeInfo(VMA vma, ushort opIndex, SrcFile::ln &line) const
Definition: LM.cpp:651
const SegMap & segs() const
Definition: LM.hpp:240
unsigned int ln
Definition: SrcFile.hpp:66
VMA m_textBegReloc
Definition: LM.hpp:549
bfd_vma VMA
Definition: ISATypes.hpp:79
NoReturns * m_noreturns
Definition: LM.hpp:580
bool doUnrelocate(VMA loadAddr) const
Definition: LM.hpp:227
Proc * findProc(VMA vma) const
Definition: LM.hpp:281
void textBegEndVMA(VMA *begVMA, VMA *endVMA)
Definition: LM.cpp:676
void ddumpProcMap(unsigned flag) const
Definition: LM.cpp:781
long m_bfdSymTabSz
Definition: LM.hpp:575
Insn * findInsnNear(VMA vma, ushort opIndex) const
Definition: LM.hpp:347
std::map< VMA, Insn * > InsnMap
Definition: LM.hpp:139
void relocate(VMA textBegReloc)
Definition: LM.cpp:487
virtual void read(const std::set< std::string > &directorySet, ReadFlg readflg)
Definition: LM.cpp:460
Type m_type
Definition: LM.hpp:543
VMA beg() const
void ddump(int code=DUMP_Long_decode) const
Definition: LM.cpp:751
VMA firstVMA() const
Definition: LM.hpp:202
bool isPseudolLoadModule()
ProcMap m_procMap
Definition: LM.hpp:559
bool insertSeg(VMAInterval ival, Seg *seg)
Definition: LM.hpp:255
bool functionNeverReturns(VMA addr)
Definition: LM.cpp:929
VMA textBeg() const
Definition: LM.hpp:185
BinUtil::Dbg::LM m_dbgInfo
Definition: LM.hpp:563
Type type() const
Definition: LM.hpp:175
MachInsn * findMachInsn(VMA vma, ushort &size) const
Definition: LM.cpp:503
VMAIntervalMap< Seg * > SegMap
Definition: LM.hpp:137
ReadFlg readFlags()
Definition: LM.hpp:179
VMA m_startVMA
Definition: LM.hpp:639
InsnMap & insns()
Definition: LM.hpp:327
bool realpath(std::string &filenm)
Definition: LM.hpp:422
asymbol ** m_bfdDynSymTab
Definition: LM.hpp:572
const std::string & name() const
Definition: LM.hpp:170
unsigned short int ushort
Definition: uint.h:120
bool realpath(std::string &pathNm) const
unsigned int uint
Definition: uint.h:124
void insertInsn(VMA vma, ushort opIndex, Insn *insn)
Definition: LM.hpp:359
bfd_signed_vma VMASigned
Definition: ISATypes.hpp:80
VMA textEnd() const
Definition: LM.hpp:189
VMASigned m_unrelocDelta
Definition: LM.hpp:550
RealPathMgr & m_realpathMgr
Definition: LM.hpp:582
long m_bfdSynthTabSz
Definition: LM.hpp:578
const char * getPseudoLoadModuleName()
virtual void dumpProcMap(std::ostream &o=std::cerr, unsigned flag=0, const char *pre="") const
Definition: LM.cpp:766
VMA m_txtEnd
Definition: LM.hpp:546
asymbol ** m_bfdSymTabSort
Definition: LM.hpp:574
Definition: ISA.hpp:106
uint numSegs() const
Definition: LM.hpp:264
VMA end() const
ReadFlg m_readFlags
Definition: LM.hpp:544
asymbol * m_bfdSynthTab
Definition: LM.hpp:573
bfd * m_bfd
Definition: LM.hpp:570
long m_bfdSymTabSortSz
Definition: LM.hpp:577
VMAIntervalMap< Proc * > ProcMap
Definition: LM.hpp:138
void dumpModuleInfo(std::ostream &o=std::cerr, const char *pre="") const
Definition: LM.cpp:936
My_t::const_iterator const_iterator
LM(const LM &GCC_ATTR_UNUSED lm)
Definition: LM.hpp:499
virtual void dumpme(std::ostream &o=std::cerr, const char *pre="") const
asymbol ** m_bfdSymTab
Definition: LM.hpp:571
const InsnMap & insns() const
Definition: LM.hpp:331
void readSegs()
Definition: LM.cpp:880
SegMap & segs()
Definition: LM.hpp:236
static int cmpBFDSymByVMA(const void *s1, const void *s2)
Definition: LM.cpp:789
SegMap m_segMap
Definition: LM.hpp:558
void MachInsn
Definition: ISATypes.hpp:87
void dumpSymTab(std::ostream &o=std::cerr, const char *pre="") const
Definition: LM.cpp:1082
VMA unrelocate(VMA relocVMA) const
Definition: LM.hpp:520
Seg * findSeg(VMA vma) const
Definition: LM.hpp:244
virtual void dump(std::ostream &o=std::cerr, int flags=DUMP_Short, const char *pre="") const
Definition: LM.cpp:715
void textEnd(VMA x)
Definition: LM.hpp:198
VMA m_begVMA
Definition: LM.hpp:547
#define NULL
Definition: ElfHelper.cpp:85
void firstVMA(VMA x)
Definition: LM.hpp:206
const ProcMap & procs() const
Definition: LM.hpp:277
long m_bfdDynSymTabSz
Definition: LM.hpp:576
virtual std::string message() const
Definition: LM.hpp:660
std::pair< const key_type, T > value_type
Insn * findInsn(VMA vma, ushort opIndex) const
Definition: LM.hpp:335
iterator find(const key_type &toFind)
std::string m_name
Definition: LM.hpp:541
LM & operator=(const LM &GCC_ATTR_UNUSED lm)
Definition: LM.hpp:504
void readSymbolTables()
Definition: LM.cpp:808
bfd * abfd() const
Definition: LM.hpp:432
VMA getStartVMA() const
Definition: LM.hpp:619
bool findSrcCodeInfo(VMA vma, ushort opIndex, std::string &func, std::string &file, SrcFile::ln &line)
VMA m_txtBeg
Definition: LM.hpp:546
cct_addr_t * addr
Definition: cct.c:130
asymbol ** bfdSymTab() const
Definition: LM.hpp:436
#define GCC_ATTR_UNUSED
Definition: gcc-attr.h:80
uint bfdSymTabSz() const
Definition: LM.hpp:440
static ISA * isa
Definition: LM.hpp:493
void textBeg(VMA x)
Definition: LM.hpp:194
void computeNoReturns()
Definition: LM.cpp:916
BinUtil::Dbg::LM * getDebugInfo()
Definition: LM.hpp:537
bool insertProc(VMAInterval ival, Proc *proc)
Definition: LM.hpp:291
LM(bool useBinutils=false)
Definition: LM.cpp:340
SimpleSymbols * m_simpleSymbols
Definition: LM.hpp:585
bool isRelocated() const
Definition: LM.hpp:222
virtual void open(const char *filenm)
Definition: LM.cpp:395
InsnMap m_insnMap
Definition: LM.hpp:560
const std::string & name()