Files
clang-p2996/lldb/source/Plugins/Process/minidump/ProcessMinidump.h
Adrian McCarthy 3887ba8d38 Re-land r313210 - Fix for bug 34532 - A few rough corners related to post-mortem debugging (core/minidump)
The main change is to avoid setting the process state as running when
debugging core/minidumps (details in the bug).  Also included a few small,
related fixes around how the errors propagate in this case.

Fixed the FreeBSD/Windows break: the intention was to keep
Process::WillResume() and Process::DoResume() "in-sync", but this had the
unfortunate consequence of breaking Process sub-classes which don't override
WillResume().

The safer approach is to keep Process::WillResume() untouched and only
override it in the minidump and core implementations.

patch by lemo

Bug: https://bugs.llvm.org/show_bug.cgi?id=34532

Differential Revision: https://reviews.llvm.org/D37651

llvm-svn: 313655
2017-09-19 18:07:33 +00:00

114 lines
2.9 KiB
C++

//===-- ProcessMinidump.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_ProcessMinidump_h_
#define liblldb_ProcessMinidump_h_
// Project includes
#include "MinidumpParser.h"
#include "MinidumpTypes.h"
// Other libraries and framework includes
#include "lldb/Target/Process.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Status.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
// C Includes
// C++ Includes
namespace lldb_private {
namespace minidump {
class ProcessMinidump : 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();
ProcessMinidump(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
const FileSpec &core_file, MinidumpParser minidump_parser);
~ProcessMinidump() override;
bool CanDebug(lldb::TargetSP target_sp,
bool plugin_specified_by_name) override;
Status DoLoadCore() override;
DynamicLoader *GetDynamicLoader() override;
ConstString GetPluginName() override;
uint32_t GetPluginVersion() override;
Status DoDestroy() override;
void RefreshStateAfterStop() override;
bool IsAlive() override;
bool WarnBeforeDetach() const override;
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();
Status GetMemoryRegionInfo(lldb::addr_t load_addr,
MemoryRegionInfo &range_info) override;
bool GetProcessInfo(ProcessInstanceInfo &info) override;
Status WillResume() override {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support resuming processes",
GetPluginName().GetCString());
return error;
}
MinidumpParser m_minidump_parser;
protected:
void Clear();
bool UpdateThreadList(ThreadList &old_thread_list,
ThreadList &new_thread_list) override;
void ReadModuleList();
private:
FileSpec m_core_file;
llvm::ArrayRef<MinidumpThread> m_thread_list;
const MinidumpExceptionStream *m_active_exception;
bool m_is_wow64;
};
} // namespace minidump
} // namespace lldb_private
#endif // liblldb_ProcessMinidump_h_