MapFileEntry.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (c) 2006 Michael Eddington
  3. * Copyright (c) 2001 Jani Kajala
  4. *
  5. * Permission to use, copy, modify, distribute and sell this
  6. * software and its documentation for any purpose is hereby
  7. * granted without fee, provided that the above copyright notice
  8. * appear in all copies and that both that copyright notice and
  9. * this permission notice appear in supporting documentation.
  10. * Jani Kajala makes no representations about the suitability
  11. * of this software for any purpose. It is provided "as is"
  12. * without express or implied warranty.
  13. */
  14. #include "MapFileEntry.h"
  15. #include <string.h>
  16. //-----------------------------------------------------------------------------
  17. namespace dev
  18. {
  19. MapFileEntry::MapFileEntry()
  20. {
  21. m_sec = 0;
  22. m_addr = 0;
  23. m_len = 0;
  24. m_name[0] = 0;
  25. }
  26. MapFileEntry::MapFileEntry( long section, long offset, long length,
  27. const char* name, long rvabase, const char* lib )
  28. {
  29. m_sec = section;
  30. m_addr = offset;
  31. m_len = length;
  32. m_rvabase = rvabase;
  33. strncpy( m_name, name, MAX_NAME );
  34. m_name[MAX_NAME] = 0;
  35. if(lib)
  36. strncpy( m_lib, lib, MAX_NAME );
  37. m_name[MAX_NAME] = 0;
  38. }
  39. long MapFileEntry::section() const
  40. {
  41. return m_sec;
  42. }
  43. long MapFileEntry::offset() const
  44. {
  45. return m_addr;
  46. }
  47. long MapFileEntry::length() const
  48. {
  49. return m_len;
  50. }
  51. const char* MapFileEntry::name() const
  52. {
  53. return m_name;
  54. }
  55. /** Returns rva+base */
  56. long MapFileEntry::rvabase() const
  57. {
  58. return m_rvabase;
  59. }
  60. /** Returns name of the library */
  61. const char* MapFileEntry::lib() const
  62. {
  63. return m_lib;
  64. }
  65. bool MapFileEntry::operator<( const MapFileEntry& other ) const
  66. {
  67. return m_rvabase < other.m_rvabase;
  68. }
  69. } // dev