ProcessTrace.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //===-- ProcessTrace.h ------------------------------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLDB_TARGET_PROCESSTRACE_H
  9. #define LLDB_TARGET_PROCESSTRACE_H
  10. #include "lldb/Target/PostMortemProcess.h"
  11. #include "lldb/Utility/ConstString.h"
  12. #include "lldb/Utility/Status.h"
  13. namespace lldb_private {
  14. /// Class that represents a defunct process loaded on memory via the "trace
  15. /// load" command.
  16. class ProcessTrace : public PostMortemProcess {
  17. public:
  18. static void Initialize();
  19. static void Terminate();
  20. static ConstString GetPluginNameStatic();
  21. static const char *GetPluginDescriptionStatic();
  22. ProcessTrace(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
  23. ~ProcessTrace() override;
  24. bool CanDebug(lldb::TargetSP target_sp,
  25. bool plugin_specified_by_name) override;
  26. void DidAttach(ArchSpec &process_arch) override;
  27. DynamicLoader *GetDynamicLoader() override { return nullptr; }
  28. SystemRuntime *GetSystemRuntime() override { return nullptr; }
  29. ConstString GetPluginName() override;
  30. uint32_t GetPluginVersion() override;
  31. Status DoDestroy() override;
  32. void RefreshStateAfterStop() override;
  33. Status WillResume() override {
  34. Status error;
  35. error.SetErrorStringWithFormat(
  36. "error: %s does not support resuming processes",
  37. GetPluginName().GetCString());
  38. return error;
  39. }
  40. bool WarnBeforeDetach() const override { return false; }
  41. size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size,
  42. Status &error) override;
  43. size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
  44. Status &error) override;
  45. ArchSpec GetArchitecture();
  46. bool GetProcessInfo(ProcessInstanceInfo &info) override;
  47. protected:
  48. void Clear();
  49. bool DoUpdateThreadList(ThreadList &old_thread_list,
  50. ThreadList &new_thread_list) override;
  51. private:
  52. static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,
  53. lldb::ListenerSP listener_sp,
  54. const FileSpec *crash_file_path,
  55. bool can_connect);
  56. };
  57. } // namespace lldb_private
  58. #endif // LLDB_TARGET_PROCESSTRACE_H