Files
clang-p2996/lldb/source/Plugins/Process/Trace/ProcessTrace.h
Walter Erquinigo 26d861cbbd [trace] Scaffold "thread trace dump instructions"
Depends on D88841

As per the discussion in the RFC, we'll implement both

  thread trace dump [instructions | functions]

This is the first step in implementing the "instructions" dumping command.

It includes:

- A minimal ProcessTrace plugin for representing processes from a trace file. I noticed that it was a required step to mimic how core-based processes are initialized, e.g. ProcessElfCore and ProcessMinidump. I haven't had the need to create ThreadTrace yet, though. So far HistoryThread seems good enough.
- The command handling itself in CommandObjectThread, which outputs a placeholder text instead of the actual instructions. I'll do that part in the next diff.
- Tests

{F13132325}

Differential Revision: https://reviews.llvm.org/D88769
2020-10-12 12:08:18 -07:00

87 lines
2.4 KiB
C++

//===-- ProcessTrace.h ------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_SOURCE_PLUGINS_PROCESS_TRACE_PROCESSTRACE_H
#define LLDB_SOURCE_PLUGINS_PROCESS_TRACE_PROCESSTRACE_H
#include "lldb/Target/Process.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Status.h"
namespace lldb_private {
namespace process_trace {
class ProcessTrace : public Process {
public:
static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,
lldb::ListenerSP listener_sp,
const FileSpec *crash_file_path);
static void Initialize();
static void Terminate();
static ConstString GetPluginNameStatic();
static const char *GetPluginDescriptionStatic();
ProcessTrace(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
~ProcessTrace() override;
bool CanDebug(lldb::TargetSP target_sp,
bool plugin_specified_by_name) override;
void DidAttach(ArchSpec &process_arch) override;
DynamicLoader *GetDynamicLoader() override { return nullptr; }
SystemRuntime *GetSystemRuntime() override { return nullptr; }
ConstString GetPluginName() override;
uint32_t GetPluginVersion() override;
Status DoDestroy() override;
void RefreshStateAfterStop() override;
Status WillResume() override {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support resuming processes",
GetPluginName().GetCString());
return error;
}
bool IsAlive() override;
bool WarnBeforeDetach() const override { return false; }
size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size,
Status &error) override;
size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
Status &error) override;
ArchSpec GetArchitecture();
bool GetProcessInfo(ProcessInstanceInfo &info) override;
protected:
void Clear();
bool UpdateThreadList(ThreadList &old_thread_list,
ThreadList &new_thread_list) override;
};
} // namespace process_trace
} // namespace lldb_private
#endif // LLDB_SOURCE_PLUGINS_PROCESS_TRACE_PROCESSTRACE_H