interprocess_printers.hpp 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright 2024 Braden Ganetsky
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // https://www.boost.org/LICENSE_1_0.txt
  4. // Generated on 2024-08-16T22:13:13
  5. #ifndef BOOST_INTERPROCESS_INTERPROCESS_PRINTERS_HPP
  6. #define BOOST_INTERPROCESS_INTERPROCESS_PRINTERS_HPP
  7. #ifndef BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS
  8. #if defined(__ELF__)
  9. #ifdef __clang__
  10. #pragma clang diagnostic push
  11. #pragma clang diagnostic ignored "-Woverlength-strings"
  12. #endif
  13. __asm__(".pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n"
  14. ".ascii \"\\4gdb.inlined-script.BOOST_INTERPROCESS_INTERPROCESS_PRINTERS_HPP\\n\"\n"
  15. ".ascii \"import gdb.printing\\n\"\n"
  16. ".ascii \"class BoostInterprocessOffsetPtrPrinter:\\n\"\n"
  17. ".ascii \" def __init__(self, val):\\n\"\n"
  18. ".ascii \" self.val = val\\n\"\n"
  19. ".ascii \" def to_string(self):\\n\"\n"
  20. ".ascii \" return f\\\"{BoostInterprocessOffsetPtrPrinter.get(self.val)}\\\"\\n\"\n"
  21. ".ascii \" # This is a simplified and inlined version of `offset_ptr::get()`\\n\"\n"
  22. ".ascii \" def get(offset_ptr):\\n\"\n"
  23. ".ascii \" offset = offset_ptr[\\\"internal\\\"][\\\"m_offset\\\"]\\n\"\n"
  24. ".ascii \" pointer = offset_ptr.type.template_argument(0).pointer()\\n\"\n"
  25. ".ascii \" if offset == 1:\\n\"\n"
  26. ".ascii \" return gdb.Value(0).cast(pointer) # nullptr\\n\"\n"
  27. ".ascii \" else:\\n\"\n"
  28. ".ascii \" unsigned_char_pointer = gdb.lookup_type(\\\"unsigned char\\\").pointer()\\n\"\n"
  29. ".ascii \" this = offset_ptr.address\\n\"\n"
  30. ".ascii \" return (this.cast(unsigned_char_pointer) + offset).cast(pointer)\\n\"\n"
  31. ".ascii \" def boost_to_address(offset_ptr):\\n\"\n"
  32. ".ascii \" return BoostInterprocessOffsetPtrPrinter.get(offset_ptr)\\n\"\n"
  33. ".ascii \" # This is a simplified and inlined version of `offset_ptr::operator+=()`\\n\"\n"
  34. ".ascii \" def boost_next(raw_ptr, offset):\\n\"\n"
  35. ".ascii \" unsigned_char_pointer = gdb.lookup_type(\\\"unsigned char\\\").pointer()\\n\"\n"
  36. ".ascii \" pointer = raw_ptr.type\\n\"\n"
  37. ".ascii \" aa = raw_ptr.cast(unsigned_char_pointer)\\n\"\n"
  38. ".ascii \" bb = offset * pointer.target().sizeof\\n\"\n"
  39. ".ascii \" return (aa + bb).cast(pointer)\\n\"\n"
  40. ".ascii \"def boost_interprocess_build_pretty_printer():\\n\"\n"
  41. ".ascii \" pp = gdb.printing.RegexpCollectionPrettyPrinter(\\\"boost_interprocess\\\")\\n\"\n"
  42. ".ascii \" pp.add_printer(\\\"boost::interprocess::offset_ptr\\\", \\\"^boost::interprocess::offset_ptr<.*>$\\\", BoostInterprocessOffsetPtrPrinter)\\n\"\n"
  43. ".ascii \" return pp\\n\"\n"
  44. ".ascii \"gdb.printing.register_pretty_printer(gdb.current_objfile(), boost_interprocess_build_pretty_printer())\\n\"\n"
  45. ".byte 0\n"
  46. ".popsection\n");
  47. #ifdef __clang__
  48. #pragma clang diagnostic pop
  49. #endif
  50. #endif // defined(__ELF__)
  51. #endif // !defined(BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS)
  52. #endif // !defined(BOOST_INTERPROCESS_INTERPROCESS_PRINTERS_HPP)