DebugDocument.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #pragma once
  6. struct StatementSpan
  7. {
  8. int32 ich;
  9. int32 cch;
  10. };
  11. // A Document in Engine means a file, eval code or new function code. For each of these there is a Utf8SourceInfo.
  12. // DebugDocument relates debug operations such as adding/remove breakpoints to a specific Utf8SourceInfo.
  13. namespace Js
  14. {
  15. class DebugDocument
  16. {
  17. public:
  18. DebugDocument(Utf8SourceInfo* utf8SourceInfo, Js::FunctionBody* functionBody);
  19. ~DebugDocument();
  20. virtual void CloseDocument();
  21. HRESULT SetBreakPoint(int32 ibos, BREAKPOINT_STATE bps);
  22. BreakpointProbe* SetBreakPoint(StatementLocation statement, BREAKPOINT_STATE bps);
  23. void RemoveBreakpointProbe(BreakpointProbe *probe);
  24. void ClearAllBreakPoints(void);
  25. #if ENABLE_TTD
  26. BreakpointProbe* SetBreakPoint_TTDWbpId(int64 bpId, StatementLocation statement);
  27. #endif
  28. BreakpointProbe* FindBreakpoint(StatementLocation statement);
  29. bool FindBPStatementLocation(UINT bpId, StatementLocation * statement);
  30. BOOL GetStatementSpan(int32 ibos, StatementSpan* pBos);
  31. BOOL GetStatementLocation(int32 ibos, StatementLocation* plocation);
  32. virtual bool HasDocumentText() const
  33. {
  34. Assert(false);
  35. return false;
  36. }
  37. virtual void* GetDocumentText() const
  38. {
  39. Assert(false);
  40. return nullptr;
  41. };
  42. Js::FunctionBody * GetFunctionBodyAt(int32 ibos);
  43. Utf8SourceInfo* GetUtf8SourceInfo() { return this->utf8SourceInfo; }
  44. private:
  45. Utf8SourceInfo* utf8SourceInfo;
  46. RecyclerRootPtr<Js::FunctionBody> functionBody;
  47. BreakpointProbeList* m_breakpointList;
  48. BreakpointProbeList* NewBreakpointList(ArenaAllocator* arena);
  49. BreakpointProbeList* GetBreakpointList();
  50. BOOL HasLineBreak(int32 _start, int32 _end);
  51. };
  52. }