LUADebuggerComponent.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #ifndef LUADEBUGGER_COMPONENT_H
  9. #define LUADEBUGGER_COMPONENT_H
  10. #include "LUAEditorDebuggerMessages.h"
  11. #include <AzFramework/Network/IRemoteTools.h>
  12. #include <AzCore/Component/Component.h>
  13. #include <AzCore/Component/TickBus.h>
  14. #pragma once
  15. namespace LUADebugger
  16. {
  17. // the perforce component's job is to manage perforce connectivity and execute perforce commands
  18. // it parses the status of perforce commands and returns results.
  19. // it has helpers to determine what needs to be done with a file in order to remove it or to add it.
  20. // for example, if a file is checked out and needs to be deleted, it knows that it will need to both revert the file and mark it for delete
  21. // in order to get to where we want it to be, from where we are now.
  22. // it does not keep track of individual files or watch directories or anything
  23. class Component
  24. : public AZ::Component
  25. , public LUAEditor::LUAEditorDebuggerMessages::Bus::Handler
  26. , public AZ::SystemTickBus::Handler
  27. {
  28. public:
  29. AZ_COMPONENT(Component, "{7854C9F4-D7E5-4420-A14E-FA5B19822F39}");
  30. Component();
  31. virtual ~Component();
  32. //////////////////////////////////////////////////////////////////////////
  33. // AZ::Component
  34. virtual void Init();
  35. virtual void Activate();
  36. virtual void Deactivate();
  37. //////////////////////////////////////////////////////////////////////////
  38. //! AZ::SystemTickBus::Handler overrides.
  39. //! @{
  40. void OnSystemTick() override;
  41. //! @}
  42. //
  43. //////////////////////////////////////////////////////////////////////////
  44. //Debugger Messages, from the LUAEditor::LUAEditorDebuggerMessages::Bus
  45. // Enumerate script contexts on the target
  46. // Request enumeration of available script contexts
  47. virtual void EnumerateContexts();
  48. // Request to be attached to script context
  49. virtual void AttachDebugger(const char* scriptContextName);
  50. // Request to be detached from current context
  51. virtual void DetachDebugger();
  52. // Request enumeration of classes registered in the current context
  53. virtual void EnumRegisteredClasses(const char* scriptContextName);
  54. // Request enumeration of eBusses registered in the current context
  55. virtual void EnumRegisteredEBuses(const char* scriptContextName);
  56. // Request enumeration of global methods and properties registered in the current context
  57. virtual void EnumRegisteredGlobals(const char* scriptContextName);
  58. // create a breakpoint. The debugName is the name that was given when the script was executed and represents
  59. // the 'document' (or blob of script) that the breakpoint is for. The line number is relative to the start of that blob.
  60. // the combination of line number and debug name uniquely identify a debug breakpoint.
  61. virtual void CreateBreakpoint(const AZStd::string& debugName, int lineNumber);
  62. // Remove a previously set breakpoint from the current context
  63. virtual void RemoveBreakpoint(const AZStd::string& debugName, int lineNumber);
  64. // Set over current line in current context. Can only be called while context is on a breakpoint.
  65. virtual void DebugRunStepOver();
  66. // Set into current line in current context. Can only be called while context is on a breakpoint.
  67. virtual void DebugRunStepIn();
  68. // Set out of current line in current context. Can only be called while context is on a breakpoint.
  69. virtual void DebugRunStepOut();
  70. // Stop execution in current context. Not supported.
  71. virtual void DebugRunStop();
  72. // Continue execution of current context. Can only be called while context is on a breakpoint.
  73. virtual void DebugRunContinue();
  74. // Request enumeration of local variables in current context. Can only be called while context is on a breakpoint
  75. virtual void EnumLocals();
  76. // Get value of a variable in the current context. Can only be called while context is on a breakpoint
  77. virtual void GetValue(const AZStd::string& varName);
  78. // Set value of a variable in the current context. Can only be called while context is on a breakpoint
  79. // and value should be the structure returned from a previous call to GetValue().
  80. virtual void SetValue(const AZ::ScriptContextDebug::DebugValue& value);
  81. // Request current callstack in the current context. Can only be called while context is on a breakpoint
  82. virtual void GetCallstack();
  83. //////////////////////////////////////////////////////////////////////////
  84. //////////////////////////////////////////////////////////////////////////
  85. // TargetManagerClient
  86. virtual void DesiredTargetChanged(AZ::u32 newTargetID, AZ::u32 oldTargetID);
  87. //////////////////////////////////////////////////////////////////////////
  88. static void Reflect(AZ::ReflectContext* reflection);
  89. private:
  90. AzFramework::IRemoteTools* m_remoteTools = nullptr;
  91. };
  92. };
  93. #endif