14#include "llvm/Support/ConvertUTF.h"
29 std::optional<FileSpec> outfileSpec = core_options.
GetOutputFile();
30 const auto &outfile = outfileSpec.value();
31 HANDLE process_handle = ::OpenProcess(
32 PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, process_sp->GetID());
33 const std::string file_name = outfile.GetPath();
34 std::wstring wide_name;
35 wide_name.resize(file_name.size() + 1);
36 char *result_ptr =
reinterpret_cast<char *
>(&wide_name[0]);
37 const llvm::UTF8 *error_ptr =
nullptr;
38 if (!llvm::ConvertUTF8toWide(
sizeof(
wchar_t), file_name, result_ptr,
40 error.SetErrorString(
"cannot convert file name");
44 ::CreateFileW(wide_name.c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL,
45 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
47 ::MiniDumpWriteDump(process_handle, process_sp->GetID(), file_handle,
48 MiniDumpWithFullMemoryInfo, NULL, NULL, NULL);
49 ::CloseHandle(file_handle);
50 ::CloseHandle(process_handle);
static llvm::raw_ostream & error(Stream &strm)
const std::optional< lldb_private::FileSpec > GetOutputFile() const
A class that represents a running process on the host machine.
bool SaveMiniDump(const lldb::ProcessSP &process_sp, const SaveCoreOptions &core_options, lldb_private::Status &error)
@ eErrorTypeWin32
Standard Win32 error codes.
std::shared_ptr< lldb_private::Process > ProcessSP