blob: 0e6900d8fb7f5364cae5f2eed6308c5c090d93ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
//===-- ProcessWindows.cpp --------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "ProcessWindows.h"
// Other libraries and framework includes
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/State.h"
#include "lldb/Host/windows/windows.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
namespace lldb_private
{
//------------------------------------------------------------------------------
// Constructors and destructors.
ProcessWindows::ProcessWindows(lldb::TargetSP target_sp, Listener &listener)
: lldb_private::Process(target_sp, listener)
{
}
ProcessWindows::~ProcessWindows()
{
}
size_t
ProcessWindows::GetSTDOUT(char *buf, size_t buf_size, Error &error)
{
error.SetErrorString("GetSTDOUT unsupported on Windows");
return 0;
}
size_t
ProcessWindows::GetSTDERR(char *buf, size_t buf_size, Error &error)
{
error.SetErrorString("GetSTDERR unsupported on Windows");
return 0;
}
size_t
ProcessWindows::PutSTDIN(const char *buf, size_t buf_size, Error &error)
{
error.SetErrorString("PutSTDIN unsupported on Windows");
return 0;
}
//------------------------------------------------------------------------------
// ProcessInterface protocol.
lldb::addr_t
ProcessWindows::GetImageInfoAddress()
{
Target &target = GetTarget();
ObjectFile *obj_file = target.GetExecutableModule()->GetObjectFile();
Address addr = obj_file->GetImageInfoAddress(&target);
if (addr.IsValid())
return addr.GetLoadAddress(&target);
else
return LLDB_INVALID_ADDRESS;
}
// The Windows page protection bits are NOT independent masks that can be bitwise-ORed
// together. For example, PAGE_EXECUTE_READ is not (PAGE_EXECUTE | PAGE_READ).
// To test for an access type, it's necessary to test for any of the bits that provide
// that access type.
bool
ProcessWindows::IsPageReadable(uint32_t protect)
{
return (protect & PAGE_NOACCESS) == 0;
}
bool
ProcessWindows::IsPageWritable(uint32_t protect)
{
return (protect & (PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY | PAGE_READWRITE | PAGE_WRITECOPY)) != 0;
}
bool
ProcessWindows::IsPageExecutable(uint32_t protect)
{
return (protect & (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY)) != 0;
}
}
|