DebuggingFlags.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #include "RuntimeDebugPch.h"
  6. #ifdef ENABLE_SCRIPT_DEBUGGING
  7. //static
  8. DebuggingFlags::DebuggingFlags() :
  9. m_forceInterpreter(false),
  10. m_isIgnoringException(false),
  11. m_byteCodeOffsetAfterIgnoreException(InvalidByteCodeOffset),
  12. m_funcNumberAfterIgnoreException(InvalidFuncNumber),
  13. m_isBuiltInWrapperPresent(false)
  14. {
  15. // In Lowerer::LowerBailForDebugger we rely on the following:
  16. CompileAssert(offsetof(DebuggingFlags, m_isIgnoringException) == offsetof(DebuggingFlags, m_forceInterpreter) + 1);
  17. }
  18. bool DebuggingFlags::GetForceInterpreter() const
  19. {
  20. return this->m_forceInterpreter;
  21. }
  22. void DebuggingFlags::SetForceInterpreter(bool value)
  23. {
  24. this->m_forceInterpreter = value;
  25. }
  26. //static
  27. size_t DebuggingFlags::GetForceInterpreterOffset()
  28. {
  29. return offsetof(DebuggingFlags, m_forceInterpreter);
  30. }
  31. int DebuggingFlags::GetByteCodeOffsetAfterIgnoreException() const
  32. {
  33. return this->m_byteCodeOffsetAfterIgnoreException;
  34. }
  35. uint DebuggingFlags::GetFuncNumberAfterIgnoreException() const
  36. {
  37. return this->m_funcNumberAfterIgnoreException;
  38. }
  39. void DebuggingFlags::SetByteCodeOffsetAfterIgnoreException(int offset)
  40. {
  41. this->m_byteCodeOffsetAfterIgnoreException = offset;
  42. this->m_isIgnoringException = offset != InvalidByteCodeOffset;
  43. }
  44. void DebuggingFlags::SetByteCodeOffsetAndFuncAfterIgnoreException(int offset, uint functionNumber)
  45. {
  46. this->SetByteCodeOffsetAfterIgnoreException(offset);
  47. this->m_funcNumberAfterIgnoreException = functionNumber;
  48. }
  49. void DebuggingFlags::ResetByteCodeOffsetAndFuncAfterIgnoreException()
  50. {
  51. this->SetByteCodeOffsetAfterIgnoreException(InvalidByteCodeOffset);
  52. this->m_funcNumberAfterIgnoreException = InvalidFuncNumber;
  53. }
  54. /* static */
  55. size_t DebuggingFlags::GetByteCodeOffsetAfterIgnoreExceptionOffset()
  56. {
  57. return offsetof(DebuggingFlags, m_byteCodeOffsetAfterIgnoreException);
  58. }
  59. bool DebuggingFlags::IsBuiltInWrapperPresent() const
  60. {
  61. return m_isBuiltInWrapperPresent;
  62. }
  63. void DebuggingFlags::SetIsBuiltInWrapperPresent(bool value /* = true */)
  64. {
  65. m_isBuiltInWrapperPresent = value;
  66. }
  67. #endif