aboutsummaryrefslogtreecommitdiffstats
path: root/include/lldb/Target
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-16 16:04:10 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-16 16:04:10 +0000
commit74a628f776edb588bff8f8f5cc16eac947c9d631 (patch)
treedc32e010ac4902621e5a279bfeb48628f7f0e166 /include/lldb/Target
parentafed7be32164a598f8172282c249af7266c48b46 (diff)
downloadsrc-74a628f776edb588bff8f8f5cc16eac947c9d631.tar.gz
src-74a628f776edb588bff8f8f5cc16eac947c9d631.zip
Vendor import of lldb trunk r300422:vendor/lldb/lldb-trunk-r300422
Notes
Notes: svn path=/vendor/lldb/dist/; revision=317027 svn path=/vendor/lldb/lldb-trunk-r300422/; revision=317028; tag=vendor/lldb/lldb-trunk-r300422
Diffstat (limited to 'include/lldb/Target')
-rw-r--r--include/lldb/Target/ABI.h2
-rw-r--r--include/lldb/Target/DynamicLoader.h38
-rw-r--r--include/lldb/Target/FileAction.h2
-rw-r--r--include/lldb/Target/Memory.h28
-rw-r--r--include/lldb/Target/MemoryRegionInfo.h23
-rw-r--r--include/lldb/Target/ModuleCache.h76
-rw-r--r--include/lldb/Target/PathMappingList.h4
-rw-r--r--include/lldb/Target/Platform.h4
-rw-r--r--include/lldb/Target/Process.h18
-rw-r--r--include/lldb/Target/ProcessInfo.h2
-rw-r--r--include/lldb/Target/ProcessLaunchInfo.h7
-rw-r--r--include/lldb/Target/ProcessStructReader.h102
-rw-r--r--include/lldb/Target/QueueItem.h2
-rw-r--r--include/lldb/Target/QueueList.h2
-rw-r--r--include/lldb/Target/RegisterCheckpoint.h2
-rw-r--r--include/lldb/Target/RegisterNumber.h62
-rw-r--r--include/lldb/Target/StackFrame.h9
-rw-r--r--include/lldb/Target/SystemRuntime.h2
-rw-r--r--include/lldb/Target/Thread.h14
-rw-r--r--include/lldb/Target/ThreadList.h2
-rw-r--r--include/lldb/Target/ThreadPlan.h26
-rw-r--r--include/lldb/Target/ThreadPlanPython.h2
-rw-r--r--include/lldb/Target/UnixSignals.h23
23 files changed, 399 insertions, 53 deletions
diff --git a/include/lldb/Target/ABI.h b/include/lldb/Target/ABI.h
index 8a1243613616..4b611d244e21 100644
--- a/include/lldb/Target/ABI.h
+++ b/include/lldb/Target/ABI.h
@@ -14,9 +14,9 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/Error.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Utility/Error.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/ArrayRef.h"
diff --git a/include/lldb/Target/DynamicLoader.h b/include/lldb/Target/DynamicLoader.h
index 071cbe69d880..ced6ef44000a 100644
--- a/include/lldb/Target/DynamicLoader.h
+++ b/include/lldb/Target/DynamicLoader.h
@@ -11,10 +11,38 @@
#define liblldb_DynamicLoader_h_
// Project includes
-#include "lldb/Core/Error.h"
#include "lldb/Core/PluginInterface.h"
-#include "lldb/Core/UUID.h"
-#include "lldb/lldb-private.h"
+#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h" // for FileSpec
+#include "lldb/Utility/UUID.h"
+#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS
+#include "lldb/lldb-forward.h" // for ModuleSP, ThreadPlanSP
+#include "lldb/lldb-private-enumerations.h" // for LazyBool, LazyBool::eLaz...
+#include "lldb/lldb-types.h" // for addr_t
+
+#include <stddef.h> // for size_t
+#include <stdint.h> // for int64_t
+namespace lldb_private {
+class ModuleList;
+}
+namespace lldb_private {
+class Process;
+}
+namespace lldb_private {
+class SectionList;
+}
+namespace lldb_private {
+class Symbol;
+}
+namespace lldb_private {
+class SymbolContext;
+}
+namespace lldb_private {
+class SymbolContextList;
+}
+namespace lldb_private {
+class Thread;
+}
namespace lldb_private {
@@ -331,6 +359,10 @@ protected:
// Read a pointer from memory at the given addr.
// Return LLDB_INVALID_ADDRESS if the read fails.
lldb::addr_t ReadPointer(lldb::addr_t addr);
+
+ // Calls into the Process protected method LoadOperatingSystemPlugin:
+ void LoadOperatingSystemPlugin(bool flush);
+
//------------------------------------------------------------------
// Member variables.
diff --git a/include/lldb/Target/FileAction.h b/include/lldb/Target/FileAction.h
index 81122ec68798..f80f57ac588b 100644
--- a/include/lldb/Target/FileAction.h
+++ b/include/lldb/Target/FileAction.h
@@ -10,7 +10,7 @@
#ifndef liblldb_Target_FileAction_h
#define liblldb_Target_FileAction_h
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include <string>
namespace lldb_private {
diff --git a/include/lldb/Target/Memory.h b/include/lldb/Target/Memory.h
index 57275bbda593..f0a4bc5881f0 100644
--- a/include/lldb/Target/Memory.h
+++ b/include/lldb/Target/Memory.h
@@ -75,6 +75,8 @@ private:
DISALLOW_COPY_AND_ASSIGN(MemoryCache);
};
+
+
class AllocatedBlock {
public:
AllocatedBlock(lldb::addr_t addr, uint32_t byte_size, uint32_t permissions,
@@ -86,32 +88,34 @@ public:
bool FreeBlock(lldb::addr_t addr);
- lldb::addr_t GetBaseAddress() const { return m_addr; }
+ lldb::addr_t GetBaseAddress() const { return m_range.GetRangeBase(); }
- uint32_t GetByteSize() const { return m_byte_size; }
+ uint32_t GetByteSize() const { return m_range.GetByteSize(); }
uint32_t GetPermissions() const { return m_permissions; }
uint32_t GetChunkSize() const { return m_chunk_size; }
bool Contains(lldb::addr_t addr) const {
- return ((addr >= m_addr) && addr < (m_addr + m_byte_size));
+ return m_range.Contains(addr);
}
protected:
- uint32_t TotalChunks() const { return m_byte_size / m_chunk_size; }
+ uint32_t TotalChunks() const { return GetByteSize() / GetChunkSize(); }
uint32_t CalculateChunksNeededForSize(uint32_t size) const {
return (size + m_chunk_size - 1) / m_chunk_size;
}
- const lldb::addr_t m_addr; // Base address of this block of memory
- const uint32_t m_byte_size; // 4GB of chunk should be enough...
- const uint32_t m_permissions; // Permissions for this memory (logical OR of
- // lldb::Permissions bits)
- const uint32_t m_chunk_size; // The size of chunks that the memory at m_addr
- // is divied up into
- typedef std::map<uint32_t, uint32_t> OffsetToChunkSize;
- OffsetToChunkSize m_offset_to_chunk_size;
+ // Base address of this block of memory 4GB of chunk should be enough.
+ Range<lldb::addr_t, uint32_t> m_range;
+ // Permissions for this memory (logical OR of lldb::Permissions bits)
+ const uint32_t m_permissions;
+ // The size of chunks that the memory at m_addr is divied up into.
+ const uint32_t m_chunk_size;
+ // A sorted list of free address ranges.
+ RangeVector<lldb::addr_t, uint32_t> m_free_blocks;
+ // A sorted list of reserved address.
+ RangeVector<lldb::addr_t, uint32_t> m_reserved_blocks;
};
//----------------------------------------------------------------------
diff --git a/include/lldb/Target/MemoryRegionInfo.h b/include/lldb/Target/MemoryRegionInfo.h
index be0cfa429b8f..0824b2442acc 100644
--- a/include/lldb/Target/MemoryRegionInfo.h
+++ b/include/lldb/Target/MemoryRegionInfo.h
@@ -11,8 +11,9 @@
#ifndef lldb_MemoryRegionInfo_h
#define lldb_MemoryRegionInfo_h
-#include "lldb/Core/ConstString.h"
#include "lldb/Core/RangeMap.h"
+#include "llvm/Support/FormatProviders.h"
+#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Range.h"
namespace lldb_private {
@@ -100,4 +101,24 @@ protected:
};
}
+namespace llvm {
+template <>
+struct format_provider<lldb_private::MemoryRegionInfo::OptionalBool> {
+ static void format(const lldb_private::MemoryRegionInfo::OptionalBool &B,
+ raw_ostream &OS, StringRef Options) {
+ switch(B) {
+ case lldb_private::MemoryRegionInfo::eNo:
+ OS << "no";
+ return;
+ case lldb_private::MemoryRegionInfo::eYes:
+ OS << "yes";
+ return;
+ case lldb_private::MemoryRegionInfo::eDontKnow:
+ OS << "don't know";
+ return;
+ }
+ }
+};
+}
+
#endif // #ifndef lldb_MemoryRegionInfo_h
diff --git a/include/lldb/Target/ModuleCache.h b/include/lldb/Target/ModuleCache.h
new file mode 100644
index 000000000000..49a7c97c60c3
--- /dev/null
+++ b/include/lldb/Target/ModuleCache.h
@@ -0,0 +1,76 @@
+//===-- ModuleCache.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_MODULECACHE_H
+#define LLDB_TARGET_MODULECACHE_H
+
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include "lldb/Host/File.h"
+#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
+
+#include <functional>
+#include <string>
+#include <unordered_map>
+
+namespace lldb_private {
+
+class Module;
+class UUID;
+
+//----------------------------------------------------------------------
+/// @class ModuleCache ModuleCache.h "lldb/Target/ModuleCache.h"
+/// @brief A module cache class.
+///
+/// Caches locally modules that are downloaded from remote targets.
+/// Each cached module maintains 2 views:
+/// - UUID view:
+/// /${CACHE_ROOT}/${PLATFORM_NAME}/.cache/${UUID}/${MODULE_FILENAME}
+/// - Sysroot view:
+/// /${CACHE_ROOT}/${PLATFORM_NAME}/${HOSTNAME}/${MODULE_FULL_FILEPATH}
+///
+/// UUID views stores a real module file, whereas Sysroot view holds a symbolic
+/// link to UUID-view file.
+///
+/// Example:
+/// UUID view :
+/// /tmp/lldb/remote-linux/.cache/30C94DC6-6A1F-E951-80C3-D68D2B89E576-D5AE213C/libc.so.6
+/// Sysroot view: /tmp/lldb/remote-linux/ubuntu/lib/x86_64-linux-gnu/libc.so.6
+//----------------------------------------------------------------------
+
+class ModuleCache {
+public:
+ using ModuleDownloader =
+ std::function<Error(const ModuleSpec &, const FileSpec &)>;
+ using SymfileDownloader =
+ std::function<Error(const lldb::ModuleSP &, const FileSpec &)>;
+
+ Error GetAndPut(const FileSpec &root_dir_spec, const char *hostname,
+ const ModuleSpec &module_spec,
+ const ModuleDownloader &module_downloader,
+ const SymfileDownloader &symfile_downloader,
+ lldb::ModuleSP &cached_module_sp, bool *did_create_ptr);
+
+private:
+ Error Put(const FileSpec &root_dir_spec, const char *hostname,
+ const ModuleSpec &module_spec, const FileSpec &tmp_file,
+ const FileSpec &target_file);
+
+ Error Get(const FileSpec &root_dir_spec, const char *hostname,
+ const ModuleSpec &module_spec, lldb::ModuleSP &cached_module_sp,
+ bool *did_create_ptr);
+
+ std::unordered_map<std::string, lldb::ModuleWP> m_loaded_modules;
+};
+
+} // namespace lldb_private
+
+#endif // utility_ModuleCache_h_
diff --git a/include/lldb/Target/PathMappingList.h b/include/lldb/Target/PathMappingList.h
index 4e5a5693235a..2b844882e4ad 100644
--- a/include/lldb/Target/PathMappingList.h
+++ b/include/lldb/Target/PathMappingList.h
@@ -15,8 +15,8 @@
#include <map>
#include <vector>
// Other libraries and framework includes
-#include "lldb/Core/ConstString.h"
-#include "lldb/Core/Error.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Error.h"
// Project includes
namespace lldb_private {
diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h
index 9707093440a5..fb05d3e06dd5 100644
--- a/include/lldb/Target/Platform.h
+++ b/include/lldb/Target/Platform.h
@@ -22,11 +22,11 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Core/ConstString.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/UserSettingsController.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Interpreter/Options.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private-forward.h"
#include "lldb/lldb-public.h"
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index 251dfe6a17c0..56bbbfd53fdd 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -30,7 +30,6 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Communication.h"
-#include "lldb/Core/Error.h"
#include "lldb/Core/Event.h"
#include "lldb/Core/Listener.h"
#include "lldb/Core/LoadedModuleInfoList.h"
@@ -48,6 +47,8 @@
#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Target/QueueList.h"
#include "lldb/Target/ThreadList.h"
+#include "lldb/Utility/Error.h"
+#include "lldb/Utility/NameMatches.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/ArrayRef.h"
@@ -305,11 +306,11 @@ public:
class ProcessInstanceInfoMatch {
public:
ProcessInstanceInfoMatch()
- : m_match_info(), m_name_match_type(eNameMatchIgnore),
+ : m_match_info(), m_name_match_type(NameMatch::Ignore),
m_match_all_users(false) {}
ProcessInstanceInfoMatch(const char *process_name,
- NameMatchType process_name_match_type)
+ NameMatch process_name_match_type)
: m_match_info(), m_name_match_type(process_name_match_type),
m_match_all_users(false) {
m_match_info.GetExecutableFile().SetFile(process_name, false);
@@ -323,9 +324,9 @@ public:
void SetMatchAllUsers(bool b) { m_match_all_users = b; }
- NameMatchType GetNameMatchType() const { return m_name_match_type; }
+ NameMatch GetNameMatchType() const { return m_name_match_type; }
- void SetNameMatchType(NameMatchType name_match_type) {
+ void SetNameMatchType(NameMatch name_match_type) {
m_name_match_type = name_match_type;
}
@@ -338,7 +339,7 @@ public:
protected:
ProcessInstanceInfo m_match_info;
- NameMatchType m_name_match_type;
+ NameMatch m_name_match_type;
bool m_match_all_users;
};
@@ -504,6 +505,7 @@ class Process : public std::enable_shared_from_this<Process>,
public PluginInterface {
friend class FunctionCaller; // For WaitForStateChangeEventsPrivate
friend class Debugger; // For PopProcessIOHandler and ProcessIOHandlerIsActive
+ friend class DynamicLoader; // For LoadOperatingSystemPlugin
friend class ProcessEventData;
friend class StopInfo;
friend class Target;
@@ -2605,7 +2607,7 @@ public:
bool RunPreResumeActions();
void ClearPreResumeActions();
-
+
void ClearPreResumeAction(PreResumeActionCallback callback, void *baton);
ProcessRunLock &GetRunLock();
@@ -3143,6 +3145,8 @@ protected:
Error StopForDestroyOrDetach(lldb::EventSP &exit_event_sp);
+ virtual Error UpdateAutomaticSignalFiltering();
+
bool StateChangedIsExternallyHijacked();
void LoadOperatingSystemPlugin(bool flush);
diff --git a/include/lldb/Target/ProcessInfo.h b/include/lldb/Target/ProcessInfo.h
index f8d37fa4ebb4..03b15242f7ee 100644
--- a/include/lldb/Target/ProcessInfo.h
+++ b/include/lldb/Target/ProcessInfo.h
@@ -12,8 +12,8 @@
// LLDB headers
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Interpreter/Args.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
//----------------------------------------------------------------------
diff --git a/include/lldb/Target/ProcessLaunchInfo.h b/include/lldb/Target/ProcessLaunchInfo.h
index 2c192c24da87..083e0bbed8bd 100644
--- a/include/lldb/Target/ProcessLaunchInfo.h
+++ b/include/lldb/Target/ProcessLaunchInfo.h
@@ -14,12 +14,13 @@
#include <string>
// LLDB Headers
-#include "lldb/Core/Flags.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/Flags.h"
+
#include "lldb/Host/Host.h"
+#include "lldb/Host/PseudoTerminal.h"
#include "lldb/Target/FileAction.h"
#include "lldb/Target/ProcessInfo.h"
-#include "lldb/Utility/PseudoTerminal.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
diff --git a/include/lldb/Target/ProcessStructReader.h b/include/lldb/Target/ProcessStructReader.h
new file mode 100644
index 000000000000..acc5c1f32686
--- /dev/null
+++ b/include/lldb/Target/ProcessStructReader.h
@@ -0,0 +1,102 @@
+//===---------------------ProcessStructReader.h ------------------*- C++-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_PROCESSSTRUCTREADER_H
+#define LLDB_TARGET_PROCESSSTRUCTREADER_H
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Error.h"
+
+#include <initializer_list>
+#include <map>
+#include <string>
+
+namespace lldb_private {
+class ProcessStructReader {
+protected:
+ struct FieldImpl {
+ CompilerType type;
+ size_t offset;
+ size_t size;
+ };
+
+ std::map<ConstString, FieldImpl> m_fields;
+ DataExtractor m_data;
+ lldb::ByteOrder m_byte_order;
+ size_t m_addr_byte_size;
+
+public:
+ ProcessStructReader(Process *process, lldb::addr_t base_addr,
+ CompilerType struct_type) {
+ if (!process)
+ return;
+ if (base_addr == 0 || base_addr == LLDB_INVALID_ADDRESS)
+ return;
+ m_byte_order = process->GetByteOrder();
+ m_addr_byte_size = process->GetAddressByteSize();
+
+ for (size_t idx = 0; idx < struct_type.GetNumFields(); idx++) {
+ std::string name;
+ uint64_t bit_offset;
+ uint32_t bitfield_bit_size;
+ bool is_bitfield;
+ CompilerType field_type = struct_type.GetFieldAtIndex(
+ idx, name, &bit_offset, &bitfield_bit_size, &is_bitfield);
+ // no support for bitfields in here (yet)
+ if (is_bitfield)
+ return;
+ auto size = field_type.GetByteSize(nullptr);
+ // no support for things larger than a uint64_t (yet)
+ if (size > 8)
+ return;
+ ConstString const_name = ConstString(name.c_str());
+ size_t byte_index = static_cast<size_t>(bit_offset / 8);
+ m_fields[const_name] =
+ FieldImpl{field_type, byte_index, static_cast<size_t>(size)};
+ }
+ size_t total_size = struct_type.GetByteSize(nullptr);
+ lldb::DataBufferSP buffer_sp(new DataBufferHeap(total_size, 0));
+ Error error;
+ process->ReadMemoryFromInferior(base_addr, buffer_sp->GetBytes(),
+ total_size, error);
+ if (error.Fail())
+ return;
+ m_data = DataExtractor(buffer_sp, m_byte_order, m_addr_byte_size);
+ }
+
+ template <typename RetType>
+ RetType GetField(ConstString name, RetType fail_value = RetType()) {
+ auto iter = m_fields.find(name), end = m_fields.end();
+ if (iter == end)
+ return fail_value;
+ auto size = iter->second.size;
+ if (sizeof(RetType) < size)
+ return fail_value;
+ lldb::offset_t offset = iter->second.offset;
+ if (offset + size > m_data.GetByteSize())
+ return fail_value;
+ return (RetType)(m_data.GetMaxU64(&offset, size));
+ }
+
+ size_t GetOffsetOf(ConstString name, size_t fail_value = SIZE_MAX) {
+ auto iter = m_fields.find(name), end = m_fields.end();
+ if (iter == end)
+ return fail_value;
+ return iter->second.offset;
+ }
+};
+}
+
+#endif // utility_ProcessStructReader_h_
diff --git a/include/lldb/Target/QueueItem.h b/include/lldb/Target/QueueItem.h
index f6378502c19c..acbf94e1b0f9 100644
--- a/include/lldb/Target/QueueItem.h
+++ b/include/lldb/Target/QueueItem.h
@@ -23,7 +23,7 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/ConstString.h"
+#include "lldb/Utility/ConstString.h"
namespace lldb_private {
diff --git a/include/lldb/Target/QueueList.h b/include/lldb/Target/QueueList.h
index 038463d9ab02..91cf3eb6d4c2 100644
--- a/include/lldb/Target/QueueList.h
+++ b/include/lldb/Target/QueueList.h
@@ -13,8 +13,8 @@
#include <mutex>
#include <vector>
-#include "lldb/Core/UserID.h"
#include "lldb/Utility/Iterable.h"
+#include "lldb/Utility/UserID.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
diff --git a/include/lldb/Target/RegisterCheckpoint.h b/include/lldb/Target/RegisterCheckpoint.h
index 8391cadcdf66..578cf25eef25 100644
--- a/include/lldb/Target/RegisterCheckpoint.h
+++ b/include/lldb/Target/RegisterCheckpoint.h
@@ -10,8 +10,8 @@
#ifndef liblldb_RegisterCheckpoint_h_
#define liblldb_RegisterCheckpoint_h_
-#include "lldb/Core/UserID.h"
#include "lldb/Target/StackID.h"
+#include "lldb/Utility/UserID.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
diff --git a/include/lldb/Target/RegisterNumber.h b/include/lldb/Target/RegisterNumber.h
new file mode 100644
index 000000000000..5649c8022ee7
--- /dev/null
+++ b/include/lldb/Target/RegisterNumber.h
@@ -0,0 +1,62 @@
+//===-- RegisterNumber.h ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_REGISTERNUMBER_H
+#define LLDB_TARGET_REGISTERNUMBER_H
+
+#include "lldb/lldb-private.h"
+#include <map>
+
+//--------------------------------------------------------------------
+/// A class to represent register numbers, and able to convert between
+/// different register numbering schemes that may be used in a single
+/// debug session.
+//--------------------------------------------------------------------
+
+class RegisterNumber {
+public:
+ RegisterNumber(lldb_private::Thread &thread, lldb::RegisterKind kind,
+ uint32_t num);
+
+ // This constructor plus the init() method below allow for the placeholder
+ // creation of an invalid object initially, possibly to be filled in. It
+ // would be more consistent to have three Set* methods to set the three
+ // data that the object needs.
+ RegisterNumber();
+
+ void init(lldb_private::Thread &thread, lldb::RegisterKind kind,
+ uint32_t num);
+
+ const RegisterNumber &operator=(const RegisterNumber &rhs);
+
+ bool operator==(RegisterNumber &rhs);
+
+ bool operator!=(RegisterNumber &rhs);
+
+ bool IsValid() const;
+
+ uint32_t GetAsKind(lldb::RegisterKind kind);
+
+ uint32_t GetRegisterNumber() const;
+
+ lldb::RegisterKind GetRegisterKind() const;
+
+ const char *GetName();
+
+private:
+ typedef std::map<lldb::RegisterKind, uint32_t> Collection;
+
+ lldb::RegisterContextSP m_reg_ctx_sp;
+ uint32_t m_regnum;
+ lldb::RegisterKind m_kind;
+ Collection m_kind_regnum_map;
+ const char *m_name;
+};
+
+#endif // liblldb_RegisterNumber_h
diff --git a/include/lldb/Target/StackFrame.h b/include/lldb/Target/StackFrame.h
index 34bd187b776c..1f25575e236a 100644
--- a/include/lldb/Target/StackFrame.h
+++ b/include/lldb/Target/StackFrame.h
@@ -17,15 +17,16 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/Error.h"
-#include "lldb/Core/Flags.h"
+#include "lldb/Utility/Flags.h"
+
#include "lldb/Core/Scalar.h"
-#include "lldb/Core/StreamString.h"
-#include "lldb/Core/UserID.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/StackID.h"
+#include "lldb/Utility/Error.h"
+#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/UserID.h"
namespace lldb_private {
diff --git a/include/lldb/Target/SystemRuntime.h b/include/lldb/Target/SystemRuntime.h
index 3a2a544fe0b0..f50c9c1b4a56 100644
--- a/include/lldb/Target/SystemRuntime.h
+++ b/include/lldb/Target/SystemRuntime.h
@@ -16,12 +16,12 @@
// Project includes
#include <vector>
-#include "lldb/Core/ConstString.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/StructuredData.h"
#include "lldb/Target/QueueItem.h"
#include "lldb/Target/QueueList.h"
+#include "lldb/Utility/ConstString.h"
#include "lldb/lldb-private.h"
#include "lldb/lldb-public.h"
diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h
index 63449bbf930e..47d0b7d767d6 100644
--- a/include/lldb/Target/Thread.h
+++ b/include/lldb/Target/Thread.h
@@ -22,11 +22,11 @@
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Event.h"
#include "lldb/Core/StructuredData.h"
-#include "lldb/Core/UserID.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/RegisterCheckpoint.h"
#include "lldb/Target/StackFrameList.h"
+#include "lldb/Utility/UserID.h"
#include "lldb/lldb-private.h"
#define LLDB_THREAD_MAX_STOP_EXC_DATA 8
@@ -126,6 +126,7 @@ public:
// bit of data.
lldb::StopInfoSP stop_info_sp; // You have to restore the stop info or you
// might continue with the wrong signals.
+ std::vector<lldb::ThreadPlanSP> m_completed_plan_stack;
lldb::RegisterCheckpointSP
register_backup_sp; // You need to restore the registers, of course...
uint32_t current_inlined_depth;
@@ -1029,6 +1030,15 @@ public:
bool WasThreadPlanDiscarded(ThreadPlan *plan);
//------------------------------------------------------------------
+ /// Check if we have completed plan to override breakpoint stop reason
+ ///
+ /// @return
+ /// Returns true if completed plan stack is not empty
+ /// false otherwise.
+ //------------------------------------------------------------------
+ bool CompletedPlanOverridesBreakpoint();
+
+ //------------------------------------------------------------------
/// Queues a generic thread plan.
///
/// @param[in] plan_sp
@@ -1213,6 +1223,8 @@ public:
void SetStopInfo(const lldb::StopInfoSP &stop_info_sp);
+ void ResetStopInfo();
+
void SetShouldReportStop(Vote vote);
//----------------------------------------------------------------------
diff --git a/include/lldb/Target/ThreadList.h b/include/lldb/Target/ThreadList.h
index 9e3c940c3c2d..2ebcd0b0e2c9 100644
--- a/include/lldb/Target/ThreadList.h
+++ b/include/lldb/Target/ThreadList.h
@@ -13,10 +13,10 @@
#include <mutex>
#include <vector>
-#include "lldb/Core/UserID.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadCollection.h"
#include "lldb/Utility/Iterable.h"
+#include "lldb/Utility/UserID.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
diff --git a/include/lldb/Target/ThreadPlan.h b/include/lldb/Target/ThreadPlan.h
index fd25cd08f2ba..acc63ffe562b 100644
--- a/include/lldb/Target/ThreadPlan.h
+++ b/include/lldb/Target/ThreadPlan.h
@@ -17,12 +17,12 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/UserID.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlanTracer.h"
+#include "lldb/Utility/UserID.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -40,9 +40,10 @@ namespace lldb_private {
// The thread maintaining a thread plan stack, and you program the actions of a
// particular thread
// by pushing plans onto the plan stack.
-// There is always a "Current" plan, which is the head of the plan stack,
+// There is always a "Current" plan, which is the top of the plan stack,
// though in some cases
-// a plan may defer to plans higher in the stack for some piece of information.
+// a plan may defer to plans higher in the stack for some piece of information
+// (let us define that the plan stack grows downwards).
//
// The plan stack is never empty, there is always a Base Plan which persists
// through the life
@@ -109,6 +110,15 @@ namespace lldb_private {
// plans in the time between when
// your plan gets unshipped and the next resume.
//
+// Thread State Checkpoint:
+//
+// Note that calling functions on target process (ThreadPlanCallFunction) changes
+// current thread state. The function can be called either by direct user demand or
+// internally, for example lldb allocates memory on device to calculate breakpoint
+// condition expression - on Linux it is performed by calling mmap on device.
+// ThreadStateCheckpoint saves Thread state (stop info and completed
+// plan stack) to restore it after completing function call.
+//
// Over the lifetime of the plan, various methods of the ThreadPlan are then
// called in response to changes of state in
// the process we are debugging as follows:
@@ -149,7 +159,7 @@ namespace lldb_private {
// If the Current plan answers "true" then it is asked if the stop should
// percolate all the way to the
// user by calling the ShouldStop method. If the current plan doesn't explain
-// the stop, then we query down
+// the stop, then we query up
// the plan stack for a plan that does explain the stop. The plan that does
// explain the stop then needs to
// figure out what to do about the plans below it in the stack. If the stop is
@@ -170,7 +180,7 @@ namespace lldb_private {
// event it didn't directly handle
// it can designate itself a "Master" plan by responding true to IsMasterPlan,
// and then if it wants not to be
-// discarded, it can return true to OkayToDiscard, and it and all its dependent
+// discarded, it can return false to OkayToDiscard, and it and all its dependent
// plans will be preserved when
// we resume execution.
//
@@ -207,7 +217,7 @@ namespace lldb_private {
//
// If a plan says responds "true" to ShouldStop, then it is asked if it's job
// is complete by calling
-// MischiefManaged. If that returns true, the thread is popped from the plan
+// MischiefManaged. If that returns true, the plan is popped from the plan
// stack and added to the
// Completed Plan Stack. Then the next plan in the stack is asked if it
// ShouldStop, and it returns "true",
@@ -241,9 +251,9 @@ namespace lldb_private {
//
// When the process stops, the thread is given a StopReason, in the form of a
// StopInfo object. If there is a completed
-// plan corresponding to the stop, then the "actual" stop reason will be
+// plan corresponding to the stop, then the "actual" stop reason can be
// suppressed, and instead a StopInfoThreadPlan
-// object will be cons'ed up from the highest completed plan in the stack.
+// object will be cons'ed up from the top completed plan in the stack.
// However, if the plan doesn't want to be
// the stop reason, then it can call SetPlanComplete and pass in "false" for
// the "success" parameter. In that case,
diff --git a/include/lldb/Target/ThreadPlanPython.h b/include/lldb/Target/ThreadPlanPython.h
index a053b5bcb77d..9b7e5d029912 100644
--- a/include/lldb/Target/ThreadPlanPython.h
+++ b/include/lldb/Target/ThreadPlanPython.h
@@ -18,13 +18,13 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/StructuredData.h"
-#include "lldb/Core/UserID.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanTracer.h"
+#include "lldb/Utility/UserID.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
diff --git a/include/lldb/Target/UnixSignals.h b/include/lldb/Target/UnixSignals.h
index 1c58d6452b5f..a209f3549aed 100644
--- a/include/lldb/Target/UnixSignals.h
+++ b/include/lldb/Target/UnixSignals.h
@@ -14,11 +14,13 @@
// C++ Includes
#include <map>
#include <string>
+#include <vector>
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/ConstString.h"
+#include "lldb/Utility/ConstString.h"
#include "lldb/lldb-private.h"
+#include "llvm/ADT/Optional.h"
namespace lldb_private {
@@ -88,6 +90,19 @@ public:
void RemoveSignal(int signo);
+ // Returns a current version of the data stored in this class.
+ // Version gets incremented each time Set... method is called.
+ uint64_t GetVersion() const;
+
+ // Returns a vector of signals that meet criteria provided in arguments.
+ // Each should_[suppress|stop|notify] flag can be
+ // None - no filtering by this flag
+ // true - only signals that have it set to true are returned
+ // false - only signals that have it set to true are returned
+ std::vector<int32_t> GetFilteredSignals(llvm::Optional<bool> should_suppress,
+ llvm::Optional<bool> should_stop,
+ llvm::Optional<bool> should_notify);
+
protected:
//------------------------------------------------------------------
// Classes that inherit from UnixSignals can see and modify these
@@ -111,6 +126,12 @@ protected:
collection m_signals;
+ // This version gets incremented every time something is changing in
+ // this class, including when we call AddSignal from the constructor.
+ // So after the object is constructed m_version is going to be > 0
+ // if it has at least one signal registered in it.
+ uint64_t m_version = 0;
+
// GDBRemote signals need to be copyable.
UnixSignals(const UnixSignals &rhs);