[Lldb-commits] [lldb] r331197 - Reflow paragraphs in comments.
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 30 09:49:06 PDT 2018
Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Mon Apr 30 09:49:04 2018
@@ -91,11 +91,10 @@ bool ProcessMachCore::CanDebug(lldb::Tar
// For now we are just making sure the file exists for a given module
if (!m_core_module_sp && m_core_file.Exists()) {
- // Don't add the Target's architecture to the ModuleSpec - we may be working
- // with a core file that doesn't have the correct cpusubtype in the header
- // but we should still try to use it -
- // ModuleSpecList::FindMatchingModuleSpec
- // enforces a strict arch mach.
+ // Don't add the Target's architecture to the ModuleSpec - we may be
+ // working with a core file that doesn't have the correct cpusubtype in the
+ // header but we should still try to use it -
+ // ModuleSpecList::FindMatchingModuleSpec enforces a strict arch mach.
ModuleSpec core_module_spec(m_core_file);
Status error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp,
NULL, NULL, NULL));
@@ -125,10 +124,10 @@ ProcessMachCore::ProcessMachCore(lldb::T
//----------------------------------------------------------------------
ProcessMachCore::~ProcessMachCore() {
Clear();
- // We need to call finalize on the process before destroying ourselves
- // to make sure all of the broadcaster cleanup goes as planned. If we
- // destruct this class, then Process::~Process() might have problems
- // trying to fully destroy the broadcaster.
+ // We need to call finalize on the process before destroying ourselves to
+ // make sure all of the broadcaster cleanup goes as planned. If we destruct
+ // this class, then Process::~Process() might have problems trying to fully
+ // destroy the broadcaster.
Finalize();
}
@@ -162,11 +161,10 @@ bool ProcessMachCore::GetDynamicLoaderAd
// header.magic, header.filetype);
if (header.magic == llvm::MachO::MH_MAGIC ||
header.magic == llvm::MachO::MH_MAGIC_64) {
- // Check MH_EXECUTABLE to see if we can find the mach image
- // that contains the shared library list. The dynamic loader
- // (dyld) is what contains the list for user applications,
- // and the mach kernel contains a global that has the list
- // of kexts to load
+ // Check MH_EXECUTABLE to see if we can find the mach image that contains
+ // the shared library list. The dynamic loader (dyld) is what contains the
+ // list for user applications, and the mach kernel contains a global that
+ // has the list of kexts to load
switch (header.filetype) {
case llvm::MachO::MH_DYLINKER:
// printf("0x%16.16" PRIx64 ": file_type = MH_DYLINKER\n", vaddr);
@@ -272,13 +270,10 @@ Status ProcessMachCore::DoLoadCore() {
} else {
m_core_aranges.Append(range_entry);
}
- // Some core files don't fill in the permissions correctly. If that is the
- // case
- // assume read + execute so clients don't think the memory is not
- // readable,
- // or executable. The memory isn't writable since this plug-in doesn't
- // implement
- // DoWriteMemory.
+ // Some core files don't fill in the permissions correctly. If that is
+ // the case assume read + execute so clients don't think the memory is
+ // not readable, or executable. The memory isn't writable since this
+ // plug-in doesn't implement DoWriteMemory.
uint32_t permissions = section->GetPermissions();
if (permissions == 0)
permissions = lldb::ePermissionsReadable | lldb::ePermissionsExecutable;
@@ -309,8 +304,8 @@ Status ProcessMachCore::DoLoadCore() {
}
// This checks for the presence of an LC_IDENT string in a core file;
- // LC_IDENT is very obsolete and should not be used in new code, but
- // if the load command is present, let's use the contents.
+ // LC_IDENT is very obsolete and should not be used in new code, but if the
+ // load command is present, let's use the contents.
std::string corefile_identifier = core_objfile->GetIdentifierString();
if (found_main_binary_definitively == false
&& corefile_identifier.find("Darwin Kernel") != std::string::npos) {
@@ -342,16 +337,12 @@ Status ProcessMachCore::DoLoadCore() {
if (found_main_binary_definitively == false
&& (m_dyld_addr == LLDB_INVALID_ADDRESS
|| m_mach_kernel_addr == LLDB_INVALID_ADDRESS)) {
- // We need to locate the main executable in the memory ranges
- // we have in the core file. We need to search for both a user-process dyld
- // binary
+ // We need to locate the main executable in the memory ranges we have in
+ // the core file. We need to search for both a user-process dyld binary
// and a kernel binary in memory; we must look at all the pages in the
- // binary so
- // we don't miss one or the other. Step through all memory segments
- // searching for
- // a kernel binary and for a user process dyld -- we'll decide which to
- // prefer
- // later if both are present.
+ // binary so we don't miss one or the other. Step through all memory
+ // segments searching for a kernel binary and for a user process dyld --
+ // we'll decide which to prefer later if both are present.
const size_t num_core_aranges = m_core_aranges.GetSize();
for (size_t i = 0; i < num_core_aranges; ++i) {
@@ -369,13 +360,10 @@ Status ProcessMachCore::DoLoadCore() {
if (found_main_binary_definitively == false
&& m_mach_kernel_addr != LLDB_INVALID_ADDRESS) {
// In the case of multiple kernel images found in the core file via
- // exhaustive
- // search, we may not pick the correct one. See if the
- // DynamicLoaderDarwinKernel's
- // search heuristics might identify the correct one.
- // Most of the time, I expect the address from SearchForDarwinKernel() will
- // be the
- // same as the address we found via exhaustive search.
+ // exhaustive search, we may not pick the correct one. See if the
+ // DynamicLoaderDarwinKernel's search heuristics might identify the correct
+ // one. Most of the time, I expect the address from SearchForDarwinKernel()
+ // will be the same as the address we found via exhaustive search.
if (GetTarget().GetArchitecture().IsValid() == false &&
m_core_module_sp.get()) {
@@ -383,13 +371,11 @@ Status ProcessMachCore::DoLoadCore() {
}
// SearchForDarwinKernel will end up calling back into this this class in
- // the GetImageInfoAddress
- // method which will give it the m_mach_kernel_addr/m_dyld_addr it already
- // has. Save that aside
- // and set m_mach_kernel_addr/m_dyld_addr to an invalid address temporarily
- // so
- // DynamicLoaderDarwinKernel does a real search for the kernel using its own
- // heuristics.
+ // the GetImageInfoAddress method which will give it the
+ // m_mach_kernel_addr/m_dyld_addr it already has. Save that aside and set
+ // m_mach_kernel_addr/m_dyld_addr to an invalid address temporarily so
+ // DynamicLoaderDarwinKernel does a real search for the kernel using its
+ // own heuristics.
addr_t saved_mach_kernel_addr = m_mach_kernel_addr;
addr_t saved_user_dyld_addr = m_dyld_addr;
@@ -410,8 +396,8 @@ Status ProcessMachCore::DoLoadCore() {
}
}
- // If we found both a user-process dyld and a kernel binary, we need to decide
- // which to prefer.
+ // If we found both a user-process dyld and a kernel binary, we need to
+ // decide which to prefer.
if (GetCorefilePreference() == eKernelCorefile) {
if (m_mach_kernel_addr != LLDB_INVALID_ADDRESS) {
if (log)
@@ -444,18 +430,13 @@ Status ProcessMachCore::DoLoadCore() {
if (m_dyld_plugin_name != DynamicLoaderMacOSXDYLD::GetPluginNameStatic()) {
// For non-user process core files, the permissions on the core file
- // segments are usually
- // meaningless, they may be just "read", because we're dealing with kernel
- // coredumps or
- // early startup coredumps and the dumper is grabbing pages of memory
- // without knowing
- // what they are. If they aren't marked as "exeuctable", that can break the
- // unwinder
- // which will check a pc value to see if it is in an executable segment and
- // stop the
+ // segments are usually meaningless, they may be just "read", because we're
+ // dealing with kernel coredumps or early startup coredumps and the dumper
+ // is grabbing pages of memory without knowing what they are. If they
+ // aren't marked as "exeuctable", that can break the unwinder which will
+ // check a pc value to see if it is in an executable segment and stop the
// backtrace early if it is not ("executable" and "unknown" would both be
- // fine, but
- // "not executable" will break the unwinder).
+ // fine, but "not executable" will break the unwinder).
size_t core_range_infos_size = m_core_range_infos.GetSize();
for (size_t i = 0; i < core_range_infos_size; i++) {
VMRangeToPermissions::Entry *ent =
@@ -464,8 +445,8 @@ Status ProcessMachCore::DoLoadCore() {
}
}
- // Even if the architecture is set in the target, we need to override
- // it to match the core file which is always single arch.
+ // Even if the architecture is set in the target, we need to override it to
+ // match the core file which is always single arch.
ArchSpec arch(m_core_module_sp->GetArchitecture());
if (arch.GetCore() == ArchSpec::eCore_x86_32_i486) {
arch = Platform::GetAugmentedArchSpec(GetTarget().GetPlatform().get(), "i386");
@@ -488,8 +469,7 @@ bool ProcessMachCore::UpdateThreadList(T
ThreadList &new_thread_list) {
if (old_thread_list.GetSize(false) == 0) {
// Make up the thread the first time this is called so we can setup our one
- // and only
- // core thread state.
+ // and only core thread state.
ObjectFile *core_objfile = m_core_module_sp->GetObjectFile();
if (core_objfile) {
@@ -508,8 +488,8 @@ bool ProcessMachCore::UpdateThreadList(T
}
void ProcessMachCore::RefreshStateAfterStop() {
- // Let all threads recover from stopping and do any clean up based
- // on the previous thread state (if any).
+ // Let all threads recover from stopping and do any clean up based on the
+ // previous thread state (if any).
m_thread_list.RefreshStateAfterStop();
// SetThreadStopInfo (m_last_stop_packet);
}
@@ -529,8 +509,8 @@ bool ProcessMachCore::WarnBeforeDetach()
//------------------------------------------------------------------
size_t ProcessMachCore::ReadMemory(addr_t addr, void *buf, size_t size,
Status &error) {
- // Don't allow the caching that lldb_private::Process::ReadMemory does
- // since in core files we have it all cached our our core file anyway.
+ // Don't allow the caching that lldb_private::Process::ReadMemory does since
+ // in core files we have it all cached our our core file anyway.
return DoReadMemory(addr, buf, size, error);
}
@@ -546,19 +526,17 @@ size_t ProcessMachCore::DoReadMemory(add
// Address Size File off File size
// ---------- ---------- ---------- ----------
// LC_SEGMENT 0x000f6000 0x00001000 0x1d509ee8 0x00001000 --- --- 0
- // 0x00000000 __TEXT
- // LC_SEGMENT 0x0f600000 0x00100000 0x1d50aee8 0x00100000 --- --- 0
- // 0x00000000 __TEXT
- // LC_SEGMENT 0x000f7000 0x00001000 0x1d60aee8 0x00001000 --- --- 0
- // 0x00000000 __TEXT
+ // 0x00000000 __TEXT LC_SEGMENT 0x0f600000 0x00100000 0x1d50aee8 0x00100000
+ // --- --- 0 0x00000000 __TEXT LC_SEGMENT 0x000f7000 0x00001000
+ // 0x1d60aee8 0x00001000 --- --- 0 0x00000000 __TEXT
//
// Any if the user executes the following command:
//
// (lldb) mem read 0xf6ff0
//
- // We would attempt to read 32 bytes from 0xf6ff0 but would only
- // get 16 unless we loop through consecutive memory ranges that are
- // contiguous in the address space, but not in the file data.
+ // We would attempt to read 32 bytes from 0xf6ff0 but would only get 16
+ // unless we loop through consecutive memory ranges that are contiguous in
+ // the address space, but not in the file data.
//----------------------------------------------------------------------
while (bytes_read < size) {
const addr_t curr_addr = addr + bytes_read;
@@ -641,8 +619,8 @@ void ProcessMachCore::Initialize() {
}
addr_t ProcessMachCore::GetImageInfoAddress() {
- // If we found both a user-process dyld and a kernel binary, we need to decide
- // which to prefer.
+ // If we found both a user-process dyld and a kernel binary, we need to
+ // decide which to prefer.
if (GetCorefilePreference() == eKernelCorefile) {
if (m_mach_kernel_addr != LLDB_INVALID_ADDRESS) {
return m_mach_kernel_addr;
Modified: lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp Mon Apr 30 09:49:04 2018
@@ -54,8 +54,8 @@ void ThreadMachCore::RefreshStateAfterSt
// context by the time this function gets called. The KDPRegisterContext
// class has been made smart enough to detect when it needs to invalidate
// which registers are valid by putting hooks in the register read and
- // register supply functions where they check the process stop ID and do
- // the right thing.
+ // register supply functions where they check the process stop ID and do the
+ // right thing.
const bool force = false;
GetRegisterContext()->InvalidateIfNeeded(force);
}
Modified: lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp (original)
+++ lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp Mon Apr 30 09:49:04 2018
@@ -115,12 +115,12 @@ MinidumpParser::GetThreadContext(const M
llvm::ArrayRef<uint8_t>
MinidumpParser::GetThreadContextWow64(const MinidumpThread &td) {
- // On Windows, a 32-bit process can run on a 64-bit machine under
- // WOW64. If the minidump was captured with a 64-bit debugger, then
- // the CONTEXT we just grabbed from the mini_dump_thread is the one
- // for the 64-bit "native" process rather than the 32-bit "guest"
- // process we care about. In this case, we can get the 32-bit CONTEXT
- // from the TEB (Thread Environment Block) of the 64-bit process.
+ // On Windows, a 32-bit process can run on a 64-bit machine under WOW64. If
+ // the minidump was captured with a 64-bit debugger, then the CONTEXT we just
+ // grabbed from the mini_dump_thread is the one for the 64-bit "native"
+ // process rather than the 32-bit "guest" process we care about. In this
+ // case, we can get the 32-bit CONTEXT from the TEB (Thread Environment
+ // Block) of the 64-bit process.
auto teb_mem = GetMemory(td.teb, sizeof(TEB64));
if (teb_mem.empty())
return {};
@@ -130,9 +130,9 @@ MinidumpParser::GetThreadContextWow64(co
if (error.Fail())
return {};
- // Slot 1 of the thread-local storage in the 64-bit TEB points to a
- // structure that includes the 32-bit CONTEXT (after a ULONG).
- // See: https://msdn.microsoft.com/en-us/library/ms681670.aspx
+ // Slot 1 of the thread-local storage in the 64-bit TEB points to a structure
+ // that includes the 32-bit CONTEXT (after a ULONG). See:
+ // https://msdn.microsoft.com/en-us/library/ms681670.aspx
auto context =
GetMemory(wow64teb->tls_slots[1] + 4, sizeof(MinidumpContext_x86_32));
if (context.size() < sizeof(MinidumpContext_x86_32))
@@ -334,10 +334,10 @@ MinidumpParser::FindMemoryRange(lldb::ad
}
}
- // Some Minidumps have a Memory64ListStream that captures all the heap
- // memory (full-memory Minidumps). We can't exactly use the same loop as
- // above, because the Minidump uses slightly different data structures to
- // describe those
+ // Some Minidumps have a Memory64ListStream that captures all the heap memory
+ // (full-memory Minidumps). We can't exactly use the same loop as above,
+ // because the Minidump uses slightly different data structures to describe
+ // those
if (!data64.empty()) {
llvm::ArrayRef<MinidumpMemoryDescriptor64> memory64_list;
@@ -377,8 +377,8 @@ llvm::ArrayRef<uint8_t> MinidumpParser::
return {};
// There's at least some overlap between the beginning of the desired range
- // (addr) and the current range. Figure out where the overlap begins and
- // how much overlap there is.
+ // (addr) and the current range. Figure out where the overlap begins and how
+ // much overlap there is.
const size_t offset = addr - range->start;
Modified: lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp (original)
+++ lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp Mon Apr 30 09:49:04 2018
@@ -55,10 +55,9 @@ lldb_private::minidump::parseMinidumpStr
return llvm::None;
auto source_start = reinterpret_cast<const llvm::UTF16 *>(data.data());
- // source_length is the length of the string in bytes
- // we need the length of the string in UTF-16 characters/code points (16 bits
- // per char)
- // that's why it's divided by 2
+ // source_length is the length of the string in bytes we need the length of
+ // the string in UTF-16 characters/code points (16 bits per char) that's why
+ // it's divided by 2
const auto source_end = source_start + source_length / 2;
// resize to worst case length
result.resize(UNI_MAX_UTF8_BYTES_PER_CODE_POINT * source_length / 2);
Modified: lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp (original)
+++ lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp Mon Apr 30 09:49:04 2018
@@ -49,8 +49,8 @@ public:
PlaceholderModule(const FileSpec &file_spec, const ArchSpec &arch) :
Module(file_spec, arch) {}
- // Creates a synthetic module section covering the whole module image
- // (and sets the section load address as well)
+ // Creates a synthetic module section covering the whole module image (and
+ // sets the section load address as well)
void CreateImageSection(const MinidumpModule *module, Target& target) {
const ConstString section_name(".module_image");
lldb::SectionSP section_sp(new Section(
@@ -137,10 +137,10 @@ ProcessMinidump::ProcessMinidump(lldb::T
ProcessMinidump::~ProcessMinidump() {
Clear();
- // We need to call finalize on the process before destroying ourselves
- // to make sure all of the broadcaster cleanup goes as planned. If we
- // destruct this class, then Process::~Process() might have problems
- // trying to fully destroy the broadcaster.
+ // We need to call finalize on the process before destroying ourselves to
+ // make sure all of the broadcaster cleanup goes as planned. If we destruct
+ // this class, then Process::~Process() might have problems trying to fully
+ // destroy the broadcaster.
Finalize();
}
@@ -230,8 +230,8 @@ bool ProcessMinidump::WarnBeforeDetach()
size_t ProcessMinidump::ReadMemory(lldb::addr_t addr, void *buf, size_t size,
Status &error) {
- // Don't allow the caching that lldb_private::Process::ReadMemory does
- // since we have it all cached in our dump file anyway.
+ // Don't allow the caching that lldb_private::Process::ReadMemory does since
+ // we have it all cached in our dump file anyway.
return DoReadMemory(addr, buf, size, error);
}
@@ -327,9 +327,9 @@ void ProcessMinidump::ReadModuleList() {
Status error;
lldb::ModuleSP module_sp = GetTarget().GetSharedModule(module_spec, &error);
if (!module_sp || error.Fail()) {
- // We failed to locate a matching local object file. Fortunately,
- // the minidump format encodes enough information about each module's
- // memory range to allow us to create placeholder modules.
+ // We failed to locate a matching local object file. Fortunately, the
+ // minidump format encodes enough information about each module's memory
+ // range to allow us to create placeholder modules.
//
// This enables most LLDB functionality involving address-to-module
// translations (ex. identifing the module for a stack frame PC) and
Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp Mon Apr 30 09:49:04 2018
@@ -123,21 +123,20 @@ PythonObject::ResolveNameWithDictionary(
}
PythonObject PythonObject::ResolveName(llvm::StringRef name) const {
- // Resolve the name in the context of the specified object. If,
- // for example, `this` refers to a PyModule, then this will look for
- // `name` in this module. If `this` refers to a PyType, then it will
- // resolve `name` as an attribute of that type. If `this` refers to
- // an instance of an object, then it will resolve `name` as the value
- // of the specified field.
+ // Resolve the name in the context of the specified object. If, for example,
+ // `this` refers to a PyModule, then this will look for `name` in this
+ // module. If `this` refers to a PyType, then it will resolve `name` as an
+ // attribute of that type. If `this` refers to an instance of an object,
+ // then it will resolve `name` as the value of the specified field.
//
// This function handles dotted names so that, for example, if `m_py_obj`
- // refers to the `sys` module, and `name` == "path.append", then it
- // will find the function `sys.path.append`.
+ // refers to the `sys` module, and `name` == "path.append", then it will find
+ // the function `sys.path.append`.
size_t dot_pos = name.find_first_of('.');
if (dot_pos == llvm::StringRef::npos) {
- // No dots in the name, we should be able to find the value immediately
- // as an attribute of `m_py_obj`.
+ // No dots in the name, we should be able to find the value immediately as
+ // an attribute of `m_py_obj`.
return GetAttributeValue(name);
}
@@ -230,8 +229,8 @@ bool PythonBytes::Check(PyObject *py_obj
}
void PythonBytes::Reset(PyRefType type, PyObject *py_obj) {
- // Grab the desired reference type so that if we end up rejecting
- // `py_obj` it still gets decremented if necessary.
+ // Grab the desired reference type so that if we end up rejecting `py_obj` it
+ // still gets decremented if necessary.
PythonObject result(type, py_obj);
if (!PythonBytes::Check(py_obj)) {
@@ -240,8 +239,7 @@ void PythonBytes::Reset(PyRefType type,
}
// Calling PythonObject::Reset(const PythonObject&) will lead to stack
- // overflow since it calls
- // back into the virtual implementation.
+ // overflow since it calls back into the virtual implementation.
PythonObject::Reset(PyRefType::Borrowed, result.get());
}
@@ -303,8 +301,8 @@ bool PythonByteArray::Check(PyObject *py
}
void PythonByteArray::Reset(PyRefType type, PyObject *py_obj) {
- // Grab the desired reference type so that if we end up rejecting
- // `py_obj` it still gets decremented if necessary.
+ // Grab the desired reference type so that if we end up rejecting `py_obj` it
+ // still gets decremented if necessary.
PythonObject result(type, py_obj);
if (!PythonByteArray::Check(py_obj)) {
@@ -313,8 +311,7 @@ void PythonByteArray::Reset(PyRefType ty
}
// Calling PythonObject::Reset(const PythonObject&) will lead to stack
- // overflow since it calls
- // back into the virtual implementation.
+ // overflow since it calls back into the virtual implementation.
PythonObject::Reset(PyRefType::Borrowed, result.get());
}
@@ -378,8 +375,8 @@ bool PythonString::Check(PyObject *py_ob
}
void PythonString::Reset(PyRefType type, PyObject *py_obj) {
- // Grab the desired reference type so that if we end up rejecting
- // `py_obj` it still gets decremented if necessary.
+ // Grab the desired reference type so that if we end up rejecting `py_obj` it
+ // still gets decremented if necessary.
PythonObject result(type, py_obj);
if (!PythonString::Check(py_obj)) {
@@ -394,8 +391,7 @@ void PythonString::Reset(PyRefType type,
result.Reset(PyRefType::Owned, PyUnicode_AsUTF8String(result.get()));
#endif
// Calling PythonObject::Reset(const PythonObject&) will lead to stack
- // overflow since it calls
- // back into the virtual implementation.
+ // overflow since it calls back into the virtual implementation.
PythonObject::Reset(PyRefType::Borrowed, result.get());
}
@@ -466,8 +462,8 @@ bool PythonInteger::Check(PyObject *py_o
return false;
#if PY_MAJOR_VERSION >= 3
- // Python 3 does not have PyInt_Check. There is only one type of
- // integral value, long.
+ // Python 3 does not have PyInt_Check. There is only one type of integral
+ // value, long.
return PyLong_Check(py_obj);
#else
return PyLong_Check(py_obj) || PyInt_Check(py_obj);
@@ -475,8 +471,8 @@ bool PythonInteger::Check(PyObject *py_o
}
void PythonInteger::Reset(PyRefType type, PyObject *py_obj) {
- // Grab the desired reference type so that if we end up rejecting
- // `py_obj` it still gets decremented if necessary.
+ // Grab the desired reference type so that if we end up rejecting `py_obj` it
+ // still gets decremented if necessary.
PythonObject result(type, py_obj);
if (!PythonInteger::Check(py_obj)) {
@@ -485,13 +481,13 @@ void PythonInteger::Reset(PyRefType type
}
#if PY_MAJOR_VERSION < 3
- // Always store this as a PyLong, which makes interoperability between
- // Python 2.x and Python 3.x easier. This is only necessary in 2.x,
- // since 3.x doesn't even have a PyInt.
+ // Always store this as a PyLong, which makes interoperability between Python
+ // 2.x and Python 3.x easier. This is only necessary in 2.x, since 3.x
+ // doesn't even have a PyInt.
if (PyInt_Check(py_obj)) {
// Since we converted the original object to a different type, the new
- // object is an owned object regardless of the ownership semantics requested
- // by the user.
+ // object is an owned object regardless of the ownership semantics
+ // requested by the user.
result.Reset(PyRefType::Owned, PyLong_FromLongLong(PyInt_AsLong(py_obj)));
}
#endif
@@ -500,8 +496,7 @@ void PythonInteger::Reset(PyRefType type
"Couldn't get a PyLong from this PyObject");
// Calling PythonObject::Reset(const PythonObject&) will lead to stack
- // overflow since it calls
- // back into the virtual implementation.
+ // overflow since it calls back into the virtual implementation.
PythonObject::Reset(PyRefType::Borrowed, result.get());
}
@@ -513,10 +508,9 @@ int64_t PythonInteger::GetInteger() cons
int overflow = 0;
int64_t result = PyLong_AsLongLongAndOverflow(m_py_obj, &overflow);
if (overflow != 0) {
- // We got an integer that overflows, like 18446744072853913392L
- // we can't use PyLong_AsLongLong() as it will return
- // 0xffffffffffffffff. If we use the unsigned long long
- // it will work as expected.
+ // We got an integer that overflows, like 18446744072853913392L we can't
+ // use PyLong_AsLongLong() as it will return 0xffffffffffffffff. If we
+ // use the unsigned long long it will work as expected.
const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
result = static_cast<int64_t>(uval);
}
@@ -563,8 +557,8 @@ bool PythonList::Check(PyObject *py_obj)
}
void PythonList::Reset(PyRefType type, PyObject *py_obj) {
- // Grab the desired reference type so that if we end up rejecting
- // `py_obj` it still gets decremented if necessary.
+ // Grab the desired reference type so that if we end up rejecting `py_obj` it
+ // still gets decremented if necessary.
PythonObject result(type, py_obj);
if (!PythonList::Check(py_obj)) {
@@ -573,8 +567,7 @@ void PythonList::Reset(PyRefType type, P
}
// Calling PythonObject::Reset(const PythonObject&) will lead to stack
- // overflow since it calls
- // back into the virtual implementation.
+ // overflow since it calls back into the virtual implementation.
PythonObject::Reset(PyRefType::Borrowed, result.get());
}
@@ -668,8 +661,8 @@ bool PythonTuple::Check(PyObject *py_obj
}
void PythonTuple::Reset(PyRefType type, PyObject *py_obj) {
- // Grab the desired reference type so that if we end up rejecting
- // `py_obj` it still gets decremented if necessary.
+ // Grab the desired reference type so that if we end up rejecting `py_obj` it
+ // still gets decremented if necessary.
PythonObject result(type, py_obj);
if (!PythonTuple::Check(py_obj)) {
@@ -678,8 +671,7 @@ void PythonTuple::Reset(PyRefType type,
}
// Calling PythonObject::Reset(const PythonObject&) will lead to stack
- // overflow since it calls
- // back into the virtual implementation.
+ // overflow since it calls back into the virtual implementation.
PythonObject::Reset(PyRefType::Borrowed, result.get());
}
@@ -741,8 +733,8 @@ bool PythonDictionary::Check(PyObject *p
}
void PythonDictionary::Reset(PyRefType type, PyObject *py_obj) {
- // Grab the desired reference type so that if we end up rejecting
- // `py_obj` it still gets decremented if necessary.
+ // Grab the desired reference type so that if we end up rejecting `py_obj` it
+ // still gets decremented if necessary.
PythonObject result(type, py_obj);
if (!PythonDictionary::Check(py_obj)) {
@@ -751,8 +743,7 @@ void PythonDictionary::Reset(PyRefType t
}
// Calling PythonObject::Reset(const PythonObject&) will lead to stack
- // overflow since it calls
- // back into the virtual implementation.
+ // overflow since it calls back into the virtual implementation.
PythonObject::Reset(PyRefType::Borrowed, result.get());
}
@@ -833,8 +824,8 @@ bool PythonModule::Check(PyObject *py_ob
}
void PythonModule::Reset(PyRefType type, PyObject *py_obj) {
- // Grab the desired reference type so that if we end up rejecting
- // `py_obj` it still gets decremented if necessary.
+ // Grab the desired reference type so that if we end up rejecting `py_obj` it
+ // still gets decremented if necessary.
PythonObject result(type, py_obj);
if (!PythonModule::Check(py_obj)) {
@@ -843,8 +834,7 @@ void PythonModule::Reset(PyRefType type,
}
// Calling PythonObject::Reset(const PythonObject&) will lead to stack
- // overflow since it calls
- // back into the virtual implementation.
+ // overflow since it calls back into the virtual implementation.
PythonObject::Reset(PyRefType::Borrowed, result.get());
}
@@ -871,8 +861,8 @@ bool PythonCallable::Check(PyObject *py_
}
void PythonCallable::Reset(PyRefType type, PyObject *py_obj) {
- // Grab the desired reference type so that if we end up rejecting
- // `py_obj` it still gets decremented if necessary.
+ // Grab the desired reference type so that if we end up rejecting `py_obj` it
+ // still gets decremented if necessary.
PythonObject result(type, py_obj);
if (!PythonCallable::Check(py_obj)) {
@@ -881,8 +871,7 @@ void PythonCallable::Reset(PyRefType typ
}
// Calling PythonObject::Reset(const PythonObject&) will lead to stack
- // overflow since it calls
- // back into the virtual implementation.
+ // overflow since it calls back into the virtual implementation.
PythonObject::Reset(PyRefType::Borrowed, result.get());
}
@@ -963,9 +952,9 @@ bool PythonFile::Check(PyObject *py_obj)
#else
// In Python 3, there is no `PyFile_Check`, and in fact PyFile is not even a
// first-class object type anymore. `PyFile_FromFd` is just a thin wrapper
- // over `io.open()`, which returns some object derived from `io.IOBase`.
- // As a result, the only way to detect a file in Python 3 is to check whether
- // it inherits from `io.IOBase`. Since it is possible for non-files to also
+ // over `io.open()`, which returns some object derived from `io.IOBase`. As a
+ // result, the only way to detect a file in Python 3 is to check whether it
+ // inherits from `io.IOBase`. Since it is possible for non-files to also
// inherit from `io.IOBase`, we additionally verify that it has the `fileno`
// attribute, which should guarantee that it is backed by the file system.
PythonObject io_module(PyRefType::Owned, PyImport_ImportModule("io"));
@@ -985,8 +974,8 @@ bool PythonFile::Check(PyObject *py_obj)
}
void PythonFile::Reset(PyRefType type, PyObject *py_obj) {
- // Grab the desired reference type so that if we end up rejecting
- // `py_obj` it still gets decremented if necessary.
+ // Grab the desired reference type so that if we end up rejecting `py_obj` it
+ // still gets decremented if necessary.
PythonObject result(type, py_obj);
if (!PythonFile::Check(py_obj)) {
Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp Mon Apr 30 09:49:04 2018
@@ -30,9 +30,9 @@ PythonExceptionState::~PythonExceptionSt
}
void PythonExceptionState::Acquire(bool restore_on_exit) {
- // If a state is already acquired, the user needs to decide whether they
- // want to discard or restore it. Don't allow the potential silent
- // loss of a valid state.
+ // If a state is already acquired, the user needs to decide whether they want
+ // to discard or restore it. Don't allow the potential silent loss of a
+ // valid state.
assert(!IsError());
if (!HasErrorOccurred())
@@ -45,8 +45,7 @@ void PythonExceptionState::Acquire(bool
// PyErr_Fetch clears the error flag.
assert(!HasErrorOccurred());
- // Ownership of the objects returned by `PyErr_Fetch` is transferred
- // to us.
+ // Ownership of the objects returned by `PyErr_Fetch` is transferred to us.
m_type.Reset(PyRefType::Owned, py_type);
m_value.Reset(PyRefType::Owned, py_value);
m_traceback.Reset(PyRefType::Owned, py_traceback);
@@ -56,14 +55,14 @@ void PythonExceptionState::Acquire(bool
void PythonExceptionState::Restore() {
if (m_type.IsValid()) {
// The documentation for PyErr_Restore says "Do not pass a null type and
- // non-null value or traceback. So only restore if type was non-null
- // to begin with. In this case we're passing ownership back to Python
- // so release them all.
+ // non-null value or traceback. So only restore if type was non-null to
+ // begin with. In this case we're passing ownership back to Python so
+ // release them all.
PyErr_Restore(m_type.release(), m_value.release(), m_traceback.release());
}
- // After we restore, we should not hold onto the exception state. Demand that
- // it be re-acquired.
+ // After we restore, we should not hold onto the exception state. Demand
+ // that it be re-acquired.
Discard();
}
@@ -100,10 +99,10 @@ std::string PythonExceptionState::Format
if (!IsError())
return std::string();
- // It's possible that ReadPythonBacktrace generated another exception.
- // If this happens we have to clear the exception, because otherwise
- // PyObject_Str() will assert below. That's why we needed to do the
- // save / restore at the beginning of this function.
+ // It's possible that ReadPythonBacktrace generated another exception. If
+ // this happens we have to clear the exception, because otherwise
+ // PyObject_Str() will assert below. That's why we needed to do the save /
+ // restore at the beginning of this function.
PythonExceptionState bt_error_state(false);
std::string error_string;
@@ -114,8 +113,8 @@ std::string PythonExceptionState::Format
// If we were able to read the backtrace, just append it.
error_stream << backtrace << "\n";
} else {
- // Otherwise, append some information about why we were unable to
- // obtain the backtrace.
+ // Otherwise, append some information about why we were unable to obtain
+ // the backtrace.
PythonString bt_error = bt_error_state.GetValue().Str();
error_stream << "An error occurred while retrieving the backtrace: "
<< bt_error.GetString() << "\n";
Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Mon Apr 30 09:49:04 2018
@@ -112,13 +112,12 @@ static bool g_initialized = false;
namespace {
-// Initializing Python is not a straightforward process. We cannot control what
-// external code may have done before getting to this point in LLDB, including
-// potentially having already initialized Python, so we need to do a lot of work
-// to ensure that the existing state of the system is maintained across our
-// initialization. We do this by using an RAII pattern where we save off
-// initial
-// state at the beginning, and restore it at the end
+// Initializing Python is not a straightforward process. We cannot control
+// what external code may have done before getting to this point in LLDB,
+// including potentially having already initialized Python, so we need to do a
+// lot of work to ensure that the existing state of the system is maintained
+// across our initialization. We do this by using an RAII pattern where we
+// save off initial state at the beginning, and restore it at the end
struct InitializePythonRAII {
public:
InitializePythonRAII()
@@ -210,12 +209,11 @@ bool ScriptInterpreterPython::Locker::Do
LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked",
m_GILState == PyGILState_UNLOCKED ? "un" : "");
- // we need to save the thread state when we first start the command
- // because we might decide to interrupt it while some action is taking
- // place outside of Python (e.g. printing to screen, waiting for the network,
- // ...)
- // in that case, _PyThreadState_Current will be NULL - and we would be unable
- // to set the asynchronous exception - not a desirable situation
+ // we need to save the thread state when we first start the command because
+ // we might decide to interrupt it while some action is taking place outside
+ // of Python (e.g. printing to screen, waiting for the network, ...) in that
+ // case, _PyThreadState_Current will be NULL - and we would be unable to set
+ // the asynchronous exception - not a desirable situation
m_python_interpreter->SetThreadState(PyThreadState_Get());
m_python_interpreter->IncrementLockCount();
return true;
@@ -281,17 +279,16 @@ ScriptInterpreterPython::ScriptInterpret
PyRun_SimpleString(run_string.GetData());
// Reloading modules requires a different syntax in Python 2 and Python 3.
- // This provides
- // a consistent syntax no matter what version of Python.
+ // This provides a consistent syntax no matter what version of Python.
run_string.Clear();
run_string.Printf("run_one_line (%s, 'from six.moves import reload_module')",
m_dictionary_name.c_str());
PyRun_SimpleString(run_string.GetData());
// WARNING: temporary code that loads Cocoa formatters - this should be done
- // on a per-platform basis rather than loading the whole set
- // and letting the individual formatter classes exploit APIs to check whether
- // they can/cannot do their task
+ // on a per-platform basis rather than loading the whole set and letting the
+ // individual formatter classes exploit APIs to check whether they can/cannot
+ // do their task
run_string.Clear();
run_string.Printf(
"run_one_line (%s, 'import lldb.formatters, lldb.formatters.cpp, pydoc')",
@@ -314,13 +311,11 @@ ScriptInterpreterPython::ScriptInterpret
}
ScriptInterpreterPython::~ScriptInterpreterPython() {
- // the session dictionary may hold objects with complex state
- // which means that they may need to be torn down with some level of smarts
- // and that, in turn, requires a valid thread state
- // force Python to procure itself such a thread state, nuke the session
- // dictionary
- // and then release it for others to use and proceed with the rest of the
- // shutdown
+ // the session dictionary may hold objects with complex state which means
+ // that they may need to be torn down with some level of smarts and that, in
+ // turn, requires a valid thread state force Python to procure itself such a
+ // thread state, nuke the session dictionary and then release it for others
+ // to use and proceed with the rest of the shutdown
auto gil_state = PyGILState_Ensure();
m_session_dict.Reset();
PyGILState_Release(gil_state);
@@ -452,16 +447,16 @@ void ScriptInterpreterPython::ResetOutpu
void ScriptInterpreterPython::SaveTerminalState(int fd) {
// Python mucks with the terminal state of STDIN. If we can possibly avoid
// this by setting the file handles up correctly prior to entering the
- // interpreter we should. For now we save and restore the terminal state
- // on the input file handle.
+ // interpreter we should. For now we save and restore the terminal state on
+ // the input file handle.
m_terminal_state.Save(fd, false);
}
void ScriptInterpreterPython::RestoreTerminalState() {
// Python mucks with the terminal state of STDIN. If we can possibly avoid
// this by setting the file handles up correctly prior to entering the
- // interpreter we should. For now we save and restore the terminal state
- // on the input file handle.
+ // interpreter we should. For now we save and restore the terminal state on
+ // the input file handle.
m_terminal_state.Restore();
}
@@ -470,14 +465,11 @@ void ScriptInterpreterPython::LeaveSessi
if (log)
log->PutCString("ScriptInterpreterPython::LeaveSession()");
- // checking that we have a valid thread state - since we use our own threading
- // and locking
- // in some (rare) cases during cleanup Python may end up believing we have no
- // thread state
- // and PyImport_AddModule will crash if that is the case - since that seems to
- // only happen
- // when destroying the SBDebugger, we can make do without clearing up stdout
- // and stderr
+ // checking that we have a valid thread state - since we use our own
+ // threading and locking in some (rare) cases during cleanup Python may end
+ // up believing we have no thread state and PyImport_AddModule will crash if
+ // that is the case - since that seems to only happen when destroying the
+ // SBDebugger, we can make do without clearing up stdout and stderr
// rdar://problem/11292882
// When the current thread state is NULL, PyThreadState_Get() issues a fatal
@@ -526,8 +518,7 @@ bool ScriptInterpreterPython::SetStdHand
bool ScriptInterpreterPython::EnterSession(uint16_t on_entry_flags, FILE *in,
FILE *out, FILE *err) {
// If we have already entered the session, without having officially 'left'
- // it, then there is no need to
- // 'enter' it again.
+ // it, then there is no need to 'enter' it again.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
if (m_session_is_active) {
if (log)
@@ -560,8 +551,8 @@ bool ScriptInterpreterPython::EnterSessi
run_string.PutCString("; lldb.frame = lldb.thread.GetSelectedFrame ()");
run_string.PutCString("')");
} else {
- // If we aren't initing the globals, we should still always set the debugger
- // (since that is always unique.)
+ // If we aren't initing the globals, we should still always set the
+ // debugger (since that is always unique.)
run_string.Printf("run_one_line (%s, 'lldb.debugger_unique_id = %" PRIu64,
m_dictionary_name.c_str(),
GetCommandInterpreter().GetDebugger().GetID());
@@ -702,12 +693,11 @@ bool ScriptInterpreterPython::ExecuteOne
if (command && command[0]) {
// We want to call run_one_line, passing in the dictionary and the command
- // string. We cannot do this through
- // PyRun_SimpleString here because the command string may contain escaped
- // characters, and putting it inside
+ // string. We cannot do this through PyRun_SimpleString here because the
+ // command string may contain escaped characters, and putting it inside
// another string to pass to PyRun_SimpleString messes up the escaping. So
- // we use the following more complicated
- // method to pass the command string directly down to Python.
+ // we use the following more complicated method to pass the command string
+ // directly down to Python.
Debugger &debugger = m_interpreter.GetDebugger();
StreamFileSP input_file_sp;
@@ -773,17 +763,14 @@ bool ScriptInterpreterPython::ExecuteOne
FILE *err_file = error_file_sp->GetFile().GetStream();
bool success = false;
{
- // WARNING! It's imperative that this RAII scope be as tight as possible.
- // In particular, the
- // scope must end *before* we try to join the read thread. The reason for
- // this is that a
- // pre-requisite for joining the read thread is that we close the write
- // handle (to break the
- // pipe and cause it to wake up and exit). But acquiring the GIL as below
- // will redirect Python's
- // stdio to use this same handle. If we close the handle while Python is
- // still using it, bad
- // things will happen.
+ // WARNING! It's imperative that this RAII scope be as tight as
+ // possible. In particular, the scope must end *before* we try to join
+ // the read thread. The reason for this is that a pre-requisite for
+ // joining the read thread is that we close the write handle (to break
+ // the pipe and cause it to wake up and exit). But acquiring the GIL as
+ // below will redirect Python's stdio to use this same handle. If we
+ // close the handle while Python is still using it, bad things will
+ // happen.
Locker locker(
this,
ScriptInterpreterPython::Locker::AcquireLock |
@@ -827,12 +814,12 @@ bool ScriptInterpreterPython::ExecuteOne
}
if (join_read_thread) {
- // Close the write end of the pipe since we are done with our
- // one line script. This should cause the read thread that
- // output_comm is using to exit
+ // Close the write end of the pipe since we are done with our one line
+ // script. This should cause the read thread that output_comm is using to
+ // exit
output_file_sp->GetFile().Close();
- // The close above should cause this thread to exit when it gets
- // to the end of file, so let it get all its data
+ // The close above should cause this thread to exit when it gets to the
+ // end of file, so let it get all its data
output_comm.JoinReadThread();
// Now we can close the read end of the pipe
output_comm.Disconnect();
@@ -889,21 +876,18 @@ public:
ScriptInterpreterPython::Locker::FreeAcquiredLock |
ScriptInterpreterPython::Locker::TearDownSession);
- // The following call drops into the embedded interpreter loop and stays
- // there until the
- // user chooses to exit from the Python interpreter.
- // This embedded interpreter will, as any Python code that performs I/O,
- // unlock the GIL before
- // a system call that can hang, and lock it when the syscall has
- // returned.
+ // The following call drops into the embedded interpreter loop and
+ // stays there until the user chooses to exit from the Python
+ // interpreter. This embedded interpreter will, as any Python code that
+ // performs I/O, unlock the GIL before a system call that can hang, and
+ // lock it when the syscall has returned.
// We need to surround the call to the embedded interpreter with calls
- // to PyGILState_Ensure and
- // PyGILState_Release (using the Locker above). This is because Python
- // has a global lock which must be held whenever we want
- // to touch any Python objects. Otherwise, if the user calls Python
- // code, the interpreter state will be off,
- // and things could hang (it's happened before).
+ // to PyGILState_Ensure and PyGILState_Release (using the Locker
+ // above). This is because Python has a global lock which must be held
+ // whenever we want to touch any Python objects. Otherwise, if the user
+ // calls Python code, the interpreter state will be off, and things
+ // could hang (it's happened before).
StreamString run_string;
run_string.Printf("run_python_interpreter (%s)",
@@ -934,12 +918,10 @@ void ScriptInterpreterPython::ExecuteInt
Debugger &debugger = GetCommandInterpreter().GetDebugger();
// At the moment, the only time the debugger does not have an input file
- // handle is when this is called
- // directly from Python, in which case it is both dangerous and unnecessary
- // (not to mention confusing) to
- // try to embed a running interpreter loop inside the already running Python
- // interpreter loop, so we won't
- // do it.
+ // handle is when this is called directly from Python, in which case it is
+ // both dangerous and unnecessary (not to mention confusing) to try to embed
+ // a running interpreter loop inside the already running Python interpreter
+ // loop, so we won't do it.
if (!debugger.GetInputFile()->GetFile().IsValid())
return;
@@ -1174,10 +1156,8 @@ Status ScriptInterpreterPython::ExecuteM
if (code_object.IsValid()) {
// In Python 2.x, PyEval_EvalCode takes a PyCodeObject, but in Python 3.x, it
-// takes
-// a PyObject. They are convertible (hence the function
-// PyCode_Check(PyObject*), so
-// we have to do the cast for Python 2.x
+// takes a PyObject. They are convertible (hence the function
+// PyCode_Check(PyObject*), so we have to do the cast for Python 2.x
#if PY_MAJOR_VERSION >= 3
PyObject *py_code_obj = code_object.get();
#else
@@ -1243,10 +1223,9 @@ Status ScriptInterpreterPython::SetBreak
auto data_ap = llvm::make_unique<CommandDataPython>();
// Split the command_body_text into lines, and pass that to
- // GenerateBreakpointCommandCallbackData. That will
- // wrap the body in an auto-generated function, and return the function name
- // in script_source. That is what
- // the callback will actually invoke.
+ // GenerateBreakpointCommandCallbackData. That will wrap the body in an
+ // auto-generated function, and return the function name in script_source.
+ // That is what the callback will actually invoke.
data_ap->user_source.SplitIntoLines(command_body_text);
Status error = GenerateBreakpointCommandCallbackData(data_ap->user_source,
@@ -1268,9 +1247,8 @@ void ScriptInterpreterPython::SetWatchpo
// It's necessary to set both user_source and script_source to the oneliner.
// The former is used to generate callback description (as in watchpoint
- // command list)
- // while the latter is used for Python to interpret during the actual
- // callback.
+ // command list) while the latter is used for Python to interpret during the
+ // actual callback.
data_ap->user_source.AppendString(oneliner);
data_ap->script_source.assign(oneliner);
@@ -1365,8 +1343,7 @@ bool ScriptInterpreterPython::GenerateTy
return false;
// Take what the user wrote, wrap it all up inside one big auto-generated
- // Python function, passing in the
- // ValueObject as parameter to the function.
+ // Python function, passing in the ValueObject as parameter to the function.
std::string auto_generated_function_name(
GenerateUniqueName("lldb_autogen_python_type_print_func",
@@ -1430,8 +1407,8 @@ bool ScriptInterpreterPython::GenerateTy
sstr.Printf("class %s:", auto_generated_class_name.c_str());
auto_generated_class.AppendString(sstr.GetString());
- // Wrap everything up inside the class, increasing the indentation.
- // we don't need to play any fancy indentation tricks here because there is no
+ // Wrap everything up inside the class, increasing the indentation. we don't
+ // need to play any fancy indentation tricks here because there is no
// surrounding code whose indentation we need to honor
for (int i = 0; i < num_lines; ++i) {
sstr.Clear();
@@ -1439,9 +1416,8 @@ bool ScriptInterpreterPython::GenerateTy
auto_generated_class.AppendString(sstr.GetString());
}
- // Verify that the results are valid Python.
- // (even though the method is ExportFunctionDefinitionToInterpreter, a class
- // will actually be exported)
+ // Verify that the results are valid Python. (even though the method is
+ // ExportFunctionDefinitionToInterpreter, a class will actually be exported)
// (TODO: rename that method to ExportDefinitionToInterpreter)
if (!ExportFunctionDefinitionToInterpreter(auto_generated_class).Success())
return false;
@@ -1585,8 +1561,8 @@ StructuredData::ArraySP ScriptInterprete
// GetPythonValueFormatString provides a system independent type safe way to
// convert a variable's type into a python value format. Python value formats
-// are defined in terms of builtin C types and could change from system to
-// as the underlying typedef for uint* types, size_t, off_t and other values
+// are defined in terms of builtin C types and could change from system to as
+// the underlying typedef for uint* types, size_t, off_t and other values
// change.
template <typename T> const char *GetPythonValueFormatString(T t);
@@ -2044,8 +2020,7 @@ void ScriptInterpreterPython::Clear() {
ScriptInterpreterPython::Locker::FreeAcquiredLock);
// This may be called as part of Py_Finalize. In that case the modules are
- // destroyed in random
- // order and we can't guarantee that we can access these.
+ // destroyed in random order and we can't guarantee that we can access these.
if (Py_IsInitialized())
PyRun_SimpleString("lldb.debugger = None; lldb.target = None; lldb.process "
"= None; lldb.thread = None; lldb.frame = None");
@@ -2629,9 +2604,8 @@ bool ScriptInterpreterPython::LoadScript
command_stream.Clear();
command_stream.Printf("sys.modules.__contains__('%s')", basename.c_str());
bool does_contain = false;
- // this call will succeed if the module was ever imported in any Debugger in
- // the lifetime of the process
- // in which this LLDB framework is living
+ // this call will succeed if the module was ever imported in any Debugger
+ // in the lifetime of the process in which this LLDB framework is living
bool was_imported_globally =
(ExecuteOneLineWithReturn(
command_stream.GetData(),
@@ -2705,8 +2679,8 @@ bool ScriptInterpreterPython::IsReserved
llvm::StringRef word_sr(word);
- // filter out a few characters that would just confuse us
- // and that are clearly not keyword material anyway
+ // filter out a few characters that would just confuse us and that are
+ // clearly not keyword material anyway
if (word_sr.find_first_of("'\"") != llvm::StringRef::npos)
return false;
@@ -2834,9 +2808,9 @@ bool ScriptInterpreterPython::RunScriptB
return ret_val;
}
-// in Python, a special attribute __doc__ contains the docstring
-// for an object (function, method, class, ...) if any is defined
-// Otherwise, the attribute's value is None
+// in Python, a special attribute __doc__ contains the docstring for an object
+// (function, method, class, ...) if any is defined Otherwise, the attribute's
+// value is None
bool ScriptInterpreterPython::GetDocumentationForItem(const char *item,
std::string &dest) {
dest.clear();
@@ -3106,10 +3080,9 @@ void ScriptInterpreterPython::Initialize
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
// RAII-based initialization which correctly handles multiple-initialization,
- // version-
- // specific differences among Python 2 and Python 3, and saving and restoring
- // various
- // other pieces of state that can get mucked with during initialization.
+ // version- specific differences among Python 2 and Python 3, and saving and
+ // restoring various other pieces of state that can get mucked with during
+ // initialization.
InitializePythonRAII initialize_guard;
if (g_swig_init_callback)
@@ -3123,12 +3096,9 @@ void ScriptInterpreterPython::Initialize
FileSpec file_spec;
// Don't denormalize paths when calling file_spec.GetPath(). On platforms
- // that use
- // a backslash as the path separator, this will result in executing python
- // code containing
- // paths with unescaped backslashes. But Python also accepts forward slashes,
- // so to make
- // life easier we just use that.
+ // that use a backslash as the path separator, this will result in executing
+ // python code containing paths with unescaped backslashes. But Python also
+ // accepts forward slashes, so to make life easier we just use that.
if (HostInfo::GetLLDBPath(ePathTypePythonDir, file_spec))
AddToSysPath(AddLocation::Beginning, file_spec.GetPath(false));
if (HostInfo::GetLLDBPath(ePathTypeLLDBShlibDir, file_spec))
Modified: lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp (original)
+++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp Mon Apr 30 09:49:04 2018
@@ -186,9 +186,9 @@ const char *const s_filter_attributes[]
"subsystem" // subsystem of the log message
// Consider impelmenting this action as it would be cheaper to filter.
- // "message" requires always formatting the message, which is a waste
- // of cycles if it ends up being rejected.
- // "format", // format string used to format message text
+ // "message" requires always formatting the message, which is a waste of
+ // cycles if it ends up being rejected. "format", // format string
+ // used to format message text
};
static const ConstString &GetDarwinLogTypeName() {
@@ -239,11 +239,10 @@ public:
// Indicate whether this is an accept or reject rule.
dict_p->AddBooleanItem("accept", m_accept);
- // Indicate which attribute of the message this filter references.
- // This can drop into the rule-specific DoSerialization if we get
- // to the point where not all FilterRule derived classes work on
- // an attribute. (e.g. logical and/or and other compound
- // operations).
+ // Indicate which attribute of the message this filter references. This can
+ // drop into the rule-specific DoSerialization if we get to the point where
+ // not all FilterRule derived classes work on an attribute. (e.g. logical
+ // and/or and other compound operations).
dict_p->AddStringItem("attribute", s_filter_attributes[m_attribute_index]);
// Indicate the type of the rule.
@@ -404,9 +403,9 @@ static void RegisterFilterOperations() {
// -------------------------------------------------------------------------
static OptionDefinition g_enable_option_table[] = {
- // Source stream include/exclude options (the first-level filter).
- // This one should be made as small as possible as everything that
- // goes through here must be processed by the process monitor.
+ // Source stream include/exclude options (the first-level filter). This one
+ // should be made as small as possible as everything that goes through here
+ // must be processed by the process monitor.
{LLDB_OPT_SET_ALL, false, "any-process", 'a', OptionParser::eNoArgument,
nullptr, nullptr, 0, eArgTypeNone,
"Specifies log messages from other related processes should be "
@@ -420,10 +419,10 @@ static OptionDefinition g_enable_option_
"Specifies info-level log messages should be included."},
{LLDB_OPT_SET_ALL, false, "filter", 'f', OptionParser::eRequiredArgument,
nullptr, nullptr, 0, eArgRawInput,
- // There doesn't appear to be a great way for me to have these
- // multi-line, formatted tables in help. This looks mostly right
- // but there are extra linefeeds added at seemingly random spots,
- // and indentation isn't handled properly on those lines.
+ // There doesn't appear to be a great way for me to have these multi-line,
+ // formatted tables in help. This looks mostly right but there are extra
+ // linefeeds added at seemingly random spots, and indentation isn't
+ // handled properly on those lines.
"Appends a filter rule to the log message filter chain. Multiple "
"rules may be added by specifying this option multiple times, "
"once per filter rule. Filter rules are processed in the order "
@@ -786,12 +785,11 @@ protected:
if (!source_name)
return;
- // Check if we're *not* using strict sources. If not,
- // then the user is going to get debug-level info
- // anyways, probably not what they're expecting.
- // Unfortunately we can only fix this by adding an
- // env var, which would have had to have happened
- // already. Thus, a warning is the best we can do here.
+ // Check if we're *not* using strict sources. If not, then the user is
+ // going to get debug-level info anyways, probably not what they're
+ // expecting. Unfortunately we can only fix this by adding an env var,
+ // which would have had to have happened already. Thus, a warning is the
+ // best we can do here.
StreamString stream;
stream.Printf("darwin-log source settings specify to exclude "
"%s messages, but setting "
@@ -805,24 +803,22 @@ protected:
}
bool DoExecute(Args &command, CommandReturnObject &result) override {
- // First off, set the global sticky state of enable/disable
- // based on this command execution.
+ // First off, set the global sticky state of enable/disable based on this
+ // command execution.
s_is_explicitly_enabled = m_enable;
- // Next, if this is an enable, save off the option data.
- // We will need it later if a process hasn't been launched or
- // attached yet.
+ // Next, if this is an enable, save off the option data. We will need it
+ // later if a process hasn't been launched or attached yet.
if (m_enable) {
- // Save off enabled configuration so we can apply these parsed
- // options the next time an attach or launch occurs.
+ // Save off enabled configuration so we can apply these parsed options
+ // the next time an attach or launch occurs.
DebuggerSP debugger_sp =
GetCommandInterpreter().GetDebugger().shared_from_this();
SetGlobalEnableOptions(debugger_sp, m_options_sp);
}
- // Now check if we have a running process. If so, we should
- // instruct the process monitor to enable/disable DarwinLog support
- // now.
+ // Now check if we have a running process. If so, we should instruct the
+ // process monitor to enable/disable DarwinLog support now.
Target *target = GetSelectedOrDummyTarget();
if (!target) {
// No target, so there is nothing more to do right now.
@@ -833,14 +829,13 @@ protected:
// Grab the active process.
auto process_sp = target->GetProcessSP();
if (!process_sp) {
- // No active process, so there is nothing more to do right
- // now.
+ // No active process, so there is nothing more to do right now.
result.SetStatus(eReturnStatusSuccessFinishNoResult);
return true;
}
- // If the process is no longer alive, we can't do this now.
- // We'll catch it the next time the process is started up.
+ // If the process is no longer alive, we can't do this now. We'll catch it
+ // the next time the process is started up.
if (!process_sp->IsAlive()) {
result.SetStatus(eReturnStatusSuccessFinishNoResult);
return true;
@@ -859,19 +854,17 @@ protected:
*static_cast<StructuredDataDarwinLog *>(plugin_sp.get());
if (m_enable) {
- // Hook up the breakpoint for the process that detects when
- // libtrace has been sufficiently initialized to really start
- // the os_log stream. This is insurance to assure us that
- // logging is really enabled. Requesting that logging be
- // enabled for a process before libtrace is initialized
- // results in a scenario where no errors occur, but no logging
- // is captured, either. This step is to eliminate that
- // possibility.
+ // Hook up the breakpoint for the process that detects when libtrace has
+ // been sufficiently initialized to really start the os_log stream. This
+ // is insurance to assure us that logging is really enabled. Requesting
+ // that logging be enabled for a process before libtrace is initialized
+ // results in a scenario where no errors occur, but no logging is
+ // captured, either. This step is to eliminate that possibility.
plugin.AddInitCompletionHook(*process_sp.get());
}
- // Send configuration to the feature by way of the process.
- // Construct the options we will use.
+ // Send configuration to the feature by way of the process. Construct the
+ // options we will use.
auto config_sp = m_options_sp->BuildConfigurationData(m_enable);
const Status error =
process_sp->ConfigureStructuredData(GetDarwinLogTypeName(), config_sp);
@@ -884,8 +877,8 @@ protected:
plugin.SetEnabled(false);
} else {
result.SetStatus(eReturnStatusSuccessFinishNoResult);
- // Our configuration succeeeded, so we're enabled/disabled
- // per whichever one this command is setup to do.
+ // Our configuration succeeeded, so we're enabled/disabled per whichever
+ // one this command is setup to do.
plugin.SetEnabled(m_enable);
}
return result.Succeeded();
@@ -916,8 +909,8 @@ protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
auto &stream = result.GetOutputStream();
- // Figure out if we've got a process. If so, we can tell if
- // DarwinLog is available for that process.
+ // Figure out if we've got a process. If so, we can tell if DarwinLog is
+ // available for that process.
Target *target = GetSelectedOrDummyTarget();
auto process_sp = target ? target->GetProcessSP() : ProcessSP();
if (!target || !process_sp) {
@@ -1016,13 +1009,12 @@ public:
EnableOptionsSP ParseAutoEnableOptions(Status &error, Debugger &debugger) {
Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS);
- // We are abusing the options data model here so that we can parse
- // options without requiring the Debugger instance.
+ // We are abusing the options data model here so that we can parse options
+ // without requiring the Debugger instance.
- // We have an empty execution context at this point. We only want
- // to parse options, and we don't need any context to do this here.
- // In fact, we want to be able to parse the enable options before having
- // any context.
+ // We have an empty execution context at this point. We only want to parse
+ // options, and we don't need any context to do this here. In fact, we want
+ // to be able to parse the enable options before having any context.
ExecutionContext exe_ctx;
EnableOptionsSP options_sp(new EnableOptions());
@@ -1047,8 +1039,8 @@ EnableOptionsSP ParseAutoEnableOptions(S
options_property_sp->GetAsString()->GetCurrentValue();
Args args(enable_options);
if (args.GetArgumentCount() > 0) {
- // Eliminate the initial '--' that would be required to set the
- // settings that themselves include '-' and/or '--'.
+ // Eliminate the initial '--' that would be required to set the settings
+ // that themselves include '-' and/or '--'.
const char *first_arg = args.GetArgumentAtIndex(0);
if (first_arg && (strcmp(first_arg, "--") == 0))
args.Shift();
@@ -1172,9 +1164,9 @@ void StructuredDataDarwinLog::HandleArri
return;
}
- // Broadcast the structured data event if we have that enabled.
- // This is the way that the outside world (all clients) get access
- // to this data. This plugin sets policy as to whether we do that.
+ // Broadcast the structured data event if we have that enabled. This is the
+ // way that the outside world (all clients) get access to this data. This
+ // plugin sets policy as to whether we do that.
DebuggerSP debugger_sp = process.GetTarget().GetDebugger().shared_from_this();
auto options_sp = GetGlobalEnableOptions(debugger_sp);
if (options_sp && options_sp->GetBroadcastEvents()) {
@@ -1184,8 +1176,8 @@ void StructuredDataDarwinLog::HandleArri
process.BroadcastStructuredData(object_sp, shared_from_this());
}
- // Later, hang on to a configurable amount of these and allow commands
- // to inspect, including showing backtraces.
+ // Later, hang on to a configurable amount of these and allow commands to
+ // inspect, including showing backtraces.
}
static void SetErrorWithJSON(Status &error, const char *message,
@@ -1261,8 +1253,8 @@ Status StructuredDataDarwinLog::GetDescr
return false;
}
- // If we haven't already grabbed the first timestamp
- // value, do that now.
+ // If we haven't already grabbed the first timestamp value, do that
+ // now.
if (!m_recorded_first_timestamp) {
uint64_t timestamp = 0;
if (event->GetValueForKeyAsInteger("timestamp", timestamp)) {
@@ -1300,8 +1292,8 @@ void StructuredDataDarwinLog::ModulesDid
// Check if we should enable the darwin log support on startup/attach.
if (!GetGlobalProperties()->GetEnableOnStartup() &&
!s_is_explicitly_enabled) {
- // We're neither auto-enabled or explicitly enabled, so we shouldn't
- // try to enable here.
+ // We're neither auto-enabled or explicitly enabled, so we shouldn't try to
+ // enable here.
if (log)
log->Printf("StructuredDataDarwinLog::%s not applicable, we're not "
"enabled (process uid %u)",
@@ -1321,9 +1313,9 @@ void StructuredDataDarwinLog::ModulesDid
}
}
- // The logging support module name, specifies the name of
- // the image name that must be loaded into the debugged process before
- // we can try to enable logging.
+ // The logging support module name, specifies the name of the image name that
+ // must be loaded into the debugged process before we can try to enable
+ // logging.
const char *logging_module_cstr =
GetGlobalProperties()->GetLoggingModuleName();
if (!logging_module_cstr || (logging_module_cstr[0] == 0)) {
@@ -1363,8 +1355,8 @@ void StructuredDataDarwinLog::ModulesDid
return;
}
- // Time to enqueue the breakpoint so we can wait for logging support
- // to be initialized before we try to tap the libtrace stream.
+ // Time to enqueue the breakpoint so we can wait for logging support to be
+ // initialized before we try to tap the libtrace stream.
AddInitCompletionHook(process);
if (log)
log->Printf("StructuredDataDarwinLog::%s post-init hook breakpoint "
@@ -1372,13 +1364,13 @@ void StructuredDataDarwinLog::ModulesDid
__FUNCTION__, logging_module_name.AsCString(),
process.GetUniqueID());
- // We need to try the enable here as well, which will succeed
- // in the event that we're attaching to (rather than launching) the
- // process and the process is already past initialization time. In that
- // case, the completion breakpoint will never get hit and therefore won't
- // start that way. It doesn't hurt much beyond a bit of bandwidth
- // if we end up doing this twice. It hurts much more if we don't get
- // the logging enabled when the user expects it.
+ // We need to try the enable here as well, which will succeed in the event
+ // that we're attaching to (rather than launching) the process and the
+ // process is already past initialization time. In that case, the completion
+ // breakpoint will never get hit and therefore won't start that way. It
+ // doesn't hurt much beyond a bit of bandwidth if we end up doing this twice.
+ // It hurts much more if we don't get the logging enabled when the user
+ // expects it.
EnableNow();
}
@@ -1415,8 +1407,7 @@ StructuredDataDarwinLog::StructuredDataD
StructuredDataPluginSP
StructuredDataDarwinLog::CreateInstance(Process &process) {
- // Currently only Apple targets support the os_log/os_activity
- // protocol.
+ // Currently only Apple targets support the os_log/os_activity protocol.
if (process.GetTarget().GetArchitecture().GetTriple().getVendor() ==
llvm::Triple::VendorType::Apple) {
auto process_wp = ProcessWP(process.shared_from_this());
@@ -1463,20 +1454,20 @@ Status StructuredDataDarwinLog::FilterLa
Target *target) {
Status error;
- // If we're not debugging this launched process, there's nothing for us
- // to do here.
+ // If we're not debugging this launched process, there's nothing for us to do
+ // here.
if (!launch_info.GetFlags().AnySet(eLaunchFlagDebug))
return error;
// Darwin os_log() support automatically adds debug-level and info-level
// messages when a debugger is attached to a process. However, with
- // integrated suppport for debugging built into the command-line LLDB,
- // the user may specifically set to *not* include debug-level and info-level
- // content. When the user is using the integrated log support, we want
- // to put the kabosh on that automatic adding of info and debug level.
- // This is done by adding an environment variable to the process on launch.
- // (This also means it is not possible to suppress this behavior if
- // attaching to an already-running app).
+ // integrated suppport for debugging built into the command-line LLDB, the
+ // user may specifically set to *not* include debug-level and info-level
+ // content. When the user is using the integrated log support, we want to
+ // put the kabosh on that automatic adding of info and debug level. This is
+ // done by adding an environment variable to the process on launch. (This
+ // also means it is not possible to suppress this behavior if attaching to an
+ // already-running app).
// Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
// If the target architecture is not one that supports DarwinLog, we have
@@ -1487,20 +1478,19 @@ Status StructuredDataDarwinLog::FilterLa
return error;
}
- // If DarwinLog is not enabled (either by explicit user command or via
- // the auto-enable option), then we have nothing to do.
+ // If DarwinLog is not enabled (either by explicit user command or via the
+ // auto-enable option), then we have nothing to do.
if (!GetGlobalProperties()->GetEnableOnStartup() &&
!s_is_explicitly_enabled) {
// Nothing to do, DarwinLog is not enabled.
return error;
}
- // If we don't have parsed configuration info, that implies we have
- // enable-on-startup set up, but we haven't yet attempted to run the
- // enable command.
+ // If we don't have parsed configuration info, that implies we have enable-
+ // on-startup set up, but we haven't yet attempted to run the enable command.
if (!target) {
- // We really can't do this without a target. We need to be able
- // to get to the debugger to get the proper options to do this right.
+ // We really can't do this without a target. We need to be able to get to
+ // the debugger to get the proper options to do this right.
// TODO log.
error.SetErrorString("requires a target to auto-enable DarwinLog.");
return error;
@@ -1513,28 +1503,28 @@ Status StructuredDataDarwinLog::FilterLa
if (!options_sp || !error.Success())
return error;
- // We already parsed the options, save them now so we don't generate
- // them again until the user runs the command manually.
+ // We already parsed the options, save them now so we don't generate them
+ // again until the user runs the command manually.
SetGlobalEnableOptions(debugger_sp, options_sp);
}
if (!options_sp->GetEchoToStdErr()) {
- // The user doesn't want to see os_log/NSLog messages echo to stderr.
- // That mechanism is entirely separate from the DarwinLog support.
- // By default we don't want to get it via stderr, because that would
- // be in duplicate of the explicit log support here.
+ // The user doesn't want to see os_log/NSLog messages echo to stderr. That
+ // mechanism is entirely separate from the DarwinLog support. By default we
+ // don't want to get it via stderr, because that would be in duplicate of
+ // the explicit log support here.
// Here we need to strip out any OS_ACTIVITY_DT_MODE setting to prevent
// echoing of os_log()/NSLog() to stderr in the target program.
launch_info.GetEnvironment().erase("OS_ACTIVITY_DT_MODE");
- // We will also set the env var that tells any downstream launcher
- // from adding OS_ACTIVITY_DT_MODE.
+ // We will also set the env var that tells any downstream launcher from
+ // adding OS_ACTIVITY_DT_MODE.
launch_info.GetEnvironment()["IDE_DISABLED_OS_ACTIVITY_DT_MODE"] = "1";
}
- // Set the OS_ACTIVITY_MODE env var appropriately to enable/disable
- // debug and info level messages.
+ // Set the OS_ACTIVITY_MODE env var appropriately to enable/disable debug and
+ // info level messages.
const char *env_var_value;
if (options_sp->GetIncludeDebugLevel())
env_var_value = "debug";
@@ -1553,8 +1543,8 @@ bool StructuredDataDarwinLog::InitComple
lldb::user_id_t break_loc_id) {
// We hit the init function. We now want to enqueue our new thread plan,
// which will in turn enqueue a StepOut thread plan. When the StepOut
- // finishes and control returns to our new thread plan, that is the time
- // when we can execute our logic to enable the logging support.
+ // finishes and control returns to our new thread plan, that is the time when
+ // we can execute our logic to enable the logging support.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
if (log)
@@ -1613,8 +1603,8 @@ bool StructuredDataDarwinLog::InitComple
process_uid);
return;
}
- // Make sure we only call it once, just in case the
- // thread plan hits the breakpoint twice.
+ // Make sure we only call it once, just in case the thread plan hits
+ // the breakpoint twice.
if (!called_enable_method) {
if (log)
log->Printf("StructuredDataDarwinLog::post-init callback: "
@@ -1624,8 +1614,8 @@ bool StructuredDataDarwinLog::InitComple
->EnableNow();
called_enable_method = true;
} else {
- // Our breakpoint was hit more than once. Unexpected but
- // no harm done. Log it.
+ // Our breakpoint was hit more than once. Unexpected but no harm
+ // done. Log it.
if (log)
log->Printf("StructuredDataDarwinLog::post-init callback: "
"skipping EnableNow(), already called by "
@@ -1682,8 +1672,8 @@ void StructuredDataDarwinLog::AddInitCom
m_added_breakpoint = true;
}
- // Set a breakpoint for the process that will kick in when libtrace
- // has finished its initialization.
+ // Set a breakpoint for the process that will kick in when libtrace has
+ // finished its initialization.
Target &target = process.GetTarget();
// Build up the module list.
@@ -1788,8 +1778,8 @@ StructuredDataDarwinLog::DumpHeader(Stre
if (header_count > 0)
stream.PutChar(',');
- // Display the activity chain, from parent-most to child-most
- // activity, separated by a colon (:).
+ // Display the activity chain, from parent-most to child-most activity,
+ // separated by a colon (:).
stream.PutCString("activity-chain=");
stream.PutCString(activity_chain);
++header_count;
@@ -1831,8 +1821,8 @@ size_t StructuredDataDarwinLog::HandleDi
// Check the type of the event.
ConstString event_type;
if (!event.GetValueForKeyAsString("type", event_type)) {
- // Hmm, we expected to get events that describe
- // what they are. Continue anyway.
+ // Hmm, we expected to get events that describe what they are. Continue
+ // anyway.
return 0;
}
@@ -1880,10 +1870,10 @@ void StructuredDataDarwinLog::EnableNow(
log->Printf("StructuredDataDarwinLog::%s() call is for process uid %u",
__FUNCTION__, process_sp->GetUniqueID());
- // If we have configuration data, we can directly enable it now.
- // Otherwise, we need to run through the command interpreter to parse
- // the auto-run options (which is the only way we get here without having
- // already-parsed configuration data).
+ // If we have configuration data, we can directly enable it now. Otherwise,
+ // we need to run through the command interpreter to parse the auto-run
+ // options (which is the only way we get here without having already-parsed
+ // configuration data).
DebuggerSP debugger_sp =
process_sp->GetTarget().GetDebugger().shared_from_this();
if (!debugger_sp) {
@@ -1896,8 +1886,8 @@ void StructuredDataDarwinLog::EnableNow(
auto options_sp = GetGlobalEnableOptions(debugger_sp);
if (!options_sp) {
- // We haven't run the enable command yet. Just do that now, it'll
- // take care of the rest.
+ // We haven't run the enable command yet. Just do that now, it'll take
+ // care of the rest.
auto &interpreter = debugger_sp->GetCommandInterpreter();
const bool success = RunEnableCommand(interpreter);
if (log) {
@@ -1920,8 +1910,8 @@ void StructuredDataDarwinLog::EnableNow(
return;
}
- // We've previously been enabled. We will re-enable now with the
- // previously specified options.
+ // We've previously been enabled. We will re-enable now with the previously
+ // specified options.
auto config_sp = options_sp->BuildConfigurationData(true);
if (!config_sp) {
if (log)
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Mon Apr 30 09:49:04 2018
@@ -106,9 +106,9 @@ struct BitfieldInfo {
bool NextBitfieldOffsetIsValid(const uint64_t next_bit_offset) const {
if (IsValid()) {
- // This bitfield info is valid, so any subsequent bitfields
- // must not overlap and must be at a higher bit offset than
- // any previous bitfield + size.
+ // This bitfield info is valid, so any subsequent bitfields must not
+ // overlap and must be at a higher bit offset than any previous bitfield
+ // + size.
return (bit_size + bit_offset) <= next_bit_offset;
} else {
// If the this BitfieldInfo is not valid, then any offset isOK
@@ -152,8 +152,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
if (!isClangModuleFwdDecl(die))
return TypeSP();
- // Since this this type is defined in one of the Clang modules
- // imported by this symbol file, search all of them.
+ // Since this this type is defined in one of the Clang modules imported by
+ // this symbol file, search all of them.
auto *SymFile = die.GetCU()->GetSymbolFileDWARF();
for (const auto &NameModule : SymFile->getExternalTypeModules()) {
if (!NameModule.second)
@@ -168,9 +168,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
if (num_dwo_types != 1)
return TypeSP();
- // We found a real definition for this type in the Clang module, so
- // lets use it and cache the fact that we found a complete type for
- // this die.
+ // We found a real definition for this type in the Clang module, so lets use
+ // it and cache the fact that we found a complete type for this die.
TypeSP dwo_type_sp = dwo_types.GetTypeAtIndex(0);
if (!dwo_type_sp)
return TypeSP();
@@ -211,8 +210,7 @@ static void CompleteExternalTagDeclType(
if (!tag_decl_ctx)
return;
- // If this type was not imported from an external AST, there's
- // nothing to do.
+ // If this type was not imported from an external AST, there's nothing to do.
CompilerType type = ClangASTContext::GetTypeForDecl(tag_decl_ctx);
if (!type || !ast_importer.CanImport(type))
return;
@@ -223,8 +221,8 @@ static void CompleteExternalTagDeclType(
"Unable to complete the Decl context for DIE '%s' at offset "
"0x%8.8x.\nPlease file a bug report.",
type_name_cstr ? type_name_cstr : "", die.GetOffset());
- // We need to make the type look complete otherwise, we
- // might crash in Clang when adding children.
+ // We need to make the type look complete otherwise, we might crash in
+ // Clang when adding children.
if (ClangASTContext::StartTagDeclarationDefinition(type))
ClangASTContext::CompleteTagDeclarationDefinition(type);
}
@@ -312,8 +310,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
type_name_cstr = form_value.AsCString();
// Work around a bug in llvm-gcc where they give a name to a
- // reference type which doesn't
- // include the "&"...
+ // reference type which doesn't include the "&"...
if (tag == DW_TAG_reference_type) {
if (strchr(type_name_cstr, '&') == NULL)
type_name_cstr = NULL;
@@ -339,32 +336,32 @@ TypeSP DWARFASTParserClang::ParseTypeFro
}
if (tag == DW_TAG_typedef && encoding_uid.IsValid()) {
- // Try to parse a typedef from the DWO file first as modules
- // can contain typedef'ed structures that have no names like:
+ // Try to parse a typedef from the DWO file first as modules can
+ // contain typedef'ed structures that have no names like:
//
// typedef struct { int a; } Foo;
//
- // In this case we will have a structure with no name and a
- // typedef named "Foo" that points to this unnamed structure.
- // The name in the typedef is the only identifier for the struct,
- // so always try to get typedefs from DWO files if possible.
+ // In this case we will have a structure with no name and a typedef
+ // named "Foo" that points to this unnamed structure. The name in the
+ // typedef is the only identifier for the struct, so always try to
+ // get typedefs from DWO files if possible.
//
- // The type_sp returned will be empty if the typedef doesn't exist
- // in a DWO file, so it is cheap to call this function just to check.
+ // The type_sp returned will be empty if the typedef doesn't exist in
+ // a DWO file, so it is cheap to call this function just to check.
//
- // If we don't do this we end up creating a TypeSP that says this
- // is a typedef to type 0x123 (the DW_AT_type value would be 0x123
- // in the DW_TAG_typedef), and this is the unnamed structure type.
- // We will have a hard time tracking down an unnammed structure
- // type in the module DWO file, so we make sure we don't get into
- // this situation by always resolving typedefs from the DWO file.
+ // If we don't do this we end up creating a TypeSP that says this is
+ // a typedef to type 0x123 (the DW_AT_type value would be 0x123 in
+ // the DW_TAG_typedef), and this is the unnamed structure type. We
+ // will have a hard time tracking down an unnammed structure type in
+ // the module DWO file, so we make sure we don't get into this
+ // situation by always resolving typedefs from the DWO file.
const DWARFDIE encoding_die = dwarf->GetDIE(DIERef(encoding_uid));
- // First make sure that the die that this is typedef'ed to _is_
- // just a declaration (DW_AT_declaration == 1), not a full definition
+ // First make sure that the die that this is typedef'ed to _is_ just
+ // a declaration (DW_AT_declaration == 1), not a full definition
// since template types can't be represented in modules since only
- // concrete instances of templates are ever emitted and modules
- // won't contain those
+ // concrete instances of templates are ever emitted and modules won't
+ // contain those
if (encoding_die &&
encoding_die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0) ==
1) {
@@ -563,10 +560,9 @@ TypeSP DWARFASTParserClang::ParseTypeFro
case DW_AT_decl_file:
if (die.GetCU()->DW_AT_decl_file_attributes_are_invalid()) {
// llvm-gcc outputs invalid DW_AT_decl_file attributes that
- // always
- // point to the compile unit file, so we clear this invalid
- // value
- // so that we can still unique types efficiently.
+ // always point to the compile unit file, so we clear this
+ // invalid value so that we can still unique types
+ // efficiently.
decl.SetFile(FileSpec("<invalid>", false));
} else
decl.SetFile(
@@ -625,10 +621,10 @@ TypeSP DWARFASTParserClang::ParseTypeFro
}
}
- // UniqueDWARFASTType is large, so don't create a local variables on the
- // stack, put it on the heap. This function is often called recursively
- // and clang isn't good and sharing the stack space for variables in
- // different blocks.
+ // UniqueDWARFASTType is large, so don't create a local variables on
+ // the stack, put it on the heap. This function is often called
+ // recursively and clang isn't good and sharing the stack space for
+ // variables in different blocks.
std::unique_ptr<UniqueDWARFASTType> unique_ast_entry_ap(
new UniqueDWARFASTType());
@@ -639,10 +635,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
LanguageType die_language = die.GetLanguage();
if (Language::LanguageIsCPlusPlus(die_language)) {
// For C++, we rely solely upon the one definition rule that says
- // only
- // one thing can exist at a given decl context. We ignore the file
- // and
- // line that things are declared on.
+ // only one thing can exist at a given decl context. We ignore the
+ // file and line that things are declared on.
std::string qualified_name;
if (die.GetQualifiedName(qualified_name))
unique_typename = ConstString(qualified_name);
@@ -679,17 +673,16 @@ TypeSP DWARFASTParserClang::ParseTypeFro
if (byte_size_valid && byte_size == 0 && type_name_cstr &&
die.HasChildren() == false &&
sc.comp_unit->GetLanguage() == eLanguageTypeObjC) {
- // Work around an issue with clang at the moment where
- // forward declarations for objective C classes are emitted
- // as:
+ // Work around an issue with clang at the moment where forward
+ // declarations for objective C classes are emitted as:
// DW_TAG_structure_type [2]
// DW_AT_name( "ForwardObjcClass" )
// DW_AT_byte_size( 0x00 )
// DW_AT_decl_file( "..." )
// DW_AT_decl_line( 1 )
//
- // Note that there is no DW_AT_declaration and there are
- // no children, and the byte size is zero.
+ // Note that there is no DW_AT_declaration and there are no children,
+ // and the byte size is zero.
is_forward_declaration = true;
}
@@ -697,11 +690,11 @@ TypeSP DWARFASTParserClang::ParseTypeFro
class_language == eLanguageTypeObjC_plus_plus) {
if (!is_complete_objc_class &&
die.Supports_DW_AT_APPLE_objc_complete_type()) {
- // We have a valid eSymbolTypeObjCClass class symbol whose
- // name matches the current objective C class that we
- // are trying to find and this DIE isn't the complete
- // definition (we checked is_complete_objc_class above and
- // know it is false), so the real definition is in here somewhere
+ // We have a valid eSymbolTypeObjCClass class symbol whose name
+ // matches the current objective C class that we are trying to find
+ // and this DIE isn't the complete definition (we checked
+ // is_complete_objc_class above and know it is false), so the real
+ // definition is in here somewhere
type_sp = dwarf->FindCompleteObjCDefinitionTypeForDIE(
die, type_name_const_str, true);
@@ -709,9 +702,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
SymbolFileDWARFDebugMap *debug_map_symfile =
dwarf->GetDebugMapSymfile();
if (debug_map_symfile) {
- // We weren't able to find a full declaration in
- // this DWARF, see if we have a declaration anywhere
- // else...
+ // We weren't able to find a full declaration in this DWARF,
+ // see if we have a declaration anywhere else...
type_sp =
debug_map_symfile->FindCompleteObjCDefinitionTypeForDIE(
die, type_name_const_str, true);
@@ -728,9 +720,9 @@ TypeSP DWARFASTParserClang::ParseTypeFro
type_sp->GetID());
}
- // We found a real definition for this type elsewhere
- // so lets use it and cache the fact that we found
- // a complete type for this die
+ // We found a real definition for this type elsewhere so lets use
+ // it and cache the fact that we found a complete type for this
+ // die
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
return type_sp;
}
@@ -738,11 +730,11 @@ TypeSP DWARFASTParserClang::ParseTypeFro
}
if (is_forward_declaration) {
- // We have a forward declaration to a type and we need
- // to try and find a full declaration. We look in the
- // current type index just in case we have a forward
- // declaration followed by an actual declarations in the
- // DWARF. If this fails, we need to look elsewhere...
+ // We have a forward declaration to a type and we need to try and
+ // find a full declaration. We look in the current type index just in
+ // case we have a forward declaration followed by an actual
+ // declarations in the DWARF. If this fails, we need to look
+ // elsewhere...
if (log) {
dwarf->GetObjectFile()->GetModule()->LogMessage(
log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a "
@@ -768,9 +760,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
SymbolFileDWARFDebugMap *debug_map_symfile =
dwarf->GetDebugMapSymfile();
if (debug_map_symfile) {
- // We weren't able to find a full declaration in
- // this DWARF, see if we have a declaration anywhere
- // else...
+ // We weren't able to find a full declaration in this DWARF, see
+ // if we have a declaration anywhere else...
type_sp =
debug_map_symfile->FindDefinitionTypeForDWARFDeclContext(
die_decl_ctx);
@@ -786,9 +777,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
DW_TAG_value_to_name(tag), type_name_cstr, type_sp->GetID());
}
- // We found a real definition for this type elsewhere
- // so lets use it and cache the fact that we found
- // a complete type for this die
+ // We found a real definition for this type elsewhere so lets use
+ // it and cache the fact that we found a complete type for this die
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
clang::DeclContext *defn_decl_ctx = GetCachedClangDeclContextForDIE(
dwarf->DebugInfo()->GetDIE(DIERef(type_sp->GetID(), dwarf)));
@@ -805,18 +795,17 @@ TypeSP DWARFASTParserClang::ParseTypeFro
clang::DeclContext *decl_ctx =
GetClangDeclContextContainingDIE(die, nullptr);
- // If your decl context is a record that was imported from
- // another AST context (in the gmodules case), we need to
- // make sure the type backing the Decl is complete before
- // adding children to it. This is not an issue in the
- // non-gmodules case because the debug info will always contain
- // a full definition of parent types in that case.
+ // If your decl context is a record that was imported from another
+ // AST context (in the gmodules case), we need to make sure the type
+ // backing the Decl is complete before adding children to it. This is
+ // not an issue in the non-gmodules case because the debug info will
+ // always contain a full definition of parent types in that case.
CompleteExternalTagDeclType(GetClangASTImporter(), decl_ctx, die,
type_name_cstr);
if (accessibility == eAccessNone && decl_ctx) {
- // Check the decl context that contains this class/struct/union.
- // If it is a class we must give it an accessibility.
+ // Check the decl context that contains this class/struct/union. If
+ // it is a class we must give it an accessibility.
const clang::Decl::Kind containing_decl_kind =
decl_ctx->getDeclKind();
if (DeclKindIsCXXClass(containing_decl_kind))
@@ -868,8 +857,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
}
// Store a forward declaration to this class type in case any
- // parameters in any class methods need it for the clang
- // types for function prototypes.
+ // parameters in any class methods need it for the clang types for
+ // function prototypes.
LinkDeclContextToDIE(m_ast.GetDeclContextForType(clang_type), die);
type_sp.reset(new Type(die.GetID(), dwarf, type_name_const_str,
byte_size, NULL, LLDB_INVALID_UID,
@@ -878,9 +867,9 @@ TypeSP DWARFASTParserClang::ParseTypeFro
type_sp->SetIsCompleteObjCClass(is_complete_objc_class);
- // Add our type to the unique type map so we don't
- // end up creating many copies of the same type over
- // and over in the ASTContext for our module
+ // Add our type to the unique type map so we don't end up creating many
+ // copies of the same type over and over in the ASTContext for our
+ // module
unique_ast_entry_ap->m_type_sp = type_sp;
unique_ast_entry_ap->m_die = die;
unique_ast_entry_ap->m_declaration = unique_decl;
@@ -892,8 +881,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
// Check to see if the DIE actually has a definition, some version of
// GCC will
// emit DIEs with DW_AT_declaration set to true, but yet still have
- // subprogram,
- // members, or inheritance, so we can't trust it
+ // subprogram, members, or inheritance, so we can't trust it
DWARFDIE child_die = die.GetFirstChild();
while (child_die) {
switch (child_die.Tag()) {
@@ -917,10 +905,10 @@ TypeSP DWARFASTParserClang::ParseTypeFro
}
if (!is_forward_declaration) {
- // Always start the definition for a class type so that
- // if the class has child classes or types that require
- // the class to be created for use as their decl contexts
- // the class will be ready to accept these child definitions.
+ // Always start the definition for a class type so that if the class
+ // has child classes or types that require the class to be created
+ // for use as their decl contexts the class will be ready to accept
+ // these child definitions.
if (die.HasChildren() == false) {
// No children for this struct/union/class, lets finish it
if (ClangASTContext::StartTagDeclarationDefinition(clang_type)) {
@@ -944,33 +932,30 @@ TypeSP DWARFASTParserClang::ParseTypeFro
}
}
} else if (clang_type_was_created) {
- // Start the definition if the class is not objective C since
- // the underlying decls respond to isCompleteDefinition(). Objective
+ // Start the definition if the class is not objective C since the
+ // underlying decls respond to isCompleteDefinition(). Objective
// C decls don't respond to isCompleteDefinition() so we can't
// start the declaration definition right away. For C++
- // class/union/structs
- // we want to start the definition in case the class is needed as
- // the
- // declaration context for a contained class or type without the
- // need
- // to complete that type..
+ // class/union/structs we want to start the definition in case the
+ // class is needed as the declaration context for a contained class
+ // or type without the need to complete that type..
if (class_language != eLanguageTypeObjC &&
class_language != eLanguageTypeObjC_plus_plus)
ClangASTContext::StartTagDeclarationDefinition(clang_type);
- // Leave this as a forward declaration until we need
- // to know the details of the type. lldb_private::Type
- // will automatically call the SymbolFile virtual function
- // "SymbolFileDWARF::CompleteType(Type *)"
- // When the definition needs to be defined.
+ // Leave this as a forward declaration until we need to know the
+ // details of the type. lldb_private::Type will automatically call
+ // the SymbolFile virtual function
+ // "SymbolFileDWARF::CompleteType(Type *)" When the definition
+ // needs to be defined.
assert(!dwarf->GetForwardDeclClangTypeToDie().count(
ClangUtil::RemoveFastQualifiers(clang_type)
.GetOpaqueQualType()) &&
"Type already in the forward declaration map!");
- // Can't assume m_ast.GetSymbolFile() is actually a SymbolFileDWARF,
- // it can be a
- // SymbolFileDWARFDebugMap for Apple binaries.
+ // Can't assume m_ast.GetSymbolFile() is actually a
+ // SymbolFileDWARF, it can be a SymbolFileDWARFDebugMap for Apple
+ // binaries.
dwarf->GetForwardDeclDieToClangType()[die.GetDIE()] =
clang_type.GetOpaqueQualType();
dwarf->GetForwardDeclClangTypeToDie()
@@ -980,11 +965,10 @@ TypeSP DWARFASTParserClang::ParseTypeFro
}
}
- // If we made a clang type, set the trivial abi if applicable:
- // We only do this for pass by value - which implies the Trivial ABI.
- // There isn't a way to assert that something that would normally be
- // pass by value is pass by reference, so we ignore that attribute if
- // set.
+ // If we made a clang type, set the trivial abi if applicable: We only
+ // do this for pass by value - which implies the Trivial ABI. There
+ // isn't a way to assert that something that would normally be pass by
+ // value is pass by reference, so we ignore that attribute if set.
if (calling_convention == llvm::dwarf::DW_CC_pass_by_value) {
clang::CXXRecordDecl *record_decl =
m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType());
@@ -1070,9 +1054,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
SymbolFileDWARFDebugMap *debug_map_symfile =
dwarf->GetDebugMapSymfile();
if (debug_map_symfile) {
- // We weren't able to find a full declaration in
- // this DWARF, see if we have a declaration anywhere
- // else...
+ // We weren't able to find a full declaration in this DWARF,
+ // see if we have a declaration anywhere else...
type_sp =
debug_map_symfile->FindDefinitionTypeForDWARFDeclContext(
die_decl_ctx);
@@ -1089,9 +1072,9 @@ TypeSP DWARFASTParserClang::ParseTypeFro
type_sp->GetID());
}
- // We found a real definition for this type elsewhere
- // so lets use it and cache the fact that we found
- // a complete type for this die
+ // We found a real definition for this type elsewhere so lets use
+ // it and cache the fact that we found a complete type for this
+ // die
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
clang::DeclContext *defn_decl_ctx =
GetCachedClangDeclContextForDIE(dwarf->DebugInfo()->GetDIE(
@@ -1317,8 +1300,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
bool is_cxx_method = DeclKindIsCXXClass(containing_decl_kind);
// Start off static. This will be set to false in
- // ParseChildParameters(...)
- // if we find a "this" parameters as the first parameter
+ // ParseChildParameters(...) if we find a "this" parameters as the
+ // first parameter
if (is_cxx_method) {
is_static = true;
}
@@ -1333,25 +1316,22 @@ TypeSP DWARFASTParserClang::ParseTypeFro
bool ignore_containing_context = false;
// Check for templatized class member functions. If we had any
- // DW_TAG_template_type_parameter
- // or DW_TAG_template_value_parameter the DW_TAG_subprogram DIE, then we
- // can't let this become
- // a method in a class. Why? Because templatized functions are only
- // emitted if one of the
- // templatized methods is used in the current compile unit and we will
- // end up with classes
- // that may or may not include these member functions and this means one
- // class won't match another
- // class definition and it affects our ability to use a class in the
- // clang expression parser. So
- // for the greater good, we currently must not allow any template member
- // functions in a class definition.
+ // DW_TAG_template_type_parameter or DW_TAG_template_value_parameter
+ // the DW_TAG_subprogram DIE, then we can't let this become a method in
+ // a class. Why? Because templatized functions are only emitted if one
+ // of the templatized methods is used in the current compile unit and
+ // we will end up with classes that may or may not include these member
+ // functions and this means one class won't match another class
+ // definition and it affects our ability to use a class in the clang
+ // expression parser. So for the greater good, we currently must not
+ // allow any template member functions in a class definition.
if (is_cxx_method && has_template_params) {
ignore_containing_context = true;
is_cxx_method = false;
}
- // clang_type will get the function prototype clang type after this call
+ // clang_type will get the function prototype clang type after this
+ // call
clang_type = m_ast.CreateFunctionType(
return_clang_type, function_param_types.data(),
function_param_types.size(), is_variadic, type_quals);
@@ -1379,8 +1359,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
if (class_opaque_type) {
// If accessibility isn't set to anything valid, assume public
- // for
- // now...
+ // for now...
if (accessibility == eAccessNone)
accessibility = eAccessPublic;
@@ -1402,9 +1381,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
}
}
} else if (is_cxx_method) {
- // Look at the parent of this DIE and see if is is
- // a class or struct and see if this is actually a
- // C++ method
+ // Look at the parent of this DIE and see if is is a class or
+ // struct and see if this is actually a C++ method
Type *class_type = dwarf->ResolveType(decl_ctx_die);
if (class_type) {
bool alternate_defn = false;
@@ -1413,10 +1391,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
alternate_defn = true;
// We uniqued the parent class of this function to another
- // class
- // so we now need to associate all dies under "decl_ctx_die"
- // to
- // DIEs in the DIE for "class_type"...
+ // class so we now need to associate all dies under
+ // "decl_ctx_die" to DIEs in the DIE for "class_type"...
SymbolFileDWARF *class_symfile = NULL;
DWARFDIE class_type_die;
@@ -1442,10 +1418,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
// FIXME do something with these failures that's smarter
// than
// just dropping them on the ground. Unfortunately classes
- // don't
- // like having stuff added to them after their definitions
- // are
- // complete...
+ // don't like having stuff added to them after their
+ // definitions are complete...
type_ptr = dwarf->GetDIEToType()[die.GetDIE()];
if (type_ptr && type_ptr != DIE_IS_BEING_PARSED) {
@@ -1457,16 +1431,13 @@ TypeSP DWARFASTParserClang::ParseTypeFro
if (specification_die_form.IsValid()) {
// We have a specification which we are going to base our
- // function
- // prototype off of, so we need this type to be completed so
- // that the
- // m_die_to_decl_ctx for the method in the specification has a
- // valid
- // clang decl context.
+ // function prototype off of, so we need this type to be
+ // completed so that the m_die_to_decl_ctx for the method in
+ // the specification has a valid clang decl context.
class_type->GetForwardCompilerType();
// If we have a specification, then the function type should
- // have been
- // made with the specification and not with this die.
+ // have been made with the specification and not with this
+ // die.
DWARFDIE spec_die = dwarf->DebugInfo()->GetDIE(
DIERef(specification_die_form));
clang::DeclContext *spec_clang_decl_ctx =
@@ -1482,12 +1453,9 @@ TypeSP DWARFASTParserClang::ParseTypeFro
type_handled = true;
} else if (abstract_origin_die_form.IsValid()) {
// We have a specification which we are going to base our
- // function
- // prototype off of, so we need this type to be completed so
- // that the
- // m_die_to_decl_ctx for the method in the abstract origin has
- // a valid
- // clang decl context.
+ // function prototype off of, so we need this type to be
+ // completed so that the m_die_to_decl_ctx for the method in
+ // the abstract origin has a valid clang decl context.
class_type->GetForwardCompilerType();
DWARFDIE abs_die = dwarf->DebugInfo()->GetDIE(
@@ -1510,17 +1478,16 @@ TypeSP DWARFASTParserClang::ParseTypeFro
if (class_opaque_type.IsBeingDefined() || alternate_defn) {
if (!is_static && !die.HasChildren()) {
// We have a C++ member function with no children (this
- // pointer!)
- // and clang will get mad if we try and make a function
- // that isn't
- // well formed in the DWARF, so we will just skip it...
+ // pointer!) and clang will get mad if we try and make
+ // a function that isn't well formed in the DWARF, so
+ // we will just skip it...
type_handled = true;
} else {
bool add_method = true;
if (alternate_defn) {
// If an alternate definition for the class exists,
- // then add the method only if an
- // equivalent is not already present.
+ // then add the method only if an equivalent is not
+ // already present.
clang::CXXRecordDecl *record_decl =
m_ast.GetAsCXXRecordDecl(
class_opaque_type.GetOpaqueQualType());
@@ -1560,9 +1527,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
const bool is_attr_used = false;
// Neither GCC 4.2 nor clang++ currently set a valid
- // accessibility
- // in the DWARF for C++ methods... Default to public
- // for now...
+ // accessibility in the DWARF for C++ methods...
+ // Default to public for now...
if (accessibility == eAccessNone)
accessibility = eAccessPublic;
@@ -1603,25 +1569,21 @@ TypeSP DWARFASTParserClang::ParseTypeFro
}
} else {
// We were asked to parse the type for a method in a
- // class, yet the
- // class hasn't been asked to complete itself through the
- // clang::ExternalASTSource protocol, so we need to just
- // have the
- // class complete itself and do things the right way, then
- // our
+ // class, yet the class hasn't been asked to complete
+ // itself through the clang::ExternalASTSource protocol,
+ // so we need to just have the class complete itself and
+ // do things the right way, then our
// DIE should then have an entry in the
// dwarf->GetDIEToType() map. First
// we need to modify the dwarf->GetDIEToType() so it
- // doesn't think we are
- // trying to parse this DIE anymore...
+ // doesn't think we are trying to parse this DIE
+ // anymore...
dwarf->GetDIEToType()[die.GetDIE()] = NULL;
// Now we get the full type to force our class type to
- // complete itself
- // using the clang::ExternalASTSource protocol which will
- // parse all
- // base classes and all methods (including the method for
- // this DIE).
+ // complete itself using the clang::ExternalASTSource
+ // protocol which will parse all base classes and all
+ // methods (including the method for this DIE).
class_type->GetFullCompilerType();
// The type for this DIE should have been filled in the
@@ -1635,8 +1597,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
// FIXME This is fixing some even uglier behavior but we
// really need to
// uniq the methods of each class as well as the class
- // itself.
- // <rdar://problem/11240464>
+ // itself. <rdar://problem/11240464>
type_handled = true;
}
}
@@ -1821,11 +1782,10 @@ TypeSP DWARFASTParserClang::ParseTypeFro
}
// We have no choice other than to pretend that the element class
- // type
- // is complete. If we don't do this, clang will crash when trying
- // to layout the class. Since we provide layout assistance, all
- // ivars in this class and other classes will be fine, this is
- // the best we can do short of crashing.
+ // type is complete. If we don't do this, clang will crash when
+ // trying to layout the class. Since we provide layout
+ // assistance, all ivars in this class and other classes will be
+ // fine, this is the best we can do short of crashing.
if (ClangASTContext::StartTagDeclarationDefinition(
array_element_type)) {
ClangASTContext::CompleteTagDeclarationDefinition(
@@ -2148,9 +2108,9 @@ bool DWARFASTParserClang::ParseTemplateP
return template_param_infos.args.size() == template_param_infos.names.size();
}
-// Checks whether m1 is an overload of m2 (as opposed to an override).
-// This is called by addOverridesForMethod to distinguish overrides (which share
-// a vtable entry) from overloads (which require distinct entries).
+// Checks whether m1 is an overload of m2 (as opposed to an override). This is
+// called by addOverridesForMethod to distinguish overrides (which share a
+// vtable entry) from overloads (which require distinct entries).
static bool isOverload(clang::CXXMethodDecl *m1, clang::CXXMethodDecl *m2) {
// FIXME: This should detect covariant return types, but currently doesn't.
lldbassert(&m1->getASTContext() == &m2->getASTContext() &&
@@ -2179,8 +2139,8 @@ static bool isOverload(clang::CXXMethodD
}
// If decl is a virtual method, walk the base classes looking for methods that
-// decl overrides. This table of overridden methods is used by IRGen to determine
-// the vtable layout for decl's parent class.
+// decl overrides. This table of overridden methods is used by IRGen to
+// determine the vtable layout for decl's parent class.
static void addOverridesForMethod(clang::CXXMethodDecl *decl) {
if (!decl->isVirtual())
return;
@@ -2254,10 +2214,10 @@ bool DWARFASTParserClang::CompleteTypeFr
#if defined LLDB_CONFIGURATION_DEBUG
//----------------------------------------------------------------------
- // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES
- // environment variable can be set with one or more typenames separated
- // by ';' characters. This will cause this function to not complete any
- // types whose names match.
+ // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES environment
+ // variable can be set with one or more typenames separated by ';'
+ // characters. This will cause this function to not complete any types whose
+ // names match.
//
// Examples of setting this environment variable:
//
@@ -2308,8 +2268,8 @@ bool DWARFASTParserClang::CompleteTypeFr
LanguageType class_language = eLanguageTypeUnknown;
if (ClangASTContext::IsObjCObjectOrInterfaceType(clang_type)) {
class_language = eLanguageTypeObjC;
- // For objective C we don't start the definition when
- // the class is created.
+ // For objective C we don't start the definition when the class is
+ // created.
ClangASTContext::StartTagDeclarationDefinition(clang_type);
}
@@ -2381,29 +2341,27 @@ bool DWARFASTParserClang::CompleteTypeFr
clang::TTK_Class);
}
- // Since DW_TAG_structure_type gets used for both classes
- // and structures, we may need to set any DW_TAG_member
- // fields to have a "private" access if none was specified.
- // When we parsed the child members we tracked that actual
- // accessibility value for each DW_TAG_member in the
- // "member_accessibilities" array. If the value for the
- // member is zero, then it was set to the "default_accessibility"
- // which for structs was "public". Below we correct this
- // by setting any fields to "private" that weren't correctly
- // set.
+ // Since DW_TAG_structure_type gets used for both classes and
+ // structures, we may need to set any DW_TAG_member fields to have a
+ // "private" access if none was specified. When we parsed the child
+ // members we tracked that actual accessibility value for each
+ // DW_TAG_member in the "member_accessibilities" array. If the value
+ // for the member is zero, then it was set to the
+ // "default_accessibility" which for structs was "public". Below we
+ // correct this by setting any fields to "private" that weren't
+ // correctly set.
if (is_a_class && !member_accessibilities.empty()) {
- // This is a class and all members that didn't have
- // their access specified are private.
+ // This is a class and all members that didn't have their access
+ // specified are private.
m_ast.SetDefaultAccessForRecordFields(
m_ast.GetAsRecordDecl(clang_type), eAccessPrivate,
&member_accessibilities.front(), member_accessibilities.size());
}
if (!base_classes.empty()) {
- // Make sure all base classes refer to complete types and not
- // forward declarations. If we don't do this, clang will crash
- // with an assertion in the call to
- // clang_type.SetBaseClassesForClassType()
+ // Make sure all base classes refer to complete types and not forward
+ // declarations. If we don't do this, clang will crash with an
+ // assertion in the call to clang_type.SetBaseClassesForClassType()
for (auto &base_class : base_classes) {
clang::TypeSourceInfo *type_source_info =
base_class->getTypeSourceInfo();
@@ -2423,11 +2381,10 @@ bool DWARFASTParserClang::CompleteTypeFr
// We have no choice other than to pretend that the base class
// is complete. If we don't do this, clang will crash when we
// call setBases() inside of
- // "clang_type.SetBaseClassesForClassType()"
- // below. Since we provide layout assistance, all ivars in this
- // class and other classes will be fine, this is the best we can
- // do
- // short of crashing.
+ // "clang_type.SetBaseClassesForClassType()" below. Since we
+ // provide layout assistance, all ivars in this class and other
+ // classes will be fine, this is the best we can do short of
+ // crashing.
if (ClangASTContext::StartTagDeclarationDefinition(
base_class_type)) {
ClangASTContext::CompleteTagDeclarationDefinition(
@@ -2440,8 +2397,8 @@ bool DWARFASTParserClang::CompleteTypeFr
&base_classes.front(),
base_classes.size());
- // Clang will copy each CXXBaseSpecifier in "base_classes"
- // so we have to free them all.
+ // Clang will copy each CXXBaseSpecifier in "base_classes" so we have
+ // to free them all.
ClangASTContext::DeleteBaseClassSpecifiers(&base_classes.front(),
base_classes.size());
}
@@ -2751,10 +2708,8 @@ Function *DWARFASTParserClang::ParseFunc
Language::LanguageIsCPlusPlus(die.GetLanguage()) && name &&
strcmp(name, "main") != 0) {
// If the mangled name is not present in the DWARF, generate the
- // demangled name
- // using the decl context. We skip if the function is "main" as its name
- // is
- // never mangled.
+ // demangled name using the decl context. We skip if the function is
+ // "main" as its name is never mangled.
bool is_static = false;
bool is_variadic = false;
bool has_template_params = false;
@@ -2928,8 +2883,8 @@ bool DWARFASTParserClang::ParseChildMemb
}
} else {
// With DWARF 3 and later, if the value is an integer constant,
- // this form value is the offset in bytes from the beginning
- // of the containing entity.
+ // this form value is the offset in bytes from the beginning of
+ // the containing entity.
member_byte_offset = form_value.Unsigned();
}
break;
@@ -2971,8 +2926,8 @@ bool DWARFASTParserClang::ParseChildMemb
ConstString fixed_getter;
ConstString fixed_setter;
- // Check if the property getter/setter were provided as full
- // names. We want basenames, so we extract them.
+ // Check if the property getter/setter were provided as full names.
+ // We want basenames, so we extract them.
if (prop_getter_name && prop_getter_name[0] == '-') {
ObjCLanguage::MethodName prop_getter_method(prop_getter_name, true);
@@ -2984,8 +2939,7 @@ bool DWARFASTParserClang::ParseChildMemb
prop_setter_name = prop_setter_method.GetSelector().GetCString();
}
- // If the names haven't been provided, they need to be
- // filled in.
+ // If the names haven't been provided, they need to be filled in.
if (!prop_getter_name) {
prop_getter_name = prop_name;
@@ -3001,19 +2955,18 @@ bool DWARFASTParserClang::ParseChildMemb
}
}
- // Clang has a DWARF generation bug where sometimes it
- // represents fields that are references with bad byte size
- // and bit size/offset information such as:
+ // Clang has a DWARF generation bug where sometimes it represents
+ // fields that are references with bad byte size and bit size/offset
+ // information such as:
//
// DW_AT_byte_size( 0x00 )
// DW_AT_bit_size( 0x40 )
// DW_AT_bit_offset( 0xffffffffffffffc0 )
//
- // So check the bit offset to make sure it is sane, and if
- // the values are not sane, remove them. If we don't do this
- // then we will end up with a crash if we try to use this
- // type in an expression when clang becomes unhappy with its
- // recycled debug info.
+ // So check the bit offset to make sure it is sane, and if the values
+ // are not sane, remove them. If we don't do this then we will end up
+ // with a crash if we try to use this type in an expression when clang
+ // becomes unhappy with its recycled debug info.
if (byte_size == 0 && bit_offset < 0) {
bit_size = 0;
@@ -3027,12 +2980,10 @@ bool DWARFASTParserClang::ParseChildMemb
if (member_idx == 0 && !is_artificial && name &&
(strstr(name, "_vptr$") == name)) {
- // Not all compilers will mark the vtable pointer
- // member as artificial (llvm-gcc). We can't have
- // the virtual members in our classes otherwise it
- // throws off all child offsets since we end up
- // having and extra pointer sized member in our
- // class layouts.
+ // Not all compilers will mark the vtable pointer member as
+ // artificial (llvm-gcc). We can't have the virtual members in our
+ // classes otherwise it throws off all child offsets since we end up
+ // having and extra pointer sized member in our class layouts.
is_artificial = true;
}
@@ -3072,15 +3023,15 @@ bool DWARFASTParserClang::ParseChildMemb
/////////////////////////////////////////////////////////////
// How to locate a field given the DWARF debug information
//
- // AT_byte_size indicates the size of the word in which the
- // bit offset must be interpreted.
+ // AT_byte_size indicates the size of the word in which the bit
+ // offset must be interpreted.
//
// AT_data_member_location indicates the byte offset of the
// word from the base address of the structure.
//
// AT_bit_offset indicates how many bits into the word
- // (according to the host endianness) the low-order bit of
- // the field starts. AT_bit_offset can be negative.
+ // (according to the host endianness) the low-order bit of the
+ // field starts. AT_bit_offset can be negative.
//
// AT_bit_size indicates the size of the field in bits.
/////////////////////////////////////////////////////////////
@@ -3121,12 +3072,9 @@ bool DWARFASTParserClang::ParseChildMemb
field_bit_offset = this_field_info.bit_offset;
// If the member to be emitted did not start on a character
- // boundary and there is
- // empty space between the last field and this one, then we need
- // to emit an
- // anonymous member filling up the space up to its start. There
- // are three cases
- // here:
+ // boundary and there is empty space between the last field and
+ // this one, then we need to emit an anonymous member filling
+ // up the space up to its start. There are three cases here:
//
// 1 If the previous member ended on a character boundary, then
// we can emit an
@@ -3151,10 +3099,8 @@ bool DWARFASTParserClang::ParseChildMemb
const uint64_t word_width = 32;
// Objective-C has invalid DW_AT_bit_offset values in older
- // versions
- // of clang, so we have to be careful and only insert unnamed
- // bitfields
- // if we have a new enough clang.
+ // versions of clang, so we have to be careful and only insert
+ // unnamed bitfields if we have a new enough clang.
bool detect_unnamed_bitfields = true;
if (class_language == eLanguageTypeObjC ||
@@ -3217,10 +3163,10 @@ bool DWARFASTParserClang::ParseChildMemb
{
// Older versions of clang emit array[0] and array[1] in the
- // same way (<rdar://problem/12566646>).
- // If the current field is at the end of the structure, then
- // there is definitely no room for extra
- // elements and we override the type to array[0].
+ // same way (<rdar://problem/12566646>). If the current field
+ // is at the end of the structure, then there is definitely no
+ // room for extra elements and we override the type to
+ // array[0].
CompilerType member_array_element_type;
uint64_t member_array_size;
@@ -3272,12 +3218,11 @@ bool DWARFASTParserClang::ParseChildMemb
die.GetOffset(), name,
sc.comp_unit ? sc.comp_unit->GetPath().c_str()
: "the source file");
- // We have no choice other than to pretend that the member class
- // is complete. If we don't do this, clang will crash when
- // trying
- // to layout the class. Since we provide layout assistance, all
- // ivars in this class and other classes will be fine, this is
- // the best we can do short of crashing.
+ // We have no choice other than to pretend that the member
+ // class is complete. If we don't do this, clang will crash
+ // when trying to layout the class. Since we provide layout
+ // assistance, all ivars in this class and other classes will
+ // be fine, this is the best we can do short of crashing.
if (ClangASTContext::StartTagDeclarationDefinition(
member_clang_type)) {
ClangASTContext::CompleteTagDeclarationDefinition(
@@ -3399,8 +3344,8 @@ bool DWARFASTParserClang::ParseChildMemb
}
} else {
// With DWARF 3 and later, if the value is an integer constant,
- // this form value is the offset in bytes from the beginning
- // of the containing entity.
+ // this form value is the offset in bytes from the beginning of
+ // the containing entity.
member_byte_offset = form_value.Unsigned();
}
break;
@@ -3446,18 +3391,16 @@ bool DWARFASTParserClang::ParseChildMemb
if (is_virtual) {
// Do not specify any offset for virtual inheritance. The DWARF
- // produced by clang doesn't
- // give us a constant offset, but gives us a DWARF expressions that
- // requires an actual object
- // in memory. the DW_AT_data_member_location for a virtual base
- // class looks like:
+ // produced by clang doesn't give us a constant offset, but gives
+ // us a DWARF expressions that requires an actual object in memory.
+ // the DW_AT_data_member_location for a virtual base class looks
+ // like:
// DW_AT_data_member_location( DW_OP_dup, DW_OP_deref,
// DW_OP_constu(0x00000018), DW_OP_minus, DW_OP_deref,
// DW_OP_plus )
// Given this, there is really no valid response we can give to
- // clang for virtual base
- // class offsets, and this should eventually be removed from
- // LayoutRecordType() in the external
+ // clang for virtual base class offsets, and this should eventually
+ // be removed from LayoutRecordType() in the external
// AST source in clang.
} else {
layout_info.base_offsets.insert(std::make_pair(
@@ -3547,14 +3490,13 @@ size_t DWARFASTParserClang::ParseChildPa
bool skip = false;
if (skip_artificial) {
if (is_artificial) {
- // In order to determine if a C++ member function is
- // "const" we have to look at the const-ness of "this"...
- // Ugly, but that
+ // In order to determine if a C++ member function is "const" we
+ // have to look at the const-ness of "this"... Ugly, but that
if (arg_idx == 0) {
if (DeclKindIsCXXClass(containing_decl_ctx->getDeclKind())) {
// Often times compilers omit the "this" name for the
- // specification DIEs, so we can't rely upon the name
- // being in the formal parameter DIE...
+ // specification DIEs, so we can't rely upon the name being in
+ // the formal parameter DIE...
if (name == NULL || ::strcmp(name, "this") == 0) {
Type *this_type =
die.ResolveTypeUID(DIERef(param_type_die_form));
@@ -3618,10 +3560,10 @@ size_t DWARFASTParserClang::ParseChildPa
case DW_TAG_template_type_parameter:
case DW_TAG_template_value_parameter:
case DW_TAG_GNU_template_parameter_pack:
- // The one caller of this was never using the template_param_infos,
- // and the local variable was taking up a large amount of stack space
- // in SymbolFileDWARF::ParseType() so this was removed. If we ever need
- // the template params back, we can add them back.
+ // The one caller of this was never using the template_param_infos, and
+ // the local variable was taking up a large amount of stack space in
+ // SymbolFileDWARF::ParseType() so this was removed. If we ever need the
+ // template params back, we can add them back.
// ParseTemplateDIE (dwarf_cu, die, template_param_infos);
has_template_params = true;
break;
@@ -4157,8 +4099,8 @@ bool DWARFASTParserClang::CopyUniqueClas
// Now do the work of linking the DeclContexts and Types.
if (fast_path) {
- // We can do this quickly. Just run across the tables index-for-index since
- // we know each node has matching names and tags.
+ // We can do this quickly. Just run across the tables index-for-index
+ // since we know each node has matching names and tags.
for (idx = 0; idx < src_size; ++idx) {
src_die = src_name_to_die.GetValueAtIndexUnchecked(idx);
dst_die = dst_name_to_die.GetValueAtIndexUnchecked(idx);
@@ -4195,9 +4137,9 @@ bool DWARFASTParserClang::CopyUniqueClas
}
}
} else {
- // We must do this slowly. For each member of the destination, look
- // up a member in the source with the same name, check its tag, and
- // unique them if everything matches up. Report failures.
+ // We must do this slowly. For each member of the destination, look up a
+ // member in the source with the same name, check its tag, and unique them
+ // if everything matches up. Report failures.
if (!src_name_to_die.IsEmpty() && !dst_name_to_die.IsEmpty()) {
src_name_to_die.Sort();
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp Mon Apr 30 09:49:04 2018
@@ -157,7 +157,8 @@ TypeSP DWARFASTParserGo::ParseTypeFromDW
Type *type = dwarf->ResolveTypeUID(encoding_uid);
if (type) {
if (go_kind == 0 && type->GetName() == type_name_const_str) {
- // Go emits extra typedefs as a forward declaration. Ignore these.
+ // Go emits extra typedefs as a forward declaration. Ignore
+ // these.
dwarf->m_die_to_type[die.GetDIE()] = type;
return type->shared_from_this();
}
@@ -212,10 +213,10 @@ TypeSP DWARFASTParserGo::ParseTypeFromDW
// TODO(ribrdb): Do we need this?
- // UniqueDWARFASTType is large, so don't create a local variables on the
- // stack, put it on the heap. This function is often called recursively
- // and clang isn't good and sharing the stack space for variables in
- // different blocks.
+ // UniqueDWARFASTType is large, so don't create a local variables on
+ // the stack, put it on the heap. This function is often called
+ // recursively and clang isn't good and sharing the stack space for
+ // variables in different blocks.
std::unique_ptr<UniqueDWARFASTType> unique_ast_entry_ap(
new UniqueDWARFASTType());
@@ -224,11 +225,10 @@ TypeSP DWARFASTParserGo::ParseTypeFromDW
dwarf->GetUniqueDWARFASTTypeMap().Find(
type_name_const_str, die, decl,
byte_size_valid ? byte_size : -1, *unique_ast_entry_ap)) {
- // We have already parsed this type or from another
- // compile unit. GCC loves to use the "one definition
- // rule" which can result in multiple definitions
- // of the same class over and over in each compile
- // unit.
+ // We have already parsed this type or from another compile unit. GCC
+ // loves to use the "one definition rule" which can result in
+ // multiple definitions of the same class over and over in each
+ // compile unit.
type_sp = unique_ast_entry_ap->m_type_sp;
if (type_sp) {
dwarf->m_die_to_type[die.GetDIE()] = type_sp.get();
@@ -254,9 +254,9 @@ TypeSP DWARFASTParserGo::ParseTypeFromDW
Type::eEncodingIsUID, &decl, compiler_type,
Type::eResolveStateForward));
- // Add our type to the unique type map so we don't
- // end up creating many copies of the same type over
- // and over in the ASTContext for our module
+ // Add our type to the unique type map so we don't end up creating many
+ // copies of the same type over and over in the ASTContext for our
+ // module
unique_ast_entry_ap->m_type_sp = type_sp;
unique_ast_entry_ap->m_die = die;
unique_ast_entry_ap->m_declaration = decl;
@@ -265,19 +265,19 @@ TypeSP DWARFASTParserGo::ParseTypeFromDW
*unique_ast_entry_ap);
if (!is_forward_declaration) {
- // Always start the definition for a class type so that
- // if the class has child classes or types that require
- // the class to be created for use as their decl contexts
- // the class will be ready to accept these child definitions.
+ // Always start the definition for a class type so that if the class
+ // has child classes or types that require the class to be created
+ // for use as their decl contexts the class will be ready to accept
+ // these child definitions.
if (die.HasChildren() == false) {
// No children for this struct/union/class, lets finish it
m_ast.CompleteStructType(compiler_type);
} else if (compiler_type_was_created) {
- // Leave this as a forward declaration until we need
- // to know the details of the type. lldb_private::Type
- // will automatically call the SymbolFile virtual function
- // "SymbolFileDWARF::CompleteType(Type *)"
- // When the definition needs to be defined.
+ // Leave this as a forward declaration until we need to know the
+ // details of the type. lldb_private::Type will automatically call
+ // the SymbolFile virtual function
+ // "SymbolFileDWARF::CompleteType(Type *)" When the definition
+ // needs to be defined.
dwarf->m_forward_decl_die_to_clang_type[die.GetDIE()] =
compiler_type.GetOpaqueQualType();
dwarf->m_forward_decl_clang_type_to_die[compiler_type
@@ -670,8 +670,8 @@ size_t DWARFASTParserGo::ParseChildMembe
}
} else {
// With DWARF 3 and later, if the value is an integer constant,
- // this form value is the offset in bytes from the beginning
- // of the containing entity.
+ // this form value is the offset in bytes from the beginning of
+ // the containing entity.
member_byte_offset = form_value.Unsigned();
}
break;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp Mon Apr 30 09:49:04 2018
@@ -80,8 +80,8 @@ DWARFAbbreviationDeclarationSet::GetAbbr
//----------------------------------------------------------------------
// DWARFAbbreviationDeclarationSet::AppendAbbrevDeclSequential()
//
-// Append an abbreviation declaration with a sequential code for O(n)
-// lookups. Handy when creating an DWARFAbbreviationDeclarationSet.
+// Append an abbreviation declaration with a sequential code for O(n) lookups.
+// Handy when creating an DWARFAbbreviationDeclarationSet.
//----------------------------------------------------------------------
dw_uleb128_t DWARFAbbreviationDeclarationSet::AppendAbbrevDeclSequential(
const DWARFAbbreviationDeclaration &abbrevDecl) {
@@ -115,9 +115,9 @@ void DWARFAbbreviationDeclarationSet::Ge
//----------------------------------------------------------------------
// Encode
//
-// Encode the abbreviation table onto the end of the buffer provided
-// into a byte representation as would be found in a ".debug_abbrev"
-// debug information section.
+// Encode the abbreviation table onto the end of the buffer provided into a
+// byte representation as would be found in a ".debug_abbrev" debug information
+// section.
//----------------------------------------------------------------------
// void
// DWARFAbbreviationDeclarationSet::Encode(BinaryStreamBuf& debug_abbrev_buf)
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp Mon Apr 30 09:49:04 2018
@@ -46,19 +46,17 @@ void DWARFDebugArangeSet::Compact() {
if (m_arange_descriptors.empty())
return;
- // Iterate through all arange descriptors and combine any ranges that
- // overlap or have matching boundaries. The m_arange_descriptors are assumed
- // to be in ascending order after being built by adding descriptors
- // using the AddDescriptor method.
+ // Iterate through all arange descriptors and combine any ranges that overlap
+ // or have matching boundaries. The m_arange_descriptors are assumed to be in
+ // ascending order after being built by adding descriptors using the
+ // AddDescriptor method.
uint32_t i = 0;
while (i + 1 < m_arange_descriptors.size()) {
if (m_arange_descriptors[i].end_address() >=
m_arange_descriptors[i + 1].address) {
// The current range ends at or exceeds the start of the next address
- // range.
- // Compute the max end address between the two and use that to make the
- // new
- // length.
+ // range. Compute the max end address between the two and use that to
+ // make the new length.
const dw_addr_t max_end_addr =
std::max(m_arange_descriptors[i].end_address(),
m_arange_descriptors[i + 1].end_address());
@@ -82,8 +80,8 @@ static bool DescriptorLessThan(const DWA
}
//----------------------------------------------------------------------
-// Add a range descriptor and keep things sorted so we can easily
-// compact the ranges before being saved or used.
+// Add a range descriptor and keep things sorted so we can easily compact the
+// ranges before being saved or used.
//----------------------------------------------------------------------
void DWARFDebugArangeSet::AddDescriptor(
const DWARFDebugArangeSet::Descriptor &range) {
@@ -103,15 +101,14 @@ void DWARFDebugArangeSet::AddDescriptor(
// Non-contiguous entries, add this one before the found entry
m_arange_descriptors.insert(pos, range);
} else if (range_end_addr == pos->address) {
- // The top end of 'range' is the lower end of the entry
- // pointed to by 'pos'. We can combine range with the
- // entry we found by setting the starting address and
- // increasing the length since they don't overlap.
+ // The top end of 'range' is the lower end of the entry pointed to by
+ // 'pos'. We can combine range with the entry we found by setting the
+ // starting address and increasing the length since they don't overlap.
pos->address = range.address;
pos->length += range.length;
} else {
- // We can combine these two and make sure the largest end
- // address is used to make end address.
+ // We can combine these two and make sure the largest end address is
+ // used to make end address.
pos->address = range.address;
pos->length = std::max(found_end_addr, range_end_addr) - pos->address;
}
@@ -142,18 +139,18 @@ bool DWARFDebugArangeSet::Extract(const
// 7.20 Address Range Table
//
- // Each set of entries in the table of address ranges contained in
- // the .debug_aranges section begins with a header consisting of: a
- // 4-byte length containing the length of the set of entries for this
- // compilation unit, not including the length field itself; a 2-byte
- // version identifier containing the value 2 for DWARF Version 2; a
- // 4-byte offset into the.debug_infosection; a 1-byte unsigned integer
- // containing the size in bytes of an address (or the offset portion of
- // an address for segmented addressing) on the target system; and a
- // 1-byte unsigned integer containing the size in bytes of a segment
- // descriptor on the target system. This header is followed by a series
- // of tuples. Each tuple consists of an address and a length, each in
- // the size appropriate for an address on the target architecture.
+ // Each set of entries in the table of address ranges contained in the
+ // .debug_aranges section begins with a header consisting of: a 4-byte
+ // length containing the length of the set of entries for this compilation
+ // unit, not including the length field itself; a 2-byte version identifier
+ // containing the value 2 for DWARF Version 2; a 4-byte offset into
+ // the.debug_infosection; a 1-byte unsigned integer containing the size in
+ // bytes of an address (or the offset portion of an address for segmented
+ // addressing) on the target system; and a 1-byte unsigned integer
+ // containing the size in bytes of a segment descriptor on the target
+ // system. This header is followed by a series of tuples. Each tuple
+ // consists of an address and a length, each in the size appropriate for an
+ // address on the target architecture.
m_header.length = data.GetDWARFInitialLength(offset_ptr);
m_header.version = data.GetU16(offset_ptr);
m_header.cu_offset = data.GetDWARFOffset(offset_ptr);
@@ -195,8 +192,8 @@ bool DWARFDebugArangeSet::Extract(const
arangeDescriptor.length =
data.GetMaxU64(offset_ptr, m_header.addr_size);
- // Each set of tuples is terminated by a 0 for the address and 0
- // for the length.
+ // Each set of tuples is terminated by a 0 for the address and 0 for
+ // the length.
if (arangeDescriptor.address || arangeDescriptor.length)
m_arange_descriptors.push_back(arangeDescriptor);
else
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Mon Apr 30 09:49:04 2018
@@ -120,8 +120,8 @@ DWARFUnit *DWARFDebugInfo::GetCompileUni
}
bool DWARFDebugInfo::ContainsCompileUnit(const DWARFUnit *cu) const {
- // Not a verify efficient function, but it is handy for use in assertions
- // to make sure that a compile unit comes from a debug information file.
+ // Not a verify efficient function, but it is handy for use in assertions to
+ // make sure that a compile unit comes from a debug information file.
CompileUnitColl::const_iterator end_pos = m_compile_units.end();
CompileUnitColl::const_iterator pos;
@@ -227,12 +227,12 @@ DWARFDebugInfo::GetDIE(const DIERef &die
//----------------------------------------------------------------------
// Parse
//
-// Parses the .debug_info section and uses the .debug_abbrev section
-// and various other sections in the SymbolFileDWARF class and calls the
-// supplied callback function each time a compile unit header, or debug
-// information entry is successfully parsed. This function can be used
-// for different tasks such as parsing the file contents into a
-// structured data, dumping, verifying and much more.
+// Parses the .debug_info section and uses the .debug_abbrev section and
+// various other sections in the SymbolFileDWARF class and calls the supplied
+// callback function each time a compile unit header, or debug information
+// entry is successfully parsed. This function can be used for different tasks
+// such as parsing the file contents into a structured data, dumping, verifying
+// and much more.
//----------------------------------------------------------------------
void DWARFDebugInfo::Parse(SymbolFileDWARF *dwarf2Data, Callback callback,
void *userData) {
@@ -252,8 +252,8 @@ void DWARFDebugInfo::Parse(SymbolFileDWA
// Make sure we are within our compile unit
if (offset < next_cu_offset) {
- // We are in our compile unit, parse starting at the offset
- // we were told to parse
+ // We are in our compile unit, parse starting at the offset we were
+ // told to parse
bool done = false;
while (!done && die.Extract(dwarf2Data, cu.get(), &offset)) {
// Call the callback function with DIE pointer that falls within the
@@ -301,11 +301,11 @@ typedef struct DumpInfo {
// DumpCallback
//
// A callback function for the static DWARFDebugInfo::Parse() function
-// that gets called each time a compile unit header or debug information
-// entry is successfully parsed.
+// that gets called each time a compile unit header or debug information entry
+// is successfully parsed.
//
-// This function dump DWARF information and obey recurse depth and
-// whether a single DIE is to be dumped (or all of the data).
+// This function dump DWARF information and obey recurse depth and whether a
+// single DIE is to be dumped (or all of the data).
//----------------------------------------------------------------------
static dw_offset_t DumpCallback(SymbolFileDWARF *dwarf2Data,
DWARFUnit *cu, DWARFDebugInfoEntry *die,
@@ -403,8 +403,8 @@ static dw_offset_t DumpCallback(SymbolFi
dumpInfo->ancestors.resize(1);
}
- // We are dumping only a single DIE possibly with it's children and
- // we must find it's compile unit before we can dump it properly
+ // We are dumping only a single DIE possibly with it's children and we
+ // must find it's compile unit before we can dump it properly
if (cu && dumpInfo->die_offset < cu->GetFirstDIEOffset()) {
// Not found, maybe the DIE offset provided wasn't correct?
// *ostrm_ptr << "DIE at offset " << HEX32 << dumpInfo->die_offset << "
@@ -436,14 +436,13 @@ static dw_offset_t DumpCallback(SymbolFi
//----------------------------------------------------------------------
// Dump
//
-// Dump the information in the .debug_info section to the specified
-// ostream. If die_offset is valid, a single DIE will be dumped. If the
-// die_offset is invalid, all the DWARF information will be dumped. Both
-// cases will obey a "recurse_depth" or how deep to traverse into the
-// children of each DIE entry. A recurse_depth of zero will dump all
-// compile unit headers. A recurse_depth of 1 will dump all compile unit
-// headers and the DW_TAG_compile unit tags. A depth of 2 will also
-// dump all types and functions.
+// Dump the information in the .debug_info section to the specified ostream. If
+// die_offset is valid, a single DIE will be dumped. If the die_offset is
+// invalid, all the DWARF information will be dumped. Both cases will obey a
+// "recurse_depth" or how deep to traverse into the children of each DIE entry.
+// A recurse_depth of zero will dump all compile unit headers. A recurse_depth
+// of 1 will dump all compile unit headers and the DW_TAG_compile unit tags. A
+// depth of 2 will also dump all types and functions.
//----------------------------------------------------------------------
void DWARFDebugInfo::Dump(Stream *s, SymbolFileDWARF *dwarf2Data,
const uint32_t die_offset,
@@ -469,8 +468,8 @@ void DWARFDebugInfo::Dump(Stream *s, Sym
//----------------------------------------------------------------------
// Dump
//
-// Dump the contents of this DWARFDebugInfo object as has been parsed
-// and/or modified after it has been parsed.
+// Dump the contents of this DWARFDebugInfo object as has been parsed and/or
+// modified after it has been parsed.
//----------------------------------------------------------------------
void DWARFDebugInfo::Dump(Stream *s, const uint32_t die_offset,
const uint32_t recurse_depth) {
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Mon Apr 30 09:49:04 2018
@@ -189,9 +189,9 @@ bool DWARFDebugInfoEntry::FastExtract(
//----------------------------------------------------------------------
// Extract
//
-// Extract a debug info entry for a given compile unit from the
-// .debug_info and .debug_abbrev data within the SymbolFileDWARF class
-// starting at the given offset
+// Extract a debug info entry for a given compile unit from the .debug_info and
+// .debug_abbrev data within the SymbolFileDWARF class starting at the given
+// offset
//----------------------------------------------------------------------
bool DWARFDebugInfoEntry::Extract(SymbolFileDWARF *dwarf2Data,
const DWARFUnit *cu,
@@ -246,8 +246,7 @@ bool DWARFDebugInfoEntry::Extract(Symbol
uint32_t form_size = 0;
switch (form) {
// Blocks if inlined data that have a length field and the data
- // bytes
- // inlined in the .debug_info
+ // bytes inlined in the .debug_info
case DW_FORM_exprloc:
case DW_FORM_block:
form_size = debug_info_data.GetULEB128(&offset);
@@ -357,8 +356,8 @@ bool DWARFDebugInfoEntry::Extract(Symbol
//----------------------------------------------------------------------
// DumpAncestry
//
-// Dumps all of a debug information entries parents up until oldest and
-// all of it's attributes to the specified stream.
+// Dumps all of a debug information entries parents up until oldest and all of
+// it's attributes to the specified stream.
//----------------------------------------------------------------------
void DWARFDebugInfoEntry::DumpAncestry(SymbolFileDWARF *dwarf2Data,
const DWARFUnit *cu,
@@ -375,8 +374,7 @@ void DWARFDebugInfoEntry::DumpAncestry(S
// GetDIENamesAndRanges
//
// Gets the valid address ranges for a given DIE by looking for a
-// DW_AT_low_pc/DW_AT_high_pc pair, DW_AT_entry_pc, or DW_AT_ranges
-// attributes.
+// DW_AT_low_pc/DW_AT_high_pc pair, DW_AT_entry_pc, or DW_AT_ranges attributes.
//----------------------------------------------------------------------
bool DWARFDebugInfoEntry::GetDIENamesAndRanges(
SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, const char *&name,
@@ -452,9 +450,9 @@ bool DWARFDebugInfoEntry::GetDIENamesAnd
const DWARFDebugRanges *debug_ranges = dwarf2Data->DebugRanges();
if (debug_ranges) {
debug_ranges->FindRanges(cu->GetRangesBase(), form_value.Unsigned(), ranges);
- // All DW_AT_ranges are relative to the base address of the
- // compile unit. We add the compile unit base address to make
- // sure all the addresses are properly fixed up.
+ // All DW_AT_ranges are relative to the base address of the compile
+ // unit. We add the compile unit base address to make sure all the
+ // addresses are properly fixed up.
ranges.Slide(cu->GetBaseAddress());
} else {
cu->GetSymbolFileDWARF()->GetObjectFile()->GetModule()->ReportError(
@@ -583,8 +581,8 @@ bool DWARFDebugInfoEntry::GetDIENamesAnd
//----------------------------------------------------------------------
// Dump
//
-// Dumps a debug information entry and all of it's attributes to the
-// specified stream.
+// Dumps a debug information entry and all of it's attributes to the specified
+// stream.
//----------------------------------------------------------------------
void DWARFDebugInfoEntry::Dump(SymbolFileDWARF *dwarf2Data,
const DWARFUnit *cu, Stream &s,
@@ -659,9 +657,9 @@ void DWARFDebugInfoEntry::DumpLocation(S
//----------------------------------------------------------------------
// DumpAttribute
//
-// Dumps a debug information entry attribute along with it's form. Any
-// special display of attributes is done (disassemble location lists,
-// show enumeration values for attributes, etc).
+// Dumps a debug information entry attribute along with it's form. Any special
+// display of attributes is done (disassemble location lists, show enumeration
+// values for attributes, etc).
//----------------------------------------------------------------------
void DWARFDebugInfoEntry::DumpAttribute(
SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
@@ -717,9 +715,8 @@ void DWARFDebugInfoEntry::DumpAttribute(
DWARFExpression::PrintDWARFExpression(
s, locationData, DWARFUnit::GetAddressByteSize(cu), 4, false);
} else {
- // We have a location list offset as the value that is
- // the offset into the .debug_loc section that describes
- // the value over it's lifetime
+ // We have a location list offset as the value that is the offset into
+ // the .debug_loc section that describes the value over it's lifetime
uint64_t debug_loc_offset = form_value.Unsigned();
if (dwarf2Data) {
DWARFExpression::PrintDWARFLocationList(
@@ -760,9 +757,9 @@ void DWARFDebugInfoEntry::DumpAttribute(
//----------------------------------------------------------------------
// Get all attribute values for a given DIE, including following any
-// specification or abstract origin attributes and including those in
-// the results. Any duplicate attributes will have the first instance
-// take precedence (this can happen for declaration attributes).
+// specification or abstract origin attributes and including those in the
+// results. Any duplicate attributes will have the first instance take
+// precedence (this can happen for declaration attributes).
//----------------------------------------------------------------------
size_t DWARFDebugInfoEntry::GetAttributes(
const DWARFUnit *cu, DWARFFormValue::FixedFormSizes fixed_form_sizes,
@@ -804,9 +801,9 @@ size_t DWARFDebugInfoEntry::GetAttribute
case DW_AT_sibling:
case DW_AT_declaration:
if (curr_depth > 0) {
- // This attribute doesn't make sense when combined with
- // the DIE that references this DIE. We know a DIE is
- // referencing this DIE because curr_depth is not zero
+ // This attribute doesn't make sense when combined with the DIE that
+ // references this DIE. We know a DIE is referencing this DIE because
+ // curr_depth is not zero
break;
}
LLVM_FALLTHROUGH;
@@ -842,9 +839,9 @@ size_t DWARFDebugInfoEntry::GetAttribute
// GetAttributeValue
//
// Get the value of an attribute and return the .debug_info offset of the
-// attribute if it was properly extracted into form_value, or zero
-// if we fail since an offset of zero is invalid for an attribute (it
-// would be a compile unit header).
+// attribute if it was properly extracted into form_value, or zero if we fail
+// since an offset of zero is invalid for an attribute (it would be a compile
+// unit header).
//----------------------------------------------------------------------
dw_offset_t DWARFDebugInfoEntry::GetAttributeValue(
SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
@@ -930,10 +927,10 @@ dw_offset_t DWARFDebugInfoEntry::GetAttr
//----------------------------------------------------------------------
// GetAttributeValueAsString
//
-// Get the value of an attribute as a string return it. The resulting
-// pointer to the string data exists within the supplied SymbolFileDWARF
-// and will only be available as long as the SymbolFileDWARF is still around
-// and it's content doesn't change.
+// Get the value of an attribute as a string return it. The resulting pointer
+// to the string data exists within the supplied SymbolFileDWARF and will only
+// be available as long as the SymbolFileDWARF is still around and it's content
+// doesn't change.
//----------------------------------------------------------------------
const char *DWARFDebugInfoEntry::GetAttributeValueAsString(
SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
@@ -981,8 +978,8 @@ int64_t DWARFDebugInfoEntry::GetAttribut
//----------------------------------------------------------------------
// GetAttributeValueAsReference
//
-// Get the value of an attribute as reference and fix up and compile
-// unit relative offsets as needed.
+// Get the value of an attribute as reference and fix up and compile unit
+// relative offsets as needed.
//----------------------------------------------------------------------
uint64_t DWARFDebugInfoEntry::GetAttributeValueAsReference(
SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
@@ -1009,8 +1006,8 @@ uint64_t DWARFDebugInfoEntry::GetAttribu
//----------------------------------------------------------------------
// GetAttributeHighPC
//
-// Get the hi_pc, adding hi_pc to lo_pc when specified
-// as an <offset-from-low-pc>.
+// Get the hi_pc, adding hi_pc to lo_pc when specified as an <offset-from-low-
+// pc>.
//
// Returns the hi_pc or fail_value.
//----------------------------------------------------------------------
@@ -1033,8 +1030,8 @@ dw_addr_t DWARFDebugInfoEntry::GetAttrib
//----------------------------------------------------------------------
// GetAttributeAddressRange
//
-// Get the lo_pc and hi_pc, adding hi_pc to lo_pc when specified
-// as an <offset-from-low-pc>.
+// Get the lo_pc and hi_pc, adding hi_pc to lo_pc when specified as an <offset-
+// from-low-pc>.
//
// Returns true or sets lo_pc and hi_pc to fail_value.
//----------------------------------------------------------------------
@@ -1085,8 +1082,8 @@ size_t DWARFDebugInfoEntry::GetAttribute
//----------------------------------------------------------------------
// GetName
//
-// Get value of the DW_AT_name attribute and return it if one exists,
-// else return NULL.
+// Get value of the DW_AT_name attribute and return it if one exists, else
+// return NULL.
//----------------------------------------------------------------------
const char *DWARFDebugInfoEntry::GetName(SymbolFileDWARF *dwarf2Data,
const DWARFUnit *cu) const {
@@ -1096,8 +1093,8 @@ const char *DWARFDebugInfoEntry::GetName
//----------------------------------------------------------------------
// GetMangledName
//
-// Get value of the DW_AT_MIPS_linkage_name attribute and return it if
-// one exists, else return the value of the DW_AT_name attribute
+// Get value of the DW_AT_MIPS_linkage_name attribute and return it if one
+// exists, else return the value of the DW_AT_name attribute
//----------------------------------------------------------------------
const char *
DWARFDebugInfoEntry::GetMangledName(SymbolFileDWARF *dwarf2Data,
@@ -1125,8 +1122,8 @@ DWARFDebugInfoEntry::GetMangledName(Symb
//----------------------------------------------------------------------
// GetPubname
//
-// Get value the name for a DIE as it should appear for a
-// .debug_pubnames or .debug_pubtypes section.
+// Get value the name for a DIE as it should appear for a .debug_pubnames or
+// .debug_pubtypes section.
//----------------------------------------------------------------------
const char *DWARFDebugInfoEntry::GetPubname(SymbolFileDWARF *dwarf2Data,
const DWARFUnit *cu) const {
@@ -1151,11 +1148,10 @@ const char *DWARFDebugInfoEntry::GetPubn
//----------------------------------------------------------------------
// GetName
//
-// Get value of the DW_AT_name attribute for a debug information entry
-// that exists at offset "die_offset" and place that value into the
-// supplied stream object. If the DIE is a NULL object "NULL" is placed
-// into the stream, and if no DW_AT_name attribute exists for the DIE
-// then nothing is printed.
+// Get value of the DW_AT_name attribute for a debug information entry that
+// exists at offset "die_offset" and place that value into the supplied stream
+// object. If the DIE is a NULL object "NULL" is placed into the stream, and if
+// no DW_AT_name attribute exists for the DIE then nothing is printed.
//----------------------------------------------------------------------
bool DWARFDebugInfoEntry::GetName(SymbolFileDWARF *dwarf2Data,
const DWARFUnit *cu,
@@ -1186,10 +1182,9 @@ bool DWARFDebugInfoEntry::GetName(Symbol
//----------------------------------------------------------------------
// AppendTypeName
//
-// Follows the type name definition down through all needed tags to
-// end up with a fully qualified type name and dump the results to
-// the supplied stream. This is used to show the name of types given
-// a type identifier.
+// Follows the type name definition down through all needed tags to end up with
+// a fully qualified type name and dump the results to the supplied stream.
+// This is used to show the name of types given a type identifier.
//----------------------------------------------------------------------
bool DWARFDebugInfoEntry::AppendTypeName(SymbolFileDWARF *dwarf2Data,
const DWARFUnit *cu,
@@ -1345,10 +1340,10 @@ void DWARFDebugInfoEntry::BuildAddressRa
//----------------------------------------------------------------------
// BuildFunctionAddressRangeTable
//
-// This function is very similar to the BuildAddressRangeTable function
-// except that the actual DIE offset for the function is placed in the
-// table instead of the compile unit offset (which is the way the
-// standard .debug_aranges section does it).
+// This function is very similar to the BuildAddressRangeTable function except
+// that the actual DIE offset for the function is placed in the table instead
+// of the compile unit offset (which is the way the standard .debug_aranges
+// section does it).
//----------------------------------------------------------------------
void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable(
SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
@@ -1421,9 +1416,9 @@ DWARFDebugInfoEntry::GetParentDeclContex
DWARFDIE die(cu, const_cast<DWARFDebugInfoEntry *>(this));
while (die) {
- // If this is the original DIE that we are searching for a declaration
- // for, then don't look in the cache as we don't want our own decl
- // context to be our decl context...
+ // If this is the original DIE that we are searching for a declaration for,
+ // then don't look in the cache as we don't want our own decl context to be
+ // our decl context...
if (die.GetDIE() != this) {
switch (die.Tag()) {
case DW_TAG_compile_unit:
@@ -1712,9 +1707,10 @@ bool DWARFDebugInfoEntry::LookupAddress(
break;
}
}
- } else { // compile units may not have a valid high/low pc when there
+ } else {
+ // Compile units may not have a valid high/low pc when there
// are address gaps in subroutines so we must always search
- // if there is no valid high and low PC
+ // if there is no valid high and low PC.
check_children = (m_tag == DW_TAG_compile_unit ||
m_tag == DW_TAG_partial_unit) &&
((function_die != NULL) || (block_die != NULL));
@@ -1726,9 +1722,9 @@ bool DWARFDebugInfoEntry::LookupAddress(
DWARFRangeList ranges;
DWARFDebugRanges *debug_ranges = dwarf2Data->DebugRanges();
debug_ranges->FindRanges(cu->GetRangesBase(), debug_ranges_offset, ranges);
- // All DW_AT_ranges are relative to the base address of the
- // compile unit. We add the compile unit base address to make
- // sure all the addresses are properly fixed up.
+ // All DW_AT_ranges are relative to the base address of the compile
+ // unit. We add the compile unit base address to make sure all the
+ // addresses are properly fixed up.
ranges.Slide(cu->GetBaseAddress());
if (ranges.FindEntryThatContains(address)) {
found_address = true;
@@ -1790,8 +1786,8 @@ DWARFDebugInfoEntry::GetAbbreviationDecl
const DWARFAbbreviationDeclaration *abbrev_decl =
abbrev_set->GetAbbreviationDeclaration(m_abbr_idx);
if (abbrev_decl) {
- // Make sure the abbreviation code still matches. If it doesn't and
- // the DWARF data was mmap'ed, the backing file might have been modified
+ // Make sure the abbreviation code still matches. If it doesn't and the
+ // DWARF data was mmap'ed, the backing file might have been modified
// which is bad news.
const uint64_t abbrev_code =
dwarf2Data->get_debug_info_data().GetULEB128(&offset);
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp Mon Apr 30 09:49:04 2018
@@ -242,8 +242,8 @@ dw_offset_t DWARFDebugLine::DumpStatemen
log->Printf("0x%8.8x: DW_LNE_??? (%2.2x) - Skipping unknown upcode",
op_offset, opcode);
// Length doesn't include the zero opcode byte or the length itself,
- // but
- // it does include the sub_opcode, so we have to adjust for that below
+ // but it does include the sub_opcode, so we have to adjust for that
+ // below
offset += arg_size;
break;
}
@@ -324,9 +324,9 @@ dw_offset_t DWARFDebugLine::DumpStatemen
// Special Opcodes
default:
if (opcode < prologue.opcode_base) {
- // We have an opcode that this parser doesn't know about, skip
- // the number of ULEB128 numbers that is says to skip in the
- // prologue's standard_opcode_lengths array
+ // We have an opcode that this parser doesn't know about, skip the
+ // number of ULEB128 numbers that is says to skip in the prologue's
+ // standard_opcode_lengths array
uint8_t n = prologue.standard_opcode_lengths[opcode - 1];
log->Printf("0x%8.8x: Special : Unknown skipping %u ULEB128 values.",
op_offset, n);
@@ -357,9 +357,9 @@ dw_offset_t DWARFDebugLine::DumpStatemen
//----------------------------------------------------------------------
// Parse
//
-// Parse the entire line table contents calling callback each time a
-// new prologue is parsed and every time a new row is to be added to
-// the line table.
+// Parse the entire line table contents calling callback each time a new
+// prologue is parsed and every time a new row is to be added to the line
+// table.
//----------------------------------------------------------------------
void DWARFDebugLine::Parse(const DWARFDataExtractor &debug_line_data,
DWARFDebugLine::State::Callback callback,
@@ -472,9 +472,9 @@ bool DWARFDebugLine::ParseSupportFiles(
//----------------------------------------------------------------------
// ParseStatementTable
//
-// Parse a single line table (prologue and all rows) and call the
-// callback function once for the prologue (row in state will be zero)
-// and each time a row is to be added to the line table.
+// Parse a single line table (prologue and all rows) and call the callback
+// function once for the prologue (row in state will be zero) and each time a
+// row is to be added to the line table.
//----------------------------------------------------------------------
bool DWARFDebugLine::ParseStatementTable(
const DWARFDataExtractor &debug_line_data, lldb::offset_t *offset_ptr,
@@ -511,8 +511,8 @@ bool DWARFDebugLine::ParseStatementTable
uint8_t opcode = debug_line_data.GetU8(offset_ptr);
if (opcode == 0) {
- // Extended Opcodes always start with a zero opcode followed by
- // a uleb128 length so you can skip ones you don't know about
+ // Extended Opcodes always start with a zero opcode followed by a uleb128
+ // length so you can skip ones you don't know about
lldb::offset_t ext_offset = *offset_ptr;
dw_uleb128_t len = debug_line_data.GetULEB128(offset_ptr);
dw_offset_t arg_size = len - (*offset_ptr - ext_offset);
@@ -522,12 +522,12 @@ bool DWARFDebugLine::ParseStatementTable
switch (sub_opcode) {
case DW_LNE_end_sequence:
// Set the end_sequence register of the state machine to true and
- // append a row to the matrix using the current values of the
- // state-machine registers. Then reset the registers to the initial
- // values specified above. Every statement program sequence must end
- // with a DW_LNE_end_sequence instruction which creates a row whose
- // address is that of the byte after the last target machine instruction
- // of the sequence.
+ // append a row to the matrix using the current values of the state-
+ // machine registers. Then reset the registers to the initial values
+ // specified above. Every statement program sequence must end with a
+ // DW_LNE_end_sequence instruction which creates a row whose address is
+ // that of the byte after the last target machine instruction of the
+ // sequence.
state.end_sequence = true;
state.AppendRowToMatrix(*offset_ptr);
state.Reset();
@@ -537,8 +537,8 @@ bool DWARFDebugLine::ParseStatementTable
// Takes a single relocatable address as an operand. The size of the
// operand is the size appropriate to hold an address on the target
// machine. Set the address register to the value given by the
- // relocatable address. All of the other statement program opcodes
- // that affect the address register add a delta to it. This instruction
+ // relocatable address. All of the other statement program opcodes that
+ // affect the address register add a delta to it. This instruction
// stores a relocatable value into it instead.
if (arg_size == 4)
state.address = debug_line_data.GetU32(offset_ptr);
@@ -549,24 +549,24 @@ bool DWARFDebugLine::ParseStatementTable
case DW_LNE_define_file:
// Takes 4 arguments. The first is a null terminated string containing
// a source file name. The second is an unsigned LEB128 number
- // representing
- // the directory index of the directory in which the file was found. The
- // third is an unsigned LEB128 number representing the time of last
- // modification of the file. The fourth is an unsigned LEB128 number
- // representing the length in bytes of the file. The time and length
- // fields may contain LEB128(0) if the information is not available.
+ // representing the directory index of the directory in which the file
+ // was found. The third is an unsigned LEB128 number representing the
+ // time of last modification of the file. The fourth is an unsigned
+ // LEB128 number representing the length in bytes of the file. The time
+ // and length fields may contain LEB128(0) if the information is not
+ // available.
//
// The directory index represents an entry in the include_directories
- // section of the statement program prologue. The index is LEB128(0)
- // if the file was found in the current directory of the compilation,
+ // section of the statement program prologue. The index is LEB128(0) if
+ // the file was found in the current directory of the compilation,
// LEB128(1) if it was found in the first directory in the
// include_directories section, and so on. The directory index is
// ignored for file names that represent full path names.
//
// The files are numbered, starting at 1, in the order in which they
- // appear; the names in the prologue come before names defined by
- // the DW_LNE_define_file instruction. These numbers are used in the
- // file register of the state machine.
+ // appear; the names in the prologue come before names defined by the
+ // DW_LNE_define_file instruction. These numbers are used in the file
+ // register of the state machine.
{
FileNameEntry fileEntry;
fileEntry.name = debug_line_data.GetCStr(offset_ptr);
@@ -578,8 +578,9 @@ bool DWARFDebugLine::ParseStatementTable
break;
default:
- // Length doesn't include the zero opcode byte or the length itself, but
- // it does include the sub_opcode, so we have to adjust for that below
+ // Length doesn't include the zero opcode byte or the length itself,
+ // but it does include the sub_opcode, so we have to adjust for that
+ // below
(*offset_ptr) += arg_size;
break;
}
@@ -587,23 +588,23 @@ bool DWARFDebugLine::ParseStatementTable
switch (opcode) {
// Standard Opcodes
case DW_LNS_copy:
- // Takes no arguments. Append a row to the matrix using the
- // current values of the state-machine registers. Then set
- // the basic_block register to false.
+ // Takes no arguments. Append a row to the matrix using the current
+ // values of the state-machine registers. Then set the basic_block
+ // register to false.
state.AppendRowToMatrix(*offset_ptr);
break;
case DW_LNS_advance_pc:
// Takes a single unsigned LEB128 operand, multiplies it by the
- // min_inst_length field of the prologue, and adds the
- // result to the address register of the state machine.
+ // min_inst_length field of the prologue, and adds the result to the
+ // address register of the state machine.
state.address +=
debug_line_data.GetULEB128(offset_ptr) * prologue->min_inst_length;
break;
case DW_LNS_advance_line:
- // Takes a single signed LEB128 operand and adds that value to
- // the line register of the state machine.
+ // Takes a single signed LEB128 operand and adds that value to the line
+ // register of the state machine.
state.line += debug_line_data.GetSLEB128(offset_ptr);
break;
@@ -614,35 +615,35 @@ bool DWARFDebugLine::ParseStatementTable
break;
case DW_LNS_set_column:
- // Takes a single unsigned LEB128 operand and stores it in the
- // column register of the state machine.
+ // Takes a single unsigned LEB128 operand and stores it in the column
+ // register of the state machine.
state.column = debug_line_data.GetULEB128(offset_ptr);
break;
case DW_LNS_negate_stmt:
- // Takes no arguments. Set the is_stmt register of the state
- // machine to the logical negation of its current value.
+ // Takes no arguments. Set the is_stmt register of the state machine to
+ // the logical negation of its current value.
state.is_stmt = !state.is_stmt;
break;
case DW_LNS_set_basic_block:
- // Takes no arguments. Set the basic_block register of the
- // state machine to true
+ // Takes no arguments. Set the basic_block register of the state
+ // machine to true
state.basic_block = true;
break;
case DW_LNS_const_add_pc:
- // Takes no arguments. Add to the address register of the state
- // machine the address increment value corresponding to special
- // opcode 255. The motivation for DW_LNS_const_add_pc is this:
- // when the statement program needs to advance the address by a
- // small amount, it can use a single special opcode, which occupies
- // a single byte. When it needs to advance the address by up to
- // twice the range of the last special opcode, it can use
- // DW_LNS_const_add_pc followed by a special opcode, for a total
- // of two bytes. Only if it needs to advance the address by more
- // than twice that range will it need to use both DW_LNS_advance_pc
- // and a special opcode, requiring three or more bytes.
+ // Takes no arguments. Add to the address register of the state machine
+ // the address increment value corresponding to special opcode 255. The
+ // motivation for DW_LNS_const_add_pc is this: when the statement
+ // program needs to advance the address by a small amount, it can use a
+ // single special opcode, which occupies a single byte. When it needs
+ // to advance the address by up to twice the range of the last special
+ // opcode, it can use DW_LNS_const_add_pc followed by a special opcode,
+ // for a total of two bytes. Only if it needs to advance the address by
+ // more than twice that range will it need to use both
+ // DW_LNS_advance_pc and a special opcode, requiring three or more
+ // bytes.
{
uint8_t adjust_opcode = 255 - prologue->opcode_base;
dw_addr_t addr_offset = (adjust_opcode / prologue->line_range) *
@@ -652,40 +653,40 @@ bool DWARFDebugLine::ParseStatementTable
break;
case DW_LNS_fixed_advance_pc:
- // Takes a single uhalf operand. Add to the address register of
- // the state machine the value of the (unencoded) operand. This
- // is the only extended opcode that takes an argument that is not
- // a variable length number. The motivation for DW_LNS_fixed_advance_pc
- // is this: existing assemblers cannot emit DW_LNS_advance_pc or
- // special opcodes because they cannot encode LEB128 numbers or
- // judge when the computation of a special opcode overflows and
- // requires the use of DW_LNS_advance_pc. Such assemblers, however,
- // can use DW_LNS_fixed_advance_pc instead, sacrificing compression.
+ // Takes a single uhalf operand. Add to the address register of the
+ // state machine the value of the (unencoded) operand. This is the only
+ // extended opcode that takes an argument that is not a variable length
+ // number. The motivation for DW_LNS_fixed_advance_pc is this: existing
+ // assemblers cannot emit DW_LNS_advance_pc or special opcodes because
+ // they cannot encode LEB128 numbers or judge when the computation of a
+ // special opcode overflows and requires the use of DW_LNS_advance_pc.
+ // Such assemblers, however, can use DW_LNS_fixed_advance_pc instead,
+ // sacrificing compression.
state.address += debug_line_data.GetU16(offset_ptr);
break;
case DW_LNS_set_prologue_end:
- // Takes no arguments. Set the prologue_end register of the
- // state machine to true
+ // Takes no arguments. Set the prologue_end register of the state
+ // machine to true
state.prologue_end = true;
break;
case DW_LNS_set_epilogue_begin:
- // Takes no arguments. Set the basic_block register of the
- // state machine to true
+ // Takes no arguments. Set the basic_block register of the state
+ // machine to true
state.epilogue_begin = true;
break;
case DW_LNS_set_isa:
- // Takes a single unsigned LEB128 operand and stores it in the
- // column register of the state machine.
+ // Takes a single unsigned LEB128 operand and stores it in the column
+ // register of the state machine.
state.isa = debug_line_data.GetULEB128(offset_ptr);
break;
default:
- // Handle any unknown standard opcodes here. We know the lengths
- // of such opcodes because they are specified in the prologue
- // as a multiple of LEB128 operands for each opcode.
+ // Handle any unknown standard opcodes here. We know the lengths of
+ // such opcodes because they are specified in the prologue as a
+ // multiple of LEB128 operands for each opcode.
{
uint8_t i;
assert(static_cast<size_t>(opcode - 1) <
@@ -702,32 +703,32 @@ bool DWARFDebugLine::ParseStatementTable
// A special opcode value is chosen based on the amount that needs
// to be added to the line and address registers. The maximum line
- // increment for a special opcode is the value of the line_base
- // field in the header, plus the value of the line_range field,
- // minus 1 (line base + line range - 1). If the desired line
- // increment is greater than the maximum line increment, a standard
- // opcode must be used instead of a special opcode. The "address
- // advance" is calculated by dividing the desired address increment
- // by the minimum_instruction_length field from the header. The
- // special opcode is then calculated using the following formula:
+ // increment for a special opcode is the value of the line_base field in
+ // the header, plus the value of the line_range field, minus 1 (line base
+ // + line range - 1). If the desired line increment is greater than the
+ // maximum line increment, a standard opcode must be used instead of a
+ // special opcode. The "address advance" is calculated by dividing the
+ // desired address increment by the minimum_instruction_length field from
+ // the header. The special opcode is then calculated using the following
+ // formula:
//
// opcode = (desired line increment - line_base) + (line_range * address
// advance) + opcode_base
//
- // If the resulting opcode is greater than 255, a standard opcode
- // must be used instead.
+ // If the resulting opcode is greater than 255, a standard opcode must be
+ // used instead.
//
- // To decode a special opcode, subtract the opcode_base from the
- // opcode itself to give the adjusted opcode. The amount to
- // increment the address register is the result of the adjusted
- // opcode divided by the line_range multiplied by the
- // minimum_instruction_length field from the header. That is:
+ // To decode a special opcode, subtract the opcode_base from the opcode
+ // itself to give the adjusted opcode. The amount to increment the
+ // address register is the result of the adjusted opcode divided by the
+ // line_range multiplied by the minimum_instruction_length field from the
+ // header. That is:
//
// address increment = (adjusted opcode / line_range) *
// minimum_instruction_length
//
- // The amount to increment the line register is the line_base plus
- // the result of the adjusted opcode modulo the line_range. That is:
+ // The amount to increment the line register is the line_base plus the
+ // result of the adjusted opcode modulo the line_range. That is:
//
// line increment = line_base + (adjusted opcode % line_range)
@@ -755,8 +756,8 @@ static void ParseStatementTableCallback(
void *userData) {
DWARFDebugLine::LineTable *line_table = (DWARFDebugLine::LineTable *)userData;
if (state.row == DWARFDebugLine::State::StartParsingLineTable) {
- // Just started parsing the line table, so lets keep a reference to
- // the prologue using the supplied shared pointer
+ // Just started parsing the line table, so lets keep a reference to the
+ // prologue using the supplied shared pointer
line_table->prologue = state.prologue;
} else if (state.row == DWARFDebugLine::State::DoneParsingLineTable) {
// Done parsing line table, nothing to do for the cleanup
@@ -769,8 +770,8 @@ static void ParseStatementTableCallback(
//----------------------------------------------------------------------
// ParseStatementTable
//
-// Parse a line table at offset and populate the LineTable class with
-// the prologue and all rows.
+// Parse a line table at offset and populate the LineTable class with the
+// prologue and all rows.
//----------------------------------------------------------------------
bool DWARFDebugLine::ParseStatementTable(
const DWARFDataExtractor &debug_line_data, lldb::offset_t *offset_ptr,
@@ -936,11 +937,10 @@ uint32_t DWARFDebugLine::LineTable::Look
if (address < cu_high_pc)
return rows.size() - 1;
} else {
- // Rely on fact that we are using a std::vector and we can do
- // pointer arithmetic to find the row index (which will be one less
- // that what we found since it will find the first position after
- // the current address) since std::vector iterators are just
- // pointers to the container type.
+ // Rely on fact that we are using a std::vector and we can do pointer
+ // arithmetic to find the row index (which will be one less that what we
+ // found since it will find the first position after the current address)
+ // since std::vector iterators are just pointers to the container type.
index = pos - begin_pos;
if (pos->address > address) {
if (index > 0)
@@ -1005,9 +1005,9 @@ static bool AddressLessThan(const DWARFD
return a.address < b.address;
}
-// Insert a row at the correct address if the addresses can be out of
-// order which can only happen when we are linking a line table that
-// may have had it's contents rearranged.
+// Insert a row at the correct address if the addresses can be out of order
+// which can only happen when we are linking a line table that may have had
+// it's contents rearranged.
void DWARFDebugLine::Row::Insert(Row::collection &state_coll,
const Row &state) {
// If we don't have anything yet, or if the address of the last state in our
@@ -1020,12 +1020,12 @@ void DWARFDebugLine::Row::Insert(Row::co
state_coll.begin(), state_coll.end(), state, AddressLessThan));
// If the addresses are equal, we can safely replace the previous entry
- // with the current one if the one it is replacing is an end_sequence entry.
- // We currently always place an extra end sequence when ever we exit a valid
- // address range for a function in case the functions get rearranged by
- // optimizations or by order specifications. These extra end sequences will
- // disappear by getting replaced with valid consecutive entries within a
- // compile unit if there are no gaps.
+ // with the current one if the one it is replacing is an end_sequence
+ // entry. We currently always place an extra end sequence when ever we exit
+ // a valid address range for a function in case the functions get
+ // rearranged by optimizations or by order specifications. These extra end
+ // sequences will disappear by getting replaced with valid consecutive
+ // entries within a compile unit if there are no gaps.
if (range.first == range.second) {
state_coll.insert(range.first, state);
} else {
@@ -1065,10 +1065,9 @@ void DWARFDebugLine::State::Reset() { Ro
// DWARFDebugLine::State::AppendRowToMatrix
//----------------------------------------------------------------------
void DWARFDebugLine::State::AppendRowToMatrix(dw_offset_t offset) {
- // Each time we are to add an entry into the line table matrix
- // call the callback function so that someone can do something with
- // the current state of the state machine (like build a line table
- // or dump the line table!)
+ // Each time we are to add an entry into the line table matrix call the
+ // callback function so that someone can do something with the current state
+ // of the state machine (like build a line table or dump the line table!)
if (log) {
if (row == 0) {
log->PutCString("Address Line Column File ISA Flags");
@@ -1088,8 +1087,8 @@ void DWARFDebugLine::State::AppendRowToM
// DWARFDebugLine::State::Finalize
//----------------------------------------------------------------------
void DWARFDebugLine::State::Finalize(dw_offset_t offset) {
- // Call the callback with a special row state when we are done parsing a
- // line table
+ // Call the callback with a special row state when we are done parsing a line
+ // table
row = DoneParsingLineTable;
if (callback)
callback(offset, *this, callbackUserData);
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp Mon Apr 30 09:49:04 2018
@@ -89,8 +89,8 @@ void DWARFDebugRanges::Dump(Stream &s,
debug_ranges_data.ValidOffsetForDataOfSize(*offset_ptr, 2 * addr_size)) {
dw_addr_t begin = debug_ranges_data.GetMaxU64(offset_ptr, addr_size);
dw_addr_t end = debug_ranges_data.GetMaxU64(offset_ptr, addr_size);
- // Extend 4 byte addresses that consists of 32 bits of 1's to be 64 bits
- // of ones
+ // Extend 4 byte addresses that consists of 32 bits of 1's to be 64 bits of
+ // ones
if (begin == 0xFFFFFFFFull && addr_size == 4)
begin = LLDB_INVALID_ADDRESS;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp Mon Apr 30 09:49:04 2018
@@ -67,8 +67,8 @@ bool DWARFDeclContext::operator==(const
// First compare the tags before we do expensive name compares
for (pos = begin, rhs_pos = rhs_begin; pos != end; ++pos, ++rhs_pos) {
if (pos->tag != rhs_pos->tag) {
- // Check for DW_TAG_structure_type and DW_TAG_class_type as they are often
- // used interchangeably in GCC
+ // Check for DW_TAG_structure_type and DW_TAG_class_type as they are
+ // often used interchangeably in GCC
if (pos->tag == DW_TAG_structure_type &&
rhs_pos->tag == DW_TAG_class_type)
continue;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Mon Apr 30 09:49:04 2018
@@ -299,8 +299,8 @@ bool DWARFFormValue::SkipValue(dw_form_t
const DWARFUnit *cu) {
uint8_t ref_addr_size;
switch (form) {
- // Blocks if inlined data that have a length field and the data bytes
- // inlined in the .debug_info
+ // Blocks if inlined data that have a length field and the data bytes inlined
+ // in the .debug_info
case DW_FORM_exprloc:
case DW_FORM_block: {
dw_uleb128_t size = debug_info_data.GetULEB128(offset_ptr);
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Mon Apr 30 09:49:04 2018
@@ -38,8 +38,7 @@ DWARFUnit::~DWARFUnit() {}
//----------------------------------------------------------------------
// ParseCompileUnitDIEsIfNeeded
//
-// Parses a compile unit and indexes its DIEs if it hasn't already been
-// done.
+// Parses a compile unit and indexes its DIEs if it hasn't already been done.
//----------------------------------------------------------------------
size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) {
const size_t initial_die_array_size = m_die_array.size();
@@ -71,8 +70,8 @@ size_t DWARFUnit::ExtractDIEsIfNeeded(bo
}
uint32_t depth = 0;
- // We are in our compile unit, parse starting at the offset
- // we were told to parse
+ // We are in our compile unit, parse starting at the offset we were told to
+ // parse
const DWARFDataExtractor &debug_info_data = m_dwarf->get_debug_info_data();
std::vector<uint32_t> die_index_stack;
die_index_stack.reserve(32);
@@ -105,11 +104,10 @@ size_t DWARFUnit::ExtractDIEsIfNeeded(bo
} else {
if (null_die) {
if (prev_die_had_children) {
- // This will only happen if a DIE says is has children
- // but all it contains is a NULL tag. Since we are removing
- // the NULL DIEs from the list (saves up to 25% in C++ code),
- // we need a way to let the DIE know that it actually doesn't
- // have children.
+ // This will only happen if a DIE says is has children but all it
+ // contains is a NULL tag. Since we are removing the NULL DIEs from
+ // the list (saves up to 25% in C++ code), we need a way to let the
+ // DIE know that it actually doesn't have children.
if (!m_die_array.empty())
m_die_array.back().SetEmptyChildren(true);
}
@@ -148,9 +146,9 @@ size_t DWARFUnit::ExtractDIEsIfNeeded(bo
}
}
- // Give a little bit of info if we encounter corrupt DWARF (our offset
- // should always terminate at or before the start of the next compilation
- // unit header).
+ // Give a little bit of info if we encounter corrupt DWARF (our offset should
+ // always terminate at or before the start of the next compilation unit
+ // header).
if (offset > next_cu_offset) {
m_dwarf->GetObjectFile()->GetModule()->ReportWarning(
"DWARF compile unit extends beyond its bounds cu 0x%8.8x at "
@@ -158,10 +156,9 @@ size_t DWARFUnit::ExtractDIEsIfNeeded(bo
GetOffset(), offset);
}
- // Since std::vector objects will double their size, we really need to
- // make a new array with the perfect size so we don't end up wasting
- // space. So here we copy and swap to make sure we don't have any extra
- // memory taken up.
+ // Since std::vector objects will double their size, we really need to make a
+ // new array with the perfect size so we don't end up wasting space. So here
+ // we copy and swap to make sure we don't have any extra memory taken up.
if (m_die_array.size() < m_die_array.capacity()) {
DWARFDebugInfoEntry::collection exact_size_die_array(m_die_array.begin(),
@@ -196,8 +193,8 @@ void DWARFUnit::AddUnitDIE(DWARFDebugInf
// Only reserve the memory if we are adding children of the main compile unit
// DIE. The compile unit DIE is always the first entry, so if our size is 1,
- // then we are adding the first compile unit child DIE and should reserve
- // the memory.
+ // then we are adding the first compile unit child DIE and should reserve the
+ // memory.
m_die_array.reserve(GetDebugInfoSize() / 24);
m_die_array.push_back(die);
@@ -307,13 +304,12 @@ void DWARFUnit::SetAddrBase(dw_addr_t ad
void DWARFUnit::ClearDIEs(bool keep_compile_unit_die) {
if (m_die_array.size() > 1) {
- // std::vectors never get any smaller when resized to a smaller size,
- // or when clear() or erase() are called, the size will report that it
- // is smaller, but the memory allocated remains intact (call capacity()
- // to see this). So we need to create a temporary vector and swap the
- // contents which will cause just the internal pointers to be swapped
- // so that when "tmp_array" goes out of scope, it will destroy the
- // contents.
+ // std::vectors never get any smaller when resized to a smaller size, or
+ // when clear() or erase() are called, the size will report that it is
+ // smaller, but the memory allocated remains intact (call capacity() to see
+ // this). So we need to create a temporary vector and swap the contents
+ // which will cause just the internal pointers to be swapped so that when
+ // "tmp_array" goes out of scope, it will destroy the contents.
// Save at least the compile unit DIE
DWARFDebugInfoEntry::collection tmp_array;
@@ -328,9 +324,9 @@ void DWARFUnit::ClearDIEs(bool keep_comp
void DWARFUnit::BuildAddressRangeTable(SymbolFileDWARF *dwarf,
DWARFDebugAranges *debug_aranges) {
- // This function is usually called if there in no .debug_aranges section
- // in order to produce a compile unit level set of address ranges that
- // is accurate.
+ // This function is usually called if there in no .debug_aranges section in
+ // order to produce a compile unit level set of address ranges that is
+ // accurate.
size_t num_debug_aranges = debug_aranges->GetNumRanges();
@@ -343,10 +339,10 @@ void DWARFUnit::BuildAddressRangeTable(S
const size_t num_ranges =
die->GetAttributeAddressRanges(dwarf, this, ranges, false);
if (num_ranges > 0) {
- // This compile unit has DW_AT_ranges, assume this is correct if it
- // is present since clang no longer makes .debug_aranges by default
- // and it emits DW_AT_ranges for DW_TAG_compile_units. GCC also does
- // this with recent GCC builds.
+ // This compile unit has DW_AT_ranges, assume this is correct if it is
+ // present since clang no longer makes .debug_aranges by default and it
+ // emits DW_AT_ranges for DW_TAG_compile_units. GCC also does this with
+ // recent GCC builds.
for (size_t i = 0; i < num_ranges; ++i) {
const DWARFRangeList::Entry &range = ranges.GetEntryRef(i);
debug_aranges->AppendRange(cu_offset, range.GetRangeBase(),
@@ -359,9 +355,8 @@ void DWARFUnit::BuildAddressRangeTable(S
// We don't have a DW_AT_ranges attribute, so we need to parse the DWARF
// If the DIEs weren't parsed, then we don't want all dies for all compile
- // units
- // to stay loaded when they weren't needed. So we can end up parsing the DWARF
- // and then throwing them all away to keep memory usage down.
+ // units to stay loaded when they weren't needed. So we can end up parsing
+ // the DWARF and then throwing them all away to keep memory usage down.
const bool clear_dies = ExtractDIEsIfNeeded(false) > 1;
die = DIEPtr();
@@ -419,8 +414,8 @@ void DWARFUnit::BuildAddressRangeTable(S
}
}
- // Keep memory down by clearing DIEs if this generate function
- // caused them to be parsed
+ // Keep memory down by clearing DIEs if this generate function caused them to
+ // be parsed
if (clear_dies)
ClearDIEs(true);
}
@@ -456,10 +451,9 @@ static bool CompareDIEOffset(const DWARF
//----------------------------------------------------------------------
// GetDIE()
//
-// Get the DIE (Debug Information Entry) with the specified offset by
-// first checking if the DIE is contained within this compile unit and
-// grabbing the DIE from this compile unit. Otherwise we grab the DIE
-// from the DWARF file.
+// Get the DIE (Debug Information Entry) with the specified offset by first
+// checking if the DIE is contained within this compile unit and grabbing the
+// DIE from this compile unit. Otherwise we grab the DIE from the DWARF file.
//----------------------------------------------------------------------
DWARFDIE
DWARFUnit::GetDIE(dw_offset_t die_offset) {
@@ -515,8 +509,8 @@ bool DWARFUnit::Supports_DW_AT_APPLE_obj
}
bool DWARFUnit::DW_AT_decl_file_attributes_are_invalid() {
- // llvm-gcc makes completely invalid decl file attributes and won't ever
- // be fixed, so we need to know to ignore these.
+ // llvm-gcc makes completely invalid decl file attributes and won't ever be
+ // fixed, so we need to know to ignore these.
return GetProducer() == eProducerLLVMGCC;
}
@@ -602,8 +596,8 @@ uint32_t DWARFUnit::GetProducerVersionUp
return m_producer_version_update;
}
LanguageType DWARFUnit::LanguageTypeFromDWARF(uint64_t val) {
- // Note: user languages between lo_user and hi_user
- // must be handled explicitly here.
+ // Note: user languages between lo_user and hi_user must be handled
+ // explicitly here.
switch (val) {
case DW_LANG_Mips_Assembler:
return eLanguageTypeMipsAssembler;
@@ -851,8 +845,8 @@ void DWARFUnit::IndexPrivate(
func_fullnames.Insert(objc_fullname_no_category_name,
DIERef(cu_offset, die.GetOffset()));
}
- // If we have a mangled name, then the DW_AT_name attribute
- // is usually the method name without the class or any parameters
+ // If we have a mangled name, then the DW_AT_name attribute is
+ // usually the method name without the class or any parameters
const DWARFDebugInfoEntry *parent = die.GetParent();
bool is_method = false;
if (parent) {
@@ -883,10 +877,10 @@ void DWARFUnit::IndexPrivate(
DIERef(cu_offset, die.GetOffset()));
}
if (mangled_cstr) {
- // Make sure our mangled name isn't the same string table entry
- // as our name. If it starts with '_', then it is ok, else compare
- // the string to make sure it isn't the same and we don't end up
- // with duplicate entries
+ // Make sure our mangled name isn't the same string table entry as
+ // our name. If it starts with '_', then it is ok, else compare the
+ // string to make sure it isn't the same and we don't end up with
+ // duplicate entries
if (name && name != mangled_cstr &&
((mangled_cstr[0] == '_') ||
(::strcmp(name, mangled_cstr) != 0))) {
@@ -908,10 +902,10 @@ void DWARFUnit::IndexPrivate(
func_basenames.Insert(ConstString(name),
DIERef(cu_offset, die.GetOffset()));
if (mangled_cstr) {
- // Make sure our mangled name isn't the same string table entry
- // as our name. If it starts with '_', then it is ok, else compare
- // the string to make sure it isn't the same and we don't end up
- // with duplicate entries
+ // Make sure our mangled name isn't the same string table entry as
+ // our name. If it starts with '_', then it is ok, else compare the
+ // string to make sure it isn't the same and we don't end up with
+ // duplicate entries
if (name && name != mangled_cstr &&
((mangled_cstr[0] == '_') ||
(::strcmp(name, mangled_cstr) != 0))) {
@@ -956,15 +950,15 @@ void DWARFUnit::IndexPrivate(
case DW_TAG_variable:
if (name && has_location_or_const_value && is_global_or_static_variable) {
globals.Insert(ConstString(name), DIERef(cu_offset, die.GetOffset()));
- // Be sure to include variables by their mangled and demangled
- // names if they have any since a variable can have a basename
- // "i", a mangled named "_ZN12_GLOBAL__N_11iE" and a demangled
- // mangled name "(anonymous namespace)::i"...
-
- // Make sure our mangled name isn't the same string table entry
- // as our name. If it starts with '_', then it is ok, else compare
- // the string to make sure it isn't the same and we don't end up
- // with duplicate entries
+ // Be sure to include variables by their mangled and demangled names if
+ // they have any since a variable can have a basename "i", a mangled
+ // named "_ZN12_GLOBAL__N_11iE" and a demangled mangled name
+ // "(anonymous namespace)::i"...
+
+ // Make sure our mangled name isn't the same string table entry as our
+ // name. If it starts with '_', then it is ok, else compare the string
+ // to make sure it isn't the same and we don't end up with duplicate
+ // entries
if (mangled_cstr && name != mangled_cstr &&
((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) {
Mangled mangled(ConstString(mangled_cstr), true);
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp Mon Apr 30 09:49:04 2018
@@ -75,15 +75,14 @@ void DWARFMappedHash::ExtractClassOrStru
die_tag == DW_TAG_structure_type) {
if (die_info_array[i].type_flags & eTypeFlagClassIsImplementation) {
if (return_implementation_only_if_available) {
- // We found the one true definition for this class, so
- // only return that
+ // We found the one true definition for this class, so only return
+ // that
die_offsets.clear();
die_offsets.emplace_back(die_info_array[i].cu_offset,
die_info_array[i].offset);
return;
} else {
- // Put the one true definition as the first entry so it
- // matches first
+ // Put the one true definition as the first entry so it matches first
die_offsets.emplace(die_offsets.begin(), die_info_array[i].cu_offset,
die_info_array[i].offset);
}
@@ -137,9 +136,8 @@ DWARFMappedHash::DIEInfo::DIEInfo(dw_off
DWARFMappedHash::Prologue::Prologue(dw_offset_t _die_base_offset)
: die_base_offset(_die_base_offset), atoms(), atom_mask(0),
min_hash_data_byte_size(0), hash_data_has_fixed_byte_size(true) {
- // Define an array of DIE offsets by first defining an array,
- // and then define the atom type for the array, in this case
- // we have an array of DIE offsets
+ // Define an array of DIE offsets by first defining an array, and then define
+ // the atom type for the array, in this case we have an array of DIE offsets
AppendAtom(eAtomTypeDIEOffset, DW_FORM_data4);
}
@@ -239,8 +237,7 @@ DWARFMappedHash::Prologue::Read(const ll
size_t DWARFMappedHash::Prologue::GetByteSize() const {
// Add an extra count to the atoms size for the zero termination Atom that
- // gets
- // written to disk
+ // gets written to disk
return sizeof(die_base_offset) + sizeof(uint32_t) +
atoms.size() * sizeof(Atom);
}
@@ -384,13 +381,13 @@ DWARFMappedHash::MemoryTable::GetHashDat
pair.key = m_data.GetU32(hash_data_offset_ptr);
pair.value.clear();
- // If the key is zero, this terminates our chain of HashData objects
- // for this hash value.
+ // If the key is zero, this terminates our chain of HashData objects for this
+ // hash value.
if (pair.key == 0)
return eResultEndOfHashData;
- // There definitely should be a string for this string offset, if
- // there isn't, there is something wrong, return and error
+ // There definitely should be a string for this string offset, if there
+ // isn't, there is something wrong, return and error
const char *strp_cstr = m_string_table.PeekCStr(pair.key);
if (strp_cstr == NULL) {
*hash_data_offset_ptr = UINT32_MAX;
@@ -403,22 +400,21 @@ DWARFMappedHash::MemoryTable::GetHashDat
if (count > 0 &&
m_data.ValidOffsetForDataOfSize(*hash_data_offset_ptr,
min_total_hash_data_size)) {
- // We have at least one HashData entry, and we have enough
- // data to parse at least "count" HashData entries.
+ // We have at least one HashData entry, and we have enough data to parse at
+ // least "count" HashData entries.
// First make sure the entire C string matches...
const bool match = name == strp_cstr;
if (!match && m_header.header_data.HashDataHasFixedByteSize()) {
- // If the string doesn't match and we have fixed size data,
- // we can just add the total byte size of all HashData objects
- // to the hash data offset and be done...
+ // If the string doesn't match and we have fixed size data, we can just
+ // add the total byte size of all HashData objects to the hash data
+ // offset and be done...
*hash_data_offset_ptr += min_total_hash_data_size;
} else {
- // If the string does match, or we don't have fixed size data
- // then we need to read the hash data as a stream. If the
- // string matches we also append all HashData objects to the
- // value array.
+ // If the string does match, or we don't have fixed size data then we
+ // need to read the hash data as a stream. If the string matches we also
+ // append all HashData objects to the value array.
for (uint32_t i = 0; i < count; ++i) {
DIEInfo die_info;
if (m_header.Read(m_data, hash_data_offset_ptr, die_info)) {
@@ -432,16 +428,15 @@ DWARFMappedHash::MemoryTable::GetHashDat
}
}
}
- // Return the correct response depending on if the string matched
- // or not...
+ // Return the correct response depending on if the string matched or not...
if (match)
return eResultKeyMatch; // The key (cstring) matches and we have lookup
// results!
else
return eResultKeyMismatch; // The key doesn't match, this function will
// get called
- // again for the next key/value or the key terminator
- // which in our case is a zero .debug_str offset.
+ // again for the next key/value or the key terminator which in our case is
+ // a zero .debug_str offset.
} else {
*hash_data_offset_ptr = UINT32_MAX;
return eResultError;
@@ -453,13 +448,13 @@ DWARFMappedHash::MemoryTable::AppendHash
const lldb_private::RegularExpression ®ex,
lldb::offset_t *hash_data_offset_ptr, Pair &pair) const {
pair.key = m_data.GetU32(hash_data_offset_ptr);
- // If the key is zero, this terminates our chain of HashData objects
- // for this hash value.
+ // If the key is zero, this terminates our chain of HashData objects for this
+ // hash value.
if (pair.key == 0)
return eResultEndOfHashData;
- // There definitely should be a string for this string offset, if
- // there isn't, there is something wrong, return and error
+ // There definitely should be a string for this string offset, if there
+ // isn't, there is something wrong, return and error
const char *strp_cstr = m_string_table.PeekCStr(pair.key);
if (strp_cstr == NULL)
return eResultError;
@@ -473,15 +468,14 @@ DWARFMappedHash::MemoryTable::AppendHash
const bool match = regex.Execute(llvm::StringRef(strp_cstr));
if (!match && m_header.header_data.HashDataHasFixedByteSize()) {
- // If the regex doesn't match and we have fixed size data,
- // we can just add the total byte size of all HashData objects
- // to the hash data offset and be done...
+ // If the regex doesn't match and we have fixed size data, we can just
+ // add the total byte size of all HashData objects to the hash data
+ // offset and be done...
*hash_data_offset_ptr += min_total_hash_data_size;
} else {
- // If the string does match, or we don't have fixed size data
- // then we need to read the hash data as a stream. If the
- // string matches we also append all HashData objects to the
- // value array.
+ // If the string does match, or we don't have fixed size data then we
+ // need to read the hash data as a stream. If the string matches we also
+ // append all HashData objects to the value array.
for (uint32_t i = 0; i < count; ++i) {
DIEInfo die_info;
if (m_header.Read(m_data, hash_data_offset_ptr, die_info)) {
@@ -495,16 +489,15 @@ DWARFMappedHash::MemoryTable::AppendHash
}
}
}
- // Return the correct response depending on if the string matched
- // or not...
+ // Return the correct response depending on if the string matched or not...
if (match)
return eResultKeyMatch; // The key (cstring) matches and we have lookup
// results!
else
return eResultKeyMismatch; // The key doesn't match, this function will
// get called
- // again for the next key/value or the key terminator
- // which in our case is a zero .debug_str offset.
+ // again for the next key/value or the key terminator which in our case is
+ // a zero .debug_str offset.
} else {
*hash_data_offset_ptr = UINT32_MAX;
return eResultError;
@@ -529,8 +522,7 @@ size_t DWARFMappedHash::MemoryTable::App
switch (hash_result) {
case eResultKeyMatch:
case eResultKeyMismatch:
- // Whether we matches or not, it doesn't matter, we
- // keep looking.
+ // Whether we matches or not, it doesn't matter, we keep looking.
break;
case eResultEndOfHashData:
@@ -553,8 +545,8 @@ size_t DWARFMappedHash::MemoryTable::App
lldb::offset_t hash_data_offset = GetHashDataOffset(offset_idx);
while (!done && hash_data_offset != UINT32_MAX) {
KeyType key = m_data.GetU32(&hash_data_offset);
- // If the key is zero, this terminates our chain of HashData objects
- // for this hash value.
+ // If the key is zero, this terminates our chain of HashData objects for
+ // this hash value.
if (key == 0)
break;
@@ -610,17 +602,16 @@ size_t DWARFMappedHash::MemoryTable::Fin
if (FindByName(name, die_info_array)) {
if (must_be_implementation &&
GetHeader().header_data.ContainsAtom(eAtomTypeTypeFlags)) {
- // If we have two atoms, then we have the DIE offset and
- // the type flags so we can find the objective C class
- // efficiently.
+ // If we have two atoms, then we have the DIE offset and the type flags
+ // so we can find the objective C class efficiently.
DWARFMappedHash::ExtractTypesFromDIEArray(die_info_array, UINT32_MAX,
eTypeFlagClassIsImplementation,
die_offsets);
} else {
- // We don't only want the one true definition, so try and see
- // what we can find, and only return class or struct DIEs.
- // If we do have the full implementation, then return it alone,
- // else return all possible matches.
+ // We don't only want the one true definition, so try and see what we can
+ // find, and only return class or struct DIEs. If we do have the full
+ // implementation, then return it alone, else return all possible
+ // matches.
const bool return_implementation_only_if_available = true;
DWARFMappedHash::ExtractClassOrStructDIEArray(
die_info_array, return_implementation_only_if_available, die_offsets);
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Apr 30 09:49:04 2018
@@ -164,8 +164,8 @@ static const char *removeHostnameFromPat
return path_from_dwarf;
}
- // check whether we have a windows path, and so the first character
- // is a drive-letter not a hostname.
+ // check whether we have a windows path, and so the first character is a
+ // drive-letter not a hostname.
if (colon_pos == path_from_dwarf + 1 && isalpha(*path_from_dwarf) &&
strlen(path_from_dwarf) > 2 && '\\' == path_from_dwarf[2]) {
return path_from_dwarf;
@@ -503,15 +503,14 @@ uint32_t SymbolFileDWARF::CalculateAbili
if (section_list == NULL)
return 0;
- // On non Apple platforms we might have .debug_types debug info that
- // is created by using "-fdebug-types-section". LLDB currently will try
- // to load this debug info, but it causes crashes during debugging when
- // types are missing since it doesn't know how to parse the info in
- // the .debug_types type units. This causes all complex debug info
- // types to be unresolved. Because this causes LLDB to crash and since
- // it really doesn't provide a solid debuggiung experience, we should
- // disable trying to debug this kind of DWARF until support gets
- // added or deprecated.
+ // On non Apple platforms we might have .debug_types debug info that is
+ // created by using "-fdebug-types-section". LLDB currently will try to
+ // load this debug info, but it causes crashes during debugging when types
+ // are missing since it doesn't know how to parse the info in the
+ // .debug_types type units. This causes all complex debug info types to be
+ // unresolved. Because this causes LLDB to crash and since it really
+ // doesn't provide a solid debuggiung experience, we should disable trying
+ // to debug this kind of DWARF until support gets added or deprecated.
if (section_list->FindSectionByName(ConstString(".debug_types"))) {
m_obj_file->GetModule()->ReportWarning(
"lldb doesn’t support .debug_types debug info");
@@ -563,10 +562,10 @@ uint32_t SymbolFileDWARF::CalculateAbili
if (symfile_dir_cstr) {
if (strcasestr(symfile_dir_cstr, ".dsym")) {
if (m_obj_file->GetType() == ObjectFile::eTypeDebugInfo) {
- // We have a dSYM file that didn't have a any debug info.
- // If the string table has a size of 1, then it was made from
- // an executable with no debug info, or from an executable that
- // was stripped.
+ // We have a dSYM file that didn't have a any debug info. If the
+ // string table has a size of 1, then it was made from an
+ // executable with no debug info, or from an executable that was
+ // stripped.
section =
section_list->FindSectionByType(eSectionTypeDWARFDebugStr, true)
.get();
@@ -730,8 +729,8 @@ SymbolFileDWARF::GetDWARFCompileUnit(lld
DWARFDebugInfo *info = DebugInfo();
if (info) {
- // Just a normal DWARF file whose user ID for the compile unit is
- // the DWARF offset itself
+ // Just a normal DWARF file whose user ID for the compile unit is the DWARF
+ // offset itself
DWARFUnit *dwarf_cu =
info->GetCompileUnit((dw_offset_t)comp_unit->GetID());
@@ -784,8 +783,8 @@ lldb::CompUnitSP SymbolFileDWARF::ParseC
FileSpec cu_file_spec{cu_die.GetName(), false};
if (cu_file_spec) {
// If we have a full path to the compile unit, we don't need to
- // resolve
- // the file. This can be expensive e.g. when the source files are
+ // resolve the file. This can be expensive e.g. when the source
+ // files are
// NFS mounted.
if (cu_file_spec.IsRelative()) {
const char *cu_comp_dir{
@@ -808,10 +807,8 @@ lldb::CompUnitSP SymbolFileDWARF::ParseC
cu_language, is_optimized ? eLazyBoolYes : eLazyBoolNo));
if (cu_sp) {
// If we just created a compile unit with an invalid file spec,
- // try and get the
- // first entry in the supports files from the line table as that
- // should be the
- // compile unit.
+ // try and get the first entry in the supports files from the
+ // line table as that should be the compile unit.
if (!cu_file_spec) {
cu_file_spec = cu_sp->GetSupportFiles().GetFileSpecAtIndex(1);
if (cu_file_spec) {
@@ -1005,8 +1002,7 @@ static void ParseDWARFLineTableCallback(
(ParseDWARFLineTableCallbackInfo *)userData;
LineTable *line_table = info->line_table;
- // If this is our first time here, we need to create a
- // sequence container.
+ // If this is our first time here, we need to create a sequence container.
if (!info->sequence_ap.get()) {
info->sequence_ap.reset(line_table->CreateLineSequenceContainer());
assert(info->sequence_ap.get());
@@ -1070,10 +1066,10 @@ bool SymbolFileDWARF::ParseCompileUnitLi
&info);
SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();
if (debug_map_symfile) {
- // We have an object file that has a line table with addresses
- // that are not linked. We need to link the line table and convert
- // the addresses that are relative to the .o file into addresses
- // for the main executable.
+ // We have an object file that has a line table with addresses that
+ // are not linked. We need to link the line table and convert the
+ // addresses that are relative to the .o file into addresses for
+ // the main executable.
sc.comp_unit->SetLineTable(
debug_map_symfile->LinkOSOLineTable(this, line_table_ap.get()));
} else {
@@ -1149,9 +1145,9 @@ size_t SymbolFileDWARF::ParseFunctionBlo
case DW_TAG_lexical_block: {
Block *block = NULL;
if (tag == DW_TAG_subprogram) {
- // Skip any DW_TAG_subprogram DIEs that are inside
- // of a normal or inlined functions. These will be
- // parsed on their own as separate entities.
+ // Skip any DW_TAG_subprogram DIEs that are inside of a normal or
+ // inlined functions. These will be parsed on their own as separate
+ // entities.
if (depth > 0)
break;
@@ -1179,18 +1175,14 @@ size_t SymbolFileDWARF::ParseFunctionBlo
assert(subprogram_low_pc == LLDB_INVALID_ADDRESS);
subprogram_low_pc = ranges.GetMinRangeBase(0);
} else if (tag == DW_TAG_inlined_subroutine) {
- // We get called here for inlined subroutines in two ways.
- // The first time is when we are making the Function object
- // for this inlined concrete instance. Since we're creating a top
- // level block at
+ // We get called here for inlined subroutines in two ways. The first
+ // time is when we are making the Function object for this inlined
+ // concrete instance. Since we're creating a top level block at
// here, the subprogram_low_pc will be LLDB_INVALID_ADDRESS. So we
- // need to
- // adjust the containing address.
- // The second time is when we are parsing the blocks inside the
- // function that contains
- // the inlined concrete instance. Since these will be blocks inside
- // the containing "real"
- // function the offset will be for that function.
+ // need to adjust the containing address. The second time is when we
+ // are parsing the blocks inside the function that contains the
+ // inlined concrete instance. Since these will be blocks inside the
+ // containing "real" function the offset will be for that function.
if (subprogram_low_pc == LLDB_INVALID_ADDRESS) {
subprogram_low_pc = ranges.GetMinRangeBase(0);
}
@@ -1245,9 +1237,9 @@ size_t SymbolFileDWARF::ParseFunctionBlo
break;
}
- // Only parse siblings of the block if we are not at depth zero. A depth
- // of zero indicates we are currently parsing the top level
- // DW_TAG_subprogram DIE
+ // Only parse siblings of the block if we are not at depth zero. A depth of
+ // zero indicates we are currently parsing the top level DW_TAG_subprogram
+ // DIE
if (depth == 0)
die.Clear();
@@ -1293,12 +1285,12 @@ void SymbolFileDWARF::ParseDeclsForConte
}
SymbolFileDWARF *SymbolFileDWARF::GetDWARFForUID(lldb::user_id_t uid) {
- // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API
- // we must make sure we use the correct DWARF file when resolving things.
- // On MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple
- // SymbolFileDWARF classes, one for each .o file. We can often end up
- // with references to other DWARF objects and we must be ready to receive
- // a "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF
+ // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API we
+ // must make sure we use the correct DWARF file when resolving things. On
+ // MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple
+ // SymbolFileDWARF classes, one for each .o file. We can often end up with
+ // references to other DWARF objects and we must be ready to receive a
+ // "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF
// instance.
SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile();
if (debug_map)
@@ -1309,12 +1301,12 @@ SymbolFileDWARF *SymbolFileDWARF::GetDWA
DWARFDIE
SymbolFileDWARF::GetDIEFromUID(lldb::user_id_t uid) {
- // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API
- // we must make sure we use the correct DWARF file when resolving things.
- // On MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple
- // SymbolFileDWARF classes, one for each .o file. We can often end up
- // with references to other DWARF objects and we must be ready to receive
- // a "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF
+ // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API we
+ // must make sure we use the correct DWARF file when resolving things. On
+ // MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple
+ // SymbolFileDWARF classes, one for each .o file. We can often end up with
+ // references to other DWARF objects and we must be ready to receive a
+ // "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF
// instance.
SymbolFileDWARF *dwarf = GetDWARFForUID(uid);
if (dwarf)
@@ -1323,9 +1315,9 @@ SymbolFileDWARF::GetDIEFromUID(lldb::use
}
CompilerDecl SymbolFileDWARF::GetDeclForUID(lldb::user_id_t type_uid) {
- // Anytime we have a lldb::user_id_t, we must get the DIE by
- // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside
- // the SymbolFileDWARF::GetDIEFromUID() for details.
+ // Anytime we have a lldb::user_id_t, we must get the DIE by calling
+ // SymbolFileDWARF::GetDIEFromUID(). See comments inside the
+ // SymbolFileDWARF::GetDIEFromUID() for details.
DWARFDIE die = GetDIEFromUID(type_uid);
if (die)
return die.GetDecl();
@@ -1334,9 +1326,9 @@ CompilerDecl SymbolFileDWARF::GetDeclFor
CompilerDeclContext
SymbolFileDWARF::GetDeclContextForUID(lldb::user_id_t type_uid) {
- // Anytime we have a lldb::user_id_t, we must get the DIE by
- // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside
- // the SymbolFileDWARF::GetDIEFromUID() for details.
+ // Anytime we have a lldb::user_id_t, we must get the DIE by calling
+ // SymbolFileDWARF::GetDIEFromUID(). See comments inside the
+ // SymbolFileDWARF::GetDIEFromUID() for details.
DWARFDIE die = GetDIEFromUID(type_uid);
if (die)
return die.GetDeclContext();
@@ -1345,9 +1337,9 @@ SymbolFileDWARF::GetDeclContextForUID(ll
CompilerDeclContext
SymbolFileDWARF::GetDeclContextContainingUID(lldb::user_id_t type_uid) {
- // Anytime we have a lldb::user_id_t, we must get the DIE by
- // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside
- // the SymbolFileDWARF::GetDIEFromUID() for details.
+ // Anytime we have a lldb::user_id_t, we must get the DIE by calling
+ // SymbolFileDWARF::GetDIEFromUID(). See comments inside the
+ // SymbolFileDWARF::GetDIEFromUID() for details.
DWARFDIE die = GetDIEFromUID(type_uid);
if (die)
return die.GetContainingDeclContext();
@@ -1355,9 +1347,9 @@ SymbolFileDWARF::GetDeclContextContainin
}
Type *SymbolFileDWARF::ResolveTypeUID(lldb::user_id_t type_uid) {
- // Anytime we have a lldb::user_id_t, we must get the DIE by
- // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside
- // the SymbolFileDWARF::GetDIEFromUID() for details.
+ // Anytime we have a lldb::user_id_t, we must get the DIE by calling
+ // SymbolFileDWARF::GetDIEFromUID(). See comments inside the
+ // SymbolFileDWARF::GetDIEFromUID() for details.
DWARFDIE type_die = GetDIEFromUID(type_uid);
if (type_die)
return type_die.ResolveType();
@@ -1378,9 +1370,9 @@ Type *SymbolFileDWARF::ResolveTypeUID(co
log, "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s'",
die.GetOffset(), die.GetTagAsCString(), die.GetName());
- // We might be coming in in the middle of a type tree (a class
- // within a class, an enum within a class), so parse any needed
- // parent DIEs before we get to this one...
+ // We might be coming in in the middle of a type tree (a class within a
+ // class, an enum within a class), so parse any needed parent DIEs before
+ // we get to this one...
DWARFDIE decl_ctx_die = GetDeclContextDIEContainingDIE(die);
if (decl_ctx_die) {
if (log) {
@@ -1408,8 +1400,8 @@ Type *SymbolFileDWARF::ResolveTypeUID(co
}
// This function is used when SymbolFileDWARFDebugMap owns a bunch of
-// SymbolFileDWARF objects to detect if this DWARF file is the one that
-// can resolve a compiler_type.
+// SymbolFileDWARF objects to detect if this DWARF file is the one that can
+// resolve a compiler_type.
bool SymbolFileDWARF::HasForwardDeclForClangType(
const CompilerType &compiler_type) {
CompilerType compiler_type_no_qualifiers =
@@ -1455,12 +1447,10 @@ bool SymbolFileDWARF::CompleteType(Compi
DWARFDIE dwarf_die = GetDIE(die_it->getSecond());
if (dwarf_die) {
- // Once we start resolving this type, remove it from the forward declaration
- // map in case anyone child members or other types require this type to get
- // resolved.
- // The type will get resolved when all of the calls to
- // SymbolFileDWARF::ResolveClangOpaqueTypeDefinition
- // are done.
+ // Once we start resolving this type, remove it from the forward
+ // declaration map in case anyone child members or other types require this
+ // type to get resolved. The type will get resolved when all of the calls
+ // to SymbolFileDWARF::ResolveClangOpaqueTypeDefinition are done.
GetForwardDeclClangTypeToDie().erase(die_it);
Type *type = GetDIEToType().lookup(dwarf_die.GetDIE());
@@ -1505,8 +1495,8 @@ SymbolFileDWARF::GetCompUnitForDWARFComp
uint32_t cu_idx) {
// Check if the symbol vendor already knows about this compile unit?
if (dwarf_cu->GetUserData() == NULL) {
- // The symbol vendor doesn't know about this compile unit, we
- // need to parse and add it to the symbol vendor object.
+ // The symbol vendor doesn't know about this compile unit, we need to parse
+ // and add it to the symbol vendor object.
return ParseCompileUnit(dwarf_cu, cu_idx).get();
}
return (CompileUnit *)dwarf_cu->GetUserData();
@@ -1652,20 +1642,18 @@ void SymbolFileDWARF::UpdateExternalModu
dwo_module_spec.GetArchitecture() =
m_obj_file->GetModule()->GetArchitecture();
- // When LLDB loads "external" modules it looks at the
- // presence of DW_AT_GNU_dwo_name.
- // However, when the already created module
- // (corresponding to .dwo itself) is being processed,
- // it will see the presence of DW_AT_GNU_dwo_name
- // (which contains the name of dwo file) and
- // will try to call ModuleList::GetSharedModule again.
- // In some cases (i.e. for empty files) Clang 4.0
- // generates a *.dwo file which has DW_AT_GNU_dwo_name,
- // but no DW_AT_comp_dir. In this case the method
- // ModuleList::GetSharedModule will fail and
- // the warning will be printed. However, as one can notice
- // in this case we don't actually need to try to load the already
- // loaded module (corresponding to .dwo) so we simply skip it.
+ // When LLDB loads "external" modules it looks at the presence of
+ // DW_AT_GNU_dwo_name. However, when the already created module
+ // (corresponding to .dwo itself) is being processed, it will see
+ // the presence of DW_AT_GNU_dwo_name (which contains the name of
+ // dwo file) and will try to call ModuleList::GetSharedModule
+ // again. In some cases (i.e. for empty files) Clang 4.0 generates
+ // a *.dwo file which has DW_AT_GNU_dwo_name, but no
+ // DW_AT_comp_dir. In this case the method
+ // ModuleList::GetSharedModule will fail and the warning will be
+ // printed. However, as one can notice in this case we don't
+ // actually need to try to load the already loaded module
+ // (corresponding to .dwo) so we simply skip it.
if (m_obj_file->GetFileSpec()
.GetFileNameExtension()
.GetStringRef() == "dwo" &&
@@ -1759,13 +1747,11 @@ uint32_t SymbolFileDWARF::ResolveSymbolC
const dw_offset_t cu_offset =
debug_info->GetCompileUnitAranges().FindAddress(file_vm_addr);
if (cu_offset == DW_INVALID_OFFSET) {
- // Global variables are not in the compile unit address ranges. The only
- // way to
- // currently find global variables is to iterate over the
- // .debug_pubnames or the
- // __apple_names table and find all items in there that point to
- // DW_TAG_variable
- // DIEs and then find the address that matches.
+ // Global variables are not in the compile unit address ranges. The
+ // only way to currently find global variables is to iterate over the
+ // .debug_pubnames or the __apple_names table and find all items in
+ // there that point to DW_TAG_variable DIEs and then find the address
+ // that matches.
if (resolve_scope & eSymbolContextVariable) {
GlobalVariableMap &map = GetGlobalAranges();
const GlobalVariableMap::Entry *entry =
@@ -1833,13 +1819,10 @@ uint32_t SymbolFileDWARF::ResolveSymbolC
LineTable *line_table = sc.comp_unit->GetLineTable();
if (line_table != NULL) {
// And address that makes it into this function should be in
- // terms
- // of this debug file if there is no debug map, or it will be an
- // address in the .o file which needs to be fixed up to be in
- // terms
- // of the debug map executable. Either way, calling
- // FixupAddress()
- // will work for us.
+ // terms of this debug file if there is no debug map, or it
+ // will be an address in the .o file which needs to be fixed up
+ // to be in terms of the debug map executable. Either way,
+ // calling FixupAddress() will work for us.
Address exe_so_addr(so_addr);
if (FixupAddress(exe_so_addr)) {
if (line_table->FindLineEntryByAddress(exe_so_addr,
@@ -1853,11 +1836,11 @@ uint32_t SymbolFileDWARF::ResolveSymbolC
if (force_check_line_table &&
!(resolved & eSymbolContextLineEntry)) {
// We might have had a compile unit that had discontiguous
- // address ranges where the gaps are symbols that don't have
- // any debug info. Discontiguous compile unit address ranges
- // should only happen when there aren't other functions from
- // other compile units in these gaps. This helps keep the size
- // of the aranges down.
+ // address ranges where the gaps are symbols that don't have any
+ // debug info. Discontiguous compile unit address ranges should
+ // only happen when there aren't other functions from other
+ // compile units in these gaps. This helps keep the size of the
+ // aranges down.
sc.comp_unit = NULL;
resolved &= ~eSymbolContextCompUnit;
}
@@ -1899,8 +1882,8 @@ uint32_t SymbolFileDWARF::ResolveSymbolC
if (sc.comp_unit) {
uint32_t file_idx = UINT32_MAX;
- // If we are looking for inline functions only and we don't
- // find it in the support files, we are done.
+ // If we are looking for inline functions only and we don't find it
+ // in the support files, we are done.
if (check_inlines) {
file_idx = sc.comp_unit->GetSupportFiles().FindFileIndex(
1, file_spec, true);
@@ -1912,8 +1895,8 @@ uint32_t SymbolFileDWARF::ResolveSymbolC
LineTable *line_table = sc.comp_unit->GetLineTable();
if (line_table != NULL && line != 0) {
- // We will have already looked up the file index if
- // we are searching for inline entries.
+ // We will have already looked up the file index if we are
+ // searching for inline entries.
if (!check_inlines)
file_idx = sc.comp_unit->GetSupportFiles().FindFileIndex(
1, file_spec, true);
@@ -1970,16 +1953,14 @@ uint32_t SymbolFileDWARF::ResolveSymbolC
}
} else if (file_spec_matches_cu_file_spec && !check_inlines) {
// only append the context if we aren't looking for inline call
- // sites
- // by file and line and if the file spec matches that of the
- // compile unit
+ // sites by file and line and if the file spec matches that of
+ // the compile unit
sc_list.Append(sc);
}
} else if (file_spec_matches_cu_file_spec && !check_inlines) {
// only append the context if we aren't looking for inline call
- // sites
- // by file and line and if the file spec matches that of the
- // compile unit
+ // sites by file and line and if the file spec matches that of
+ // the compile unit
sc_list.Append(sc);
}
@@ -2044,8 +2025,8 @@ void SymbolFileDWARF::Index() {
auto extract_fn = [debug_info, &clear_cu_dies](size_t cu_idx) {
DWARFUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx);
if (dwarf_cu) {
- // dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the
- // DIEs for a compile unit have already been parsed.
+ // dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the DIEs
+ // for a compile unit have already been parsed.
if (dwarf_cu->ExtractDIEsIfNeeded(false) > 1)
clear_cu_dies[cu_idx] = true;
}
@@ -2056,17 +2037,15 @@ void SymbolFileDWARF::Index() {
//----------------------------------------------------------------------
// First figure out which compile units didn't have their DIEs already
// parsed and remember this. If no DIEs were parsed prior to this index
- // function call, we are going to want to clear the CU dies after we
- // are done indexing to make sure we don't pull in all DWARF dies, but
- // we need to wait until all compile units have been indexed in case
- // a DIE in one compile unit refers to another and the indexes accesses
- // those DIEs.
+ // function call, we are going to want to clear the CU dies after we are
+ // done indexing to make sure we don't pull in all DWARF dies, but we need
+ // to wait until all compile units have been indexed in case a DIE in one
+ // compile unit refers to another and the indexes accesses those DIEs.
//----------------------------------------------------------------------
TaskMapOverInt(0, num_compile_units, extract_fn);
// Now create a task runner that can index each DWARF compile unit in a
- // separate
- // thread so we can index quickly.
+ // separate thread so we can index quickly.
TaskMapOverInt(0, num_compile_units, parser_fn);
@@ -2130,9 +2109,9 @@ void SymbolFileDWARF::Index() {
bool SymbolFileDWARF::DeclContextMatchesThisSymbolFile(
const lldb_private::CompilerDeclContext *decl_ctx) {
if (decl_ctx == nullptr || !decl_ctx->IsValid()) {
- // Invalid namespace decl which means we aren't matching only things
- // in this symbol file, so return true to indicate it matches this
- // symbol file.
+ // Invalid namespace decl which means we aren't matching only things in
+ // this symbol file, so return true to indicate it matches this symbol
+ // file.
return true;
}
@@ -2175,8 +2154,8 @@ uint32_t SymbolFileDWARF::FindGlobalVari
if (!append)
variables.Clear();
- // Remember how many variables are in the list before we search in case
- // we are appending the results to a variable list.
+ // Remember how many variables are in the list before we search in case we
+ // are appending the results to a variable list.
const uint32_t original_size = variables.GetSize();
DIEArray die_offsets;
@@ -2285,8 +2264,8 @@ uint32_t SymbolFileDWARF::FindGlobalVari
if (!append)
variables.Clear();
- // Remember how many variables are in the list before we search in case
- // we are appending the results to a variable list.
+ // Remember how many variables are in the list before we search in case we
+ // are appending the results to a variable list.
const uint32_t original_size = variables.GetSize();
DIEArray die_offsets;
@@ -2443,9 +2422,8 @@ void SymbolFileDWARF::ParseFunctions(con
bool SymbolFileDWARF::DIEInDeclContext(const CompilerDeclContext *decl_ctx,
const DWARFDIE &die) {
// If we have no parent decl context to match this DIE matches, and if the
- // parent
- // decl context isn't valid, we aren't trying to look for any particular decl
- // context so any die matches.
+ // parent decl context isn't valid, we aren't trying to look for any
+ // particular decl context so any die matches.
if (decl_ctx == nullptr || !decl_ctx->IsValid())
return true;
@@ -2494,8 +2472,8 @@ SymbolFileDWARF::FindFunctions(const Con
if (name.IsEmpty())
return 0;
- // Remember how many sc_list are in the list before we search in case
- // we are appending the results to a variable list.
+ // Remember how many sc_list are in the list before we search in case we are
+ // appending the results to a variable list.
const uint32_t original_size = sc_list.GetSize();
@@ -2513,10 +2491,8 @@ SymbolFileDWARF::FindFunctions(const Con
if (name_type_mask & eFunctionNameTypeFull) {
// If they asked for the full name, match what they typed. At some
- // point we may
- // want to canonicalize this (strip double spaces, etc. For now, we
- // just add all the
- // dies that we find by exact match.
+ // point we may want to canonicalize this (strip double spaces, etc.
+ // For now, we just add all the dies that we find by exact match.
num_matches =
m_apple_names_ap->FindByName(name.GetStringRef(), die_offsets);
for (uint32_t i = 0; i < num_matches; i++) {
@@ -2546,8 +2522,8 @@ SymbolFileDWARF::FindFunctions(const Con
num_matches =
m_apple_names_ap->FindByName(name.GetStringRef(), die_offsets);
// Now make sure these are actually ObjC methods. In this case we can
- // simply look up the name,
- // and if it is an ObjC method name, we're good.
+ // simply look up the name, and if it is an ObjC method name, we're
+ // good.
for (uint32_t i = 0; i < num_matches; i++) {
const DIERef &die_ref = die_offsets[i];
@@ -2573,10 +2549,9 @@ SymbolFileDWARF::FindFunctions(const Con
if (((name_type_mask & eFunctionNameTypeMethod) && !parent_decl_ctx) ||
name_type_mask & eFunctionNameTypeBase) {
// The apple_names table stores just the "base name" of C++ methods in
- // the table. So we have to
- // extract the base name, look that up, and if there is any other
- // information in the name we were
- // passed in we have to post-filter based on that.
+ // the table. So we have to extract the base name, look that up, and
+ // if there is any other information in the name we were passed in we
+ // have to post-filter based on that.
// FIXME: Arrange the logic above so that we don't calculate the base
// name twice:
@@ -2597,8 +2572,8 @@ SymbolFileDWARF::FindFunctions(const Con
if ((name_type_mask &
(eFunctionNameTypeBase | eFunctionNameTypeMethod)) !=
(eFunctionNameTypeBase | eFunctionNameTypeMethod)) {
- // We are looking for either basenames or methods, so we need to
- // trim out the ones we won't want by looking at the type
+ // We are looking for either basenames or methods, so we need
+ // to trim out the ones we won't want by looking at the type
SymbolContext sc;
if (sc_list.GetLastContext(sc)) {
if (sc.block) {
@@ -2651,14 +2626,13 @@ SymbolFileDWARF::FindFunctions(const Con
FindFunctions(name, m_function_fullname_index, include_inlines, sc_list);
// FIXME Temporary workaround for global/anonymous namespace
- // functions debugging FreeBSD and Linux binaries.
- // If we didn't find any functions in the global namespace try
- // looking in the basename index but ignore any returned
- // functions that have a namespace but keep functions which
- // have an anonymous namespace
+ // functions debugging FreeBSD and Linux binaries. If we didn't find any
+ // functions in the global namespace try looking in the basename index
+ // but ignore any returned functions that have a namespace but keep
+ // functions which have an anonymous namespace
// TODO: The arch in the object file isn't correct for MSVC
- // binaries on windows, we should find a way to make it
- // correct and handle those symbols as well.
+ // binaries on windows, we should find a way to make it correct and
+ // handle those symbols as well.
if (sc_list.GetSize() == original_size) {
ArchSpec arch;
if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) &&
@@ -2764,8 +2738,8 @@ uint32_t SymbolFileDWARF::FindFunctions(
if (!append)
sc_list.Clear();
- // Remember how many sc_list are in the list before we search in case
- // we are appending the results to a variable list.
+ // Remember how many sc_list are in the list before we search in case we are
+ // appending the results to a variable list.
uint32_t original_size = sc_list.GetSize();
if (m_using_apple_tables) {
@@ -3016,8 +2990,8 @@ SymbolFileDWARF::FindNamespace(const Sym
if (info) {
DIEArray die_offsets;
- // Index if we already haven't to make sure the compile units
- // get indexed and make their global DIE index list
+ // Index if we already haven't to make sure the compile units get indexed
+ // and make their global DIE index list
if (m_using_apple_tables) {
if (m_apple_namespaces_ap.get()) {
m_apple_namespaces_ap->FindByName(name.GetStringRef(), die_offsets);
@@ -3166,12 +3140,10 @@ SymbolFileDWARF::GetObjCClassSymbol(cons
}
// Some compilers don't emit the DW_AT_APPLE_objc_complete_type attribute. If
-// they don't
-// then we can end up looking through all class types for a complete type and
-// never find
-// the full definition. We need to know if this attribute is supported, so we
-// determine
-// this here and cache th result. We also need to worry about the debug map
+// they don't then we can end up looking through all class types for a complete
+// type and never find the full definition. We need to know if this attribute
+// is supported, so we determine this here and cache th result. We also need to
+// worry about the debug map
// DWARF file
// if we are doing darwin DWARF in .o file debugging.
bool SymbolFileDWARF::Supports_DW_AT_APPLE_objc_complete_type(
@@ -3234,7 +3206,8 @@ TypeSP SymbolFileDWARF::FindCompleteObjC
if (type_die) {
bool try_resolving_type = false;
- // Don't try and resolve the DIE we are looking for with the DIE itself!
+ // Don't try and resolve the DIE we are looking for with the DIE
+ // itself!
if (type_die != die) {
switch (type_die.Tag()) {
case DW_TAG_class_type:
@@ -3283,16 +3256,15 @@ TypeSP SymbolFileDWARF::FindCompleteObjC
}
//----------------------------------------------------------------------
-// This function helps to ensure that the declaration contexts match for
-// two different DIEs. Often times debug information will refer to a
-// forward declaration of a type (the equivalent of "struct my_struct;".
-// There will often be a declaration of that type elsewhere that has the
-// full definition. When we go looking for the full type "my_struct", we
-// will find one or more matches in the accelerator tables and we will
-// then need to make sure the type was in the same declaration context
-// as the original DIE. This function can efficiently compare two DIEs
-// and will return true when the declaration context matches, and false
-// when they don't.
+// This function helps to ensure that the declaration contexts match for two
+// different DIEs. Often times debug information will refer to a forward
+// declaration of a type (the equivalent of "struct my_struct;". There will
+// often be a declaration of that type elsewhere that has the full definition.
+// When we go looking for the full type "my_struct", we will find one or more
+// matches in the accelerator tables and we will then need to make sure the
+// type was in the same declaration context as the original DIE. This function
+// can efficiently compare two DIEs and will return true when the declaration
+// context matches, and false when they don't.
//----------------------------------------------------------------------
bool SymbolFileDWARF::DIEDeclContextsMatch(const DWARFDIE &die1,
const DWARFDIE &die2) {
@@ -3301,32 +3273,31 @@ bool SymbolFileDWARF::DIEDeclContextsMat
DWARFDIECollection decl_ctx_1;
DWARFDIECollection decl_ctx_2;
- // The declaration DIE stack is a stack of the declaration context
- // DIEs all the way back to the compile unit. If a type "T" is
- // declared inside a class "B", and class "B" is declared inside
- // a class "A" and class "A" is in a namespace "lldb", and the
- // namespace is in a compile unit, there will be a stack of DIEs:
+ // The declaration DIE stack is a stack of the declaration context DIEs all
+ // the way back to the compile unit. If a type "T" is declared inside a class
+ // "B", and class "B" is declared inside a class "A" and class "A" is in a
+ // namespace "lldb", and the namespace is in a compile unit, there will be a
+ // stack of DIEs:
//
// [0] DW_TAG_class_type for "B"
// [1] DW_TAG_class_type for "A"
// [2] DW_TAG_namespace for "lldb"
// [3] DW_TAG_compile_unit or DW_TAG_partial_unit for the source file.
//
- // We grab both contexts and make sure that everything matches
- // all the way back to the compiler unit.
+ // We grab both contexts and make sure that everything matches all the way
+ // back to the compiler unit.
// First lets grab the decl contexts for both DIEs
die1.GetDeclContextDIEs(decl_ctx_1);
die2.GetDeclContextDIEs(decl_ctx_2);
- // Make sure the context arrays have the same size, otherwise
- // we are done
+ // Make sure the context arrays have the same size, otherwise we are done
const size_t count1 = decl_ctx_1.Size();
const size_t count2 = decl_ctx_2.Size();
if (count1 != count2)
return false;
- // Make sure the DW_TAG values match all the way back up the
- // compile unit. If they don't, then we are done.
+ // Make sure the DW_TAG values match all the way back up the compile unit. If
+ // they don't, then we are done.
DWARFDIE decl_ctx_die1;
DWARFDIE decl_ctx_die2;
size_t i;
@@ -3339,27 +3310,28 @@ bool SymbolFileDWARF::DIEDeclContextsMat
#if defined LLDB_CONFIGURATION_DEBUG
// Make sure the top item in the decl context die array is always
- // DW_TAG_compile_unit or DW_TAG_partial_unit. If it isn't then something
- // went wrong in the DWARFDIE::GetDeclContextDIEs() function...
+ // DW_TAG_compile_unit or DW_TAG_partial_unit. If it isn't then
+ // something went wrong in the DWARFDIE::GetDeclContextDIEs()
+ // function.
dw_tag_t cu_tag = decl_ctx_1.GetDIEAtIndex(count1 - 1).Tag();
UNUSED_IF_ASSERT_DISABLED(cu_tag);
assert(cu_tag == DW_TAG_compile_unit || cu_tag == DW_TAG_partial_unit);
#endif
- // Always skip the compile unit when comparing by only iterating up to
- // "count - 1". Here we compare the names as we go.
+ // Always skip the compile unit when comparing by only iterating up to "count
+ // - 1". Here we compare the names as we go.
for (i = 0; i < count1 - 1; i++) {
decl_ctx_die1 = decl_ctx_1.GetDIEAtIndex(i);
decl_ctx_die2 = decl_ctx_2.GetDIEAtIndex(i);
const char *name1 = decl_ctx_die1.GetName();
const char *name2 = decl_ctx_die2.GetName();
- // If the string was from a DW_FORM_strp, then the pointer will often
- // be the same!
+ // If the string was from a DW_FORM_strp, then the pointer will often be
+ // the same!
if (name1 == name2)
continue;
- // Name pointers are not equal, so only compare the strings
- // if both are not NULL.
+ // Name pointers are not equal, so only compare the strings if both are not
+ // NULL.
if (name1 && name2) {
// If the strings don't compare, we are done...
if (strcmp(name1, name2) != 0)
@@ -3369,8 +3341,8 @@ bool SymbolFileDWARF::DIEDeclContextsMat
return false;
}
}
- // We made it through all of the checks and the declaration contexts
- // are equal.
+ // We made it through all of the checks and the declaration contexts are
+ // equal.
return true;
}
@@ -3432,10 +3404,9 @@ TypeSP SymbolFileDWARF::FindDefinitionTy
const size_t num_matches = die_offsets.size();
- // Get the type system that we are looking to find a type for. We will use
- // this
- // to ensure any matches we find are in a language that this type system
- // supports
+ // Get the type system that we are looking to find a type for. We will
+ // use this to ensure any matches we find are in a language that this
+ // type system supports
const LanguageType language = dwarf_decl_ctx.GetLanguage();
TypeSystem *type_system = (language == eLanguageTypeUnknown)
? nullptr
@@ -3448,10 +3419,8 @@ TypeSP SymbolFileDWARF::FindDefinitionTy
if (type_die) {
// Make sure type_die's langauge matches the type system we are
- // looking for.
- // We don't want to find a "Foo" type from Java if we are looking
- // for a "Foo"
- // type for C, C++, ObjC, or ObjC++.
+ // looking for. We don't want to find a "Foo" type from Java if we
+ // are looking for a "Foo" type for C, C++, ObjC, or ObjC++.
if (type_system &&
!type_system->SupportsLanguage(type_die.GetLanguage()))
continue;
@@ -3465,24 +3434,23 @@ TypeSP SymbolFileDWARF::FindDefinitionTy
// The tags match, lets try resolving this type
try_resolving_type = true;
} else {
- // The tags don't match, but we need to watch our for a
- // forward declaration for a struct and ("struct foo")
- // ends up being a class ("class foo { ... };") or
- // vice versa.
+ // The tags don't match, but we need to watch our for a forward
+ // declaration for a struct and ("struct foo") ends up being a
+ // class ("class foo { ... };") or vice versa.
switch (type_tag) {
case DW_TAG_class_type:
- // We had a "class foo", see if we ended up with a "struct foo {
- // ... };"
+ // We had a "class foo", see if we ended up with a "struct foo
+ // { ... };"
try_resolving_type = (tag == DW_TAG_structure_type);
break;
case DW_TAG_structure_type:
- // We had a "struct foo", see if we ended up with a "class foo {
- // ... };"
+ // We had a "struct foo", see if we ended up with a "class foo
+ // { ... };"
try_resolving_type = (tag == DW_TAG_class_type);
break;
default:
- // Tags don't match, don't event try to resolve
- // using this type whose name matches....
+ // Tags don't match, don't event try to resolve using this type
+ // whose name matches....
break;
}
}
@@ -3693,8 +3661,8 @@ size_t SymbolFileDWARF::ParseVariablesFo
}
}
} else {
- // Index if we already haven't to make sure the compile units
- // get indexed and make their global DIE index list
+ // Index if we already haven't to make sure the compile units get
+ // indexed and make their global DIE index list
if (!m_indexed)
Index();
@@ -3910,10 +3878,9 @@ VariableSP SymbolFileDWARF::ParseVariabl
// TODO: Handle the case when DW_AT_start_scope have form
// constant. The
// dwarf spec is a bit ambiguous about what is the expected
- // behavior in
- // case the enclosing block have a non coninious address range and
- // the
- // DW_AT_start_scope entry have a form constant.
+ // behavior in case the enclosing block have a non coninious
+ // address range and the DW_AT_start_scope entry have a form
+ // constant.
GetObjectFile()->GetModule()->ReportWarning(
"0x%8.8" PRIx64
": DW_AT_start_scope has unsupported form type (0x%x)\n",
@@ -3958,16 +3925,15 @@ VariableSP SymbolFileDWARF::ParseVariabl
bool has_explicit_mangled = mangled != nullptr;
if (!mangled) {
// LLDB relies on the mangled name (DW_TAG_linkage_name or
- // DW_AT_MIPS_linkage_name) to
- // generate fully qualified names of global variables with commands like
- // "frame var j".
- // For example, if j were an int variable holding a value 4 and declared
- // in a namespace
- // B which in turn is contained in a namespace A, the command "frame var
- // j" returns
- // "(int) A::B::j = 4". If the compiler does not emit a linkage name, we
- // should be able
- // to generate a fully qualified name from the declaration context.
+ // DW_AT_MIPS_linkage_name) to generate fully qualified names
+ // of global variables with commands like "frame var j". For
+ // example, if j were an int variable holding a value 4 and
+ // declared in a namespace B which in turn is contained in a
+ // namespace A, the command "frame var j" returns
+ // "(int) A::B::j = 4".
+ // If the compiler does not emit a linkage name, we should be
+ // able to generate a fully qualified name from the
+ // declaration context.
if ((parent_tag == DW_TAG_compile_unit ||
parent_tag == DW_TAG_partial_unit) &&
Language::LanguageIsCPlusPlus(die.GetLanguage())) {
@@ -4017,24 +3983,21 @@ VariableSP SymbolFileDWARF::ParseVariabl
scope = eValueTypeVariableStatic;
if (debug_map_symfile) {
- // When leaving the DWARF in the .o files on darwin,
- // when we have a global variable that wasn't initialized,
- // the .o file might not have allocated a virtual
- // address for the global variable. In this case it will
- // have created a symbol for the global variable
- // that is undefined/data and external and the value will
- // be the byte size of the variable. When we do the
- // address map in SymbolFileDWARFDebugMap we rely on
- // having an address, we need to do some magic here
- // so we can get the correct address for our global
- // variable. The address for all of these entries
- // will be zero, and there will be an undefined symbol
- // in this object file, and the executable will have
- // a matching symbol with a good address. So here we
- // dig up the correct address and replace it in the
- // location for the variable, and set the variable's
- // symbol context scope to be that of the main executable
- // so the file address will resolve correctly.
+ // When leaving the DWARF in the .o files on darwin, when we have a
+ // global variable that wasn't initialized, the .o file might not
+ // have allocated a virtual address for the global variable. In
+ // this case it will have created a symbol for the global variable
+ // that is undefined/data and external and the value will be the
+ // byte size of the variable. When we do the address map in
+ // SymbolFileDWARFDebugMap we rely on having an address, we need to
+ // do some magic here so we can get the correct address for our
+ // global variable. The address for all of these entries will be
+ // zero, and there will be an undefined symbol in this object file,
+ // and the executable will have a matching symbol with a good
+ // address. So here we dig up the correct address and replace it in
+ // the location for the variable, and set the variable's symbol
+ // context scope to be that of the main executable so the file
+ // address will resolve correctly.
bool linked_oso_file_addr = false;
if (is_external && location_DW_OP_addr == 0) {
// we have a possible uninitialized extern global
@@ -4066,8 +4029,7 @@ VariableSP SymbolFileDWARF::ParseVariabl
if (!linked_oso_file_addr) {
// The DW_OP_addr is not zero, but it contains a .o file address
- // which
- // needs to be linked up correctly.
+ // which needs to be linked up correctly.
const lldb::addr_t exe_file_addr =
debug_map_symfile->LinkOSOFileAddress(this,
location_DW_OP_addr);
@@ -4137,16 +4099,16 @@ VariableSP SymbolFileDWARF::ParseVariabl
var_sp->SetLocationIsConstantValueData(location_is_const_value_data);
} else {
- // Not ready to parse this variable yet. It might be a global
- // or static variable that is in a function scope and the function
- // in the symbol context wasn't filled in yet
+ // Not ready to parse this variable yet. It might be a global or static
+ // variable that is in a function scope and the function in the symbol
+ // context wasn't filled in yet
return var_sp;
}
}
- // Cache var_sp even if NULL (the variable was just a specification or
- // was missing vital information to be able to be displayed in the debugger
- // (missing location due to optimization, etc)) so we don't re-parse
- // this DIE over and over later...
+ // Cache var_sp even if NULL (the variable was just a specification or was
+ // missing vital information to be able to be displayed in the debugger
+ // (missing location due to optimization, etc)) so we don't re-parse this
+ // DIE over and over later...
GetDIEToVariable()[die.GetDIE()] = var_sp;
if (spec_die)
GetDIEToVariable()[spec_die.GetDIE()] = var_sp;
@@ -4254,8 +4216,8 @@ size_t SymbolFileDWARF::ParseVariables(c
Block *block = sc.function->GetBlock(true).FindBlockByID(
sc_parent_die.GetID());
if (block == NULL) {
- // This must be a specification or abstract origin with
- // a concrete block counterpart in the current function. We need
+ // This must be a specification or abstract origin with a
+ // concrete block counterpart in the current function. We need
// to find the concrete block so we can correctly add the
// variable to it
const DWARFDIE concrete_block_die =
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Mon Apr 30 09:49:04 2018
@@ -44,10 +44,8 @@ using namespace lldb;
using namespace lldb_private;
// Subclass lldb_private::Module so we can intercept the
-// "Module::GetObjectFile()"
-// (so we can fixup the object file sections) and also for
-// "Module::GetSymbolVendor()"
-// (so we can fixup the symbol file id.
+// "Module::GetObjectFile()" (so we can fixup the object file sections) and
+// also for "Module::GetSymbolVendor()" (so we can fixup the symbol file id.
const SymbolFileDWARFDebugMap::FileRangeMap &
SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(
@@ -84,8 +82,8 @@ SymbolFileDWARFDebugMap::CompileUnitInfo
/// const uint32_t fun_resolve_flags = SymbolContext::Module |
/// eSymbolContextCompUnit | eSymbolContextFunction;
// SectionList *oso_sections = oso_objfile->Sections();
- // Now we need to make sections that map from zero based object
- // file addresses to where things ended up in the main executable.
+ // Now we need to make sections that map from zero based object file
+ // addresses to where things ended up in the main executable.
assert(comp_unit_info->first_symbol_index != UINT32_MAX);
// End index is one past the last valid symbol index
@@ -104,9 +102,9 @@ SymbolFileDWARFDebugMap::CompileUnitInfo
break;
case eSymbolTypeCode: {
- // For each N_FUN, or function that we run into in the debug map
- // we make a new section that we add to the sections found in the
- // .o file. This new section has the file address set to what the
+ // For each N_FUN, or function that we run into in the debug map we
+ // make a new section that we add to the sections found in the .o
+ // file. This new section has the file address set to what the
// addresses are in the .o file, and the load address is adjusted
// to match where it ended up in the final executable! We do this
// before we parse any dwarf info so that when it goes get parsed
@@ -129,21 +127,21 @@ SymbolFileDWARFDebugMap::CompileUnitInfo
} break;
case eSymbolTypeData: {
- // For each N_GSYM we remap the address for the global by making
- // a new section that we add to the sections found in the .o file.
- // This new section has the file address set to what the
- // addresses are in the .o file, and the load address is adjusted
- // to match where it ended up in the final executable! We do this
- // before we parse any dwarf info so that when it goes get parsed
- // all section/offset addresses that get registered will resolve
+ // For each N_GSYM we remap the address for the global by making a
+ // new section that we add to the sections found in the .o file.
+ // This new section has the file address set to what the addresses
+ // are in the .o file, and the load address is adjusted to match
+ // where it ended up in the final executable! We do this before we
+ // parse any dwarf info so that when it goes get parsed all
+ // section/offset addresses that get registered will resolve
// correctly to the new addresses in the main executable. We
// initially set the section size to be 1 byte, but will need to
// fix up these addresses further after all globals have been
// parsed to span the gaps, or we can find the global variable
// sizes from the DWARF info as we are parsing.
- // Next we find the non-stab entry that corresponds to the N_GSYM in
- // the .o file
+ // Next we find the non-stab entry that corresponds to the N_GSYM
+ // in the .o file
Symbol *oso_gsym_symbol =
oso_symtab->FindFirstSymbolWithNameAndType(
exe_symbol->GetMangled().GetName(lldb::eLanguageTypeUnknown,
@@ -198,9 +196,9 @@ public:
SymbolVendor *symbol_vendor =
Module::GetSymbolVendor(can_create, feedback_strm);
if (symbol_vendor) {
- // Set a pointer to this class to set our OSO DWARF file know
- // that the DWARF is being used along with a debug map and that
- // it will have the remapped sections that we do below.
+ // Set a pointer to this class to set our OSO DWARF file know that
+ // the DWARF is being used along with a debug map and that it will
+ // have the remapped sections that we do below.
SymbolFileDWARF *oso_symfile =
SymbolFileDWARFDebugMap::GetSymbolFileAsSymbolFileDWARF(
symbol_vendor->GetSymbolFile());
@@ -292,8 +290,8 @@ void SymbolFileDWARFDebugMap::InitOSO()
// In order to get the abilities of this plug-in, we look at the list of
// N_OSO entries (object files) from the symbol table and make sure that
- // these files exist and also contain valid DWARF. If we get any of that
- // then we return the abilities of the first N_OSO's DWARF.
+ // these files exist and also contain valid DWARF. If we get any of that then
+ // we return the abilities of the first N_OSO's DWARF.
Symtab *symtab = m_obj_file->GetSymtab();
if (symtab) {
@@ -303,10 +301,10 @@ void SymbolFileDWARFDebugMap::InitOSO()
// When a mach-o symbol is encoded, the n_type field is encoded in bits
// 23:16, and the n_desc field is encoded in bits 15:0.
//
- // To find all N_OSO entries that are part of the DWARF + debug map
- // we find only object file symbols with the flags value as follows:
- // bits 23:16 == 0x66 (N_OSO)
- // bits 15: 0 == 0x0001 (specifies this is a debug map object file)
+ // To find all N_OSO entries that are part of the DWARF + debug map we find
+ // only object file symbols with the flags value as follows: bits 23:16 ==
+ // 0x66 (N_OSO) bits 15: 0 == 0x0001 (specifies this is a debug map object
+ // file)
const uint32_t k_oso_symbol_flags_value = 0x660001u;
const uint32_t oso_index_count =
@@ -443,16 +441,15 @@ Module *SymbolFileDWARFDebugMap::GetModu
return NULL;
}
}
- // Always create a new module for .o files. Why? Because we
- // use the debug map, to add new sections to each .o file and
- // even though a .o file might not have changed, the sections
- // that get added to the .o file can change.
+ // Always create a new module for .o files. Why? Because we use the debug
+ // map, to add new sections to each .o file and even though a .o file
+ // might not have changed, the sections that get added to the .o file can
+ // change.
ArchSpec oso_arch;
// Only adopt the architecture from the module (not the vendor or OS)
- // since .o files for "i386-apple-ios" will historically show up as
- // "i386-apple-macosx"
- // due to the lack of a LC_VERSION_MIN_MACOSX or LC_VERSION_MIN_IPHONEOS
- // load command...
+ // since .o files for "i386-apple-ios" will historically show up as "i386
+ // -apple-macosx" due to the lack of a LC_VERSION_MIN_MACOSX or
+ // LC_VERSION_MIN_IPHONEOS load command...
oso_arch.SetTriple(m_obj_file->GetModule()
->GetArchitecture()
.GetTriple()
@@ -546,8 +543,8 @@ SymbolFileDWARF *SymbolFileDWARFDebugMap
uint32_t SymbolFileDWARFDebugMap::CalculateAbilities() {
// In order to get the abilities of this plug-in, we look at the list of
// N_OSO entries (object files) from the symbol table and make sure that
- // these files exist and also contain valid DWARF. If we get any of that
- // then we return the abilities of the first N_OSO's DWARF.
+ // these files exist and also contain valid DWARF. If we get any of that then
+ // we return the abilities of the first N_OSO's DWARF.
const uint32_t oso_index_count = GetNumCompileUnits();
if (oso_index_count > 0) {
@@ -576,9 +573,8 @@ CompUnitSP SymbolFileDWARFDebugMap::Pars
if (oso_module) {
FileSpec so_file_spec;
if (GetFileSpecForSO(cu_idx, so_file_spec)) {
- // User zero as the ID to match the compile unit at offset
- // zero in each .o file since each .o file can only have
- // one compile unit for now.
+ // User zero as the ID to match the compile unit at offset zero in each
+ // .o file since each .o file can only have one compile unit for now.
lldb::user_id_t cu_id = 0;
m_compile_unit_infos[cu_idx].compile_unit_sp.reset(
new CompileUnit(m_obj_file->GetModule(), NULL, so_file_spec, cu_id,
@@ -767,8 +763,8 @@ uint32_t SymbolFileDWARFDebugMap::Resolv
const uint32_t cu_count = GetNumCompileUnits();
for (uint32_t i = 0; i < cu_count; ++i) {
- // If we are checking for inlines, then we need to look through all
- // compile units no matter if "file_spec" matches.
+ // If we are checking for inlines, then we need to look through all compile
+ // units no matter if "file_spec" matches.
bool resolve = check_inlines;
if (!resolve) {
@@ -823,8 +819,8 @@ uint32_t SymbolFileDWARFDebugMap::FindGl
if (!append)
variables.Clear();
- // Remember how many variables are in the list before we search in case
- // we are appending the results to a variable list.
+ // Remember how many variables are in the list before we search in case we
+ // are appending the results to a variable list.
const uint32_t original_size = variables.GetSize();
uint32_t total_matches = 0;
@@ -843,8 +839,8 @@ uint32_t SymbolFileDWARFDebugMap::FindGl
if (max_matches >= total_matches)
return true;
- // Update the max matches for any subsequent calls to find globals
- // in any other object files with DWARF
+ // Update the max matches for any subsequent calls to find globals in any
+ // other object files with DWARF
max_matches -= oso_matches;
}
@@ -863,8 +859,8 @@ SymbolFileDWARFDebugMap::FindGlobalVaria
if (!append)
variables.Clear();
- // Remember how many variables are in the list before we search in case
- // we are appending the results to a variable list.
+ // Remember how many variables are in the list before we search in case we
+ // are appending the results to a variable list.
const uint32_t original_size = variables.GetSize();
uint32_t total_matches = 0;
@@ -882,8 +878,8 @@ SymbolFileDWARFDebugMap::FindGlobalVaria
if (max_matches >= total_matches)
return true;
- // Update the max matches for any subsequent calls to find globals
- // in any other object files with DWARF
+ // Update the max matches for any subsequent calls to find globals in any
+ // other object files with DWARF
max_matches -= oso_matches;
}
@@ -965,12 +961,12 @@ SymbolFileDWARFDebugMap::GetCompileUnitI
static void RemoveFunctionsWithModuleNotEqualTo(const ModuleSP &module_sp,
SymbolContextList &sc_list,
uint32_t start_idx) {
- // We found functions in .o files. Not all functions in the .o files
- // will have made it into the final output file. The ones that did
- // make it into the final output file will have a section whose module
- // matches the module from the ObjectFile for this SymbolFile. When
- // the modules don't match, then we have something that was in a
- // .o file, but doesn't map to anything in the final executable.
+ // We found functions in .o files. Not all functions in the .o files will
+ // have made it into the final output file. The ones that did make it into
+ // the final output file will have a section whose module matches the module
+ // from the ObjectFile for this SymbolFile. When the modules don't match,
+ // then we have something that was in a .o file, but doesn't map to anything
+ // in the final executable.
uint32_t i = start_idx;
while (i < sc_list.GetSize()) {
SymbolContext sc;
@@ -1105,8 +1101,8 @@ TypeSP SymbolFileDWARFDebugMap::FindComp
// the type name and whose type is eSymbolTypeObjCClass. If we can find that
// symbol and find its containing parent, we can locate the .o file that will
// contain the implementation definition since it will be scoped inside the
- // N_SO
- // and we can then locate the SymbolFileDWARF that corresponds to that N_SO.
+ // N_SO and we can then locate the SymbolFileDWARF that corresponds to that
+ // N_SO.
SymbolFileDWARF *oso_dwarf = NULL;
TypeSP type_sp;
ObjectFile *module_objfile = m_obj_file->GetModule()->GetObjectFile();
@@ -1118,8 +1114,7 @@ TypeSP SymbolFileDWARFDebugMap::FindComp
Symtab::eVisibilityAny);
if (objc_class_symbol) {
// Get the N_SO symbol that contains the objective C class symbol as
- // this
- // should be the .o file that contains the real definition...
+ // this should be the .o file that contains the real definition...
const Symbol *source_file_symbol = symtab->GetParent(objc_class_symbol);
if (source_file_symbol &&
@@ -1147,10 +1142,8 @@ TypeSP SymbolFileDWARFDebugMap::FindComp
}
// Only search all .o files for the definition if we don't need the
- // implementation
- // because otherwise, with a valid debug map we should have the ObjC class
- // symbol and
- // the code above should have found it.
+ // implementation because otherwise, with a valid debug map we should have
+ // the ObjC class symbol and the code above should have found it.
if (must_be_implementation == false) {
TypeSP type_sp;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp Mon Apr 30 09:49:04 2018
@@ -27,8 +27,8 @@ bool UniqueDWARFASTTypeList::Find(const
udt.m_byte_size == byte_size) {
// Make sure the file and line match
if (udt.m_declaration == decl) {
- // The type has the same name, and was defined on the same
- // file and line. Now verify all of the parent DIEs match.
+ // The type has the same name, and was defined on the same file and
+ // line. Now verify all of the parent DIEs match.
DWARFDIE parent_arg_die = die.GetParent();
DWARFDIE parent_pos_die = udt.m_die.GetParent();
bool match = true;
Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Mon Apr 30 09:49:04 2018
@@ -137,8 +137,8 @@ GetBuiltinTypeForPDBEncodingAndBitSize(C
// represented by the one generated for `double`.
break;
}
- // If there is no match on PDB_BuiltinType, fall back to default search
- // by encoding and width only
+ // If there is no match on PDB_BuiltinType, fall back to default search by
+ // encoding and width only
return clang_ast.GetBuiltinTypeForEncodingAndBitSize(encoding, width);
}
@@ -208,9 +208,9 @@ PDBASTParser::~PDBASTParser() {}
lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
// PDB doesn't maintain enough information to robustly rebuild the entire
- // tree, and this is most problematic when it comes to figure out the
- // right DeclContext to put a type in. So for now, everything goes in
- // the translation unit decl as a fully qualified type.
+ // tree, and this is most problematic when it comes to figure out the right
+ // DeclContext to put a type in. So for now, everything goes in the
+ // translation unit decl as a fully qualified type.
clang::DeclContext *tu_decl_ctx = m_ast.GetTranslationUnitDecl();
Declaration decl;
Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Mon Apr 30 09:49:04 2018
@@ -182,13 +182,13 @@ uint32_t SymbolFilePDB::GetNumCompileUni
return 0;
// The linker could link *.dll (compiland language = LINK), or import
- // *.dll. For example, a compiland with name `Import:KERNEL32.dll`
- // could be found as a child of the global scope (PDB executable).
- // Usually, such compilands contain `thunk` symbols in which we are not
- // interested for now. However we still count them in the compiland list.
- // If we perform any compiland related activity, like finding symbols
- // through llvm::pdb::IPDBSession methods, such compilands will all be
- // searched automatically no matter whether we include them or not.
+ // *.dll. For example, a compiland with name `Import:KERNEL32.dll` could be
+ // found as a child of the global scope (PDB executable). Usually, such
+ // compilands contain `thunk` symbols in which we are not interested for
+ // now. However we still count them in the compiland list. If we perform
+ // any compiland related activity, like finding symbols through
+ // llvm::pdb::IPDBSession methods, such compilands will all be searched
+ // automatically no matter whether we include them or not.
m_cached_compile_unit_count = compilands->getChildCount();
// The linker can inject an additional "dummy" compilation unit into the
@@ -470,8 +470,8 @@ size_t SymbolFilePDB::ParseTypes(const l
ParseTypesByTagFn(*compiland);
// Also parse global types particularly coming from this compiland.
- // Unfortunately, PDB has no compiland information for each global type.
- // We have to parse them all. But ensure we only do this once.
+ // Unfortunately, PDB has no compiland information for each global type. We
+ // have to parse them all. But ensure we only do this once.
static bool parse_all_global_types = false;
if (!parse_all_global_types) {
ParseTypesByTagFn(*m_global_scope_up);
@@ -622,10 +622,10 @@ uint32_t SymbolFilePDB::ResolveSymbolCon
// For each one, either find its previously parsed data or parse it afresh
// and add it to the symbol context list.
while (auto compiland = compilands->getNext()) {
- // If we're not checking inlines, then don't add line information for this
- // file unless the FileSpec matches.
- // For inline functions, we don't have to match the FileSpec since they
- // could be defined in headers other than file specified in FileSpec.
+ // If we're not checking inlines, then don't add line information for
+ // this file unless the FileSpec matches. For inline functions, we don't
+ // have to match the FileSpec since they could be defined in headers
+ // other than file specified in FileSpec.
if (!check_inlines) {
std::string source_file = compiland->getSourceFileFullPath();
if (source_file.empty())
@@ -651,7 +651,8 @@ uint32_t SymbolFilePDB::ResolveSymbolCon
if ((resolve_scope & eSymbolContextLineEntry) && !has_line_table) {
// The query asks for line entries, but we can't get them for the
- // compile unit. This is not normal for `line` = 0. So just assert it.
+ // compile unit. This is not normal for `line` = 0. So just assert
+ // it.
assert(line && "Couldn't get all line entries!\n");
// Current compiland does not have the requested line. Search next.
@@ -669,8 +670,8 @@ uint32_t SymbolFilePDB::ResolveSymbolCon
// Skip the terminal line entry.
--num_line_entries;
- // If `line `!= 0, see if we can resolve function for each line
- // entry in the line table.
+ // If `line `!= 0, see if we can resolve function for each line entry
+ // in the line table.
for (uint32_t line_idx = 0; line && line_idx < num_line_entries;
++line_idx) {
if (!line_table->GetLineEntryAtIndex(line_idx, sc.line_entry))
@@ -779,10 +780,10 @@ void SymbolFilePDB::CacheFunctionNames()
ConstString cstr_name(name);
- // To search a method name, like NS::Class:MemberFunc, LLDB searches its
- // base name, i.e. MemberFunc by default. Since PDBSymbolFunc does not
- // have inforamtion of this, we extract base names and cache them by our
- // own effort.
+ // To search a method name, like NS::Class:MemberFunc, LLDB searches
+ // its base name, i.e. MemberFunc by default. Since PDBSymbolFunc does
+ // not have inforamtion of this, we extract base names and cache them
+ // by our own effort.
llvm::StringRef basename;
CPlusPlusLanguage::MethodName cpp_method(cstr_name);
if (cpp_method.IsValid()) {
@@ -1040,8 +1041,8 @@ void SymbolFilePDB::FindTypesByName(cons
case PDB_SymType::Typedef:
break;
default:
- // We're looking only for types that have names. Skip symbols, as well as
- // unnamed types such as arrays, pointers, etc.
+ // We're looking only for types that have names. Skip symbols, as well
+ // as unnamed types such as arrays, pointers, etc.
continue;
}
@@ -1228,8 +1229,8 @@ bool SymbolFilePDB::ParseCompileUnitLine
// LineEntry needs the *index* of the file into the list of support files
// returned by ParseCompileUnitSupportFiles. But the underlying SDK gives us
- // a globally unique idenfitifier in the namespace of the PDB. So, we have to
- // do a mapping so that we can hand out indices.
+ // a globally unique idenfitifier in the namespace of the PDB. So, we have
+ // to do a mapping so that we can hand out indices.
llvm::DenseMap<uint32_t, uint32_t> index_map;
BuildSupportFileIdToSupportFileIndexMap(*compiland_up, index_map);
auto line_table = llvm::make_unique<LineTable>(sc.comp_unit);
@@ -1240,8 +1241,8 @@ bool SymbolFilePDB::ParseCompileUnitLine
if (!files)
return false;
- // For each source and header file, create a LineSequence for contributions to
- // the compiland from that file, and add the sequence.
+ // For each source and header file, create a LineSequence for contributions
+ // to the compiland from that file, and add the sequence.
while (auto file = files->getNext()) {
std::unique_ptr<LineSequence> sequence(
line_table->CreateLineSequenceContainer());
@@ -1265,8 +1266,8 @@ bool SymbolFilePDB::ParseCompileUnitLine
uint32_t col = line->getColumnNumber();
uint32_t source_idx = index_map[source_id];
- // There was a gap between the current entry and the previous entry if the
- // addresses don't perfectly line up.
+ // There was a gap between the current entry and the previous entry if
+ // the addresses don't perfectly line up.
bool is_gap = (i > 0) && (prev_addr + prev_length < addr);
// Before inserting the current entry, insert a terminal entry at the end
@@ -1325,8 +1326,8 @@ bool SymbolFilePDB::ParseCompileUnitLine
void SymbolFilePDB::BuildSupportFileIdToSupportFileIndexMap(
const PDBSymbolCompiland &compiland,
llvm::DenseMap<uint32_t, uint32_t> &index_map) const {
- // This is a hack, but we need to convert the source id into an index into the
- // support files array. We don't want to do path comparisons to avoid
+ // This is a hack, but we need to convert the source id into an index into
+ // the support files array. We don't want to do path comparisons to avoid
// basename / full path issues that may or may not even be a problem, so we
// use the globally unique source file identifiers. Ideally we could use the
// global identifiers everywhere, but LineEntry currently assumes indices.
@@ -1400,12 +1401,12 @@ SymbolFilePDB::GetMangledForPDBFunc(cons
// For MSVC, format of C funciton's decorated name depends on calling
// conventon. Unfortunately none of the format is recognized by current
// LLDB. For example, `_purecall` is a __cdecl C function. From PDB,
- // `__purecall` is retrieved as both its decorated and
- // undecorated name (using PDBSymbolFunc::getUndecoratedName method).
- // However `__purecall` string is not treated as mangled in LLDB
- // (neither `?` nor `_Z` prefix). Mangled::GetDemangledName method
- // will fail internally and caches an empty string as its undecorated
- // name. So we will face a contradition here for the same symbol:
+ // `__purecall` is retrieved as both its decorated and undecorated name
+ // (using PDBSymbolFunc::getUndecoratedName method). However `__purecall`
+ // string is not treated as mangled in LLDB (neither `?` nor `_Z` prefix).
+ // Mangled::GetDemangledName method will fail internally and caches an
+ // empty string as its undecorated name. So we will face a contradition
+ // here for the same symbol:
// non-empty undecorated name from PDB
// empty undecorated name from LLDB
if (!func_undecorated_name.empty() &&
@@ -1413,8 +1414,8 @@ SymbolFilePDB::GetMangledForPDBFunc(cons
mangled.SetDemangledName(ConstString(func_undecorated_name));
// LLDB uses several flags to control how a C++ decorated name is
- // undecorated for MSVC. See `safeUndecorateName` in Class Mangled.
- // So the yielded name could be different from what we retrieve from
+ // undecorated for MSVC. See `safeUndecorateName` in Class Mangled. So the
+ // yielded name could be different from what we retrieve from
// PDB source unless we also apply same flags in getting undecorated
// name through PDBSymbolFunc::getUndecoratedNameEx method.
if (!func_undecorated_name.empty() &&
Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Mon Apr 30 09:49:04 2018
@@ -63,9 +63,9 @@ uint32_t SymbolFileSymtab::CalculateAbil
const Symtab *symtab = m_obj_file->GetSymtab();
if (symtab) {
//----------------------------------------------------------------------
- // The snippet of code below will get the indexes the module symbol
- // table entries that are code, data, or function related (debug info),
- // sort them by value (address) and dump the sorted symbols.
+ // The snippet of code below will get the indexes the module symbol table
+ // entries that are code, data, or function related (debug info), sort
+ // them by value (address) and dump the sorted symbols.
//----------------------------------------------------------------------
if (symtab->AppendSymbolIndexesWithType(eSymbolTypeSourceFile,
m_source_indexes)) {
@@ -105,24 +105,21 @@ uint32_t SymbolFileSymtab::CalculateAbil
}
uint32_t SymbolFileSymtab::GetNumCompileUnits() {
- // If we don't have any source file symbols we will just have one compile unit
- // for
- // the entire object file
+ // If we don't have any source file symbols we will just have one compile
+ // unit for the entire object file
if (m_source_indexes.empty())
return 0;
// If we have any source file symbols we will logically organize the object
- // symbols
- // using these.
+ // symbols using these.
return m_source_indexes.size();
}
CompUnitSP SymbolFileSymtab::ParseCompileUnitAtIndex(uint32_t idx) {
CompUnitSP cu_sp;
- // If we don't have any source file symbols we will just have one compile unit
- // for
- // the entire object file
+ // If we don't have any source file symbols we will just have one compile
+ // unit for the entire object file
if (idx < m_source_indexes.size()) {
const Symbol *cu_symbol =
m_obj_file->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]);
@@ -152,13 +149,12 @@ size_t SymbolFileSymtab::ParseCompileUni
//
// const uint32_t prefix_len = strlen(prefix);
- // If we don't have any source file symbols we will just have one compile unit
- // for
- // the entire object file
+ // If we don't have any source file symbols we will just have one compile
+ // unit for the entire object file
if (m_source_indexes.empty()) {
- // The only time we will have a user ID of zero is when we don't have
- // and source file symbols and we declare one compile unit for the
- // entire object file
+ // The only time we will have a user ID of zero is when we don't have and
+ // source file symbols and we declare one compile unit for the entire
+ // object file
if (!m_func_indexes.empty()) {
}
Modified: lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp Mon Apr 30 09:49:04 2018
@@ -57,9 +57,9 @@ const char *SymbolVendorELF::GetPluginDe
//----------------------------------------------------------------------
// CreateInstance
//
-// Platforms can register a callback to use when creating symbol
-// vendors to allow for complex debug information file setups, and to
-// also allow for finding separate debug information files.
+// Platforms can register a callback to use when creating symbol vendors to
+// allow for complex debug information file setups, and to also allow for
+// finding separate debug information files.
//----------------------------------------------------------------------
SymbolVendor *
SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp,
@@ -112,11 +112,9 @@ SymbolVendorELF::CreateInstance(const ll
module_sp, &dsym_fspec, 0, dsym_fspec.GetByteSize(),
dsym_file_data_sp, dsym_file_data_offset);
if (dsym_objfile_sp) {
- // This objfile is for debugging purposes. Sadly, ObjectFileELF won't be
- // able
- // to figure this out consistently as the symbol file may not have
- // stripped the
- // code sections, etc.
+ // This objfile is for debugging purposes. Sadly, ObjectFileELF won't
+ // be able to figure this out consistently as the symbol file may not
+ // have stripped the code sections, etc.
dsym_objfile_sp->SetType(ObjectFile::eTypeDebugInfo);
SymbolVendorELF *symbol_vendor = new SymbolVendorELF(module_sp);
Modified: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Mon Apr 30 09:49:04 2018
@@ -94,9 +94,9 @@ const char *SymbolVendorMacOSX::GetPlugi
//----------------------------------------------------------------------
// CreateInstance
//
-// Platforms can register a callback to use when creating symbol
-// vendors to allow for complex debug information file setups, and to
-// also allow for finding separate debug information files.
+// Platforms can register a callback to use when creating symbol vendors to
+// allow for complex debug information file setups, and to also allow for
+// finding separate debug information files.
//----------------------------------------------------------------------
SymbolVendor *
SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
@@ -130,14 +130,14 @@ SymbolVendorMacOSX::CreateInstance(const
"SymbolVendorMacOSX::CreateInstance (module = %s) locate dSYM",
module_sp->GetFileSpec().GetPath().c_str());
- // First check to see if the module has a symbol file in mind already.
- // If it does, then we MUST use that.
+ // First check to see if the module has a symbol file in mind already. If
+ // it does, then we MUST use that.
FileSpec dsym_fspec(module_sp->GetSymbolFileFileSpec());
ObjectFileSP dsym_objfile_sp;
if (!dsym_fspec) {
- // No symbol file was specified in the module, lets try and find
- // one ourselves.
+ // No symbol file was specified in the module, lets try and find one
+ // ourselves.
FileSpec file_spec = obj_file->GetFileSpec();
if (!file_spec)
file_spec = module_sp->GetFileSpec();
@@ -180,8 +180,7 @@ SymbolVendorMacOSX::CreateInstance(const
std::string DBGSourcePath;
// DBGSourcePathRemapping is a dictionary in the plist
- // with
- // keys which are DBGBuildSourcePath file paths and
+ // with keys which are DBGBuildSourcePath file paths and
// values which are DBGSourcePath file paths
StructuredData::ObjectSP plist_sp =
@@ -194,16 +193,15 @@ SymbolVendorMacOSX::CreateInstance(const
->GetAsDictionary()) {
// In an early version of DBGSourcePathRemapping, the
- // DBGSourcePath
- // values were incorrect. If we have a newer style
- // DBGSourcePathRemapping, there will be a DBGVersion
- // key in the plist with version 2 or higher.
+ // DBGSourcePath values were incorrect. If we have a
+ // newer style DBGSourcePathRemapping, there will be a
+ // DBGVersion key in the plist with version 2 or
+ // higher.
//
// If this is an old style DBGSourcePathRemapping,
- // ignore the
- // value half of the key-value remappings and use reuse
- // the original
- // gloal DBGSourcePath string.
+ // ignore the value half of the key-value remappings
+ // and use reuse the original gloal DBGSourcePath
+ // string.
bool new_style_source_remapping_dictionary = false;
bool do_truncate_remapping_names = false;
std::string original_DBGSourcePath_value =
@@ -253,10 +251,12 @@ SymbolVendorMacOSX::CreateInstance(const
}
module_sp->GetSourceMappingList().Append(
key, ConstString(DBGSourcePath), true);
- // With version 2 of DBGSourcePathRemapping, we can chop off the
- // last two filename parts from the source remapping and get a
- // more general source remapping that still works. Add this as
- // another option in addition to the full source path remap.
+ // With version 2 of DBGSourcePathRemapping, we
+ // can chop off the last two filename parts
+ // from the source remapping and get a more
+ // general source remapping that still works.
+ // Add this as another option in addition to
+ // the full source path remap.
if (do_truncate_remapping_names) {
FileSpec build_path(key.AsCString(), false);
FileSpec source_path(DBGSourcePath.c_str(), false);
@@ -303,9 +303,9 @@ SymbolVendorMacOSX::CreateInstance(const
}
}
- // Just create our symbol vendor using the current objfile as this is either
- // an executable with no dSYM (that we could locate), an executable with
- // a dSYM that has a UUID that doesn't match.
+ // Just create our symbol vendor using the current objfile as this is
+ // either an executable with no dSYM (that we could locate), an executable
+ // with a dSYM that has a UUID that doesn't match.
symbol_vendor->AddSymbolFileRepresentation(obj_file->shared_from_this());
}
return symbol_vendor;
Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp Mon Apr 30 09:49:04 2018
@@ -119,20 +119,18 @@ void AppleGetItemInfoHandler::Detach() {
}
// Compile our __lldb_backtrace_recording_get_item_info() function (from the
-// source above in g_get_item_info_function_code) if we don't find that function
-// in the inferior
-// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for
-// testing.)
+// source above in g_get_item_info_function_code) if we don't find that
+// function in the inferior already with USE_BUILTIN_FUNCTION defined. (e.g.
+// this would be the case for testing.)
//
-// Insert the __lldb_backtrace_recording_get_item_info into the inferior process
-// if needed.
+// Insert the __lldb_backtrace_recording_get_item_info into the inferior
+// process if needed.
//
// Write the get_item_info_arglist into the inferior's memory space to prepare
// for the call.
//
// Returns the address of the arguments written down in the inferior process,
-// which can be used to
-// make the function call.
+// which can be used to make the function call.
lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction(
Thread &thread, ValueList &get_item_info_arglist) {
@@ -146,7 +144,8 @@ lldb::addr_t AppleGetItemInfoHandler::Se
{
std::lock_guard<std::mutex> guard(m_get_item_info_function_mutex);
- // First stage is to make the UtilityFunction to hold our injected function:
+ // First stage is to make the UtilityFunction to hold our injected
+ // function:
if (!m_get_item_info_impl_code.get()) {
if (g_get_item_info_function_code != NULL) {
@@ -209,10 +208,9 @@ lldb::addr_t AppleGetItemInfoHandler::Se
diagnostics.Clear();
// Now write down the argument values for this particular call. This looks
- // like it might be a race condition
- // if other threads were calling into here, but actually it isn't because we
- // allocate a new args structure for
- // this call by passing args_addr = LLDB_INVALID_ADDRESS...
+ // like it might be a race condition if other threads were calling into here,
+ // but actually it isn't because we allocate a new args structure for this
+ // call by passing args_addr = LLDB_INVALID_ADDRESS...
if (!get_item_info_caller->WriteFunctionArguments(
exe_ctx, args_addr, get_item_info_arglist, diagnostics)) {
@@ -272,8 +270,7 @@ AppleGetItemInfoHandler::GetItemInfo(Thr
// uint64_t page_to_free_size)
// Where the return_buffer argument points to a 24 byte region of memory
- // already allocated by lldb in
- // the inferior process.
+ // already allocated by lldb in the inferior process.
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp Mon Apr 30 09:49:04 2018
@@ -121,11 +121,10 @@ void AppleGetPendingItemsHandler::Detach
}
}
-// Compile our __lldb_backtrace_recording_get_pending_items() function (from the
-// source above in g_get_pending_items_function_code) if we don't find that
-// function in the inferior
-// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for
-// testing.)
+// Compile our __lldb_backtrace_recording_get_pending_items() function (from
+// the source above in g_get_pending_items_function_code) if we don't find that
+// function in the inferior already with USE_BUILTIN_FUNCTION defined. (e.g.
+// this would be the case for testing.)
//
// Insert the __lldb_backtrace_recording_get_pending_items into the inferior
// process if needed.
@@ -134,8 +133,7 @@ void AppleGetPendingItemsHandler::Detach
// prepare for the call.
//
// Returns the address of the arguments written down in the inferior process,
-// which can be used to
-// make the function call.
+// which can be used to make the function call.
lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction(
Thread &thread, ValueList &get_pending_items_arglist) {
@@ -212,10 +210,9 @@ lldb::addr_t AppleGetPendingItemsHandler
}
// Now write down the argument values for this particular call. This looks
- // like it might be a race condition
- // if other threads were calling into here, but actually it isn't because we
- // allocate a new args structure for
- // this call by passing args_addr = LLDB_INVALID_ADDRESS...
+ // like it might be a race condition if other threads were calling into here,
+ // but actually it isn't because we allocate a new args structure for this
+ // call by passing args_addr = LLDB_INVALID_ADDRESS...
if (!get_pending_items_caller->WriteFunctionArguments(
exe_ctx, args_addr, get_pending_items_arglist, diagnostics)) {
@@ -279,8 +276,7 @@ AppleGetPendingItemsHandler::GetPendingI
// uint64_t page_to_free_size)
// Where the return_buffer argument points to a 24 byte region of memory
- // already allocated by lldb in
- // the inferior process.
+ // already allocated by lldb in the inferior process.
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp Mon Apr 30 09:49:04 2018
@@ -118,9 +118,9 @@ void AppleGetQueuesHandler::Detach() {
}
// Construct a CompilerType for the structure that
-// g_get_current_queues_function_code will return by value
-// so we can extract the fields after performing the function call.
-// i.e. we are getting this struct returned to us:
+// g_get_current_queues_function_code will return by value so we can extract
+// the fields after performing the function call. i.e. we are getting this
+// struct returned to us:
//
// struct get_current_queues_return_values
// {
@@ -130,11 +130,9 @@ void AppleGetQueuesHandler::Detach() {
// };
// Compile our __lldb_backtrace_recording_get_current_queues() function (from
-// the
-// source above in g_get_current_queues_function_code) if we don't find that
-// function in the inferior
-// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for
-// testing.)
+// the source above in g_get_current_queues_function_code) if we don't find
+// that function in the inferior already with USE_BUILTIN_FUNCTION defined.
+// (e.g. this would be the case for testing.)
//
// Insert the __lldb_backtrace_recording_get_current_queues into the inferior
// process if needed.
@@ -143,8 +141,7 @@ void AppleGetQueuesHandler::Detach() {
// the call.
//
// Returns the address of the arguments written down in the inferior process,
-// which can be used to
-// make the function call.
+// which can be used to make the function call.
lldb::addr_t
AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread,
@@ -217,10 +214,9 @@ AppleGetQueuesHandler::SetupGetQueuesFun
diagnostics.Clear();
// Now write down the argument values for this particular call. This looks
- // like it might be a race condition
- // if other threads were calling into here, but actually it isn't because we
- // allocate a new args structure for
- // this call by passing args_addr = LLDB_INVALID_ADDRESS...
+ // like it might be a race condition if other threads were calling into here,
+ // but actually it isn't because we allocate a new args structure for this
+ // call by passing args_addr = LLDB_INVALID_ADDRESS...
if (!get_queues_caller->WriteFunctionArguments(
exe_ctx, args_addr, get_queues_arglist, diagnostics)) {
@@ -280,8 +276,7 @@ AppleGetQueuesHandler::GetCurrentQueues(
// uint64_t page_to_free_size);
// Where the return_buffer argument points to a 24 byte region of memory
- // already allocated by lldb in
- // the inferior process.
+ // already allocated by lldb in the inferior process.
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp Mon Apr 30 09:49:04 2018
@@ -128,11 +128,9 @@ void AppleGetThreadItemInfoHandler::Deta
}
// Compile our __lldb_backtrace_recording_get_thread_item_info() function (from
-// the
-// source above in g_get_thread_item_info_function_code) if we don't find that
-// function in the inferior
-// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for
-// testing.)
+// the source above in g_get_thread_item_info_function_code) if we don't find
+// that function in the inferior already with USE_BUILTIN_FUNCTION defined.
+// (e.g. this would be the case for testing.)
//
// Insert the __lldb_backtrace_recording_get_thread_item_info into the inferior
// process if needed.
@@ -141,8 +139,7 @@ void AppleGetThreadItemInfoHandler::Deta
// prepare for the call.
//
// Returns the address of the arguments written down in the inferior process,
-// which can be used to
-// make the function call.
+// which can be used to make the function call.
lldb::addr_t AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction(
Thread &thread, ValueList &get_thread_item_info_arglist) {
@@ -221,10 +218,9 @@ lldb::addr_t AppleGetThreadItemInfoHandl
diagnostics.Clear();
// Now write down the argument values for this particular call. This looks
- // like it might be a race condition
- // if other threads were calling into here, but actually it isn't because we
- // allocate a new args structure for
- // this call by passing args_addr = LLDB_INVALID_ADDRESS...
+ // like it might be a race condition if other threads were calling into here,
+ // but actually it isn't because we allocate a new args structure for this
+ // call by passing args_addr = LLDB_INVALID_ADDRESS...
if (!get_thread_item_info_caller->WriteFunctionArguments(
exe_ctx, args_addr, get_thread_item_info_arglist, diagnostics)) {
@@ -266,8 +262,7 @@ AppleGetThreadItemInfoHandler::GetThread
// Set up the arguments for a call to
- // struct get_thread_item_info_return_values
- // {
+ // struct get_thread_item_info_return_values {
// uint64_t item_info_buffer_ptr; /* the address of the items buffer
// from libBacktraceRecording */
// uint64_t item_info_buffer_size; /* the size of the items buffer from
@@ -283,8 +278,7 @@ AppleGetThreadItemInfoHandler::GetThread
// uint64_t page_to_free_size)
// Where the return_buffer argument points to a 24 byte region of memory
- // already allocated by lldb in
- // the inferior process.
+ // already allocated by lldb in the inferior process.
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp Mon Apr 30 09:49:04 2018
@@ -34,9 +34,9 @@ using namespace lldb;
using namespace lldb_private;
//----------------------------------------------------------------------
-// Create an instance of this class. This function is filled into
-// the plugin info class that gets handed out by the plugin factory and
-// allows the lldb to instantiate an instance of this class.
+// Create an instance of this class. This function is filled into the plugin
+// info class that gets handed out by the plugin factory and allows the lldb to
+// instantiate an instance of this class.
//----------------------------------------------------------------------
SystemRuntime *SystemRuntimeMacOSX::CreateInstance(Process *process) {
bool create = false;
@@ -125,17 +125,15 @@ SystemRuntimeMacOSX::GetQueueNameFromThr
ReadLibdispatchOffsets();
if (m_libdispatch_offsets.IsValid()) {
// dispatch_qaddr is from a thread_info(THREAD_IDENTIFIER_INFO) call for a
- // thread -
- // deref it to get the address of the dispatch_queue_t structure for this
- // thread's
- // queue.
+ // thread - deref it to get the address of the dispatch_queue_t structure
+ // for this thread's queue.
Status error;
addr_t dispatch_queue_addr =
m_process->ReadPointerFromMemory(dispatch_qaddr, error);
if (error.Success()) {
if (m_libdispatch_offsets.dqo_version >= 4) {
- // libdispatch versions 4+, pointer to dispatch name is in the
- // queue structure.
+ // libdispatch versions 4+, pointer to dispatch name is in the queue
+ // structure.
addr_t pointer_to_label_address =
dispatch_queue_addr + m_libdispatch_offsets.dqo_label;
addr_t label_addr =
@@ -248,10 +246,8 @@ SystemRuntimeMacOSX::GetQueueIDFromThrea
ReadLibdispatchOffsets();
if (m_libdispatch_offsets.IsValid()) {
// dispatch_qaddr is from a thread_info(THREAD_IDENTIFIER_INFO) call for a
- // thread -
- // deref it to get the address of the dispatch_queue_t structure for this
- // thread's
- // queue.
+ // thread - deref it to get the address of the dispatch_queue_t structure
+ // for this thread's queue.
Status error;
uint64_t dispatch_queue_addr =
m_process->ReadPointerFromMemory(dispatch_qaddr, error);
@@ -287,8 +283,8 @@ void SystemRuntimeMacOSX::ReadLibdispatc
dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType(
g_dispatch_queue_offsets_symbol_name, eSymbolTypeData);
- // libdispatch symbols are in their own dylib as of Mac OS X 10.7 ("Lion") and
- // later
+ // libdispatch symbols are in their own dylib as of Mac OS X 10.7 ("Lion")
+ // and later
if (dispatch_queue_offsets_symbol == NULL) {
ModuleSpec libdispatch_module_spec(FileSpec("libdispatch.dylib", false));
module_sp = m_process->GetTarget().GetImages().FindFirstModule(
@@ -320,8 +316,7 @@ void SystemRuntimeMacOSX::ReadLibdispatc
lldb::offset_t data_offset = 0;
// The struct LibdispatchOffsets is a series of uint16_t's - extract them
- // all
- // in one big go.
+ // all in one big go.
data.GetU16(&data_offset, &m_libdispatch_offsets.dqo_version,
sizeof(struct LibdispatchOffsets) / sizeof(uint16_t));
}
@@ -368,8 +363,7 @@ void SystemRuntimeMacOSX::ReadLibpthread
lldb::offset_t data_offset = 0;
// The struct LibpthreadOffsets is a series of uint16_t's - extract them
- // all
- // in one big go.
+ // all in one big go.
data.GetU16(&data_offset, &m_libpthread_offsets.plo_version,
sizeof(struct LibpthreadOffsets) / sizeof(uint16_t));
}
@@ -407,10 +401,8 @@ void SystemRuntimeMacOSX::ReadLibdispatc
if (m_dispatch_tsd_indexes_addr != LLDB_INVALID_ADDRESS) {
// We don't need to check the version number right now, it will be at least 2,
-// but
-// keep this code around to fetch just the version # for the future where we
-// need
-// to fetch alternate versions of the struct.
+// but keep this code around to fetch just the version # for the future where
+// we need to fetch alternate versions of the struct.
#if 0
uint16_t dti_version = 2;
Address dti_struct_addr;
@@ -473,12 +465,9 @@ ThreadSP SystemRuntimeMacOSX::GetExtende
Status error;
// real_thread is either an actual, live thread (in which case we need to
- // call into
- // libBacktraceRecording to find its originator) or it is an extended
- // backtrace itself,
- // in which case we get the token from it and call into
- // libBacktraceRecording to find
- // the originator of that token.
+ // call into libBacktraceRecording to find its originator) or it is an
+ // extended backtrace itself, in which case we get the token from it and
+ // call into libBacktraceRecording to find the originator of that token.
if (real_thread->GetExtendedBacktraceToken() != LLDB_INVALID_ADDRESS) {
originating_thread_sp = GetExtendedBacktraceFromItemRef(
@@ -735,13 +724,11 @@ void SystemRuntimeMacOSX::PopulateQueueL
}
// We either didn't have libBacktraceRecording (and need to create the queues
- // list based on threads)
- // or we did get the queues list from libBacktraceRecording but some special
- // queues may not be
- // included in its information. This is needed because libBacktraceRecording
- // will only list queues with pending or running items by default - but the
- // magic com.apple.main-thread
- // queue on thread 1 is always around.
+ // list based on threads) or we did get the queues list from
+ // libBacktraceRecording but some special queues may not be included in its
+ // information. This is needed because libBacktraceRecording will only list
+ // queues with pending or running items by default - but the magic com.apple
+ // .main-thread queue on thread 1 is always around.
for (ThreadSP thread_sp : m_process->Threads()) {
if (thread_sp->GetAssociatedWithLibdispatchQueue() != eLazyBoolNo) {
@@ -769,12 +756,10 @@ void SystemRuntimeMacOSX::PopulateQueueL
}
// Returns either an array of introspection_dispatch_item_info_ref's for the
-// pending items on
-// a queue or an array introspection_dispatch_item_info_ref's and code addresses
-// for the
-// pending items on a queue. The information about each of these pending items
-// then needs to
-// be fetched individually by passing the ref to libBacktraceRecording.
+// pending items on a queue or an array introspection_dispatch_item_info_ref's
+// and code addresses for the pending items on a queue. The information about
+// each of these pending items then needs to be fetched individually by passing
+// the ref to libBacktraceRecording.
SystemRuntimeMacOSX::PendingItemsForQueue
SystemRuntimeMacOSX::GetPendingItemRefsForQueue(lldb::addr_t queue) {
@@ -927,8 +912,8 @@ void SystemRuntimeMacOSX::PopulateQueues
offset_t offset = 0;
uint64_t queues_read = 0;
- // The information about the queues is stored in this format (v1):
- // typedef struct introspection_dispatch_queue_info_s {
+ // The information about the queues is stored in this format (v1): typedef
+ // struct introspection_dispatch_queue_info_s {
// uint32_t offset_to_next;
// dispatch_queue_t queue;
// uint64_t serialnum; // queue's serialnum in the process, as
Modified: lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp (original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp Mon Apr 30 09:49:04 2018
@@ -58,8 +58,8 @@ bool UnwindAssemblyInstEmulation::GetNon
if (range.GetByteSize() > 0 && range.GetBaseAddress().IsValid() &&
m_inst_emulator_ap.get()) {
- // The instruction emulation subclass setup the unwind plan for the
- // first instruction.
+ // The instruction emulation subclass setup the unwind plan for the first
+ // instruction.
m_inst_emulator_ap->CreateFunctionEntryUnwind(unwind_plan);
// CreateFunctionEntryUnwind should have created the first row. If it
@@ -90,9 +90,9 @@ bool UnwindAssemblyInstEmulation::GetNon
m_register_values.clear();
m_pushed_regs.clear();
- // Initialize the CFA with a known value. In the 32 bit case
- // it will be 0x80000000, and in the 64 bit case 0x8000000000000000.
- // We use the address byte size to be safe for any future address sizes
+ // Initialize the CFA with a known value. In the 32 bit case it will be
+ // 0x80000000, and in the 64 bit case 0x8000000000000000. We use the
+ // address byte size to be safe for any future address sizes
m_initial_sp = (1ull << ((addr_byte_size * 8) - 1));
RegisterValue cfa_reg_value;
cfa_reg_value.SetUInt(m_initial_sp, m_cfa_reg_info.byte_size);
@@ -105,14 +105,12 @@ bool UnwindAssemblyInstEmulation::GetNon
Instruction *inst = inst_list.GetInstructionAtIndex(0).get();
const lldb::addr_t base_addr = inst->GetAddress().GetFileAddress();
- // Map for storing the unwind plan row and the value of the registers at
- // a given offset.
- // When we see a forward branch we add a new entry to this map with the
- // actual unwind plan
- // row and register context for the target address of the branch as the
- // current data have
- // to be valid for the target address of the branch too if we are in the
- // same function.
+ // Map for storing the unwind plan row and the value of the registers
+ // at a given offset. When we see a forward branch we add a new entry
+ // to this map with the actual unwind plan row and register context for
+ // the target address of the branch as the current data have to be
+ // valid for the target address of the branch too if we are in the same
+ // function.
std::map<lldb::addr_t, std::pair<UnwindPlan::RowSP, RegisterValueMap>>
saved_unwind_states;
@@ -128,15 +126,14 @@ bool UnwindAssemblyInstEmulation::GetNon
saved_unwind_states.insert({0, {last_row, m_register_values}});
// cache the pc register number (in whatever register numbering this
- // UnwindPlan uses) for
- // quick reference during instruction parsing.
+ // UnwindPlan uses) for quick reference during instruction parsing.
RegisterInfo pc_reg_info;
m_inst_emulator_ap->GetRegisterInfo(
eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, pc_reg_info);
// cache the return address register number (in whatever register
- // numbering this UnwindPlan uses) for
- // quick reference during instruction parsing.
+ // numbering this UnwindPlan uses) for quick reference during
+ // instruction parsing.
RegisterInfo ra_reg_info;
m_inst_emulator_ap->GetRegisterInfo(
eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA, ra_reg_info);
@@ -160,12 +157,11 @@ bool UnwindAssemblyInstEmulation::GetNon
"Unwind row for the function entry missing");
--it; // Move it to the row corresponding to the current offset
- // If the offset of m_curr_row don't match with the offset we see in
- // saved_unwind_states
- // then we have to update m_curr_row and m_register_values based on
- // the saved values. It
- // is happenning after we processed an epilogue and a return to
- // caller instruction.
+ // If the offset of m_curr_row don't match with the offset we see
+ // in saved_unwind_states then we have to update m_curr_row and
+ // m_register_values based on the saved values. It is happenning
+ // after we processed an epilogue and a return to caller
+ // instruction.
if (it->second.first->GetOffset() != m_curr_row->GetOffset()) {
UnwindPlan::Row *newrow = new UnwindPlan::Row;
*newrow = *it->second.first;
@@ -181,10 +177,9 @@ bool UnwindAssemblyInstEmulation::GetNon
if (m_inst_emulator_ap->GetInstructionCondition() !=
EmulateInstruction::UnconditionalCondition &&
saved_unwind_states.count(current_offset) == 0) {
- // If we don't have a saved row for the current offset then save
- // our
- // current state because we will have to restore it after the
- // conditional block.
+ // If we don't have a saved row for the current offset then
+ // save our current state because we will have to restore it
+ // after the conditional block.
auto new_row =
std::make_shared<UnwindPlan::Row>(*m_curr_row.get());
saved_unwind_states.insert(
@@ -192,8 +187,8 @@ bool UnwindAssemblyInstEmulation::GetNon
}
// If the last instruction was conditional with a different
- // condition
- // then the then current condition then restore the condition.
+ // condition then the then current condition then restore the
+ // condition.
if (last_condition !=
EmulateInstruction::UnconditionalCondition) {
const auto &saved_state =
@@ -230,8 +225,7 @@ bool UnwindAssemblyInstEmulation::GetNon
eEmulateInstructionOptionIgnoreConditions);
// If the current instruction is a branch forward then save the
- // current CFI information
- // for the offset where we are branching.
+ // current CFI information for the offset where we are branching.
if (m_forward_branch_offset != 0 &&
range.ContainsFileAddress(inst->GetAddress().GetFileAddress() +
m_forward_branch_offset)) {
@@ -247,8 +241,8 @@ bool UnwindAssemblyInstEmulation::GetNon
// Were there any changes to the CFI while evaluating this
// instruction?
if (m_curr_row_modified) {
- // Save the modified row if we don't already have a CFI row in the
- // currennt address
+ // Save the modified row if we don't already have a CFI row in
+ // the currennt address
if (saved_unwind_states.count(
current_offset + inst->GetOpcode().GetByteSize()) == 0) {
m_curr_row->SetOffset(current_offset +
Modified: lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp (original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp Mon Apr 30 09:49:04 2018
@@ -86,12 +86,10 @@ bool UnwindAssembly_x86::AugmentUnwindPl
LLDB_REGNUM_GENERIC_PC);
// Does this UnwindPlan describe the prologue? I want to see that the CFA is
- // set
- // in terms of the stack pointer plus an offset, and I want to see that rip is
- // retrieved at the CFA-wordsize.
- // If there is no description of the prologue, don't try to augment this
- // eh_frame
- // unwinder code, fall back to assembly parsing instead.
+ // set in terms of the stack pointer plus an offset, and I want to see that
+ // rip is retrieved at the CFA-wordsize. If there is no description of the
+ // prologue, don't try to augment this eh_frame unwinder code, fall back to
+ // assembly parsing instead.
if (first_row->GetCFAValue().GetValueType() !=
UnwindPlan::Row::CFAValue::isRegisterPlusOffset ||
@@ -110,14 +108,13 @@ bool UnwindAssembly_x86::AugmentUnwindPl
return false;
}
- // It looks like the prologue is described.
- // Is the epilogue described? If it is, no need to do any augmentation.
+ // It looks like the prologue is described. Is the epilogue described? If it
+ // is, no need to do any augmentation.
if (first_row != last_row &&
first_row->GetOffset() != last_row->GetOffset()) {
- // The first & last row have the same CFA register
- // and the same CFA offset value
- // and the CFA register is esp/rsp (the stack pointer).
+ // The first & last row have the same CFA register and the same CFA offset
+ // value and the CFA register is esp/rsp (the stack pointer).
// We're checking that both of them have an unwind rule like "CFA=esp+4" or
// CFA+rsp+8".
@@ -128,8 +125,8 @@ bool UnwindAssembly_x86::AugmentUnwindPl
last_row->GetCFAValue().GetRegisterNumber() &&
first_row->GetCFAValue().GetOffset() ==
last_row->GetCFAValue().GetOffset()) {
- // Get the register locations for eip/rip from the first & last rows.
- // Are they both CFA plus an offset? Is it the same offset?
+ // Get the register locations for eip/rip from the first & last rows. Are
+ // they both CFA plus an offset? Is it the same offset?
UnwindPlan::Row::RegisterLocation last_row_pc_loc;
if (last_row->GetRegisterInfo(
@@ -139,12 +136,10 @@ bool UnwindAssembly_x86::AugmentUnwindPl
first_row_pc_loc.GetOffset() == last_row_pc_loc.GetOffset()) {
// One last sanity check: Is the unwind rule for getting the caller
- // pc value
- // "deref the CFA-4" or "deref the CFA-8"?
+ // pc value "deref the CFA-4" or "deref the CFA-8"?
// If so, we have an UnwindPlan that already describes the epilogue
- // and we don't need
- // to modify it at all.
+ // and we don't need to modify it at all.
if (first_row_pc_loc.GetOffset() == -wordsize) {
do_augment_unwindplan = false;
Modified: lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp (original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp Mon Apr 30 09:49:04 2018
@@ -246,8 +246,7 @@ void x86AssemblyInspectionEngine::Initia
}
// This function expects an x86 native register number (i.e. the bits stripped
-// out of the
-// actual instruction), not an lldb register number.
+// out of the actual instruction), not an lldb register number.
//
// FIXME: This is ABI dependent, it shouldn't be hardcoded here.
@@ -321,15 +320,14 @@ bool x86AssemblyInspectionEngine::push_i
// pushl imm8(%esp)
//
-// e.g. 0xff 0x74 0x24 0x20 - 'pushl 0x20(%esp)'
-// (same byte pattern for 'pushq 0x20(%rsp)' in an x86_64 program)
+// e.g. 0xff 0x74 0x24 0x20 - 'pushl 0x20(%esp)' (same byte pattern for 'pushq
+// 0x20(%rsp)' in an x86_64 program)
//
-// 0xff (with opcode bits '6' in next byte, PUSH r/m32)
-// 0x74 (ModR/M byte with three bits used to specify the opcode)
+// 0xff (with opcode bits '6' in next byte, PUSH r/m32) 0x74 (ModR/M byte with
+// three bits used to specify the opcode)
// mod == b01, opcode == b110, R/M == b100
// "+disp8"
-// 0x24 (SIB byte - scaled index = 0, r32 == esp)
-// 0x20 imm8 value
+// 0x24 (SIB byte - scaled index = 0, r32 == esp) 0x20 imm8 value
bool x86AssemblyInspectionEngine::push_extended_pattern_p() {
if (*m_cur_insn == 0xff) {
@@ -337,9 +335,8 @@ bool x86AssemblyInspectionEngine::push_e
uint8_t opcode = (*(m_cur_insn + 1) >> 3) & 7;
if (opcode == 6) {
// I'm only looking for 0xff /6 here - I
- // don't really care what value is being pushed,
- // just that we're pushing a 32/64 bit value on
- // to the stack is enough.
+ // don't really care what value is being pushed, just that we're pushing
+ // a 32/64 bit value on to the stack is enough.
return true;
}
}
@@ -377,8 +374,8 @@ bool x86AssemblyInspectionEngine::push_r
return false;
}
-// movq %rsp, %rbp [0x48 0x8b 0xec] or [0x48 0x89 0xe5]
-// movl %esp, %ebp [0x8b 0xec] or [0x89 0xe5]
+// movq %rsp, %rbp [0x48 0x8b 0xec] or [0x48 0x89 0xe5] movl %esp, %ebp [0x8b
+// 0xec] or [0x89 0xe5]
bool x86AssemblyInspectionEngine::mov_rsp_rbp_pattern_p() {
uint8_t *p = m_cur_insn;
if (m_wordsize == 8 && *p == 0x48)
@@ -529,16 +526,16 @@ bool x86AssemblyInspectionEngine::call_n
(*(p + 3) == 0x0) && (*(p + 4) == 0x0);
}
-// Look for an instruction sequence storing a nonvolatile register
-// on to the stack frame.
+// Look for an instruction sequence storing a nonvolatile register on to the
+// stack frame.
// movq %rax, -0x10(%rbp) [0x48 0x89 0x45 0xf0]
// movl %eax, -0xc(%ebp) [0x89 0x45 0xf4]
-// The offset value returned in rbp_offset will be positive --
-// but it must be subtraced from the frame base register to get
-// the actual location. The positive value returned for the offset
-// is a convention used elsewhere for CFA offsets et al.
+// The offset value returned in rbp_offset will be positive -- but it must be
+// subtraced from the frame base register to get the actual location. The
+// positive value returned for the offset is a convention used elsewhere for
+// CFA offsets et al.
bool x86AssemblyInspectionEngine::mov_reg_to_local_stack_frame_p(
int ®no, int &rbp_offset) {
@@ -550,8 +547,8 @@ bool x86AssemblyInspectionEngine::mov_re
src_reg_prefix_bit = REX_W_SRCREG(*p) << 3;
target_reg_prefix_bit = REX_W_DSTREG(*p) << 3;
if (target_reg_prefix_bit == 1) {
- // rbp/ebp don't need a prefix bit - we know this isn't the
- // reg we care about.
+ // rbp/ebp don't need a prefix bit - we know this isn't the reg we care
+ // about.
return false;
}
p++;
@@ -671,18 +668,16 @@ bool x86AssemblyInspectionEngine::GetNon
*newrow = *row.get();
row.reset(newrow);
- // Track which registers have been saved so far in the prologue.
- // If we see another push of that register, it's not part of the prologue.
- // The register numbers used here are the machine register #'s
- // (i386_register_numbers, x86_64_register_numbers).
+ // Track which registers have been saved so far in the prologue. If we see
+ // another push of that register, it's not part of the prologue. The register
+ // numbers used here are the machine register #'s (i386_register_numbers,
+ // x86_64_register_numbers).
std::vector<bool> saved_registers(32, false);
// Once the prologue has completed we'll save a copy of the unwind
- // instructions
- // If there is an epilogue in the middle of the function, after that epilogue
- // we'll reinstate
- // the unwind setup -- we assume that some code path jumps over the
- // mid-function epilogue
+ // instructions If there is an epilogue in the middle of the function, after
+ // that epilogue we'll reinstate the unwind setup -- we assume that some code
+ // path jumps over the mid-function epilogue
UnwindPlan::RowSP prologue_completed_row; // copy of prologue row of CFI
int prologue_completed_sp_bytes_offset_from_cfa; // The sp value before the
@@ -723,9 +718,8 @@ bool x86AssemblyInspectionEngine::GetNon
}
// This is the start() function (or a pthread equivalent), it starts with a
- // pushl $0x0 which puts the
- // saved pc value of 0 on the stack. In this case we want to pretend we
- // didn't see a stack movement at all --
+ // pushl $0x0 which puts the saved pc value of 0 on the stack. In this
+ // case we want to pretend we didn't see a stack movement at all --
// normally the saved pc value is already on the stack by the time the
// function starts executing.
else if (push_0_pattern_p()) {
@@ -733,9 +727,9 @@ bool x86AssemblyInspectionEngine::GetNon
else if (push_reg_p(machine_regno)) {
current_sp_bytes_offset_from_cfa += m_wordsize;
- // the PUSH instruction has moved the stack pointer - if the CFA is set in
- // terms of the stack pointer,
- // we need to add a new row of instructions.
+ // the PUSH instruction has moved the stack pointer - if the CFA is set
+ // in terms of the stack pointer, we need to add a new row of
+ // instructions.
if (row->GetCFAValue().GetRegisterNumber() == m_lldb_sp_regnum) {
row->GetCFAValue().SetOffset(current_sp_bytes_offset_from_cfa);
row_updated = true;
@@ -772,8 +766,7 @@ bool x86AssemblyInspectionEngine::GetNon
}
// the POP instruction has moved the stack pointer - if the CFA is set in
- // terms of the stack pointer,
- // we need to add a new row of instructions.
+ // terms of the stack pointer, we need to add a new row of instructions.
if (row->GetCFAValue().GetRegisterNumber() == m_lldb_sp_regnum) {
row->GetCFAValue().SetIsRegisterPlusOffset(
m_lldb_sp_regnum, current_sp_bytes_offset_from_cfa);
@@ -790,13 +783,13 @@ bool x86AssemblyInspectionEngine::GetNon
}
}
- // The LEAVE instruction moves the value from rbp into rsp and pops
- // a value off the stack into rbp (restoring the caller's rbp value).
- // It is the opposite of ENTER, or 'push rbp, mov rsp rbp'.
+ // The LEAVE instruction moves the value from rbp into rsp and pops a value
+ // off the stack into rbp (restoring the caller's rbp value). It is the
+ // opposite of ENTER, or 'push rbp, mov rsp rbp'.
else if (leave_pattern_p()) {
// We're going to copy the value in rbp into rsp, so re-set the sp offset
- // based on the CFAValue. Also, adjust it to recognize that we're popping
- // the saved rbp value off the stack.
+ // based on the CFAValue. Also, adjust it to recognize that we're
+ // popping the saved rbp value off the stack.
current_sp_bytes_offset_from_cfa = row->GetCFAValue().GetOffset();
current_sp_bytes_offset_from_cfa -= m_wordsize;
row->GetCFAValue().SetOffset(current_sp_bytes_offset_from_cfa);
@@ -822,12 +815,11 @@ bool x86AssemblyInspectionEngine::GetNon
UnwindPlan::Row::RegisterLocation regloc;
- // stack_offset for 'movq %r15, -80(%rbp)' will be 80.
- // In the Row, we want to express this as the offset from the CFA. If the
- // frame base
- // is rbp (like the above instruction), the CFA offset for rbp is probably
- // 16. So we
- // want to say that the value is stored at the CFA address - 96.
+ // stack_offset for 'movq %r15, -80(%rbp)' will be 80. In the Row, we
+ // want to express this as the offset from the CFA. If the frame base is
+ // rbp (like the above instruction), the CFA offset for rbp is probably
+ // 16. So we want to say that the value is stored at the CFA address -
+ // 96.
regloc.SetAtCFAPlusOffset(
-(stack_offset + row->GetCFAValue().GetOffset()));
@@ -879,8 +871,8 @@ bool x86AssemblyInspectionEngine::GetNon
}
else if (ret_pattern_p() && prologue_completed_row.get()) {
- // Reinstate the saved prologue setup for any instructions
- // that come after the ret instruction
+ // Reinstate the saved prologue setup for any instructions that come
+ // after the ret instruction
UnwindPlan::Row *newrow = new UnwindPlan::Row;
*newrow = *prologue_completed_row.get();
@@ -960,16 +952,15 @@ bool x86AssemblyInspectionEngine::Augmen
if (!addr_start.IsValid())
return false;
- // We either need a live RegisterContext, or we need the UnwindPlan to already
- // be in the lldb register numbering scheme.
+ // We either need a live RegisterContext, or we need the UnwindPlan to
+ // already be in the lldb register numbering scheme.
if (reg_ctx.get() == nullptr &&
unwind_plan.GetRegisterKind() != eRegisterKindLLDB)
return false;
// Is original unwind_plan valid?
- // unwind_plan should have at least one row which is ABI-default (CFA register
- // is sp),
- // and another row in mid-function.
+ // unwind_plan should have at least one row which is ABI-default (CFA
+ // register is sp), and another row in mid-function.
if (unwind_plan.GetRowCount() < 2)
return false;
@@ -994,11 +985,9 @@ bool x86AssemblyInspectionEngine::Augmen
UnwindPlan::RowSP row(new UnwindPlan::Row(*first_row));
m_cur_insn = data + offset;
- // After a mid-function epilogue we will need to re-insert the original unwind
- // rules
- // so unwinds work for the remainder of the function. These aren't common
- // with clang/gcc
- // on x86 but it is possible.
+ // After a mid-function epilogue we will need to re-insert the original
+ // unwind rules so unwinds work for the remainder of the function. These
+ // aren't common with clang/gcc on x86 but it is possible.
bool reinstate_unwind_state = false;
while (offset < size) {
@@ -1015,8 +1004,7 @@ bool x86AssemblyInspectionEngine::Augmen
offset += insn_len;
m_cur_insn = data + offset;
- // offset is pointing beyond the bounds of the
- // function; stop looping.
+ // offset is pointing beyond the bounds of the function; stop looping.
if (offset >= size)
continue;
@@ -1044,9 +1032,8 @@ bool x86AssemblyInspectionEngine::Augmen
}
if (row_id == 0) {
- // If we are here, compiler didn't generate CFI for prologue.
- // This won't happen to GCC or clang.
- // In this case, bail out directly.
+ // If we are here, compiler didn't generate CFI for prologue. This won't
+ // happen to GCC or clang. In this case, bail out directly.
return false;
}
@@ -1086,10 +1073,9 @@ bool x86AssemblyInspectionEngine::Augmen
}
if (pop_reg_p(regno)) {
// Technically, this might be a nonvolatile register recover in
- // epilogue.
- // We should reset RegisterInfo for the register.
- // But in practice, previous rule for the register is still valid...
- // So we ignore this case.
+ // epilogue. We should reset RegisterInfo for the register. But in
+ // practice, previous rule for the register is still valid... So we
+ // ignore this case.
row->SetOffset(offset);
row->GetCFAValue().IncOffset(-m_wordsize);
Modified: lldb/trunk/source/Symbol/ArmUnwindInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ArmUnwindInfo.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ArmUnwindInfo.cpp (original)
+++ lldb/trunk/source/Symbol/ArmUnwindInfo.cpp Mon Apr 30 09:49:04 2018
@@ -65,17 +65,16 @@ ArmUnwindInfo::ArmUnwindInfo(ObjectFile
}
// Sort the entries in the exidx section. The entries should be sorted inside
- // the section but
- // some old compiler isn't sorted them.
+ // the section but some old compiler isn't sorted them.
std::sort(m_exidx_entries.begin(), m_exidx_entries.end());
}
ArmUnwindInfo::~ArmUnwindInfo() {}
-// Read a byte from the unwind instruction stream with the given offset.
-// Custom function is required because have to red in order of significance
-// within their containing
-// word (most significant byte first) and in increasing word address order.
+// Read a byte from the unwind instruction stream with the given offset. Custom
+// function is required because have to red in order of significance within
+// their containing word (most significant byte first) and in increasing word
+// address order.
uint8_t ArmUnwindInfo::GetByteAtOffset(const uint32_t *data,
uint16_t offset) const {
uint32_t value = data[offset / 4];
@@ -276,8 +275,8 @@ bool ArmUnwindInfo::GetUnwindPlan(Target
return false;
} else if ((byte1 & 0xff) == 0xc8) {
// 11001000 sssscccc
- // Pop VFP double precision registers D[16+ssss]-D[16+ssss+cccc] saved (as
- // if) by FSTMFDD (see remarks d,e)
+ // Pop VFP double precision registers D[16+ssss]-D[16+ssss+cccc] saved
+ // (as if) by FSTMFDD (see remarks d,e)
if (byte_offset >= byte_count)
return false;
Modified: lldb/trunk/source/Symbol/Block.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Block.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Block.cpp (original)
+++ lldb/trunk/source/Symbol/Block.cpp Mon Apr 30 09:49:04 2018
@@ -60,8 +60,7 @@ void Block::Dump(Stream *s, addr_t base_
if (depth < 0) {
Block *parent = GetParent();
if (parent) {
- // We have a depth that is less than zero, print our parent blocks
- // first
+ // We have a depth that is less than zero, print our parent blocks first
parent->Dump(s, base_addr, depth + 1, show_context);
}
}
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Apr 30 09:49:04 2018
@@ -163,8 +163,8 @@ bool ClangASTContext::IsOperator(const c
#undef OPERATOR_PREFIX
#undef OPERATOR_PREFIX_LENGTH
- // This is an operator, set the overloaded operator kind to invalid
- // in case this is a conversion operator...
+ // This is an operator, set the overloaded operator kind to invalid in case
+ // this is a conversion operator...
op_kind = clang::NUM_OVERLOADED_OPERATORS;
switch (post_op_name[0]) {
@@ -375,9 +375,9 @@ ClangASTContext::ConvertAccessTypeToAcce
static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) {
// FIXME: Cleanup per-file based stuff.
- // Set some properties which depend solely on the input kind; it would be nice
- // to move these to the language standard, and have the driver resolve the
- // input kind + language standard.
+ // Set some properties which depend solely on the input kind; it would be
+ // nice to move these to the language standard, and have the driver resolve
+ // the input kind + language standard.
if (IK.getLanguage() == InputKind::Asm) {
Opts.AsmPreprocessor = 1;
} else if (IK.isObjectiveC()) {
@@ -440,8 +440,8 @@ static void ParseLangArgs(LangOptions &O
Opts.setValueVisibilityMode(DefaultVisibility);
- // Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs
- // is specified, or -std is set to a conforming mode.
+ // Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs is
+ // specified, or -std is set to a conforming mode.
Opts.Trigraphs = !Opts.GNUMode;
Opts.CharIsSigned = ArchSpec(triple).CharIsSignedByDefault();
Opts.OptimizeSize = 0;
@@ -662,8 +662,8 @@ ASTContext *ClangASTContext::getASTConte
m_ast_ap->getDiagnostics().setClient(getDiagnosticConsumer(), false);
// This can be NULL if we don't know anything about the architecture or if
- // the
- // target for an architecture isn't enabled in the llvm/clang that we built
+ // the target for an architecture isn't enabled in the llvm/clang that we
+ // built
TargetInfo *target_info = getTargetInfo();
if (target_info)
m_ast_ap->InitBuiltinTypes(*target_info);
@@ -1254,8 +1254,8 @@ CompilerType ClangASTContext::GetTypeFor
}
CompilerType ClangASTContext::GetTypeForDecl(TagDecl *decl) {
- // No need to call the getASTContext() accessor (which can create the AST
- // if it isn't created yet, because we can't have created a decl in this
+ // No need to call the getASTContext() accessor (which can create the AST if
+ // it isn't created yet, because we can't have created a decl in this
// AST if our AST didn't already exist...
ASTContext *ast = &decl->getASTContext();
if (ast)
@@ -1264,8 +1264,8 @@ CompilerType ClangASTContext::GetTypeFor
}
CompilerType ClangASTContext::GetTypeForDecl(ObjCInterfaceDecl *decl) {
- // No need to call the getASTContext() accessor (which can create the AST
- // if it isn't created yet, because we can't have created a decl in this
+ // No need to call the getASTContext() accessor (which can create the AST if
+ // it isn't created yet, because we can't have created a decl in this
// AST if our AST didn't already exist...
ASTContext *ast = &decl->getASTContext();
if (ast)
@@ -1294,9 +1294,9 @@ CompilerType ClangASTContext::CreateReco
}
// NOTE: Eventually CXXRecordDecl will be merged back into RecordDecl and
- // we will need to update this code. I was told to currently always use
- // the CXXRecordDecl class since we often don't know from debug information
- // if something is struct or a class, so we default to always use the more
+ // we will need to update this code. I was told to currently always use the
+ // CXXRecordDecl class since we often don't know from debug information if
+ // something is struct or a class, so we default to always use the more
// complete definition just in case.
bool is_anonymous = (!name) || (!name[0]);
@@ -1499,9 +1499,9 @@ ClangASTContext::CreateTemplateTemplateP
ast, template_param_infos, template_param_decls);
// LLDB needs to create those decls only to be able to display a
- // type that includes a template template argument. Only the name
- // matters for this purpose, so we use dummy values for the other
- // characterisitcs of the type.
+ // type that includes a template template argument. Only the name matters for
+ // this purpose, so we use dummy values for the other characterisitcs of the
+ // type.
return TemplateTemplateParmDecl::Create(
*ast, decl_ctx, SourceLocation(),
/*Depth*/ 0, /*Position*/ 0,
@@ -1933,11 +1933,10 @@ ClangASTContext::GetDeclarationName(cons
return DeclarationName(&getASTContext()->Idents.get(
name)); // Not operator, but a regular function.
- // Check the number of operator parameters. Sometimes we have
- // seen bad DWARF that doesn't correctly describe operators and
- // if we try to create a method and add it to the class, clang
- // will assert and crash, so we need to make sure things are
- // acceptable.
+ // Check the number of operator parameters. Sometimes we have seen bad DWARF
+ // that doesn't correctly describe operators and if we try to create a method
+ // and add it to the class, clang will assert and crash, so we need to make
+ // sure things are acceptable.
clang::QualType method_qual_type(ClangUtil::GetQualType(function_clang_type));
const clang::FunctionProtoType *function_type =
llvm::dyn_cast<clang::FunctionProtoType>(method_qual_type.getTypePtr());
@@ -2247,8 +2246,8 @@ bool ClangASTContext::DeclsAreEquivalent
if (lhs_decl_kind == rhs_decl_kind) {
//------------------------------------------------------------------
- // Now check that the decl contexts kinds are all equivalent
- // before we have to check any names of the decl contexts...
+ // Now check that the decl contexts kinds are all equivalent before we
+ // have to check any names of the decl contexts...
//------------------------------------------------------------------
clang::DeclContext *lhs_decl_ctx = lhs_decl->getDeclContext();
clang::DeclContext *rhs_decl_ctx = rhs_decl->getDeclContext();
@@ -2290,8 +2289,8 @@ bool ClangASTContext::DeclsAreEquivalent
return false;
//--------------------------------------------------------------
- // We know that the decl context kinds all match, so now we need
- // to make sure the names match as well
+ // We know that the decl context kinds all match, so now we need to
+ // make sure the names match as well
//--------------------------------------------------------------
lhs_decl_ctx = lhs_decl->getDeclContext();
rhs_decl_ctx = rhs_decl->getDeclContext();
@@ -2561,8 +2560,7 @@ static bool GetCompleteQualType(clang::A
clang::ObjCInterfaceDecl *class_interface_decl =
objc_class_type->getInterface();
// We currently can't complete objective C types through the newly added
- // ASTContext
- // because it only supports TagDecl objects right now...
+ // ASTContext because it only supports TagDecl objects right now...
if (class_interface_decl) {
if (class_interface_decl->getDefinition())
return true;
@@ -2882,8 +2880,8 @@ bool ClangASTContext::IsCStringType(lldb
if (type_flags.AnySet(eTypeIsArray | eTypeIsPointer)) {
if (pointee_or_element_clang_type.IsCharType()) {
if (type_flags.Test(eTypeIsArray)) {
- // We know the size of the array and it could be a C string
- // since it is an array of characters
+ // We know the size of the array and it could be a C string since it is
+ // an array of characters
length = llvm::cast<clang::ConstantArrayType>(
GetCanonicalQualType(type).getTypePtr())
->getSize()
@@ -3623,9 +3621,8 @@ bool ClangASTContext::IsPossibleDynamicT
if (success) {
// Check to make sure what we are pointing too is a possible dynamic C++
- // type
- // We currently accept any "void *" (in case we have a class that has been
- // watered down to an opaque pointer) and virtual C++ classes.
+ // type We currently accept any "void *" (in case we have a class that
+ // has been watered down to an opaque pointer) and virtual C++ classes.
const clang::Type::TypeClass pointee_type_class =
pointee_qual_type.getCanonicalType()->getTypeClass();
switch (pointee_type_class) {
@@ -4777,9 +4774,8 @@ ClangASTContext::CreateTypedef(lldb::opa
}
// Check whether this declaration is an anonymous struct, union, or enum,
- // hidden behind a typedef. If so, we
- // try to check whether we have a typedef tag to attach to the original
- // record declaration
+ // hidden behind a typedef. If so, we try to check whether we have a
+ // typedef tag to attach to the original record declaration
if (tdecl && !tdecl->getIdentifier() && !tdecl->getTypedefNameForAnonDecl())
tdecl->setTypedefNameForAnonDecl(decl);
@@ -5005,9 +5001,8 @@ lldb::Encoding ClangASTContext::GetEncod
break;
}
break;
- // All pointer types are represented as unsigned integer encodings.
- // We may nee to add a eEncodingPointer if we ever need to know the
- // difference
+ // All pointer types are represented as unsigned integer encodings. We may
+ // nee to add a eEncodingPointer if we ever need to know the difference
case clang::Type::ObjCObjectPointer:
case clang::Type::BlockPointer:
case clang::Type::Pointer:
@@ -5324,10 +5319,9 @@ uint32_t ClangASTContext::GetNumChildren
llvm::dyn_cast<clang::CXXRecordDecl>(record_decl);
if (cxx_record_decl) {
if (omit_empty_base_classes) {
- // Check each base classes to see if it or any of its
- // base classes contain any fields. This can help
- // limit the noise in variable views by not having to
- // show base classes that contain no members.
+ // Check each base classes to see if it or any of its base classes
+ // contain any fields. This can help limit the noise in variable
+ // views by not having to show base classes that contain no members.
clang::CXXRecordDecl::base_class_const_iterator base_class,
base_class_end;
for (base_class = cxx_record_decl->bases_begin(),
@@ -5420,8 +5414,8 @@ uint32_t ClangASTContext::GetNumChildren
CompilerType(getASTContext(), pointee_type)
.GetNumChildren(omit_empty_base_classes);
if (num_pointee_children == 0) {
- // We have a pointer to a pointee type that claims it has no children.
- // We will want to look at
+ // We have a pointer to a pointee type that claims it has no children. We
+ // will want to look at
num_children = GetNumPointeeChildren(pointee_type);
} else
num_children = num_pointee_children;
@@ -6615,15 +6609,12 @@ CompilerType ClangASTContext::GetChildCo
child_byte_size = ivar_type_info.Width / 8;
// Figure out the field offset within the current
- // struct/union/class type
- // For ObjC objects, we can't trust the bit offset we get from
- // the Clang AST, since
- // that doesn't account for the space taken up by unbacked
- // properties, or from
- // the changing size of base classes that are newer than this
- // class.
- // So if we have a process around that we can ask about this
- // object, do so.
+ // struct/union/class type For ObjC objects, we can't trust the
+ // bit offset we get from the Clang AST, since that doesn't
+ // account for the space taken up by unbacked properties, or
+ // from the changing size of base classes that are newer than
+ // this class. So if we have a process around that we can ask
+ // about this object, do so.
child_byte_offset = LLDB_INVALID_IVAR_OFFSET;
Process *process = nullptr;
if (exe_ctx)
@@ -6651,9 +6642,8 @@ CompilerType ClangASTContext::GetChildCo
}
// Note, the ObjC Ivar Byte offset is just that, it doesn't
- // account for the bit offset
- // of a bitfield within its containing object. So regardless of
- // where we get the byte
+ // account for the bit offset of a bitfield within its
+ // containing object. So regardless of where we get the byte
// offset from, we still need to get the bit offset for
// bitfields from the layout.
@@ -6925,8 +6915,8 @@ static uint32_t GetIndexForRecordChild(c
}
// Look for a child member (doesn't include base classes, but it does include
-// their members) in the type hierarchy. Returns an index path into "clang_type"
-// on how to reach the appropriate member.
+// their members) in the type hierarchy. Returns an index path into
+// "clang_type" on how to reach the appropriate member.
//
// class A
// {
@@ -6949,16 +6939,13 @@ static uint32_t GetIndexForRecordChild(c
// "m_b" in it:
//
// With omit_empty_base_classes == false we would get an integer array back
-// with:
-// { 1, 1 }
-// The first index 1 is the child index for "class A" within class C
-// The second index 1 is the child index for "m_b" within class A
+// with: { 1, 1 } The first index 1 is the child index for "class A" within
+// class C The second index 1 is the child index for "m_b" within class A
//
-// With omit_empty_base_classes == true we would get an integer array back with:
-// { 0, 1 }
-// The first index 0 is the child index for "class A" within class C (since
-// class B doesn't have any members it doesn't count)
-// The second index 1 is the child index for "m_b" within class A
+// With omit_empty_base_classes == true we would get an integer array back
+// with: { 0, 1 } The first index 0 is the child index for "class A" within
+// class C (since class B doesn't have any members it doesn't count) The second
+// index 1 is the child index for "m_b" within class A
size_t ClangASTContext::GetIndexOfChildMemberWithName(
lldb::opaque_compiler_type_t type, const char *name,
@@ -7093,9 +7080,9 @@ size_t ClangASTContext::GetIndexOfChildM
}
if (superclass_interface_decl) {
- // The super class index is always zero for ObjC classes,
- // so we push it onto the child indexes in case we find
- // an ivar in our superclass...
+ // The super class index is always zero for ObjC classes, so we
+ // push it onto the child indexes in case we find an ivar in our
+ // superclass...
child_indexes.push_back(0);
CompilerType superclass_clang_type(
@@ -7103,14 +7090,13 @@ size_t ClangASTContext::GetIndexOfChildM
superclass_interface_decl));
if (superclass_clang_type.GetIndexOfChildMemberWithName(
name, omit_empty_base_classes, child_indexes)) {
- // We did find an ivar in a superclass so just
- // return the results!
+ // We did find an ivar in a superclass so just return the
+ // results!
return child_indexes.size();
}
- // We didn't find an ivar matching "name" in our
- // superclass, pop the superclass zero index that
- // we pushed on above.
+ // We didn't find an ivar matching "name" in our superclass, pop
+ // the superclass zero index that we pushed on above.
child_indexes.pop_back();
}
}
@@ -7703,8 +7689,8 @@ clang::FieldDecl *ClangASTContext::AddFi
clang::ICIS_NoInit); // HasInit
if (!name) {
- // Determine whether this field corresponds to an anonymous
- // struct or union.
+ // Determine whether this field corresponds to an anonymous struct or
+ // union.
if (const clang::TagType *TagT =
field->getType()->getAs<clang::TagType>()) {
if (clang::RecordDecl *Rec =
@@ -7848,8 +7834,8 @@ void ClangASTContext::BuildIndirectField
}
}
- // Check the last field to see if it has an incomplete array type as its
- // last member and if it does, the tell the record decl about it
+ // Check the last field to see if it has an incomplete array type as its last
+ // member and if it does, the tell the record decl about it
if (last_field_pos != field_end_pos) {
if (last_field_pos->getType()->isIncompleteArrayType())
record_decl->hasFlexibleArrayMember();
@@ -7983,11 +7969,10 @@ clang::CXXMethodDecl *ClangASTContext::A
if (IsOperator(name, op_kind)) {
if (op_kind != clang::NUM_OVERLOADED_OPERATORS) {
- // Check the number of operator parameters. Sometimes we have
- // seen bad DWARF that doesn't correctly describe operators and
- // if we try to create a method and add it to the class, clang
- // will assert and crash, so we need to make sure things are
- // acceptable.
+ // Check the number of operator parameters. Sometimes we have seen bad
+ // DWARF that doesn't correctly describe operators and if we try to
+ // create a method and add it to the class, clang will assert and
+ // crash, so we need to make sure things are acceptable.
const bool is_method = true;
if (!ClangASTContext::CheckOverloadedOperatorKindParameterCount(
is_method, op_kind, num_params))
@@ -8667,8 +8652,8 @@ bool ClangASTContext::CompleteTagDeclara
clang::QualType qual_type(ClangUtil::GetQualType(type));
if (!qual_type.isNull()) {
// Make sure we use the same methodology as
- // ClangASTContext::StartTagDeclarationDefinition()
- // as to how we start/end the definition. Previously we were calling
+ // ClangASTContext::StartTagDeclarationDefinition() as to how we start/end
+ // the definition. Previously we were calling
const clang::TagType *tag_type = qual_type->getAs<clang::TagType>();
if (tag_type) {
clang::TagDecl *tag_decl = tag_type->getDecl();
@@ -8938,9 +8923,8 @@ void ClangASTContext::DumpValue(
for (field = record_decl->field_begin(),
field_end = record_decl->field_end();
field != field_end; ++field, ++field_idx, ++child_idx) {
- // Print the starting squiggly bracket (if this is the
- // first member) or comma (for member 2 and beyond) for
- // the struct/union/class member.
+ // Print the starting squiggly bracket (if this is the first member) or
+ // comma (for member 2 and beyond) for the struct/union/class member.
if (child_idx == 0)
s->PutChar('{');
else
@@ -8951,8 +8935,8 @@ void ClangASTContext::DumpValue(
clang::QualType field_type = field->getType();
// Print the member type if requested
- // Figure out the type byte size (field_type_info.first) and
- // alignment (field_type_info.second) from the AST context.
+ // Figure out the type byte size (field_type_info.first) and alignment
+ // (field_type_info.second) from the AST context.
clang::TypeInfo field_type_info =
getASTContext()->getTypeInfo(field_type);
assert(field_idx < record_layout.getFieldCount());
@@ -9023,8 +9007,8 @@ void ClangASTContext::DumpValue(
return;
}
}
- // If we have gotten here we didn't get find the enumerator in the
- // enum decl, so just print the integer.
+ // If we have gotten here we didn't get find the enumerator in the enum
+ // decl, so just print the integer.
s->Printf("%" PRIi64, enum_value);
}
return;
@@ -9062,9 +9046,8 @@ void ClangASTContext::DumpValue(
lldb::Format element_format = element_clang_type.GetFormat();
for (element_idx = 0; element_idx < element_count; ++element_idx) {
- // Print the starting squiggly bracket (if this is the
- // first member) or comman (for member 2 and beyong) for
- // the struct/union/class member.
+ // Print the starting squiggly bracket (if this is the first member) or
+ // comman (for member 2 and beyong) for the struct/union/class member.
if (element_idx == 0)
s->PutChar('{');
else
@@ -9260,8 +9243,8 @@ bool ClangASTContext::DumpTypeValue(
} break;
case clang::Type::Enum:
- // If our format is enum or default, show the enumeration value as
- // its enumeration string value, else just display it as requested.
+ // If our format is enum or default, show the enumeration value as its
+ // enumeration string value, else just display it as requested.
if ((format == eFormatEnum || format == eFormatDefault) &&
GetCompleteType(type)) {
const clang::EnumType *enutype =
@@ -9553,9 +9536,9 @@ void ClangASTContext::DumpTypeName(const
if (objc_class_type) {
clang::ObjCInterfaceDecl *class_interface_decl =
objc_class_type->getInterface();
- // We currently can't complete objective C types through the newly added
- // ASTContext
- // because it only supports TagDecl objects right now...
+ // We currently can't complete objective C types through the newly
+ // added ASTContext because it only supports TagDecl objects right
+ // now...
if (class_interface_decl)
printf("@class %s", class_interface_decl->getName().str().c_str());
}
@@ -9813,15 +9796,12 @@ std::vector<CompilerDecl> ClangASTContex
// Look for child_decl_ctx's lookup scope in frame_decl_ctx and its parents,
// and return the number of levels it took to find it, or
-// LLDB_INVALID_DECL_LEVEL
-// if not found. If the decl was imported via a using declaration, its name
-// and/or
-// type, if set, will be used to check that the decl found in the scope is a
-// match.
+// LLDB_INVALID_DECL_LEVEL if not found. If the decl was imported via a using
+// declaration, its name and/or type, if set, will be used to check that the
+// decl found in the scope is a match.
//
// The optional name is required by languages (like C++) to handle using
-// declarations
-// like:
+// declarations like:
//
// void poo();
// namespace ns {
@@ -9850,14 +9830,10 @@ std::vector<CompilerDecl> ClangASTContex
//
// NOTE: Because file statics are at the TranslationUnit along with globals, a
// function at file scope will return the same level as a function at global
-// scope.
-// Ideally we'd like to treat the file scope as an additional scope just below
-// the
-// global scope. More work needs to be done to recognise that, if the decl
-// we're
-// trying to look up is static, we should compare its source file with that of
-// the
-// current scope and return a lower number for it.
+// scope. Ideally we'd like to treat the file scope as an additional scope just
+// below the global scope. More work needs to be done to recognise that, if
+// the decl we're trying to look up is static, we should compare its source
+// file with that of the current scope and return a lower number for it.
uint32_t ClangASTContext::CountDeclLevels(clang::DeclContext *frame_decl_ctx,
clang::DeclContext *child_decl_ctx,
ConstString *child_name,
@@ -9886,10 +9862,8 @@ uint32_t ClangASTContext::CountDeclLevel
continue;
// Currently DWARF has one shared translation unit for all Decls at top
- // level, so this
- // would erroneously find using statements anywhere. So don't look at
- // the top-level
- // translation unit.
+ // level, so this would erroneously find using statements anywhere. So
+ // don't look at the top-level translation unit.
// TODO fix this and add a testcase that depends on it.
if (llvm::isa<clang::TranslationUnitDecl>(it->second))
Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Mon Apr 30 09:49:04 2018
@@ -354,8 +354,7 @@ bool ClangASTImporter::CanImport(const C
clang::ObjCInterfaceDecl *class_interface_decl =
objc_class_type->getInterface();
// We currently can't complete objective C types through the newly added
- // ASTContext
- // because it only supports TagDecl objects right now...
+ // ASTContext because it only supports TagDecl objects right now...
if (class_interface_decl) {
if (ResolveDeclOrigin(class_interface_decl, NULL, NULL))
return true;
@@ -431,8 +430,7 @@ bool ClangASTImporter::Import(const Comp
clang::ObjCInterfaceDecl *class_interface_decl =
objc_class_type->getInterface();
// We currently can't complete objective C types through the newly added
- // ASTContext
- // because it only supports TagDecl objects right now...
+ // ASTContext because it only supports TagDecl objects right now...
if (class_interface_decl) {
if (ResolveDeclOrigin(class_interface_decl, NULL, NULL))
return CompleteAndFetchChildren(qual_type);
@@ -896,9 +894,9 @@ void ClangASTImporter::Minion::ImportDef
}
}
- // If we're dealing with an Objective-C class, ensure that the inheritance has
- // been set up correctly. The ASTImporter may not do this correctly if the
- // class was originally sourced from symbols.
+ // If we're dealing with an Objective-C class, ensure that the inheritance
+ // has been set up correctly. The ASTImporter may not do this correctly if
+ // the class was originally sourced from symbols.
if (ObjCInterfaceDecl *to_objc_interface = dyn_cast<ObjCInterfaceDecl>(to)) {
do {
Modified: lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompactUnwindInfo.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompactUnwindInfo.cpp (original)
+++ lldb/trunk/source/Symbol/CompactUnwindInfo.cpp Mon Apr 30 09:49:04 2018
@@ -262,8 +262,7 @@ void CompactUnwindInfo::ScanIndex(const
if (m_unwindinfo_data_computed == false) {
if (m_section_sp->IsEncrypted()) {
// Can't get section contents of a protected/encrypted section until we
- // have a live
- // process and can read them out of memory.
+ // have a live process and can read them out of memory.
if (process_sp.get() == nullptr)
return;
m_section_contents_if_encrypted.reset(
@@ -329,11 +328,10 @@ void CompactUnwindInfo::ScanIndex(const
return;
}
- // Parse the basic information from the indexes
- // We wait to scan the second level page info until it's needed
+ // Parse the basic information from the indexes We wait to scan the second
+ // level page info until it's needed
- // struct unwind_info_section_header_index_entry
- // {
+ // struct unwind_info_section_header_index_entry {
// uint32_t functionOffset;
// uint32_t secondLevelPagesSectionOffset;
// uint32_t lsdaIndexArraySectionOffset;
@@ -388,8 +386,7 @@ void CompactUnwindInfo::ScanIndex(const
uint32_t CompactUnwindInfo::GetLSDAForFunctionOffset(uint32_t lsda_offset,
uint32_t lsda_count,
uint32_t function_offset) {
- // struct unwind_info_section_header_lsda_index_entry
- // {
+ // struct unwind_info_section_header_lsda_index_entry {
// uint32_t functionOffset;
// uint32_t lsdaOffset;
// };
@@ -419,8 +416,7 @@ lldb::offset_t CompactUnwindInfo::Binary
uint32_t entry_page_offset, uint32_t entry_count, uint32_t function_offset,
uint32_t *entry_func_start_offset, uint32_t *entry_func_end_offset) {
// typedef uint32_t compact_unwind_encoding_t;
- // struct unwind_info_regular_second_level_entry
- // {
+ // struct unwind_info_regular_second_level_entry {
// uint32_t functionOffset;
// compact_unwind_encoding_t encoding;
@@ -539,9 +535,9 @@ bool CompactUnwindInfo::GetCompactUnwind
auto next_it = it + 1;
if (next_it != m_indexes.end()) {
- // initialize the function offset end range to be the start of the
- // next index offset. If we find an entry which is at the end of
- // the index table, this will establish the range end.
+ // initialize the function offset end range to be the start of the next
+ // index offset. If we find an entry which is at the end of the index
+ // table, this will establish the range end.
unwind_info.valid_range_offset_end = next_it->function_offset;
}
@@ -554,15 +550,13 @@ bool CompactUnwindInfo::GetCompactUnwind
&offset); // UNWIND_SECOND_LEVEL_REGULAR or UNWIND_SECOND_LEVEL_COMPRESSED
if (kind == UNWIND_SECOND_LEVEL_REGULAR) {
- // struct unwind_info_regular_second_level_page_header
- // {
+ // struct unwind_info_regular_second_level_page_header {
// uint32_t kind; // UNWIND_SECOND_LEVEL_REGULAR
// uint16_t entryPageOffset;
// uint16_t entryCount;
// typedef uint32_t compact_unwind_encoding_t;
- // struct unwind_info_regular_second_level_entry
- // {
+ // struct unwind_info_regular_second_level_entry {
// uint32_t functionOffset;
// compact_unwind_encoding_t encoding;
@@ -612,8 +606,7 @@ bool CompactUnwindInfo::GetCompactUnwind
}
return true;
} else if (kind == UNWIND_SECOND_LEVEL_COMPRESSED) {
- // struct unwind_info_compressed_second_level_page_header
- // {
+ // struct unwind_info_compressed_second_level_page_header {
// uint32_t kind; // UNWIND_SECOND_LEVEL_COMPRESSED
// uint16_t entryPageOffset; // offset from this 2nd lvl page
// idx to array of entries
@@ -721,8 +714,8 @@ enum x86_64_eh_regnum {
// enough
};
-// Convert the compact_unwind_info.h register numbering scheme
-// to eRegisterKindEHFrame (eh_frame) register numbering scheme.
+// Convert the compact_unwind_info.h register numbering scheme to
+// eRegisterKindEHFrame (eh_frame) register numbering scheme.
uint32_t translate_to_eh_frame_regnum_x86_64(uint32_t unwind_regno) {
switch (unwind_regno) {
case UNWIND_X86_64_REG_RBX:
@@ -802,9 +795,8 @@ bool CompactUnwindInfo::CreateUnwindPlan
case UNWIND_X86_64_MODE_STACK_IND: {
// The clang in Xcode 6 is emitting incorrect compact unwind encodings for
- // this
- // style of unwind. It was fixed in llvm r217020.
- // The clang in Xcode 7 has this fixed.
+ // this style of unwind. It was fixed in llvm r217020. The clang in Xcode
+ // 7 has this fixed.
return false;
} break;
@@ -861,17 +853,17 @@ bool CompactUnwindInfo::CreateUnwindPlan
if (register_count > 0) {
- // We need to include (up to) 6 registers in 10 bits.
- // That would be 18 bits if we just used 3 bits per reg to indicate
- // the order they're saved on the stack.
+ // We need to include (up to) 6 registers in 10 bits. That would be 18
+ // bits if we just used 3 bits per reg to indicate the order they're
+ // saved on the stack.
//
// This is done with Lehmer code permutation, e.g. see
- // http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms
+ // http://stackoverflow.com/questions/1506078/fast-permutation-number-
+ // permutation-mapping-algorithms
int permunreg[6] = {0, 0, 0, 0, 0, 0};
- // This decodes the variable-base number in the 10 bits
- // and gives us the Lehmer code sequence which can then
- // be decoded.
+ // This decodes the variable-base number in the 10 bits and gives us the
+ // Lehmer code sequence which can then be decoded.
switch (register_count) {
case 6:
@@ -923,8 +915,8 @@ bool CompactUnwindInfo::CreateUnwindPlan
break;
}
- // Decode the Lehmer code for this permutation of
- // the registers v. http://en.wikipedia.org/wiki/Lehmer_code
+ // Decode the Lehmer code for this permutation of the registers v.
+ // http://en.wikipedia.org/wiki/Lehmer_code
int registers[6] = {UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE,
UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE,
@@ -993,8 +985,8 @@ enum i386_eh_regnum {
// enough
};
-// Convert the compact_unwind_info.h register numbering scheme
-// to eRegisterKindEHFrame (eh_frame) register numbering scheme.
+// Convert the compact_unwind_info.h register numbering scheme to
+// eRegisterKindEHFrame (eh_frame) register numbering scheme.
uint32_t translate_to_eh_frame_regnum_i386(uint32_t unwind_regno) {
switch (unwind_regno) {
case UNWIND_X86_REG_EBX:
@@ -1123,17 +1115,17 @@ bool CompactUnwindInfo::CreateUnwindPlan
if (register_count > 0) {
- // We need to include (up to) 6 registers in 10 bits.
- // That would be 18 bits if we just used 3 bits per reg to indicate
- // the order they're saved on the stack.
+ // We need to include (up to) 6 registers in 10 bits. That would be 18
+ // bits if we just used 3 bits per reg to indicate the order they're
+ // saved on the stack.
//
// This is done with Lehmer code permutation, e.g. see
- // http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms
+ // http://stackoverflow.com/questions/1506078/fast-permutation-number-
+ // permutation-mapping-algorithms
int permunreg[6] = {0, 0, 0, 0, 0, 0};
- // This decodes the variable-base number in the 10 bits
- // and gives us the Lehmer code sequence which can then
- // be decoded.
+ // This decodes the variable-base number in the 10 bits and gives us the
+ // Lehmer code sequence which can then be decoded.
switch (register_count) {
case 6:
@@ -1185,8 +1177,8 @@ bool CompactUnwindInfo::CreateUnwindPlan
break;
}
- // Decode the Lehmer code for this permutation of
- // the registers v. http://en.wikipedia.org/wiki/Lehmer_code
+ // Decode the Lehmer code for this permutation of the registers v.
+ // http://en.wikipedia.org/wiki/Lehmer_code
int registers[6] = {UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE,
UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE,
@@ -1260,14 +1252,10 @@ enum arm64_eh_regnum {
pc = 32,
// Compact unwind encodes d8-d15 but we don't have eh_frame / dwarf reg #'s
- // for the 64-bit
- // fp regs. Normally in DWARF it's context sensitive - so it knows it is
- // fetching a
- // 32- or 64-bit quantity from reg v8 to indicate s0 or d0 - but the unwinder
- // is operating
- // at a lower level and we'd try to fetch 128 bits if we were told that v8
- // were stored on
- // the stack...
+ // for the 64-bit fp regs. Normally in DWARF it's context sensitive - so it
+ // knows it is fetching a 32- or 64-bit quantity from reg v8 to indicate s0
+ // or d0 - but the unwinder is operating at a lower level and we'd try to
+ // fetch 128 bits if we were told that v8 were stored on the stack...
v8 = 72,
v9 = 73,
v10 = 74,
Modified: lldb/trunk/source/Symbol/CompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompileUnit.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompileUnit.cpp (original)
+++ lldb/trunk/source/Symbol/CompileUnit.cpp Mon Apr 30 09:49:04 2018
@@ -67,10 +67,10 @@ void CompileUnit::GetDescription(Stream
}
//----------------------------------------------------------------------
-// Dump the current contents of this object. No functions that cause on
-// demand parsing of functions, globals, statics are called, so this
-// is a good function to call to get an idea of the current contents of
-// the CompileUnit object.
+// Dump the current contents of this object. No functions that cause on demand
+// parsing of functions, globals, statics are called, so this is a good
+// function to call to get an idea of the current contents of the CompileUnit
+// object.
//----------------------------------------------------------------------
void CompileUnit::Dump(Stream *s, bool show_context) const {
const char *language = Language::GetNameForLanguageType(m_language);
@@ -118,28 +118,27 @@ FunctionSP CompileUnit::GetFunctionAtInd
}
//----------------------------------------------------------------------
-// Find functions using the Mangled::Tokens token list. This
-// function currently implements an interactive approach designed to find
-// all instances of certain functions. It isn't designed to the
-// quickest way to lookup functions as it will need to iterate through
-// all functions and see if they match, though it does provide a powerful
-// and context sensitive way to search for all functions with a certain
-// name, all functions in a namespace, or all functions of a template
-// type. See Mangled::Tokens::Parse() comments for more information.
+// Find functions using the Mangled::Tokens token list. This function currently
+// implements an interactive approach designed to find all instances of certain
+// functions. It isn't designed to the quickest way to lookup functions as it
+// will need to iterate through all functions and see if they match, though it
+// does provide a powerful and context sensitive way to search for all
+// functions with a certain name, all functions in a namespace, or all
+// functions of a template type. See Mangled::Tokens::Parse() comments for more
+// information.
//
-// The function prototype will need to change to return a list of
-// results. It was originally used to help debug the Mangled class
-// and the Mangled::Tokens::MatchesQuery() function and it currently
-// will print out a list of matching results for the functions that
-// are currently in this compile unit.
+// The function prototype will need to change to return a list of results. It
+// was originally used to help debug the Mangled class and the
+// Mangled::Tokens::MatchesQuery() function and it currently will print out a
+// list of matching results for the functions that are currently in this
+// compile unit.
//
// A FindFunctions method should be called prior to this that takes
-// a regular function name (const char * or ConstString as a parameter)
-// before resorting to this slower but more complete function. The
-// other FindFunctions method should be able to take advantage of any
-// accelerator tables available in the debug information (which is
-// parsed by the SymbolFile parser plug-ins and registered with each
-// Module).
+// a regular function name (const char * or ConstString as a parameter) before
+// resorting to this slower but more complete function. The other FindFunctions
+// method should be able to take advantage of any accelerator tables available
+// in the debug information (which is parsed by the SymbolFile parser plug-ins
+// and registered with each Module).
//----------------------------------------------------------------------
// void
// CompileUnit::FindFunctions(const Mangled::Tokens& tokens)
@@ -283,8 +282,8 @@ uint32_t CompileUnit::ResolveSymbolConte
bool exact, uint32_t resolve_scope,
SymbolContextList &sc_list) {
// First find all of the file indexes that match our "file_spec". If
- // "file_spec" has an empty directory, then only compare the basenames
- // when finding file indexes
+ // "file_spec" has an empty directory, then only compare the basenames when
+ // finding file indexes
std::vector<uint32_t> file_indexes;
const bool full_match = (bool)file_spec.GetDirectory();
bool file_spec_matches_cu_file_spec =
@@ -319,23 +318,23 @@ uint32_t CompileUnit::ResolveSymbolConte
uint32_t line_idx;
if (num_file_indexes == 1) {
- // We only have a single support file that matches, so use
- // the line table function that searches for a line entries
- // that match a single support file index
+ // We only have a single support file that matches, so use the line
+ // table function that searches for a line entries that match a single
+ // support file index
LineEntry line_entry;
line_idx = line_table->FindLineEntryIndexByFileIndex(
0, file_indexes.front(), line, exact, &line_entry);
- // If "exact == true", then "found_line" will be the same
- // as "line". If "exact == false", the "found_line" will be the
- // closest line entry with a line number greater than "line" and
- // we will use this for our subsequent line exact matches below.
+ // If "exact == true", then "found_line" will be the same as "line". If
+ // "exact == false", the "found_line" will be the closest line entry
+ // with a line number greater than "line" and we will use this for our
+ // subsequent line exact matches below.
found_line = line_entry.line;
while (line_idx != UINT32_MAX) {
- // If they only asked for the line entry, then we're done, we can just
- // copy that over.
- // But if they wanted more than just the line number, fill it in.
+ // If they only asked for the line entry, then we're done, we can
+ // just copy that over. But if they wanted more than just the line
+ // number, fill it in.
if (resolve_scope == eSymbolContextLineEntry) {
sc.line_entry = line_entry;
} else {
@@ -349,17 +348,17 @@ uint32_t CompileUnit::ResolveSymbolConte
&line_entry);
}
} else {
- // We found multiple support files that match "file_spec" so use
- // the line table function that searches for a line entries
- // that match a multiple support file indexes.
+ // We found multiple support files that match "file_spec" so use the
+ // line table function that searches for a line entries that match a
+ // multiple support file indexes.
LineEntry line_entry;
line_idx = line_table->FindLineEntryIndexByFileIndex(
0, file_indexes, line, exact, &line_entry);
- // If "exact == true", then "found_line" will be the same
- // as "line". If "exact == false", the "found_line" will be the
- // closest line entry with a line number greater than "line" and
- // we will use this for our subsequent line exact matches below.
+ // If "exact == true", then "found_line" will be the same as "line". If
+ // "exact == false", the "found_line" will be the closest line entry
+ // with a line number greater than "line" and we will use this for our
+ // subsequent line exact matches below.
found_line = line_entry.line;
while (line_idx != UINT32_MAX) {
@@ -377,8 +376,8 @@ uint32_t CompileUnit::ResolveSymbolConte
}
}
} else if (file_spec_matches_cu_file_spec && !check_inlines) {
- // only append the context if we aren't looking for inline call sites
- // by file and line and if the file spec matches that of the compile unit
+ // only append the context if we aren't looking for inline call sites by
+ // file and line and if the file spec matches that of the compile unit
sc_list.Append(sc);
}
return sc_list.GetSize() - prev_size;
Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Mon Apr 30 09:49:04 2018
@@ -638,8 +638,8 @@ CompilerType CompilerType::GetChildCompi
}
// Look for a child member (doesn't include base classes, but it does include
-// their members) in the type hierarchy. Returns an index path into "clang_type"
-// on how to reach the appropriate member.
+// their members) in the type hierarchy. Returns an index path into
+// "clang_type" on how to reach the appropriate member.
//
// class A
// {
@@ -662,16 +662,13 @@ CompilerType CompilerType::GetChildCompi
// "m_b" in it:
//
// With omit_empty_base_classes == false we would get an integer array back
-// with:
-// { 1, 1 }
-// The first index 1 is the child index for "class A" within class C
-// The second index 1 is the child index for "m_b" within class A
+// with: { 1, 1 } The first index 1 is the child index for "class A" within
+// class C The second index 1 is the child index for "m_b" within class A
//
-// With omit_empty_base_classes == true we would get an integer array back with:
-// { 0, 1 }
-// The first index 0 is the child index for "class A" within class C (since
-// class B doesn't have any members it doesn't count)
-// The second index 1 is the child index for "m_b" within class A
+// With omit_empty_base_classes == true we would get an integer array back
+// with: { 0, 1 } The first index 0 is the child index for "class A" within
+// class C (since class B doesn't have any members it doesn't count) The second
+// index 1 is the child index for "m_b" within class A
size_t CompilerType::GetIndexOfChildMemberWithName(
const char *name, bool omit_empty_base_classes,
@@ -987,8 +984,8 @@ bool CompilerType::ReadFromMemory(lldb_p
if (!IsValid())
return false;
- // Can't convert a file address to anything valid without more
- // context (which Module it came from)
+ // Can't convert a file address to anything valid without more context (which
+ // Module it came from)
if (address_type == eAddressTypeFile)
return false;
@@ -1029,8 +1026,8 @@ bool CompilerType::WriteToMemory(lldb_pr
if (!IsValid())
return false;
- // Can't convert a file address to anything valid without more
- // context (which Module it came from)
+ // Can't convert a file address to anything valid without more context (which
+ // Module it came from)
if (address_type == eAddressTypeFile)
return false;
Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Mon Apr 30 09:49:04 2018
@@ -27,8 +27,8 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// GetDwarfEHPtr
//
-// Used for calls when the value type is specified by a DWARF EH Frame
-// pointer encoding.
+// Used for calls when the value type is specified by a DWARF EH Frame pointer
+// encoding.
//----------------------------------------------------------------------
static uint64_t
GetGNUEHPointer(const DataExtractor &DE, offset_t *offset_ptr,
@@ -83,8 +83,8 @@ GetGNUEHPointer(const DataExtractor &DE,
break;
case DW_EH_PE_aligned: {
- // SetPointerSize should be called prior to extracting these so the
- // pointer size is cached
+ // SetPointerSize should be called prior to extracting these so the pointer
+ // size is cached
assert(addr_size != 0);
if (addr_size) {
// Align to a address size boundary first
@@ -154,8 +154,8 @@ DWARFCallFrameInfo::DWARFCallFrameInfo(O
bool DWARFCallFrameInfo::GetUnwindPlan(Address addr, UnwindPlan &unwind_plan) {
FDEEntryMap::Entry fde_entry;
- // Make sure that the Address we're searching for is the same object file
- // as this DWARFCallFrameInfo, we only store File offsets in m_fde_index.
+ // Make sure that the Address we're searching for is the same object file as
+ // this DWARFCallFrameInfo, we only store File offsets in m_fde_index.
ModuleSP module_sp = addr.GetModule();
if (module_sp.get() == nullptr || module_sp->GetObjectFile() == nullptr ||
module_sp->GetObjectFile() != &m_objfile)
@@ -168,8 +168,8 @@ bool DWARFCallFrameInfo::GetUnwindPlan(A
bool DWARFCallFrameInfo::GetAddressRange(Address addr, AddressRange &range) {
- // Make sure that the Address we're searching for is the same object file
- // as this DWARFCallFrameInfo, we only store File offsets in m_fde_index.
+ // Make sure that the Address we're searching for is the same object file as
+ // this DWARFCallFrameInfo, we only store File offsets in m_fde_index.
ModuleSP module_sp = addr.GetModule();
if (module_sp.get() == nullptr || module_sp->GetObjectFile() == nullptr ||
module_sp->GetObjectFile() != &m_objfile)
@@ -291,8 +291,8 @@ DWARFCallFrameInfo::ParseCIE(const dw_of
return nullptr;
}
- // m_cfi_data uses address size from target architecture of the process
- // may ignore these fields?
+ // m_cfi_data uses address size from target architecture of the process may
+ // ignore these fields?
if (m_type == DWARF && cie_sp->version >= CFI_VERSION4) {
cie_sp->address_size = m_cfi_data.GetU8(&offset);
cie_sp->segment_size = m_cfi_data.GetU8(&offset);
@@ -307,15 +307,15 @@ DWARFCallFrameInfo::ParseCIE(const dw_of
: m_cfi_data.GetU8(&offset);
if (cie_sp->augmentation[0]) {
- // Get the length of the eh_frame augmentation data
- // which starts with a ULEB128 length in bytes
+ // Get the length of the eh_frame augmentation data which starts with a
+ // ULEB128 length in bytes
const size_t aug_data_len = (size_t)m_cfi_data.GetULEB128(&offset);
const size_t aug_data_end = offset + aug_data_len;
const size_t aug_str_len = strlen(cie_sp->augmentation);
// A 'z' may be present as the first character of the string.
- // If present, the Augmentation Data field shall be present.
- // The contents of the Augmentation Data shall be interpreted
- // according to other characters in the Augmentation String.
+ // If present, the Augmentation Data field shall be present. The contents
+ // of the Augmentation Data shall be interpreted according to other
+ // characters in the Augmentation String.
if (cie_sp->augmentation[0] == 'z') {
// Extract the Augmentation Data
size_t aug_str_idx = 0;
@@ -323,31 +323,27 @@ DWARFCallFrameInfo::ParseCIE(const dw_of
char aug = cie_sp->augmentation[aug_str_idx];
switch (aug) {
case 'L':
- // Indicates the presence of one argument in the
- // Augmentation Data of the CIE, and a corresponding
- // argument in the Augmentation Data of the FDE. The
- // argument in the Augmentation Data of the CIE is
- // 1-byte and represents the pointer encoding used
- // for the argument in the Augmentation Data of the
- // FDE, which is the address of a language-specific
- // data area (LSDA). The size of the LSDA pointer is
- // specified by the pointer encoding used.
+ // Indicates the presence of one argument in the Augmentation Data
+ // of the CIE, and a corresponding argument in the Augmentation
+ // Data of the FDE. The argument in the Augmentation Data of the
+ // CIE is 1-byte and represents the pointer encoding used for the
+ // argument in the Augmentation Data of the FDE, which is the
+ // address of a language-specific data area (LSDA). The size of the
+ // LSDA pointer is specified by the pointer encoding used.
cie_sp->lsda_addr_encoding = m_cfi_data.GetU8(&offset);
break;
case 'P':
- // Indicates the presence of two arguments in the
- // Augmentation Data of the CIE. The first argument
- // is 1-byte and represents the pointer encoding
- // used for the second argument, which is the
- // address of a personality routine handler. The
- // size of the personality routine pointer is
- // specified by the pointer encoding used.
+ // Indicates the presence of two arguments in the Augmentation Data
+ // of the CIE. The first argument is 1-byte and represents the
+ // pointer encoding used for the second argument, which is the
+ // address of a personality routine handler. The size of the
+ // personality routine pointer is specified by the pointer encoding
+ // used.
//
- // The address of the personality function will
- // be stored at this location. Pre-execution, it
- // will be all zero's so don't read it until we're
- // trying to do an unwind & the reloc has been
+ // The address of the personality function will be stored at this
+ // location. Pre-execution, it will be all zero's so don't read it
+ // until we're trying to do an unwind & the reloc has been
// resolved.
{
uint8_t arg_ptr_encoding = m_cfi_data.GetU8(&offset);
@@ -360,22 +356,21 @@ DWARFCallFrameInfo::ParseCIE(const dw_of
case 'R':
// A 'R' may be present at any position after the
- // first character of the string. The Augmentation
- // Data shall include a 1 byte argument that
- // represents the pointer encoding for the address
- // pointers used in the FDE.
- // Example: 0x1B == DW_EH_PE_pcrel | DW_EH_PE_sdata4
+ // first character of the string. The Augmentation Data shall
+ // include a 1 byte argument that represents the pointer encoding
+ // for the address pointers used in the FDE. Example: 0x1B ==
+ // DW_EH_PE_pcrel | DW_EH_PE_sdata4
cie_sp->ptr_encoding = m_cfi_data.GetU8(&offset);
break;
}
}
} else if (strcmp(cie_sp->augmentation, "eh") == 0) {
- // If the Augmentation string has the value "eh", then
- // the EH Data field shall be present
+ // If the Augmentation string has the value "eh", then the EH Data
+ // field shall be present
}
- // Set the offset to be the end of the augmentation data just in case
- // we didn't understand any of the data.
+ // Set the offset to be the end of the augmentation data just in case we
+ // didn't understand any of the data.
offset = (uint32_t)aug_data_end;
}
@@ -408,10 +403,8 @@ void DWARFCallFrameInfo::GetCFIData() {
}
}
// Scan through the eh_frame or debug_frame section looking for FDEs and noting
-// the start/end addresses
-// of the functions and a pointer back to the function's FDE for later
-// expansion.
-// Internalize CIEs as we come across them.
+// the start/end addresses of the functions and a pointer back to the
+// function's FDE for later expansion. Internalize CIEs as we come across them.
void DWARFCallFrameInfo::GetFDEIndex() {
if (m_section_sp.get() == nullptr || m_section_sp->IsEncrypted())
@@ -469,8 +462,8 @@ void DWARFCallFrameInfo::GetFDEIndex() {
}
// An FDE entry contains CIE_pointer in debug_frame in same place as cie_id
- // in eh_frame. CIE_pointer is an offset into the .debug_frame section.
- // So, variable cie_offset should be equal to cie_id for debug_frame.
+ // in eh_frame. CIE_pointer is an offset into the .debug_frame section. So,
+ // variable cie_offset should be equal to cie_id for debug_frame.
// FDE entries with cie_id == 0 shouldn't be ignored for it.
if ((cie_id == 0 && m_type == EH) || cie_id == UINT32_MAX || len == 0) {
auto cie_sp = ParseCIE(current_entry);
@@ -556,9 +549,8 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan
// FDE entries with zeroth cie_offset may occur for debug_frame.
assert(!(m_type == EH && 0 == cie_offset) && cie_offset != UINT32_MAX);
- // Translate the CIE_id from the eh_frame format, which
- // is relative to the FDE offset, into a __eh_frame section
- // offset
+ // Translate the CIE_id from the eh_frame format, which is relative to the
+ // FDE offset, into a __eh_frame section offset
if (m_type == EH) {
unwind_plan.SetSourceName("eh_frame CFI");
cie_offset = current_entry + (is_64bit ? 12 : 4) - cie_offset;
@@ -652,10 +644,10 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan
case DW_CFA_advance_loc: // (Row Creation Instruction)
{ // 0x40 - high 2 bits are 0x1, lower 6 bits are delta
// takes a single argument that represents a constant delta. The
- // required action is to create a new table row with a location
- // value that is computed by taking the current entry's location
- // value and adding (delta * code_align). All other
- // values in the new row are initially identical to the current row.
+ // required action is to create a new table row with a location value
+ // that is computed by taking the current entry's location value and
+ // adding (delta * code_align). All other values in the new row are
+ // initially identical to the current row.
unwind_plan.AppendRow(row);
UnwindPlan::Row *newrow = new UnwindPlan::Row;
*newrow = *row.get();
@@ -670,11 +662,10 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan
// required action is to change the rule for the indicated register
// to the rule assigned it by the initial_instructions in the CIE.
uint32_t reg_num = extended_opcode;
- // We only keep enough register locations around to
- // unwind what is in our thread, and these are organized
- // by the register index in that state, so we need to convert our
- // eh_frame register number from the EH frame info, to a register
- // index
+ // We only keep enough register locations around to unwind what is in
+ // our thread, and these are organized by the register index in that
+ // state, so we need to convert our eh_frame register number from the
+ // EH frame info, to a register index
if (unwind_plan.IsValidRowIndex(0) &&
unwind_plan.GetRowAtIndex(0)->GetRegisterInfo(reg_num,
@@ -756,8 +747,8 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan
case DW_CFA_remember_state: // 0xA
{
// These instructions define a stack of information. Encountering the
- // DW_CFA_remember_state instruction means to save the rules for every
- // register on the current row on the stack. Encountering the
+ // DW_CFA_remember_state instruction means to save the rules for
+ // every register on the current row on the stack. Encountering the
// DW_CFA_restore_state instruction means to pop the set of rules off
// the stack and place them in the current row. (This operation is
// useful for compilers that move epilogue code into the body of a
@@ -772,8 +763,8 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan
case DW_CFA_restore_state: // 0xB
{
// These instructions define a stack of information. Encountering the
- // DW_CFA_remember_state instruction means to save the rules for every
- // register on the current row on the stack. Encountering the
+ // DW_CFA_remember_state instruction means to save the rules for
+ // every register on the current row on the stack. Encountering the
// DW_CFA_restore_state instruction means to pop the set of rules off
// the stack and place them in the current row. (This operation is
// useful for compilers that move epilogue code into the body of a
@@ -798,10 +789,9 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan
case DW_CFA_GNU_args_size: // 0x2e
{
// The DW_CFA_GNU_args_size instruction takes an unsigned LEB128
- // operand
- // representing an argument size. This instruction specifies the total
- // of
- // the size of the arguments which have been pushed onto the stack.
+ // operand representing an argument size. This instruction specifies
+ // the total of the size of the arguments which have been pushed onto
+ // the stack.
// TODO: Figure out how we should handle this.
m_cfi_data.GetULEB128(&offset);
@@ -834,9 +824,9 @@ bool DWARFCallFrameInfo::HandleCommonDwa
// register
// takes two arguments: an unsigned LEB128 constant representing a
// factored offset and a register number. The required action is to
- // change the rule for the register indicated by the register number
- // to be an offset(N) rule with a value of
- // (N = factored offset * data_align).
+ // change the rule for the register indicated by the register number to
+ // be an offset(N) rule with a value of (N = factored offset *
+ // data_align).
uint8_t reg_num = extended_opcode;
int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset) * data_align;
reg_location.SetAtCFAPlusOffset(op_offset);
@@ -851,8 +841,8 @@ bool DWARFCallFrameInfo::HandleCommonDwa
case DW_CFA_offset_extended: // 0x5
{
- // takes two unsigned LEB128 arguments representing a register number
- // and a factored offset. This instruction is identical to DW_CFA_offset
+ // takes two unsigned LEB128 arguments representing a register number and
+ // a factored offset. This instruction is identical to DW_CFA_offset
// except for the encoding and size of the register argument.
uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset);
int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset) * data_align;
@@ -888,9 +878,9 @@ bool DWARFCallFrameInfo::HandleCommonDwa
case DW_CFA_register: // 0x9
{
- // takes two unsigned LEB128 arguments representing register numbers.
- // The required action is to set the rule for the first register to be
- // the second register.
+ // takes two unsigned LEB128 arguments representing register numbers. The
+ // required action is to set the rule for the first register to be the
+ // second register.
uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset);
uint32_t other_reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset);
UnwindPlan::Row::RegisterLocation reg_location;
@@ -901,10 +891,9 @@ bool DWARFCallFrameInfo::HandleCommonDwa
case DW_CFA_def_cfa: // 0xC (CFA Definition Instruction)
{
- // Takes two unsigned LEB128 operands representing a register
- // number and a (non-factored) offset. The required action
- // is to define the current CFA rule to use the provided
- // register and offset.
+ // Takes two unsigned LEB128 operands representing a register number and
+ // a (non-factored) offset. The required action is to define the current
+ // CFA rule to use the provided register and offset.
uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset);
int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset);
row.GetCFAValue().SetIsRegisterPlusOffset(reg_num, op_offset);
@@ -914,8 +903,8 @@ bool DWARFCallFrameInfo::HandleCommonDwa
case DW_CFA_def_cfa_register: // 0xD (CFA Definition Instruction)
{
// takes a single unsigned LEB128 argument representing a register
- // number. The required action is to define the current CFA rule to
- // use the provided register (but to keep the old offset).
+ // number. The required action is to define the current CFA rule to use
+ // the provided register (but to keep the old offset).
uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset);
row.GetCFAValue().SetIsRegisterPlusOffset(reg_num,
row.GetCFAValue().GetOffset());
@@ -924,10 +913,9 @@ bool DWARFCallFrameInfo::HandleCommonDwa
case DW_CFA_def_cfa_offset: // 0xE (CFA Definition Instruction)
{
- // Takes a single unsigned LEB128 operand representing a
- // (non-factored) offset. The required action is to define
- // the current CFA rule to use the provided offset (but
- // to keep the old register).
+ // Takes a single unsigned LEB128 operand representing a (non-factored)
+ // offset. The required action is to define the current CFA rule to use
+ // the provided offset (but to keep the old register).
int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset);
row.GetCFAValue().SetIsRegisterPlusOffset(
row.GetCFAValue().GetRegisterNumber(), op_offset);
@@ -945,14 +933,13 @@ bool DWARFCallFrameInfo::HandleCommonDwa
case DW_CFA_expression: // 0x10
{
- // Takes two operands: an unsigned LEB128 value representing
- // a register number, and a DW_FORM_block value representing a DWARF
- // expression. The required action is to change the rule for the
- // register indicated by the register number to be an expression(E)
- // rule where E is the DWARF expression. That is, the DWARF
- // expression computes the address. The value of the CFA is
- // pushed on the DWARF evaluation stack prior to execution of
- // the DWARF expression.
+ // Takes two operands: an unsigned LEB128 value representing a register
+ // number, and a DW_FORM_block value representing a DWARF expression. The
+ // required action is to change the rule for the register indicated by
+ // the register number to be an expression(E) rule where E is the DWARF
+ // expression. That is, the DWARF expression computes the address. The
+ // value of the CFA is pushed on the DWARF evaluation stack prior to
+ // execution of the DWARF expression.
uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset);
uint32_t block_len = (uint32_t)m_cfi_data.GetULEB128(&offset);
const uint8_t *block_data =
@@ -965,10 +952,10 @@ bool DWARFCallFrameInfo::HandleCommonDwa
case DW_CFA_offset_extended_sf: // 0x11
{
- // takes two operands: an unsigned LEB128 value representing a
- // register number and a signed LEB128 factored offset. This
- // instruction is identical to DW_CFA_offset_extended except
- // that the second operand is signed and factored.
+ // takes two operands: an unsigned LEB128 value representing a register
+ // number and a signed LEB128 factored offset. This instruction is
+ // identical to DW_CFA_offset_extended except that the second operand is
+ // signed and factored.
uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset);
int32_t op_offset = (int32_t)m_cfi_data.GetSLEB128(&offset) * data_align;
UnwindPlan::Row::RegisterLocation reg_location;
@@ -979,10 +966,10 @@ bool DWARFCallFrameInfo::HandleCommonDwa
case DW_CFA_def_cfa_sf: // 0x12 (CFA Definition Instruction)
{
- // Takes two operands: an unsigned LEB128 value representing
- // a register number and a signed LEB128 factored offset.
- // This instruction is identical to DW_CFA_def_cfa except
- // that the second operand is signed and factored.
+ // Takes two operands: an unsigned LEB128 value representing a register
+ // number and a signed LEB128 factored offset. This instruction is
+ // identical to DW_CFA_def_cfa except that the second operand is signed
+ // and factored.
uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset);
int32_t op_offset = (int32_t)m_cfi_data.GetSLEB128(&offset) * data_align;
row.GetCFAValue().SetIsRegisterPlusOffset(reg_num, op_offset);
@@ -991,9 +978,9 @@ bool DWARFCallFrameInfo::HandleCommonDwa
case DW_CFA_def_cfa_offset_sf: // 0x13 (CFA Definition Instruction)
{
- // takes a signed LEB128 operand representing a factored
- // offset. This instruction is identical to DW_CFA_def_cfa_offset
- // except that the operand is signed and factored.
+ // takes a signed LEB128 operand representing a factored offset. This
+ // instruction is identical to DW_CFA_def_cfa_offset except that the
+ // operand is signed and factored.
int32_t op_offset = (int32_t)m_cfi_data.GetSLEB128(&offset) * data_align;
uint32_t cfa_regnum = row.GetCFAValue().GetRegisterNumber();
row.GetCFAValue().SetIsRegisterPlusOffset(cfa_regnum, op_offset);
@@ -1003,9 +990,9 @@ bool DWARFCallFrameInfo::HandleCommonDwa
case DW_CFA_val_expression: // 0x16
{
// takes two operands: an unsigned LEB128 value representing a register
- // number, and a DW_FORM_block value representing a DWARF expression.
- // The required action is to change the rule for the register indicated
- // by the register number to be a val_expression(E) rule where E is the
+ // number, and a DW_FORM_block value representing a DWARF expression. The
+ // required action is to change the rule for the register indicated by
+ // the register number to be a val_expression(E) rule where E is the
// DWARF expression. That is, the DWARF expression computes the value of
// the given register. The value of the CFA is pushed on the DWARF
// evaluation stack prior to execution of the DWARF expression.
Modified: lldb/trunk/source/Symbol/FuncUnwinders.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/FuncUnwinders.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/FuncUnwinders.cpp (original)
+++ lldb/trunk/source/Symbol/FuncUnwinders.cpp Mon Apr 30 09:49:04 2018
@@ -174,10 +174,9 @@ UnwindPlanSP FuncUnwinders::GetEHFrameAu
m_tried_unwind_plan_eh_frame_augmented)
return m_unwind_plan_eh_frame_augmented_sp;
- // Only supported on x86 architectures where we get eh_frame from the compiler
- // that describes
- // the prologue instructions perfectly, and sometimes the epilogue
- // instructions too.
+ // Only supported on x86 architectures where we get eh_frame from the
+ // compiler that describes the prologue instructions perfectly, and sometimes
+ // the epilogue instructions too.
if (target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_32_i386 &&
target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_64_x86_64 &&
target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_64_x86_64h) {
@@ -194,8 +193,7 @@ UnwindPlanSP FuncUnwinders::GetEHFrameAu
m_unwind_plan_eh_frame_augmented_sp.reset(new UnwindPlan(*eh_frame_plan));
// Augment the eh_frame instructions with epilogue descriptions if necessary
- // so the
- // UnwindPlan can be used at any instruction in the function.
+ // so the UnwindPlan can be used at any instruction in the function.
UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target));
if (assembly_profiler_sp) {
@@ -238,7 +236,8 @@ FuncUnwinders::GetDebugFrameAugmentedUnw
new UnwindPlan(*debug_frame_plan));
// Augment the debug_frame instructions with epilogue descriptions if
- // necessary so the UnwindPlan can be used at any instruction in the function.
+ // necessary so the UnwindPlan can be used at any instruction in the
+ // function.
UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target));
if (assembly_profiler_sp) {
@@ -275,8 +274,7 @@ UnwindPlanSP FuncUnwinders::GetAssemblyU
// This method compares the pc unwind rule in the first row of two UnwindPlans.
// If they have the same way of getting the pc value (e.g. "CFA - 8" + "CFA is
-// sp"),
-// then it will return LazyBoolTrue.
+// sp"), then it will return LazyBoolTrue.
LazyBool FuncUnwinders::CompareUnwindPlansForIdenticalInitialPCLocation(
Thread &thread, const UnwindPlanSP &a, const UnwindPlanSP &b) {
LazyBool plans_are_identical = eLazyBoolCalculate;
@@ -320,22 +318,22 @@ UnwindPlanSP FuncUnwinders::GetUnwindPla
UnwindPlanSP assembly_sp =
GetAssemblyUnwindPlan(target, thread, current_offset);
- // This point of this code is to detect when a function is using a
- // non-standard ABI, and the eh_frame correctly describes that alternate ABI.
+ // This point of this code is to detect when a function is using a non-
+ // standard ABI, and the eh_frame correctly describes that alternate ABI.
// This is addressing a specific situation on x86_64 linux systems where one
// function in a library pushes a value on the stack and jumps to another
- // function. So using an assembly instruction based unwind will not work when
- // you're in the second function - the stack has been modified in a non-ABI
- // way. But we have eh_frame that correctly describes how to unwind from this
- // location. So we're looking to see if the initial pc register save location
- // from the eh_frame is different from the assembly unwind, the arch default
- // unwind, and the arch default at initial function entry.
+ // function. So using an assembly instruction based unwind will not work
+ // when you're in the second function - the stack has been modified in a non-
+ // ABI way. But we have eh_frame that correctly describes how to unwind from
+ // this location. So we're looking to see if the initial pc register save
+ // location from the eh_frame is different from the assembly unwind, the arch
+ // default unwind, and the arch default at initial function entry.
//
// We may have eh_frame that describes the entire function -- or we may have
// eh_frame that only describes the unwind after the prologue has executed --
// so we need to check both the arch default (once the prologue has executed)
- // and the arch default at initial function entry. And we may be running on a
- // target where we have only some of the assembly/arch default unwind plans
+ // and the arch default at initial function entry. And we may be running on
+ // a target where we have only some of the assembly/arch default unwind plans
// available.
if (CompareUnwindPlansForIdenticalInitialPCLocation(
Modified: lldb/trunk/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Function.cpp (original)
+++ lldb/trunk/source/Symbol/Function.cpp Mon Apr 30 09:49:04 2018
@@ -24,9 +24,8 @@ using namespace lldb;
using namespace lldb_private;
//----------------------------------------------------------------------
-// Basic function information is contained in the FunctionInfo class.
-// It is designed to contain the name, linkage name, and declaration
-// location.
+// Basic function information is contained in the FunctionInfo class. It is
+// designed to contain the name, linkage name, and declaration location.
//----------------------------------------------------------------------
FunctionInfo::FunctionInfo(const char *name, const Declaration *decl_ptr)
: m_name(name), m_declaration(decl_ptr) {}
@@ -188,8 +187,7 @@ void Function::GetEndLineSourceInfo(File
source_file.Clear();
// The -1 is kind of cheesy, but I want to get the last line entry for the
- // given function, not the
- // first entry of the next.
+ // given function, not the first entry of the next.
Address scratch_addr(GetAddressRange().GetBaseAddress());
scratch_addr.SetOffset(scratch_addr.GetOffset() +
GetAddressRange().GetByteSize() - 1);
@@ -331,9 +329,8 @@ size_t Function::MemorySize() const {
bool Function::GetIsOptimized() {
bool result = false;
- // Currently optimization is only indicted by the
- // vendor extension DW_AT_APPLE_optimized which
- // is set on a compile unit level.
+ // Currently optimization is only indicted by the vendor extension
+ // DW_AT_APPLE_optimized which is set on a compile unit level.
if (m_comp_unit) {
result = m_comp_unit->GetIsOptimized();
}
@@ -441,11 +438,11 @@ uint32_t Function::GetPrologueByteSize()
}
}
- // If we didn't find the end of the prologue in the line tables,
- // then just use the end address of the first line table entry
+ // If we didn't find the end of the prologue in the line tables, then
+ // just use the end address of the first line table entry
if (prologue_end_file_addr == LLDB_INVALID_ADDRESS) {
- // Check the first few instructions and look for one that has
- // a line number that's different than the first entry.
+ // Check the first few instructions and look for one that has a line
+ // number that's different than the first entry.
uint32_t last_line_entry_idx = first_line_entry_idx + 6;
for (uint32_t idx = first_line_entry_idx + 1;
idx < last_line_entry_idx; ++idx) {
@@ -498,8 +495,8 @@ uint32_t Function::GetPrologueByteSize()
}
}
- // Verify that this prologue end file address in the function's
- // address range just to be sure
+ // Verify that this prologue end file address in the function's address
+ // range just to be sure
if (func_start_file_addr < prologue_end_file_addr &&
prologue_end_file_addr < func_end_file_addr) {
m_prologue_byte_size = prologue_end_file_addr - func_start_file_addr;
Modified: lldb/trunk/source/Symbol/GoASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/GoASTContext.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/GoASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/GoASTContext.cpp Mon Apr 30 09:49:04 2018
@@ -667,8 +667,7 @@ GoASTContext::GetFullyUnqualifiedType(ll
}
// Returns -1 if this isn't a function of if the function doesn't have a
-// prototype
-// Returns a value >= 0 if there is a prototype.
+// prototype Returns a value >= 0 if there is a prototype.
int GoASTContext::GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) {
return GetNumberOfFunctionArguments(type);
}
@@ -1008,8 +1007,8 @@ CompilerType GoASTContext::GetChildCompi
return CompilerType();
}
-// Lookup a child given a name. This function will match base class names
-// and member member names in "clang_type" only, not descendants.
+// Lookup a child given a name. This function will match base class names and
+// member member names in "clang_type" only, not descendants.
uint32_t
GoASTContext::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
const char *name,
@@ -1048,8 +1047,8 @@ size_t GoASTContext::GetIndexOfChildMemb
return 1;
}
-// Converts "s" to a floating point value and place resulting floating
-// point bytes in the "dst" buffer.
+// Converts "s" to a floating point value and place resulting floating point
+// bytes in the "dst" buffer.
size_t
GoASTContext::ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
const char *s, uint8_t *dst,
@@ -1080,9 +1079,8 @@ void GoASTContext::DumpValue(lldb::opaqu
uint32_t field_idx = 0;
for (auto *field = st->GetField(field_idx); field != nullptr;
field_idx++) {
- // Print the starting squiggly bracket (if this is the
- // first member) or comma (for member 2 and beyond) for
- // the struct/union/class member.
+ // Print the starting squiggly bracket (if this is the first member) or
+ // comma (for member 2 and beyond) for the struct/union/class member.
if (field_idx == 0)
s->PutChar('{');
else
@@ -1137,9 +1135,8 @@ void GoASTContext::DumpValue(lldb::opaqu
uint64_t element_idx;
for (element_idx = 0; element_idx < a->GetLength(); ++element_idx) {
- // Print the starting squiggly bracket (if this is the
- // first member) or comman (for member 2 and beyong) for
- // the struct/union/class member.
+ // Print the starting squiggly bracket (if this is the first member) or
+ // comman (for member 2 and beyong) for the struct/union/class member.
if (element_idx == 0)
s->PutChar('{');
else
Modified: lldb/trunk/source/Symbol/LineEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/LineEntry.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/LineEntry.cpp (original)
+++ lldb/trunk/source/Symbol/LineEntry.cpp Mon Apr 30 09:49:04 2018
@@ -170,9 +170,9 @@ int LineEntry::Compare(const LineEntry &
if (a_byte_size > b_byte_size)
return +1;
- // Check for an end sequence entry mismatch after we have determined
- // that the address values are equal. If one of the items is an end
- // sequence, we don't care about the line, file, or column info.
+ // Check for an end sequence entry mismatch after we have determined that the
+ // address values are equal. If one of the items is an end sequence, we don't
+ // care about the line, file, or column info.
if (a.is_terminal_entry > b.is_terminal_entry)
return -1;
if (a.is_terminal_entry < b.is_terminal_entry)
@@ -192,8 +192,8 @@ int LineEntry::Compare(const LineEntry &
}
AddressRange LineEntry::GetSameLineContiguousAddressRange() const {
- // Add each LineEntry's range to complete_line_range until we find
- // a different file / line number.
+ // Add each LineEntry's range to complete_line_range until we find a
+ // different file / line number.
AddressRange complete_line_range = range;
while (true) {
@@ -206,9 +206,8 @@ AddressRange LineEntry::GetSameLineConti
if (next_line_sc.line_entry.IsValid() &&
next_line_sc.line_entry.range.GetByteSize() > 0 &&
original_file == next_line_sc.line_entry.original_file) {
- // Include any line 0 entries - they indicate that this is
- // compiler-generated code
- // that does not correspond to user source code.
+ // Include any line 0 entries - they indicate that this is compiler-
+ // generated code that does not correspond to user source code.
if (next_line_sc.line_entry.line == 0) {
complete_line_range.SetByteSize(
complete_line_range.GetByteSize() +
@@ -217,10 +216,9 @@ AddressRange LineEntry::GetSameLineConti
}
if (line == next_line_sc.line_entry.line) {
- // next_line_sc is the same file & line as this LineEntry, so extend our
- // AddressRange by its size and continue to see if there are more
- // LineEntries
- // that we can combine.
+ // next_line_sc is the same file & line as this LineEntry, so extend
+ // our AddressRange by its size and continue to see if there are more
+ // LineEntries that we can combine.
complete_line_range.SetByteSize(
complete_line_range.GetByteSize() +
next_line_sc.line_entry.range.GetByteSize());
Modified: lldb/trunk/source/Symbol/LineTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/LineTable.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/LineTable.cpp (original)
+++ lldb/trunk/source/Symbol/LineTable.cpp Mon Apr 30 09:49:04 2018
@@ -73,30 +73,24 @@ void LineTable::AppendLineEntryToSequenc
is_terminal_entry);
entry_collection &entries = seq->m_entries;
// Replace the last entry if the address is the same, otherwise append it. If
- // we have multiple
- // line entries at the same address, this indicates illegal DWARF so this
- // "fixes" the line table
- // to be correct. If not fixed this can cause a line entry's address that when
- // resolved back to
- // a symbol context, could resolve to a different line entry. We really want a
+ // we have multiple line entries at the same address, this indicates illegal
+ // DWARF so this "fixes" the line table to be correct. If not fixed this can
+ // cause a line entry's address that when resolved back to a symbol context,
+ // could resolve to a different line entry. We really want a
// 1 to 1 mapping
- // here to avoid these kinds of inconsistencies. We will need tor revisit this
- // if the DWARF line
- // tables are updated to allow multiple entries at the same address legally.
+ // here to avoid these kinds of inconsistencies. We will need tor revisit
+ // this if the DWARF line tables are updated to allow multiple entries at the
+ // same address legally.
if (!entries.empty() && entries.back().file_addr == file_addr) {
// GCC don't use the is_prologue_end flag to mark the first instruction
// after the prologue.
// Instead of it it is issuing a line table entry for the first instruction
- // of the prologue
- // and one for the first instruction after the prologue. If the size of the
- // prologue is 0
- // instruction then the 2 line entry will have the same file address.
- // Removing it will remove
- // our ability to properly detect the location of the end of prologe so we
- // set the prologue_end
- // flag to preserve this information (setting the prologue_end flag for an
- // entry what is after
- // the prologue end don't have any effect)
+ // of the prologue and one for the first instruction after the prologue. If
+ // the size of the prologue is 0 instruction then the 2 line entry will
+ // have the same file address. Removing it will remove our ability to
+ // properly detect the location of the end of prologe so we set the
+ // prologue_end flag to preserve this information (setting the prologue_end
+ // flag for an entry what is after the prologue end don't have any effect)
entry.is_prologue_end = entry.file_idx == entries.back().file_idx;
entries.back() = entry;
} else
@@ -200,14 +194,13 @@ bool LineTable::FindLineEntryByAddress(c
if (pos->file_addr != search_entry.file_addr)
--pos;
else if (pos->file_addr == search_entry.file_addr) {
- // If this is a termination entry, it shouldn't match since
- // entries with the "is_terminal_entry" member set to true
- // are termination entries that define the range for the
- // previous entry.
+ // If this is a termination entry, it shouldn't match since entries
+ // with the "is_terminal_entry" member set to true are termination
+ // entries that define the range for the previous entry.
if (pos->is_terminal_entry) {
- // The matching entry is a terminal entry, so we skip
- // ahead to the next entry to see if there is another
- // entry following this one whose section/offset matches.
+ // The matching entry is a terminal entry, so we skip ahead to
+ // the next entry to see if there is another entry following this
+ // one whose section/offset matches.
++pos;
if (pos != end_pos) {
if (pos->file_addr != search_entry.file_addr)
@@ -216,9 +209,8 @@ bool LineTable::FindLineEntryByAddress(c
}
if (pos != end_pos) {
- // While in the same section/offset backup to find the first
- // line entry that matches the address in case there are
- // multiple
+ // While in the same section/offset backup to find the first line
+ // entry that matches the address in case there are multiple
while (pos != begin_pos) {
entry_collection::const_iterator prev_pos = pos - 1;
if (prev_pos->file_addr == search_entry.file_addr &&
@@ -232,16 +224,15 @@ bool LineTable::FindLineEntryByAddress(c
}
else
{
- // There might be code in the containing objfile before the first line
- // table entry. Make sure that does not get considered part of the first
- // line table entry.
+ // There might be code in the containing objfile before the first
+ // line table entry. Make sure that does not get considered part of
+ // the first line table entry.
if (pos->file_addr > so_addr.GetFileAddress())
return false;
}
// Make sure we have a valid match and that the match isn't a
- // terminating
- // entry for a previous line...
+ // terminating entry for a previous line...
if (pos != end_pos && pos->is_terminal_entry == false) {
uint32_t match_idx = std::distance(begin_pos, pos);
success = ConvertEntryAtIndexToLineEntry(match_idx, line_entry);
@@ -304,8 +295,7 @@ uint32_t LineTable::FindLineEntryIndexBy
continue;
// Exact match always wins. Otherwise try to find the closest line > the
- // desired
- // line.
+ // desired line.
// FIXME: Maybe want to find the line closest before and the line closest
// after and
// if they're not in the same function, don't return a match.
@@ -349,8 +339,7 @@ uint32_t LineTable::FindLineEntryIndexBy
continue;
// Exact match always wins. Otherwise try to find the closest line > the
- // desired
- // line.
+ // desired line.
// FIXME: Maybe want to find the line closest before and the line closest
// after and
// if they're not in the same function, don't return a match.
@@ -389,8 +378,8 @@ size_t LineTable::FineLineEntriesForFile
SymbolContext sc(m_comp_unit);
for (size_t idx = 0; idx < count; ++idx) {
- // Skip line table rows that terminate the previous row (is_terminal_entry
- // is non-zero)
+ // Skip line table rows that terminate the previous row
+ // (is_terminal_entry is non-zero)
if (m_entries[idx].is_terminal_entry)
continue;
@@ -497,10 +486,9 @@ LineTable *LineTable::LinkLineTable(cons
terminate_previous_entry = prev_entry_was_linked;
}
} else if (prev_entry_was_linked) {
- // This entry doesn't have a remapping and it needs to be removed.
- // Watch out in case we need to terminate a previous entry needs to
- // be terminated now that one line entry in a sequence is not longer
- // valid.
+ // This entry doesn't have a remapping and it needs to be removed. Watch
+ // out in case we need to terminate a previous entry needs to be
+ // terminated now that one line entry in a sequence is not longer valid.
if (!sequence.m_entries.empty() &&
!sequence.m_entries.back().is_terminal_entry) {
terminate_previous_entry = true;
Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Mon Apr 30 09:49:04 2018
@@ -50,10 +50,9 @@ ObjectFile::FindPlugin(const lldb::Modul
const bool file_exists = file->Exists();
if (!data_sp) {
- // We have an object name which most likely means we have
- // a .o file in a static archive (.a file). Try and see if
- // we have a cached archive first without reading any data
- // first
+ // We have an object name which most likely means we have a .o file in
+ // a static archive (.a file). Try and see if we have a cached archive
+ // first without reading any data first
if (file_exists && module_sp->GetObjectName()) {
for (uint32_t idx = 0;
(create_object_container_callback =
@@ -72,10 +71,10 @@ ObjectFile::FindPlugin(const lldb::Modul
return object_file_sp;
}
}
- // Ok, we didn't find any containers that have a named object, now
- // lets read the first 512 bytes from the file so the object file
- // and object container plug-ins can use these bytes to see if they
- // can parse this file.
+ // Ok, we didn't find any containers that have a named object, now lets
+ // read the first 512 bytes from the file so the object file and object
+ // container plug-ins can use these bytes to see if they can parse this
+ // file.
if (file_size > 0) {
data_sp =
DataBufferLLVM::CreateSliceFromPath(file->GetPath(), 512, file_offset);
@@ -98,11 +97,12 @@ ObjectFile::FindPlugin(const lldb::Modul
file = &archive_file;
module_sp->SetFileSpecAndObjectName(archive_file, archive_object);
// Check if this is a object container by iterating through all
- // object
- // container plugin instances and then trying to get an object file
- // from the container plugins since we had a name. Also, don't read
+ // object container plugin instances and then trying to get an
+ // object file from the container plugins since we had a name.
+ // Also, don't read
// ANY data in case there is data cached in the container plug-ins
- // (like BSD archives caching the contained objects within an file).
+ // (like BSD archives caching the contained objects within an
+ // file).
for (uint32_t idx = 0;
(create_object_container_callback =
PluginManager::GetObjectContainerCreateCallbackAtIndex(
@@ -119,8 +119,8 @@ ObjectFile::FindPlugin(const lldb::Modul
if (object_file_sp.get())
return object_file_sp;
}
- // We failed to find any cached object files in the container
- // plug-ins, so lets read the first 512 bytes and try again below...
+ // We failed to find any cached object files in the container plug-
+ // ins, so lets read the first 512 bytes and try again below...
data_sp = DataBufferLLVM::CreateSliceFromPath(archive_file.GetPath(),
512, file_offset);
}
@@ -128,8 +128,8 @@ ObjectFile::FindPlugin(const lldb::Modul
}
if (data_sp && data_sp->GetByteSize() > 0) {
- // Check if this is a normal object file by iterating through
- // all object file plugin instances.
+ // Check if this is a normal object file by iterating through all
+ // object file plugin instances.
ObjectFileCreateInstance create_object_file_callback;
for (uint32_t idx = 0;
(create_object_file_callback =
@@ -142,9 +142,9 @@ ObjectFile::FindPlugin(const lldb::Modul
return object_file_sp;
}
- // Check if this is a object container by iterating through
- // all object container plugin instances and then trying to get
- // an object file from the container.
+ // Check if this is a object container by iterating through all object
+ // container plugin instances and then trying to get an object file
+ // from the container.
for (uint32_t idx = 0;
(create_object_container_callback =
PluginManager::GetObjectContainerCreateCallbackAtIndex(
@@ -163,8 +163,8 @@ ObjectFile::FindPlugin(const lldb::Modul
}
}
}
- // We didn't find it, so clear our shared pointer in case it
- // contains anything and return an empty shared pointer
+ // We didn't find it, so clear our shared pointer in case it contains
+ // anything and return an empty shared pointer
object_file_sp.reset();
return object_file_sp;
}
@@ -185,8 +185,8 @@ ObjectFileSP ObjectFile::FindPlugin(cons
static_cast<void *>(process_sp.get()), header_addr);
uint32_t idx;
- // Check if this is a normal object file by iterating through
- // all object file plugin instances.
+ // Check if this is a normal object file by iterating through all object
+ // file plugin instances.
ObjectFileCreateMemoryInstance create_callback;
for (idx = 0;
(create_callback =
@@ -200,8 +200,8 @@ ObjectFileSP ObjectFile::FindPlugin(cons
}
}
- // We didn't find it, so clear our shared pointer in case it
- // contains anything and return an empty shared pointer
+ // We didn't find it, so clear our shared pointer in case it contains
+ // anything and return an empty shared pointer
object_file_sp.reset();
return object_file_sp;
}
@@ -378,10 +378,8 @@ AddressClass ObjectFile::GetAddressClass
return eAddressClassUnknown;
case eSectionTypeAbsoluteAddress:
// In case of absolute sections decide the address class based on
- // the symbol
- // type because the section type isn't specify if it is a code or a
- // data
- // section.
+ // the symbol type because the section type isn't specify if it is
+ // a code or a data section.
break;
}
}
@@ -470,16 +468,14 @@ DataBufferSP ObjectFile::ReadMemory(cons
size_t ObjectFile::GetData(lldb::offset_t offset, size_t length,
DataExtractor &data) const {
// The entire file has already been mmap'ed into m_data, so just copy from
- // there
- // as the back mmap buffer will be shared with shared pointers.
+ // there as the back mmap buffer will be shared with shared pointers.
return data.SetData(m_data, offset, length);
}
size_t ObjectFile::CopyData(lldb::offset_t offset, size_t length,
void *dst) const {
// The entire file has already been mmap'ed into m_data, so just copy from
- // there
- // Note that the data remains in target byte order.
+ // there Note that the data remains in target byte order.
return m_data.CopyData(offset, length, dst);
}
@@ -559,8 +555,8 @@ size_t ObjectFile::ReadSectionData(Secti
return GetData(section->GetFileOffset(), section->GetFileSize(),
section_data);
} else {
- // The object file now contains a full mmap'ed copy of the object file data,
- // so just use this
+ // The object file now contains a full mmap'ed copy of the object file
+ // data, so just use this
if (!section->IsRelocated())
RelocateSection(section);
Modified: lldb/trunk/source/Symbol/Symbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symbol.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symbol.cpp (original)
+++ lldb/trunk/source/Symbol/Symbol.cpp Mon Apr 30 09:49:04 2018
@@ -122,9 +122,9 @@ ConstString Symbol::GetDisplayName() con
ConstString Symbol::GetReExportedSymbolName() const {
if (m_type == eSymbolTypeReExported) {
- // For eSymbolTypeReExported, the "const char *" from a ConstString
- // is used as the offset in the address range base address. We can
- // then make this back into a string that is the re-exported name.
+ // For eSymbolTypeReExported, the "const char *" from a ConstString is used
+ // as the offset in the address range base address. We can then make this
+ // back into a string that is the re-exported name.
intptr_t str_ptr = m_addr_range.GetBaseAddress().GetOffset();
if (str_ptr != 0)
return ConstString((const char *)str_ptr);
@@ -136,9 +136,9 @@ ConstString Symbol::GetReExportedSymbolN
FileSpec Symbol::GetReExportedSymbolSharedLibrary() const {
if (m_type == eSymbolTypeReExported) {
- // For eSymbolTypeReExported, the "const char *" from a ConstString
- // is used as the offset in the address range base address. We can
- // then make this back into a string that is the re-exported name.
+ // For eSymbolTypeReExported, the "const char *" from a ConstString is used
+ // as the offset in the address range base address. We can then make this
+ // back into a string that is the re-exported name.
intptr_t str_ptr = m_addr_range.GetByteSize();
if (str_ptr != 0)
return FileSpec((const char *)str_ptr, false);
@@ -148,15 +148,15 @@ FileSpec Symbol::GetReExportedSymbolShar
void Symbol::SetReExportedSymbolName(const ConstString &name) {
SetType(eSymbolTypeReExported);
- // For eSymbolTypeReExported, the "const char *" from a ConstString
- // is used as the offset in the address range base address.
+ // For eSymbolTypeReExported, the "const char *" from a ConstString is used
+ // as the offset in the address range base address.
m_addr_range.GetBaseAddress().SetOffset((uintptr_t)name.GetCString());
}
bool Symbol::SetReExportedSymbolSharedLibrary(const FileSpec &fspec) {
if (m_type == eSymbolTypeReExported) {
- // For eSymbolTypeReExported, the "const char *" from a ConstString
- // is used as the offset in the address range base address.
+ // For eSymbolTypeReExported, the "const char *" from a ConstString is used
+ // as the offset in the address range base address.
m_addr_range.SetByteSize(
(uintptr_t)ConstString(fspec.GetPath().c_str()).GetCString());
return true;
@@ -262,9 +262,8 @@ uint32_t Symbol::GetPrologueByteSize() {
Function *function = base_address.CalculateSymbolContextFunction();
if (function) {
// Functions have line entries which can also potentially have end of
- // prologue information.
- // So if this symbol points to a function, use the prologue information
- // from there.
+ // prologue information. So if this symbol points to a function, use
+ // the prologue information from there.
m_type_data = function->GetPrologueByteSize();
} else {
ModuleSP module_sp(base_address.GetModule());
@@ -280,10 +279,9 @@ uint32_t Symbol::GetPrologueByteSize() {
Address addr(base_address);
addr.Slide(m_type_data);
- // Check the first few instructions and look for one that has a line
- // number that is
- // different than the first entry. This is also done in
- // Function::GetPrologueByteSize().
+ // Check the first few instructions and look for one that has a
+ // line number that is different than the first entry. This is also
+ // done in Function::GetPrologueByteSize().
uint16_t total_offset = m_type_data;
for (int idx = 0; idx < 6; ++idx) {
SymbolContext sc_temp;
@@ -293,8 +291,8 @@ uint32_t Symbol::GetPrologueByteSize() {
if (!(resolved_flags & eSymbolContextLineEntry))
break;
- // If this line number is different than our first one, use it and
- // we're done.
+ // If this line number is different than our first one, use it
+ // and we're done.
if (sc_temp.line_entry.line != sc.line_entry.line) {
m_type_data = total_offset;
break;
@@ -309,12 +307,10 @@ uint32_t Symbol::GetPrologueByteSize() {
}
// Sanity check - this may be a function in the middle of code that
- // has debug information, but
- // not for this symbol. So the line entries surrounding us won't
- // lie inside our function.
- // In that case, the line entry will be bigger than we are, so we do
- // that quick check and
- // if that is true, we just return 0.
+ // has debug information, but not for this symbol. So the line
+ // entries surrounding us won't lie inside our function. In that
+ // case, the line entry will be bigger than we are, so we do that
+ // quick check and if that is true, we just return 0.
if (m_type_data >= m_addr_range.GetByteSize())
m_type_data = 0;
} else {
@@ -420,9 +416,9 @@ Symbol *Symbol::ResolveReExportedSymbolI
// Try searching for the module file spec first using the full path
module_sp = target.GetImages().FindFirstModule(module_spec);
if (!module_sp) {
- // Next try and find the module by basename in case environment
- // variables or other runtime trickery causes shared libraries
- // to be loaded from alternate paths
+ // Next try and find the module by basename in case environment variables
+ // or other runtime trickery causes shared libraries to be loaded from
+ // alternate paths
module_spec.GetFileSpec().GetDirectory().Clear();
module_sp = target.GetImages().FindFirstModule(module_spec);
}
@@ -430,8 +426,7 @@ Symbol *Symbol::ResolveReExportedSymbolI
if (module_sp) {
// There should not be cycles in the reexport list, but we don't want to
- // crash if there are so make sure
- // we haven't seen this before:
+ // crash if there are so make sure we haven't seen this before:
if (!seen_modules.AppendIfNeeded(module_sp))
return nullptr;
@@ -449,8 +444,8 @@ Symbol *Symbol::ResolveReExportedSymbolI
}
}
// If we didn't find the symbol in this module, it may be because this
- // module re-exports some
- // whole other library. We have to search those as well:
+ // module re-exports some whole other library. We have to search those as
+ // well:
seen_modules.Append(module_sp);
FileSpecList reexported_libraries =
Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Mon Apr 30 09:49:04 2018
@@ -359,8 +359,7 @@ void SymbolContext::Dump(Stream *s, Targ
if (block != nullptr)
*s << " {0x" << block->GetID() << '}';
// Dump the block and pass it a negative depth to we print all the parent
- // blocks
- // if (block != NULL)
+ // blocks if (block != NULL)
// block->Dump(s, function->GetFileAddress(), INT_MIN);
s->EOL();
s->Indent();
@@ -468,27 +467,27 @@ bool SymbolContext::GetParentOfInlinedSc
if (block) {
// const addr_t curr_frame_file_addr = curr_frame_pc.GetFileAddress();
- // In order to get the parent of an inlined function we first need to
- // see if we are in an inlined block as "this->block" could be an
- // inlined block, or a parent of "block" could be. So lets check if
- // this block or one of this blocks parents is an inlined function.
+ // In order to get the parent of an inlined function we first need to see
+ // if we are in an inlined block as "this->block" could be an inlined
+ // block, or a parent of "block" could be. So lets check if this block or
+ // one of this blocks parents is an inlined function.
Block *curr_inlined_block = block->GetContainingInlinedBlock();
if (curr_inlined_block) {
- // "this->block" is contained in an inline function block, so to
- // get the scope above the inlined block, we get the parent of the
- // inlined block itself
+ // "this->block" is contained in an inline function block, so to get the
+ // scope above the inlined block, we get the parent of the inlined block
+ // itself
Block *next_frame_block = curr_inlined_block->GetParent();
// Now calculate the symbol context of the containing block
next_frame_block->CalculateSymbolContext(&next_frame_sc);
// If we get here we weren't able to find the return line entry using the
- // nesting of the blocks and
- // the line table. So just use the call site info from our inlined block.
+ // nesting of the blocks and the line table. So just use the call site
+ // info from our inlined block.
AddressRange range;
if (curr_inlined_block->GetRangeContainingAddress(curr_frame_pc, range)) {
- // To see there this new frame block it, we need to look at the
- // call site information from
+ // To see there this new frame block it, we need to look at the call
+ // site information from
const InlineFunctionInfo *curr_inlined_block_inlined_info =
curr_inlined_block->GetInlinedFunctionInfo();
next_frame_pc = range.GetBaseAddress();
@@ -550,22 +549,22 @@ bool SymbolContext::GetParentOfInlinedSc
Block *SymbolContext::GetFunctionBlock() {
if (function) {
if (block) {
- // If this symbol context has a block, check to see if this block
- // is itself, or is contained within a block with inlined function
- // information. If so, then the inlined block is the block that
- // defines the function.
+ // If this symbol context has a block, check to see if this block is
+ // itself, or is contained within a block with inlined function
+ // information. If so, then the inlined block is the block that defines
+ // the function.
Block *inlined_block = block->GetContainingInlinedBlock();
if (inlined_block)
return inlined_block;
- // The block in this symbol context is not inside an inlined
- // block, so the block that defines the function is the function's
- // top level block, which is returned below.
+ // The block in this symbol context is not inside an inlined block, so
+ // the block that defines the function is the function's top level block,
+ // which is returned below.
}
- // There is no block information in this symbol context, so we must
- // assume that the block that is desired is the top level block of
- // the function itself.
+ // There is no block information in this symbol context, so we must assume
+ // that the block that is desired is the top level block of the function
+ // itself.
return &function->GetBlock(true);
}
return nullptr;
@@ -594,8 +593,8 @@ void SymbolContext::SortTypeList(TypeMap
isInlinedblock = true;
//----------------------------------------------------------------------
- // Find all types that match the current block if we have one and put
- // them first in the list. Keep iterating up through all blocks.
+ // Find all types that match the current block if we have one and put them
+ // first in the list. Keep iterating up through all blocks.
//----------------------------------------------------------------------
while (curr_block != nullptr && !isInlinedblock) {
type_map.ForEach(
@@ -606,8 +605,8 @@ void SymbolContext::SortTypeList(TypeMap
return true; // Keep iterating
});
- // Remove any entries that are now in "type_list" from "type_map"
- // since we can't remove from type_map while iterating
+ // Remove any entries that are now in "type_list" from "type_map" since we
+ // can't remove from type_map while iterating
type_list.ForEach([&type_map](const lldb::TypeSP &type_sp) -> bool {
type_map.Remove(type_sp);
return true; // Keep iterating
@@ -615,8 +614,8 @@ void SymbolContext::SortTypeList(TypeMap
curr_block = curr_block->GetParent();
}
//----------------------------------------------------------------------
- // Find all types that match the current function, if we have onem, and
- // put them next in the list.
+ // Find all types that match the current function, if we have onem, and put
+ // them next in the list.
//----------------------------------------------------------------------
if (function != nullptr && !type_map.Empty()) {
const size_t old_type_list_size = type_list.GetSize();
@@ -627,8 +626,8 @@ void SymbolContext::SortTypeList(TypeMap
return true; // Keep iterating
});
- // Remove any entries that are now in "type_list" from "type_map"
- // since we can't remove from type_map while iterating
+ // Remove any entries that are now in "type_list" from "type_map" since we
+ // can't remove from type_map while iterating
const size_t new_type_list_size = type_list.GetSize();
if (new_type_list_size > old_type_list_size) {
for (size_t i = old_type_list_size; i < new_type_list_size; ++i)
@@ -636,8 +635,8 @@ void SymbolContext::SortTypeList(TypeMap
}
}
//----------------------------------------------------------------------
- // Find all types that match the current compile unit, if we have one,
- // and put them next in the list.
+ // Find all types that match the current compile unit, if we have one, and
+ // put them next in the list.
//----------------------------------------------------------------------
if (comp_unit != nullptr && !type_map.Empty()) {
const size_t old_type_list_size = type_list.GetSize();
@@ -649,8 +648,8 @@ void SymbolContext::SortTypeList(TypeMap
return true; // Keep iterating
});
- // Remove any entries that are now in "type_list" from "type_map"
- // since we can't remove from type_map while iterating
+ // Remove any entries that are now in "type_list" from "type_map" since we
+ // can't remove from type_map while iterating
const size_t new_type_list_size = type_list.GetSize();
if (new_type_list_size > old_type_list_size) {
for (size_t i = old_type_list_size; i < new_type_list_size; ++i)
@@ -658,8 +657,8 @@ void SymbolContext::SortTypeList(TypeMap
}
}
//----------------------------------------------------------------------
- // Find all types that match the current module, if we have one, and put
- // them next in the list.
+ // Find all types that match the current module, if we have one, and put them
+ // next in the list.
//----------------------------------------------------------------------
if (module_sp && !type_map.Empty()) {
const size_t old_type_list_size = type_list.GetSize();
@@ -669,8 +668,8 @@ void SymbolContext::SortTypeList(TypeMap
type_list.Insert(type_sp);
return true; // Keep iterating
});
- // Remove any entries that are now in "type_list" from "type_map"
- // since we can't remove from type_map while iterating
+ // Remove any entries that are now in "type_list" from "type_map" since we
+ // can't remove from type_map while iterating
const size_t new_type_list_size = type_list.GetSize();
if (new_type_list_size > old_type_list_size) {
for (size_t i = old_type_list_size; i < new_type_list_size; ++i)
@@ -831,9 +830,9 @@ SymbolContext::FindBestGlobalDataSymbol(
case eSymbolTypeObjCMetaClass:
case eSymbolTypeObjCIVar:
if (symbol->GetDemangledNameIsSynthesized()) {
- // If the demangled name was synthesized, then don't use it
- // for expressions. Only let the symbol match if the mangled
- // named matches for these symbols.
+ // If the demangled name was synthesized, then don't use it for
+ // expressions. Only let the symbol match if the mangled named
+ // matches for these symbols.
if (symbol->GetMangled().GetMangledName() != name)
break;
}
@@ -861,8 +860,8 @@ SymbolContext::FindBestGlobalDataSymbol(
target.GetImages().FindFirstModule(reexport_module_spec);
}
}
- // Don't allow us to try and resolve a re-exported symbol if it is
- // the same as the current symbol
+ // Don't allow us to try and resolve a re-exported symbol if it
+ // is the same as the current symbol
if (name == symbol->GetReExportedSymbolName() &&
module == reexport_module_sp.get())
return nullptr;
@@ -1012,9 +1011,8 @@ bool SymbolContextSpecifier::AddSpecific
} break;
case eFileSpecified:
// CompUnits can't necessarily be resolved here, since an inlined function
- // might show up in
- // a number of CompUnits. Instead we just convert to a FileSpec and store
- // it away.
+ // might show up in a number of CompUnits. Instead we just convert to a
+ // FileSpec and store it away.
m_file_spec_ap.reset(new FileSpec(spec_string, false));
m_type |= eFileSpecified;
break;
Modified: lldb/trunk/source/Symbol/SymbolFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolFile.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolFile.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolFile.cpp Mon Apr 30 09:49:04 2018
@@ -30,8 +30,7 @@ SymbolFile *SymbolFile::FindPlugin(Objec
if (obj_file != nullptr) {
// We need to test the abilities of this section list. So create what it
- // would
- // be with this new obj_file.
+ // would be with this new obj_file.
lldb::ModuleSP module_sp(obj_file->GetModule());
if (module_sp) {
// Default to the main module section list.
@@ -60,16 +59,16 @@ SymbolFile *SymbolFile::FindPlugin(Objec
if (sym_file_abilities > best_symfile_abilities) {
best_symfile_abilities = sym_file_abilities;
best_symfile_ap.reset(curr_symfile_ap.release());
- // If any symbol file parser has all of the abilities, then
- // we should just stop looking.
+ // If any symbol file parser has all of the abilities, then we should
+ // just stop looking.
if ((kAllAbilities & sym_file_abilities) == kAllAbilities)
break;
}
}
}
if (best_symfile_ap.get()) {
- // Let the winning symbol file parser initialize itself more
- // completely now that it has been chosen
+ // Let the winning symbol file parser initialize itself more completely
+ // now that it has been chosen
best_symfile_ap->InitializeObject();
}
}
Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolVendor.cpp Mon Apr 30 09:49:04 2018
@@ -26,9 +26,9 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// FindPlugin
//
-// Platforms can register a callback to use when creating symbol
-// vendors to allow for complex debug information file setups, and to
-// also allow for finding separate debug information files.
+// Platforms can register a callback to use when creating symbol vendors to
+// allow for complex debug information file setups, and to also allow for
+// finding separate debug information files.
//----------------------------------------------------------------------
SymbolVendor *SymbolVendor::FindPlugin(const lldb::ModuleSP &module_sp,
lldb_private::Stream *feedback_strm) {
@@ -45,8 +45,8 @@ SymbolVendor *SymbolVendor::FindPlugin(c
return instance_ap.release();
}
}
- // The default implementation just tries to create debug information using the
- // file representation for the module.
+ // The default implementation just tries to create debug information using
+ // the file representation for the module.
instance_ap.reset(new SymbolVendor(module_sp));
if (instance_ap.get()) {
ObjectFile *objfile = module_sp->GetObjectFile();
@@ -88,11 +88,11 @@ bool SymbolVendor::SetCompileUnitAtIndex
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
const size_t num_compile_units = GetNumCompileUnits();
if (idx < num_compile_units) {
- // Fire off an assertion if this compile unit already exists for now.
- // The partial parsing should take care of only setting the compile
- // unit once, so if this assertion fails, we need to make sure that
- // we don't have a race condition, or have a second parse of the same
- // compile unit.
+ // Fire off an assertion if this compile unit already exists for now. The
+ // partial parsing should take care of only setting the compile unit
+ // once, so if this assertion fails, we need to make sure that we don't
+ // have a race condition, or have a second parse of the same compile
+ // unit.
assert(m_compile_units[idx].get() == nullptr);
m_compile_units[idx] = cu_sp;
return true;
@@ -111,10 +111,10 @@ size_t SymbolVendor::GetNumCompileUnits(
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
if (m_compile_units.empty()) {
if (m_sym_file_ap.get()) {
- // Resize our array of compile unit shared pointers -- which will
- // each remain NULL until someone asks for the actual compile unit
- // information. When this happens, the symbol file will be asked
- // to parse this compile unit information.
+ // Resize our array of compile unit shared pointers -- which will each
+ // remain NULL until someone asks for the actual compile unit
+ // information. When this happens, the symbol file will be asked to
+ // parse this compile unit information.
m_compile_units.resize(m_sym_file_ap->GetNumCompileUnits());
}
}
Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Mon Apr 30 09:49:04 2018
@@ -100,9 +100,8 @@ void Symtab::Dump(Stream *s, Target *tar
} break;
case eSortOrderByName: {
- // Although we maintain a lookup by exact name map, the table
- // isn't sorted by name. So we must make the ordered symbol list
- // up ourselves.
+ // Although we maintain a lookup by exact name map, the table isn't
+ // sorted by name. So we must make the ordered symbol list up ourselves.
s->PutCString(" (sorted by name):\n");
DumpSymbolHeader(s);
typedef std::multimap<const char *, const Symbol *,
@@ -228,8 +227,8 @@ void Symtab::InitNameIndexes() {
m_name_to_index.Reserve(num_symbols);
#else
// TODO: benchmark this to see if we save any memory. Otherwise we
- // will always keep the memory reserved in the vector unless we pull
- // some STL swap magic and then recopy...
+ // will always keep the memory reserved in the vector unless we pull some
+ // STL swap magic and then recopy...
uint32_t actual_count = 0;
for (const_iterator pos = m_symbols.begin(), end = m_symbols.end();
pos != end; ++pos) {
@@ -255,11 +254,10 @@ void Symtab::InitNameIndexes() {
for (entry.value = 0; entry.value < num_symbols; ++entry.value) {
const Symbol *symbol = &m_symbols[entry.value];
- // Don't let trampolines get into the lookup by name map
- // If we ever need the trampoline symbols to be searchable by name
- // we can remove this and then possibly add a new bool to any of the
- // Symtab functions that lookup symbols by name to indicate if they
- // want trampolines.
+ // Don't let trampolines get into the lookup by name map If we ever need
+ // the trampoline symbols to be searchable by name we can remove this and
+ // then possibly add a new bool to any of the Symtab functions that
+ // lookup symbols by name to indicate if they want trampolines.
if (symbol->IsTrampoline())
continue;
@@ -293,10 +291,9 @@ void Symtab::InitNameIndexes() {
mangled.GetDemangledName(lldb::eLanguageTypeC_plus_plus));
entry.cstring = ConstString(cxx_method.GetBasename());
if (entry.cstring) {
- // ConstString objects permanently store the string in the pool so
- // calling
- // GetCString() on the value gets us a const char * that will
- // never go away
+ // ConstString objects permanently store the string in the pool
+ // so calling GetCString() on the value gets us a const char *
+ // that will never go away
const char *const_context =
ConstString(cxx_method.GetContext()).GetCString();
@@ -312,25 +309,25 @@ void Symtab::InitNameIndexes() {
if (entry_ref[0] == '~' ||
!cxx_method.GetQualifiers().empty()) {
// The first character of the demangled basename is '~' which
- // means we have a class destructor. We can use this information
- // to help us know what is a class and what isn't.
+ // means we have a class destructor. We can use this
+ // information to help us know what is a class and what
+ // isn't.
if (class_contexts.find(const_context) == class_contexts.end())
class_contexts.insert(const_context);
m_method_to_index.Append(entry);
} else {
if (class_contexts.find(const_context) !=
class_contexts.end()) {
- // The current decl context is in our "class_contexts" which
- // means
- // this is a method on a class
+ // The current decl context is in our "class_contexts"
+ // which means this is a method on a class
m_method_to_index.Append(entry);
} else {
- // We don't know if this is a function basename or a method,
- // so put it into a temporary collection so once we are done
- // we can look in class_contexts to see if each entry is a
- // class
- // or just a function and will put any remaining items into
- // m_method_to_index or m_basename_to_index as needed
+ // We don't know if this is a function basename or a
+ // method, so put it into a temporary collection so once we
+ // are done we can look in class_contexts to see if each
+ // entry is a class or just a function and will put any
+ // remaining items into m_method_to_index or
+ // m_basename_to_index as needed
mangled_name_to_index.Append(entry);
symbol_contexts[entry.value] = const_context;
}
@@ -354,9 +351,8 @@ void Symtab::InitNameIndexes() {
}
}
- // If the demangled name turns out to be an ObjC name, and
- // is a category name, add the version without categories to the index
- // too.
+ // If the demangled name turns out to be an ObjC name, and is a category
+ // name, add the version without categories to the index too.
ObjCLanguage::MethodName objc_method(entry.cstring.GetStringRef(), true);
if (objc_method.IsValid(true)) {
entry.cstring = objc_method.GetSelector();
@@ -383,8 +379,7 @@ void Symtab::InitNameIndexes() {
m_method_to_index.Append(entry);
} else {
// If we got here, we have something that had a context (was inside
- // a namespace or class)
- // yet we don't know if the entry
+ // a namespace or class) yet we don't know if the entry
m_method_to_index.Append(entry);
m_basename_to_index.Append(entry);
}
@@ -520,20 +515,15 @@ struct SymbolIndexComparator {
std::vector<lldb::addr_t> &addr_cache;
// Getting from the symbol to the Address to the File Address involves some
- // work.
- // Since there are potentially many symbols here, and we're using this for
- // sorting so
- // we're going to be computing the address many times, cache that in
- // addr_cache.
- // The array passed in has to be the same size as the symbols array passed
- // into the
- // member variable symbols, and should be initialized with
- // LLDB_INVALID_ADDRESS.
+ // work. Since there are potentially many symbols here, and we're using this
+ // for sorting so we're going to be computing the address many times, cache
+ // that in addr_cache. The array passed in has to be the same size as the
+ // symbols array passed into the member variable symbols, and should be
+ // initialized with LLDB_INVALID_ADDRESS.
// NOTE: You have to make addr_cache externally and pass it in because
// std::stable_sort
// makes copies of the comparator it is initially passed in, and you end up
- // spending
- // huge amounts of time copying this array...
+ // spending huge amounts of time copying this array...
SymbolIndexComparator(const std::vector<Symbol> &s,
std::vector<lldb::addr_t> &a)
@@ -584,8 +574,7 @@ void Symtab::SortSymbolIndexesByValue(st
// NOTE: The use of std::stable_sort instead of std::sort here is strictly for
// performance,
// not correctness. The indexes vector tends to be "close" to sorted, which
- // the
- // stable sort handles better.
+ // the stable sort handles better.
std::vector<lldb::addr_t> addr_cache(m_symbols.size(), LLDB_INVALID_ADDRESS);
@@ -752,14 +741,14 @@ Symtab::FindAllSymbolsWithNameAndType(co
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
- // Initialize all of the lookup by name indexes before converting NAME
- // to a uniqued string NAME_STR below.
+ // Initialize all of the lookup by name indexes before converting NAME to a
+ // uniqued string NAME_STR below.
if (!m_name_indexes_computed)
InitNameIndexes();
if (name) {
- // The string table did have a string that matched, but we need
- // to check the symbols and match the symbol_type if any was given.
+ // The string table did have a string that matched, but we need to check
+ // the symbols and match the symbol_type if any was given.
AppendSymbolIndexesWithNameAndType(name, symbol_type, symbol_indexes);
}
return symbol_indexes.size();
@@ -772,14 +761,14 @@ size_t Symtab::FindAllSymbolsWithNameAnd
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
- // Initialize all of the lookup by name indexes before converting NAME
- // to a uniqued string NAME_STR below.
+ // Initialize all of the lookup by name indexes before converting NAME to a
+ // uniqued string NAME_STR below.
if (!m_name_indexes_computed)
InitNameIndexes();
if (name) {
- // The string table did have a string that matched, but we need
- // to check the symbols and match the symbol_type if any was given.
+ // The string table did have a string that matched, but we need to check
+ // the symbols and match the symbol_type if any was given.
AppendSymbolIndexesWithNameAndType(name, symbol_type, symbol_debug_type,
symbol_visibility, symbol_indexes);
}
@@ -810,8 +799,8 @@ Symbol *Symtab::FindFirstSymbolWithNameA
if (name) {
std::vector<uint32_t> matching_indexes;
- // The string table did have a string that matched, but we need
- // to check the symbols and match the symbol_type if any was given.
+ // The string table did have a string that matched, but we need to check
+ // the symbols and match the symbol_type if any was given.
if (AppendSymbolIndexesWithNameAndType(name, symbol_type, symbol_debug_type,
symbol_visibility,
matching_indexes)) {
@@ -835,8 +824,8 @@ typedef struct {
addr_t match_offset;
} SymbolSearchInfo;
-// Add all the section file start address & size to the RangeVector,
-// recusively adding any children sections.
+// Add all the section file start address & size to the RangeVector, recusively
+// adding any children sections.
static void AddSectionsToRangeMap(SectionList *sectlist,
RangeVector<addr_t, addr_t> §ion_ranges) {
const int num_sections = sectlist->GetNumSections(0);
@@ -885,9 +874,9 @@ void Symtab::InitAddressIndexes() {
// Create a RangeVector with the start & size of all the sections for
// this objfile. We'll need to check this for any FileRangeToIndexMap
- // entries with an uninitialized size, which could potentially be a
- // large number so reconstituting the weak pointer is busywork when it
- // is invariant information.
+ // entries with an uninitialized size, which could potentially be a large
+ // number so reconstituting the weak pointer is busywork when it is
+ // invariant information.
SectionList *sectlist = m_objfile->GetSectionList();
RangeVector<addr_t, addr_t> section_ranges;
if (sectlist) {
@@ -922,9 +911,8 @@ void Symtab::InitAddressIndexes() {
if (next_base_addr > curr_base_addr) {
addr_t size_to_next_symbol = next_base_addr - curr_base_addr;
- // Take the difference between this symbol and the next one as its
- // size,
- // if it is less than the size of the section.
+ // Take the difference between this symbol and the next one as
+ // its size, if it is less than the size of the section.
if (sym_size == 0 || size_to_next_symbol < sym_size) {
sym_size = size_to_next_symbol;
}
@@ -958,8 +946,7 @@ void Symtab::CalculateSymbolSizes() {
for (size_t i = 0; i < num_entries; ++i) {
// The entries in the m_file_addr_to_index have calculated the sizes
- // already
- // so we will use this size if we need to.
+ // already so we will use this size if we need to.
const FileRangeToIndexMap::Entry &entry =
m_file_addr_to_index.GetEntryRef(i);
@@ -1086,8 +1073,8 @@ size_t Symtab::FindFunctionSymbols(const
}
if (name_type_mask & eFunctionNameTypeBase) {
- // From mangled names we can't tell what is a basename and what
- // is a method name, so we just treat them the same
+ // From mangled names we can't tell what is a basename and what is a method
+ // name, so we just treat them the same
if (!m_name_indexes_computed)
InitNameIndexes();
Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Mon Apr 30 09:49:04 2018
@@ -387,8 +387,8 @@ bool Type::DumpValueInMemory(ExecutionCo
bool Type::ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
AddressType address_type, DataExtractor &data) {
if (address_type == eAddressTypeFile) {
- // Can't convert a file address to anything valid without more
- // context (which Module it came from)
+ // Can't convert a file address to anything valid without more context
+ // (which Module it came from)
return false;
}
@@ -533,10 +533,8 @@ bool Type::ResolveClangType(ResolveState
}
// When we have a EncodingUID, our "m_flags.compiler_type_resolve_state" is
- // set to eResolveStateUnresolved
- // so we need to update it to say that we now have a forward declaration
- // since that is what we created
- // above.
+ // set to eResolveStateUnresolved so we need to update it to say that we
+ // now have a forward declaration since that is what we created above.
if (m_compiler_type.IsValid())
m_flags.compiler_type_resolve_state = eResolveStateForward;
}
@@ -556,8 +554,8 @@ bool Type::ResolveClangType(ResolveState
}
}
- // If we have an encoding type, then we need to make sure it is
- // resolved appropriately.
+ // If we have an encoding type, then we need to make sure it is resolved
+ // appropriately.
if (m_encoding_uid != LLDB_INVALID_UID) {
if (encoding_type == nullptr)
encoding_type = GetEncodingType();
@@ -847,35 +845,26 @@ TypeImpl &TypeImpl::operator=(const Type
}
bool TypeImpl::CheckModule(lldb::ModuleSP &module_sp) const {
- // Check if we have a module for this type. If we do and the shared pointer is
- // can be successfully initialized with m_module_wp, return true. Else return
- // false
- // if we didn't have a module, or if we had a module and it has been deleted.
- // Any
- // functions doing anything with a TypeSP in this TypeImpl class should call
- // this
- // function and only do anything with the ivars if this function returns true.
- // If
- // we have a module, the "module_sp" will be filled in with a strong reference
- // to the
- // module so that the module will at least stay around long enough for the
- // type
- // query to succeed.
+ // Check if we have a module for this type. If we do and the shared pointer
+ // is can be successfully initialized with m_module_wp, return true. Else
+ // return false if we didn't have a module, or if we had a module and it has
+ // been deleted. Any functions doing anything with a TypeSP in this TypeImpl
+ // class should call this function and only do anything with the ivars if
+ // this function returns true. If we have a module, the "module_sp" will be
+ // filled in with a strong reference to the module so that the module will at
+ // least stay around long enough for the type query to succeed.
module_sp = m_module_wp.lock();
if (!module_sp) {
lldb::ModuleWP empty_module_wp;
// If either call to "std::weak_ptr::owner_before(...) value returns true,
- // this
- // indicates that m_module_wp once contained (possibly still does) a
- // reference
- // to a valid shared pointer. This helps us know if we had a valid reference
- // to
- // a section which is now invalid because the module it was in was deleted
+ // this indicates that m_module_wp once contained (possibly still does) a
+ // reference to a valid shared pointer. This helps us know if we had a
+ // valid reference to a section which is now invalid because the module it
+ // was in was deleted
if (empty_module_wp.owner_before(m_module_wp) ||
m_module_wp.owner_before(empty_module_wp)) {
// m_module_wp had a valid reference to a module, but all strong
- // references
- // have been released and the module has been deleted
+ // references have been released and the module has been deleted
return false;
}
}
Modified: lldb/trunk/source/Symbol/TypeList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeList.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/TypeList.cpp (original)
+++ lldb/trunk/source/Symbol/TypeList.cpp Mon Apr 30 09:49:04 2018
@@ -32,7 +32,8 @@ TypeList::TypeList() : m_types() {}
TypeList::~TypeList() {}
void TypeList::Insert(const TypeSP &type_sp) {
- // Just push each type on the back for now. We will worry about uniquing later
+ // Just push each type on the back for now. We will worry about uniquing
+ // later
if (type_sp)
m_types.push_back(type_sp);
}
@@ -123,10 +124,10 @@ void TypeList::RemoveMismatchedTypes(con
void TypeList::RemoveMismatchedTypes(const std::string &type_scope,
const std::string &type_basename,
TypeClass type_class, bool exact_match) {
- // Our "collection" type currently is a std::map which doesn't
- // have any good way to iterate and remove items from the map
- // so we currently just make a new list and add all of the matching
- // types to it, and then swap it into m_types at the end
+ // Our "collection" type currently is a std::map which doesn't have any good
+ // way to iterate and remove items from the map so we currently just make a
+ // new list and add all of the matching types to it, and then swap it into
+ // m_types at the end
collection matching_types;
iterator pos, end = m_types.end();
@@ -161,19 +162,15 @@ void TypeList::RemoveMismatchedTypes(con
if (type_scope_pos == match_type_scope_size - type_scope_size) {
if (type_scope_pos >= 2) {
// Our match scope ends with the type scope we were looking
- // for,
- // but we need to make sure what comes before the matching
- // type scope is a namespace boundary in case we are trying to
- // match:
- // type_basename = "d"
- // type_scope = "b::c::"
+ // for, but we need to make sure what comes before the
+ // matching type scope is a namespace boundary in case we are
+ // trying to match: type_basename = "d" type_scope = "b::c::"
// We want to match:
// match_type_scope "a::b::c::"
// But not:
// match_type_scope "a::bb::c::"
// So below we make sure what comes before "b::c::" in
- // match_type_scope
- // is "::", or the namespace boundary
+ // match_type_scope is "::", or the namespace boundary
if (match_type_scope[type_scope_pos - 1] == ':' &&
match_type_scope[type_scope_pos - 2] == ':') {
keep_match = true;
@@ -184,9 +181,8 @@ void TypeList::RemoveMismatchedTypes(con
}
}
} else {
- // The type we are currently looking at doesn't exists
- // in a namespace or class, so it only matches if there
- // is no type scope...
+ // The type we are currently looking at doesn't exists in a namespace
+ // or class, so it only matches if there is no type scope...
keep_match =
type_scope.empty() && type_basename.compare(match_type_name) == 0;
}
@@ -203,10 +199,10 @@ void TypeList::RemoveMismatchedTypes(Typ
if (type_class == eTypeClassAny)
return;
- // Our "collection" type currently is a std::map which doesn't
- // have any good way to iterate and remove items from the map
- // so we currently just make a new list and add all of the matching
- // types to it, and then swap it into m_types at the end
+ // Our "collection" type currently is a std::map which doesn't have any good
+ // way to iterate and remove items from the map so we currently just make a
+ // new list and add all of the matching types to it, and then swap it into
+ // m_types at the end
collection matching_types;
iterator pos, end = m_types.end();
Modified: lldb/trunk/source/Symbol/TypeMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeMap.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/TypeMap.cpp (original)
+++ lldb/trunk/source/Symbol/TypeMap.cpp Mon Apr 30 09:49:04 2018
@@ -45,7 +45,8 @@ TypeMap::TypeMap() : m_types() {}
TypeMap::~TypeMap() {}
void TypeMap::Insert(const TypeSP &type_sp) {
- // Just push each type on the back for now. We will worry about uniquing later
+ // Just push each type on the back for now. We will worry about uniquing
+ // later
if (type_sp)
m_types.insert(std::make_pair(type_sp->GetID(), type_sp));
}
@@ -167,10 +168,10 @@ void TypeMap::RemoveMismatchedTypes(cons
void TypeMap::RemoveMismatchedTypes(const std::string &type_scope,
const std::string &type_basename,
TypeClass type_class, bool exact_match) {
- // Our "collection" type currently is a std::map which doesn't
- // have any good way to iterate and remove items from the map
- // so we currently just make a new list and add all of the matching
- // types to it, and then swap it into m_types at the end
+ // Our "collection" type currently is a std::map which doesn't have any good
+ // way to iterate and remove items from the map so we currently just make a
+ // new list and add all of the matching types to it, and then swap it into
+ // m_types at the end
collection matching_types;
iterator pos, end = m_types.end();
@@ -205,19 +206,15 @@ void TypeMap::RemoveMismatchedTypes(cons
if (type_scope_pos == match_type_scope_size - type_scope_size) {
if (type_scope_pos >= 2) {
// Our match scope ends with the type scope we were looking
- // for,
- // but we need to make sure what comes before the matching
- // type scope is a namespace boundary in case we are trying to
- // match:
- // type_basename = "d"
- // type_scope = "b::c::"
+ // for, but we need to make sure what comes before the
+ // matching type scope is a namespace boundary in case we are
+ // trying to match: type_basename = "d" type_scope = "b::c::"
// We want to match:
// match_type_scope "a::b::c::"
// But not:
// match_type_scope "a::bb::c::"
// So below we make sure what comes before "b::c::" in
- // match_type_scope
- // is "::", or the namespace boundary
+ // match_type_scope is "::", or the namespace boundary
if (match_type_scope[type_scope_pos - 1] == ':' &&
match_type_scope[type_scope_pos - 2] == ':') {
keep_match = true;
@@ -228,9 +225,8 @@ void TypeMap::RemoveMismatchedTypes(cons
}
}
} else {
- // The type we are currently looking at doesn't exists
- // in a namespace or class, so it only matches if there
- // is no type scope...
+ // The type we are currently looking at doesn't exists in a namespace
+ // or class, so it only matches if there is no type scope...
keep_match =
type_scope.empty() && type_basename.compare(match_type_name) == 0;
}
@@ -247,10 +243,10 @@ void TypeMap::RemoveMismatchedTypes(Type
if (type_class == eTypeClassAny)
return;
- // Our "collection" type currently is a std::map which doesn't
- // have any good way to iterate and remove items from the map
- // so we currently just make a new list and add all of the matching
- // types to it, and then swap it into m_types at the end
+ // Our "collection" type currently is a std::map which doesn't have any good
+ // way to iterate and remove items from the map so we currently just make a
+ // new list and add all of the matching types to it, and then swap it into
+ // m_types at the end
collection matching_types;
iterator pos, end = m_types.end();
Modified: lldb/trunk/source/Symbol/UnwindPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindPlan.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/UnwindPlan.cpp (original)
+++ lldb/trunk/source/Symbol/UnwindPlan.cpp Mon Apr 30 09:49:04 2018
@@ -46,8 +46,7 @@ operator==(const UnwindPlan::Row::Regist
}
// This function doesn't copy the dwarf expression bytes; they must remain in
-// allocated
-// memory for the lifespan of this UnwindPlan object.
+// allocated memory for the lifespan of this UnwindPlan object.
void UnwindPlan::Row::RegisterLocation::SetAtDWARFExpression(
const uint8_t *opcodes, uint32_t len) {
m_type = atDWARFExpression;
@@ -56,8 +55,7 @@ void UnwindPlan::Row::RegisterLocation::
}
// This function doesn't copy the dwarf expression bytes; they must remain in
-// allocated
-// memory for the lifespan of this UnwindPlan object.
+// allocated memory for the lifespan of this UnwindPlan object.
void UnwindPlan::Row::RegisterLocation::SetIsDWARFExpression(
const uint8_t *opcodes, uint32_t len) {
m_type = isDWARFExpression;
Modified: lldb/trunk/source/Symbol/UnwindTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindTable.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/UnwindTable.cpp (original)
+++ lldb/trunk/source/Symbol/UnwindTable.cpp Mon Apr 30 09:49:04 2018
@@ -20,10 +20,9 @@
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
-// There is one UnwindTable object per ObjectFile.
-// It contains a list of Unwind objects -- one per function, populated lazily --
-// for the ObjectFile.
-// Each Unwind object has multiple UnwindPlans for different scenarios.
+// There is one UnwindTable object per ObjectFile. It contains a list of Unwind
+// objects -- one per function, populated lazily -- for the ObjectFile. Each
+// Unwind object has multiple UnwindPlans for different scenarios.
using namespace lldb;
using namespace lldb_private;
@@ -33,8 +32,7 @@ UnwindTable::UnwindTable(ObjectFile &obj
m_eh_frame_up(), m_compact_unwind_up(), m_arm_unwind_up() {}
// We can't do some of this initialization when the ObjectFile is running its
-// ctor; delay doing it
-// until needed for something.
+// ctor; delay doing it until needed for something.
void UnwindTable::Initialize() {
if (m_initialized)
@@ -134,10 +132,9 @@ UnwindTable::GetFuncUnwindersContainingA
}
// Ignore any existing FuncUnwinders for this function, create a new one and
-// don't add it to the
-// UnwindTable. This is intended for use by target modules show-unwind where we
-// want to create
-// new UnwindPlans, not re-use existing ones.
+// don't add it to the UnwindTable. This is intended for use by target modules
+// show-unwind where we want to create new UnwindPlans, not re-use existing
+// ones.
FuncUnwindersSP
UnwindTable::GetUncachedFuncUnwindersContainingAddress(const Address &addr,
SymbolContext &sc) {
Modified: lldb/trunk/source/Symbol/Variable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Mon Apr 30 09:49:04 2018
@@ -239,9 +239,8 @@ bool Variable::LocationIsValidForFrame(S
target_sp.get());
if (loclist_base_load_addr == LLDB_INVALID_ADDRESS)
return false;
- // It is a location list. We just need to tell if the location
- // list contains the current address when converted to a load
- // address
+ // It is a location list. We just need to tell if the location list
+ // contains the current address when converted to a load address
return m_location.LocationListContainsAddress(
loclist_base_load_addr,
frame->GetFrameCodeAddress().GetLoadAddress(target_sp.get()));
@@ -251,8 +250,8 @@ bool Variable::LocationIsValidForFrame(S
}
bool Variable::LocationIsValidForAddress(const Address &address) {
- // Be sure to resolve the address to section offset prior to
- // calling this function.
+ // Be sure to resolve the address to section offset prior to calling this
+ // function.
if (address.IsSectionOffset()) {
SymbolContext sc;
CalculateSymbolContext(&sc);
@@ -268,9 +267,8 @@ bool Variable::LocationIsValidForAddress
sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
if (loclist_base_file_addr == LLDB_INVALID_ADDRESS)
return false;
- // It is a location list. We just need to tell if the location
- // list contains the current address when converted to a load
- // address
+ // It is a location list. We just need to tell if the location list
+ // contains the current address when converted to a load address
return m_location.LocationListContainsAddress(loclist_base_file_addr,
address.GetFileAddress());
}
@@ -294,8 +292,8 @@ bool Variable::IsInScope(StackFrame *fra
case eValueTypeVariableArgument:
case eValueTypeVariableLocal:
if (frame) {
- // We don't have a location list, we just need to see if the block
- // that this variable was defined in is currently
+ // We don't have a location list, we just need to see if the block that
+ // this variable was defined in is currently
Block *deepest_frame_block =
frame->GetSymbolContext(eSymbolContextBlock).block;
if (deepest_frame_block) {
@@ -313,8 +311,7 @@ bool Variable::IsInScope(StackFrame *fra
return false;
// If no scope range is specified then it means that the scope is the
- // same as the
- // scope of the enclosing lexical block.
+ // same as the scope of the enclosing lexical block.
if (m_scope_range.IsEmpty())
return true;
@@ -455,8 +452,8 @@ Status Variable::GetValuesForVariableExp
}
bool Variable::DumpLocationForAddress(Stream *s, const Address &address) {
- // Be sure to resolve the address to section offset prior to
- // calling this function.
+ // Be sure to resolve the address to section offset prior to calling this
+ // function.
if (address.IsSectionOffset()) {
SymbolContext sc;
CalculateSymbolContext(&sc);
Modified: lldb/trunk/source/Target/ABI.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ABI.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ABI.cpp (original)
+++ lldb/trunk/source/Target/ABI.cpp Mon Apr 30 09:49:04 2018
@@ -193,18 +193,18 @@ bool ABI::PrepareTrivialCall(Thread &thr
bool ABI::GetFallbackRegisterLocation(
const RegisterInfo *reg_info,
UnwindPlan::Row::RegisterLocation &unwind_regloc) {
- // Did the UnwindPlan fail to give us the caller's stack pointer?
- // The stack pointer is defined to be the same as THIS frame's CFA, so return
- // the CFA value as
- // the caller's stack pointer. This is true on x86-32/x86-64 at least.
+ // Did the UnwindPlan fail to give us the caller's stack pointer? The stack
+ // pointer is defined to be the same as THIS frame's CFA, so return the CFA
+ // value as the caller's stack pointer. This is true on x86-32/x86-64 at
+ // least.
if (reg_info->kinds[eRegisterKindGeneric] == LLDB_REGNUM_GENERIC_SP) {
unwind_regloc.SetIsCFAPlusOffset(0);
return true;
}
// If a volatile register is being requested, we don't want to forward the
- // next frame's register contents
- // up the stack -- the register is not retrievable at this frame.
+ // next frame's register contents up the stack -- the register is not
+ // retrievable at this frame.
if (RegisterIsVolatile(reg_info)) {
unwind_regloc.SetUndefined();
return true;
Modified: lldb/trunk/source/Target/ExecutionContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ExecutionContext.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ExecutionContext.cpp (original)
+++ lldb/trunk/source/Target/ExecutionContext.cpp Mon Apr 30 09:49:04 2018
@@ -369,15 +369,14 @@ ExecutionContext &ExecutionContext::oper
bool ExecutionContext::operator==(const ExecutionContext &rhs) const {
// Check that the frame shared pointers match, or both are valid and their
- // stack
- // IDs match since sometimes we get new objects that represent the same
+ // stack IDs match since sometimes we get new objects that represent the same
// frame within a thread.
if ((m_frame_sp == rhs.m_frame_sp) ||
(m_frame_sp && rhs.m_frame_sp &&
m_frame_sp->GetStackID() == rhs.m_frame_sp->GetStackID())) {
- // Check that the thread shared pointers match, or both are valid and
- // their thread IDs match since sometimes we get new objects that
- // represent the same thread within a process.
+ // Check that the thread shared pointers match, or both are valid and their
+ // thread IDs match since sometimes we get new objects that represent the
+ // same thread within a process.
if ((m_thread_sp == rhs.m_thread_sp) ||
(m_thread_sp && rhs.m_thread_sp &&
m_thread_sp->GetID() == rhs.m_thread_sp->GetID())) {
@@ -596,9 +595,9 @@ lldb::ThreadSP ExecutionContextRef::GetT
lldb::ThreadSP thread_sp(m_thread_wp.lock());
if (m_tid != LLDB_INVALID_THREAD_ID) {
- // We check if the thread has been destroyed in cases where clients
- // might still have shared pointer to a thread, but the thread is
- // not valid anymore (not part of the process)
+ // We check if the thread has been destroyed in cases where clients might
+ // still have shared pointer to a thread, but the thread is not valid
+ // anymore (not part of the process)
if (!thread_sp || !thread_sp->IsValid()) {
lldb::ProcessSP process_sp(GetProcessSP());
if (process_sp && process_sp->IsValid()) {
@@ -608,9 +607,8 @@ lldb::ThreadSP ExecutionContextRef::GetT
}
}
- // Check that we aren't about to return an invalid thread sp. We might return
- // a nullptr thread_sp,
- // but don't return an invalid one.
+ // Check that we aren't about to return an invalid thread sp. We might
+ // return a nullptr thread_sp, but don't return an invalid one.
if (thread_sp && !thread_sp->IsValid())
thread_sp.reset();
Modified: lldb/trunk/source/Target/Memory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Memory.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/Memory.cpp (original)
+++ lldb/trunk/source/Target/Memory.cpp Mon Apr 30 09:49:04 2018
@@ -133,12 +133,12 @@ size_t MemoryCache::Read(addr_t addr, vo
Status &error) {
size_t bytes_left = dst_len;
- // Check the L1 cache for a range that contain the entire memory read.
- // If we find a range in the L1 cache that does, we use it. Else we fall
- // back to reading memory in m_L2_cache_line_byte_size byte sized chunks.
- // The L1 cache contains chunks of memory that are not required to be
- // m_L2_cache_line_byte_size bytes in size, so we don't try anything
- // tricky when reading from them (no partial reads from the L1 cache).
+ // Check the L1 cache for a range that contain the entire memory read. If we
+ // find a range in the L1 cache that does, we use it. Else we fall back to
+ // reading memory in m_L2_cache_line_byte_size byte sized chunks. The L1
+ // cache contains chunks of memory that are not required to be
+ // m_L2_cache_line_byte_size bytes in size, so we don't try anything tricky
+ // when reading from them (no partial reads from the L1 cache).
std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (!m_L1_cache.empty()) {
@@ -155,11 +155,11 @@ size_t MemoryCache::Read(addr_t addr, vo
}
}
- // If this memory read request is larger than the cache line size, then
- // we (1) try to read as much of it at once as possible, and (2) don't
- // add the data to the memory cache. We don't want to split a big read
- // up into more separate reads than necessary, and with a large memory read
- // request, it is unlikely that the caller function will ask for the next
+ // If this memory read request is larger than the cache line size, then we
+ // (1) try to read as much of it at once as possible, and (2) don't add the
+ // data to the memory cache. We don't want to split a big read up into more
+ // separate reads than necessary, and with a large memory read request, it is
+ // unlikely that the caller function will ask for the next
// 4 bytes after the large memory read - so there's little benefit to saving
// it in the cache.
if (dst && dst_len > m_L2_cache_line_byte_size) {
@@ -218,9 +218,9 @@ size_t MemoryCache::Read(addr_t addr, vo
bytes_left -= curr_read_size;
curr_addr += curr_read_size;
- // We have a cache page that succeeded to read some bytes
- // but not an entire page. If this happens, we must cap
- // off how much data we are able to read...
+ // We have a cache page that succeeded to read some bytes but not
+ // an entire page. If this happens, we must cap off how much data
+ // we are able to read...
if (pos->second->GetByteSize() != cache_line_byte_size)
return dst_len - bytes_left;
}
@@ -277,8 +277,8 @@ lldb::addr_t AllocatedBlock::ReserveBloc
if (range_size >= size)
{
// We found a free block that is big enough for our data. Figure out how
- // many chunks we will need and calculate the resulting block size we will
- // reserve.
+ // many chunks we will need and calculate the resulting block size we
+ // will reserve.
addr_t addr = free_block.GetRangeBase();
size_t num_chunks = CalculateChunksNeededForSize(size);
lldb::addr_t block_size = num_chunks * m_chunk_size;
@@ -296,8 +296,8 @@ lldb::addr_t AllocatedBlock::ReserveBloc
// Make the new allocated range and add it to the allocated ranges.
Range<lldb::addr_t, uint32_t> reserved_block(free_block);
reserved_block.SetByteSize(block_size);
- // Insert the reserved range and don't combine it with other blocks
- // in the reserved blocks list.
+ // Insert the reserved range and don't combine it with other blocks in
+ // the reserved blocks list.
m_reserved_blocks.Insert(reserved_block, false);
// Adjust the free range in place since we won't change the sorted
// ordering of the m_free_blocks list.
Modified: lldb/trunk/source/Target/ModuleCache.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ModuleCache.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ModuleCache.cpp (original)
+++ lldb/trunk/source/Target/ModuleCache.cpp Mon Apr 30 09:49:04 2018
@@ -312,9 +312,8 @@ Status ModuleCache::GetAndPut(const File
llvm::FileRemover tmp_symfile_remover(tmp_download_sym_file_spec.GetPath());
if (error.Fail())
// Failed to download a symfile but fetching the module was successful. The
- // module might
- // contain the necessary symbols and the debugging is also possible without
- // a symfile.
+ // module might contain the necessary symbols and the debugging is also
+ // possible without a symfile.
return Status();
error = Put(root_dir_spec, escaped_hostname.c_str(), module_spec,
Modified: lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ObjCLanguageRuntime.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ObjCLanguageRuntime.cpp (original)
+++ lldb/trunk/source/Target/ObjCLanguageRuntime.cpp Mon Apr 30 09:49:04 2018
@@ -170,8 +170,7 @@ ObjCLanguageRuntime::GetDescriptorIterat
UpdateISAToDescriptorMap();
if (m_hash_to_isa_map.empty()) {
// No name hashes were provided, we need to just linearly power through
- // the
- // names and find a match
+ // the names and find a match
for (ISAToDescriptorIterator pos = m_isa_to_descriptor.begin();
pos != end; ++pos) {
if (pos->second->GetClassName() == name)
@@ -239,9 +238,9 @@ ObjCLanguageRuntime::GetClassDescriptorF
ObjCLanguageRuntime::ClassDescriptorSP
ObjCLanguageRuntime::GetClassDescriptor(ValueObject &valobj) {
ClassDescriptorSP objc_class_sp;
- // if we get an invalid VO (which might still happen when playing around
- // with pointers returned by the expression parser, don't consider this
- // a valid ObjC object)
+ // if we get an invalid VO (which might still happen when playing around with
+ // pointers returned by the expression parser, don't consider this a valid
+ // ObjC object)
if (valobj.GetCompilerType().IsValid()) {
addr_t isa_pointer = valobj.GetPointerValue();
if (isa_pointer != LLDB_INVALID_ADDRESS) {
Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Mon Apr 30 09:49:04 2018
@@ -46,8 +46,8 @@
#include "llvm/Support/FileSystem.h"
-// Define these constants from POSIX mman.h rather than include the file
-// so that they will be correct even when compiled on Linux.
+// Define these constants from POSIX mman.h rather than include the file so
+// that they will be correct even when compiled on Linux.
#define MAP_PRIVATE 2
#define MAP_ANON 0x1000
@@ -56,8 +56,8 @@ using namespace lldb_private;
static uint32_t g_initialize_count = 0;
-// Use a singleton function for g_local_platform_sp to avoid init
-// constructors since LLDB is often part of a shared library
+// Use a singleton function for g_local_platform_sp to avoid init constructors
+// since LLDB is often part of a shared library
static PlatformSP &GetHostPlatformSP() {
static PlatformSP g_platform_sp;
return g_platform_sp;
@@ -468,10 +468,9 @@ bool Platform::GetOSVersion(uint32_t &ma
bool fetch = false;
if (success) {
- // We have valid OS version info, check to make sure it wasn't
- // manually set prior to connecting. If it was manually set prior
- // to connecting, then lets fetch the actual OS version info
- // if we are now connected.
+ // We have valid OS version info, check to make sure it wasn't manually
+ // set prior to connecting. If it was manually set prior to connecting,
+ // then lets fetch the actual OS version info if we are now connected.
if (is_connected && !m_os_version_set_while_connected)
fetch = true;
} else {
@@ -490,8 +489,8 @@ bool Platform::GetOSVersion(uint32_t &ma
minor = m_minor_os_version;
update = m_update_os_version;
} else if (process) {
- // Check with the process in case it can answer the question if
- // a process was provided
+ // Check with the process in case it can answer the question if a process
+ // was provided
return process->GetHostOSVersion(major, minor, update);
}
return success;
@@ -578,8 +577,8 @@ RecurseCopy_Callback(void *baton, llvm::
// now recurse
std::string src_dir_path(src.GetPath());
- // Make a filespec that only fills in the directory of a FileSpec so
- // when we enumerate we can quickly fill in the filename for dst copies
+ // Make a filespec that only fills in the directory of a FileSpec so when
+ // we enumerate we can quickly fill in the filename for dst copies
FileSpec recurse_dst;
recurse_dst.GetDirectory().SetCString(dst_dir.GetPath().c_str());
RecurseCopyBaton rc_baton2 = {recurse_dst, rc_baton->platform_ptr,
@@ -657,9 +656,9 @@ Status Platform::Install(const FileSpec
if (first_dst_dir_char == '/' || first_dst_dir_char == '\\') {
fixed_dst.GetDirectory() = dst.GetDirectory();
}
- // If the fixed destination file doesn't have a directory yet,
- // then we must have a relative path. We will resolve this relative
- // path against the platform's working directory
+ // If the fixed destination file doesn't have a directory yet, then we
+ // must have a relative path. We will resolve this relative path against
+ // the platform's working directory
if (!fixed_dst.GetDirectory()) {
FileSpec relative_spec;
std::string path;
@@ -862,21 +861,19 @@ const char *Platform::GetGroupName(uint3
bool Platform::SetOSVersion(uint32_t major, uint32_t minor, uint32_t update) {
if (IsHost()) {
- // We don't need anyone setting the OS version for the host platform,
- // we should be able to figure it out by calling
- // HostInfo::GetOSVersion(...).
+ // We don't need anyone setting the OS version for the host platform, we
+ // should be able to figure it out by calling HostInfo::GetOSVersion(...).
return false;
} else {
- // We have a remote platform, allow setting the target OS version if
- // we aren't connected, since if we are connected, we should be able to
+ // We have a remote platform, allow setting the target OS version if we
+ // aren't connected, since if we are connected, we should be able to
// request the remote OS version from the connected platform.
if (IsConnected())
return false;
else {
- // We aren't connected and we might want to set the OS version
- // ahead of time before we connect so we can peruse files and
- // use a local SDK or PDK cache of support files to disassemble
- // or do other things.
+ // We aren't connected and we might want to set the OS version ahead of
+ // time before we connect so we can peruse files and use a local SDK or
+ // PDK cache of support files to disassemble or do other things.
m_major_os_version = major;
m_minor_os_version = minor;
m_update_os_version = update;
@@ -897,9 +894,9 @@ Platform::ResolveExecutable(const Module
module_search_paths_ptr, nullptr,
nullptr);
} else {
- // No valid architecture was specified, ask the platform for
- // the architectures that we should be using (in the correct order)
- // and see if we can find a match that way
+ // No valid architecture was specified, ask the platform for the
+ // architectures that we should be using (in the correct order) and see
+ // if we can find a match that way
ModuleSpec arch_module_spec(module_spec);
for (uint32_t idx = 0; GetSupportedArchitectureAtIndex(
idx, arch_module_spec.GetArchitecture());
@@ -943,18 +940,17 @@ const ArchSpec &Platform::GetSystemArchi
m_system_arch_set_while_connected = m_system_arch.IsValid();
}
} else {
- // We have a remote platform. We can only fetch the remote
- // system architecture if we are connected, and we don't want to do it
- // more than once.
+ // We have a remote platform. We can only fetch the remote system
+ // architecture if we are connected, and we don't want to do it more than
+ // once.
const bool is_connected = IsConnected();
bool fetch = false;
if (m_system_arch.IsValid()) {
- // We have valid OS version info, check to make sure it wasn't
- // manually set prior to connecting. If it was manually set prior
- // to connecting, then lets fetch the actual OS version info
- // if we are now connected.
+ // We have valid OS version info, check to make sure it wasn't manually
+ // set prior to connecting. If it was manually set prior to connecting,
+ // then lets fetch the actual OS version info if we are now connected.
if (is_connected && !m_system_arch_set_while_connected)
fetch = true;
} else {
@@ -1026,8 +1022,8 @@ Status Platform::DisconnectRemote() {
bool Platform::GetProcessInfo(lldb::pid_t pid,
ProcessInstanceInfo &process_info) {
- // Take care of the host case so that each subclass can just
- // call this function to get the host functionality.
+ // Take care of the host case so that each subclass can just call this
+ // function to get the host functionality.
if (IsHost())
return Host::GetProcessInfo(pid, process_info);
return false;
@@ -1035,8 +1031,8 @@ bool Platform::GetProcessInfo(lldb::pid_
uint32_t Platform::FindProcesses(const ProcessInstanceInfoMatch &match_info,
ProcessInstanceInfoList &process_infos) {
- // Take care of the host case so that each subclass can just
- // call this function to get the host functionality.
+ // Take care of the host case so that each subclass can just call this
+ // function to get the host functionality.
uint32_t match_count = 0;
if (IsHost())
match_count = Host::FindProcesses(match_info, process_infos);
@@ -1049,8 +1045,8 @@ Status Platform::LaunchProcess(ProcessLa
if (log)
log->Printf("Platform::%s()", __FUNCTION__);
- // Take care of the host case so that each subclass can just
- // call this function to get the host functionality.
+ // Take care of the host case so that each subclass can just call this
+ // function to get the host functionality.
if (IsHost()) {
if (::getenv("LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY"))
launch_info.GetFlags().Set(eLaunchFlagLaunchInTTY);
@@ -1107,8 +1103,7 @@ Status Platform::KillProcess(const lldb:
log->Printf("Platform::%s, pid %" PRIu64, __FUNCTION__, pid);
// Try to find a process plugin to handle this Kill request. If we can't,
- // fall back to
- // the default OS implementation.
+ // fall back to the default OS implementation.
size_t num_debuggers = Debugger::GetNumDebuggers();
for (size_t didx = 0; didx < num_debuggers; ++didx) {
DebuggerSP debugger = Debugger::GetDebuggerAtIndex(didx);
@@ -1143,23 +1138,22 @@ Platform::DebugProcess(ProcessLaunchInfo
// Make sure we stop at the entry point
launch_info.GetFlags().Set(eLaunchFlagDebug);
// We always launch the process we are going to debug in a separate process
- // group, since then we can handle ^C interrupts ourselves w/o having to worry
- // about the target getting them as well.
+ // group, since then we can handle ^C interrupts ourselves w/o having to
+ // worry about the target getting them as well.
launch_info.SetLaunchInSeparateProcessGroup(true);
// Allow any StructuredData process-bound plugins to adjust the launch info
// if needed
size_t i = 0;
bool iteration_complete = false;
- // Note iteration can't simply go until a nullptr callback is returned, as
- // it is valid for a plugin to not supply a filter.
+ // Note iteration can't simply go until a nullptr callback is returned, as it
+ // is valid for a plugin to not supply a filter.
auto get_filter_func = PluginManager::GetStructuredDataFilterCallbackAtIndex;
for (auto filter_callback = get_filter_func(i, iteration_complete);
!iteration_complete;
filter_callback = get_filter_func(++i, iteration_complete)) {
if (filter_callback) {
- // Give this ProcessLaunchInfo filter a chance to adjust the launch
- // info.
+ // Give this ProcessLaunchInfo filter a chance to adjust the launch info.
error = (*filter_callback)(launch_info, target);
if (!error.Success()) {
if (log)
@@ -1192,10 +1186,10 @@ Platform::DebugProcess(ProcessLaunchInfo
// process if this happens.
process_sp->SetShouldDetach(false);
- // If we didn't have any file actions, the pseudo terminal might
- // have been used where the slave side was given as the file to
- // open for stdin/out/err after we have already opened the master
- // so we can read/write stdin/out/err.
+ // If we didn't have any file actions, the pseudo terminal might have
+ // been used where the slave side was given as the file to open for
+ // stdin/out/err after we have already opened the master so we can
+ // read/write stdin/out/err.
int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor();
if (pty_fd != PseudoTerminal::invalid_fd) {
process_sp->SetSTDIOFileDescriptor(pty_fd);
@@ -1314,8 +1308,8 @@ Status Platform::PutFile(const FileSpec
offset += bytes_written;
if (bytes_written != bytes_read) {
- // We didn't write the correct number of bytes, so adjust
- // the file position in the source file we are reading from...
+ // We didn't write the correct number of bytes, so adjust the file
+ // position in the source file we are reading from...
source_file.SeekFromStart(offset);
}
}
@@ -1600,9 +1594,9 @@ Status Platform::GetRemoteSharedModule(c
if (module_spec.GetArchitecture().IsValid() == false) {
Status error;
- // No valid architecture was specified, ask the platform for
- // the architectures that we should be using (in the correct order)
- // and see if we can find a match that way
+ // No valid architecture was specified, ask the platform for the
+ // architectures that we should be using (in the correct order) and see if
+ // we can find a match that way
ModuleSpec arch_module_spec(module_spec);
for (uint32_t idx = 0; GetSupportedArchitectureAtIndex(
idx, arch_module_spec.GetArchitecture());
@@ -1853,8 +1847,8 @@ size_t Platform::GetSoftwareBreakpointTr
// TODO: support big-endian arm and thumb trap codes.
case llvm::Triple::arm: {
- // The ARM reference recommends the use of 0xe7fddefe and 0xdefe
- // but the linux kernel does otherwise.
+ // The ARM reference recommends the use of 0xe7fddefe and 0xdefe but the
+ // linux kernel does otherwise.
static const uint8_t g_arm_breakpoint_opcode[] = {0xf0, 0x01, 0xf0, 0xe7};
static const uint8_t g_thumb_breakpoint_opcode[] = {0x01, 0xde};
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Apr 30 09:49:04 2018
@@ -90,19 +90,18 @@ public:
ProcessOptionValueProperties(const ConstString &name)
: OptionValueProperties(name) {}
- // This constructor is used when creating ProcessOptionValueProperties when it
- // is part of a new lldb_private::Process instance. It will copy all current
- // global property values as needed
+ // This constructor is used when creating ProcessOptionValueProperties when
+ // it is part of a new lldb_private::Process instance. It will copy all
+ // current global property values as needed
ProcessOptionValueProperties(ProcessProperties *global_properties)
: OptionValueProperties(*global_properties->GetValueProperties()) {}
const Property *GetPropertyAtIndex(const ExecutionContext *exe_ctx,
bool will_modify,
uint32_t idx) const override {
- // When getting the value for a key from the process options, we will always
- // try and grab the setting from the current process if there is one. Else
- // we just
- // use the one from this instance.
+ // When getting the value for a key from the process options, we will
+ // always try and grab the setting from the current process if there is
+ // one. Else we just use the one from this instance.
if (exe_ctx) {
Process *process = exe_ctx->GetProcessPtr();
if (process) {
@@ -809,8 +808,8 @@ Process::~Process() {
StopPrivateStateThread();
// ThreadList::Clear() will try to acquire this process's mutex, so
- // explicitly clear the thread list here to ensure that the mutex
- // is not destroyed before the thread list.
+ // explicitly clear the thread list here to ensure that the mutex is not
+ // destroyed before the thread list.
m_thread_list.Clear();
}
@@ -848,13 +847,12 @@ void Process::Finalize() {
// Clear our broadcaster before we proceed with destroying
Broadcaster::Clear();
- // Do any cleanup needed prior to being destructed... Subclasses
- // that override this method should call this superclass method as well.
+ // Do any cleanup needed prior to being destructed... Subclasses that
+ // override this method should call this superclass method as well.
// We need to destroy the loader before the derived Process class gets
- // destroyed
- // since it is very likely that undoing the loader will require access to the
- // real process.
+ // destroyed since it is very likely that undoing the loader will require
+ // access to the real process.
m_dynamic_checkers_ap.reset();
m_abi_sp.reset();
m_os_ap.reset();
@@ -874,8 +872,8 @@ void Process::Finalize() {
m_language_runtimes.clear();
m_instrumentation_runtimes.clear();
m_next_event_action_ap.reset();
- // Clear the last natural stop ID since it has a strong
- // reference to this process
+ // Clear the last natural stop ID since it has a strong reference to this
+ // process
m_mod_id.SetStopEventForLastNaturalStopID(EventSP());
//#ifdef LLDB_CONFIGURATION_DEBUG
// StreamFile s(stdout, false);
@@ -931,14 +929,11 @@ void Process::SynchronouslyNotifyStateCh
// FIXME: We need to do some work on events before the general Listener sees
// them.
// For instance if we are continuing from a breakpoint, we need to ensure that
-// we do
-// the little "insert real insn, step & stop" trick. But we can't do that when
-// the
-// event is delivered by the broadcaster - since that is done on the thread that
-// is
-// waiting for new events, so if we needed more than one event for our handling,
-// we would
-// stall. So instead we do it when we fetch the event off of the queue.
+// we do the little "insert real insn, step & stop" trick. But we can't do
+// that when the event is delivered by the broadcaster - since that is done on
+// the thread that is waiting for new events, so if we needed more than one
+// event for our handling, we would stall. So instead we do it when we fetch
+// the event off of the queue.
//
StateType Process::GetNextEvent(EventSP &event_sp) {
@@ -974,15 +969,13 @@ StateType Process::WaitForProcessToStop(
ListenerSP hijack_listener_sp,
Stream *stream, bool use_run_lock) {
// We can't just wait for a "stopped" event, because the stopped event may
- // have restarted the target.
- // We have to actually check each event, and in the case of a stopped event
- // check the restarted flag
- // on the event.
+ // have restarted the target. We have to actually check each event, and in
+ // the case of a stopped event check the restarted flag on the event.
if (event_sp_ptr)
event_sp_ptr->reset();
StateType state = GetState();
- // If we are exited or detached, we won't ever get back to any
- // other valid state...
+ // If we are exited or detached, we won't ever get back to any other valid
+ // state...
if (state == eStateDetached || state == eStateExited)
return state;
@@ -1148,10 +1141,8 @@ bool Process::HandleProcessStateChangedE
case eStopReasonSignal: {
// Don't select a signal thread if we weren't going to stop at
- // that
- // signal. We have to have had another reason for stopping here,
- // and
- // the user doesn't want to see this thread.
+ // that signal. We have to have had another reason for stopping
+ // here, and the user doesn't want to see this thread.
uint64_t signo = thread->GetStopInfo()->GetValue();
if (process_sp->GetUnixSignals()->GetShouldStop(signo)) {
if (!other_thread)
@@ -1191,10 +1182,9 @@ bool Process::HandleProcessStateChangedE
}
}
// Drop the ThreadList mutex by here, since GetThreadStatus below might
- // have to run code,
- // e.g. for Data formatters, and if we hold the ThreadList mutex, then the
- // process is going to
- // have a hard time restarting the process.
+ // have to run code, e.g. for Data formatters, and if we hold the
+ // ThreadList mutex, then the process is going to have a hard time
+ // restarting the process.
if (stream) {
Debugger &debugger = process_sp->GetTarget().GetDebugger();
if (debugger.GetTargetList().GetSelectedTarget().get() ==
@@ -1382,8 +1372,8 @@ bool Process::SetExitStatus(int status,
else
m_exit_string.clear();
- // Clear the last natural stop ID since it has a strong
- // reference to this process
+ // Clear the last natural stop ID since it has a strong reference to this
+ // process
m_mod_id.SetStopEventForLastNaturalStopID(EventSP());
SetPrivateState(eStateExited);
@@ -1410,9 +1400,9 @@ bool Process::IsAlive() {
}
}
-// This static callback can be used to watch for local child processes on
-// the current host. The child process exits, the process will be
-// found in the global target list (we want to be completely sure that the
+// This static callback can be used to watch for local child processes on the
+// current host. The child process exits, the process will be found in the
+// global target list (we want to be completely sure that the
// lldb_private::Process doesn't go away before we can deliver the signal.
bool Process::SetProcessExitStatus(
lldb::pid_t pid, bool exited,
@@ -1449,20 +1439,19 @@ void Process::UpdateThreadListIfNeeded()
const StateType state = GetPrivateState();
if (StateIsStoppedState(state, true)) {
std::lock_guard<std::recursive_mutex> guard(m_thread_list.GetMutex());
- // m_thread_list does have its own mutex, but we need to
- // hold onto the mutex between the call to UpdateThreadList(...)
- // and the os->UpdateThreadList(...) so it doesn't change on us
+ // m_thread_list does have its own mutex, but we need to hold onto the
+ // mutex between the call to UpdateThreadList(...) and the
+ // os->UpdateThreadList(...) so it doesn't change on us
ThreadList &old_thread_list = m_thread_list;
ThreadList real_thread_list(this);
ThreadList new_thread_list(this);
- // Always update the thread list with the protocol specific
- // thread list, but only update if "true" is returned
+ // Always update the thread list with the protocol specific thread list,
+ // but only update if "true" is returned
if (UpdateThreadList(m_thread_list_real, real_thread_list)) {
// Don't call into the OperatingSystem to update the thread list if we
- // are shutting down, since
- // that may call back into the SBAPI's, requiring the API lock which is
- // already held by whoever is
- // shutting us down, causing a deadlock.
+ // are shutting down, since that may call back into the SBAPI's,
+ // requiring the API lock which is already held by whoever is shutting
+ // us down, causing a deadlock.
OperatingSystem *os = GetOperatingSystem();
if (os && !m_destroy_in_process) {
// Clear any old backing threads where memory threads might have been
@@ -1472,12 +1461,9 @@ void Process::UpdateThreadListIfNeeded()
old_thread_list.GetThreadAtIndex(i, false)->ClearBackingThread();
// Turn off dynamic types to ensure we don't run any expressions.
- // Objective C
- // can run an expression to determine if a SBValue is a dynamic type
- // or not
- // and we need to avoid this. OperatingSystem plug-ins can't run
- // expressions
- // that require running code...
+ // Objective C can run an expression to determine if a SBValue is a
+ // dynamic type or not and we need to avoid this. OperatingSystem
+ // plug-ins can't run expressions that require running code...
Target &target = GetTarget();
const lldb::DynamicValueType saved_prefer_dynamic =
@@ -1586,9 +1572,9 @@ void Process::SetPublicState(StateType n
const StateType old_state = m_public_state.GetValue();
m_public_state.SetValue(new_state);
- // On the transition from Run to Stopped, we unlock the writer end of the
- // run lock. The lock gets locked in Resume, which is the public API
- // to tell the program to run.
+ // On the transition from Run to Stopped, we unlock the writer end of the run
+ // lock. The lock gets locked in Resume, which is the public API to tell the
+ // program to run.
if (!StateChangedIsExternallyHijacked()) {
if (new_state == eStateDetached) {
if (log)
@@ -1701,17 +1687,16 @@ void Process::SetPrivateState(StateType
new Event(eBroadcastBitStateChanged,
new ProcessEventData(shared_from_this(), new_state)));
if (StateIsStoppedState(new_state, false)) {
- // Note, this currently assumes that all threads in the list
- // stop when the process stops. In the future we will want to
- // support a debugging model where some threads continue to run
- // while others are stopped. When that happens we will either need
- // a way for the thread list to identify which threads are stopping
- // or create a special thread list containing only threads which
- // actually stopped.
+ // Note, this currently assumes that all threads in the list stop when
+ // the process stops. In the future we will want to support a debugging
+ // model where some threads continue to run while others are stopped.
+ // When that happens we will either need a way for the thread list to
+ // identify which threads are stopping or create a special thread list
+ // containing only threads which actually stopped.
//
- // The process plugin is responsible for managing the actual
- // behavior of the threads and should have stopped any threads
- // that are going to stop before we get here.
+ // The process plugin is responsible for managing the actual behavior of
+ // the threads and should have stopped any threads that are going to stop
+ // before we get here.
m_thread_list.DidStop();
m_mod_id.BumpStopID();
@@ -1884,8 +1869,8 @@ Process::CreateBreakpointSite(const Brea
break;
}
- // Reset the IsIndirect flag here, in case the location changes from
- // pointing to a indirect symbol to a regular symbol.
+ // Reset the IsIndirect flag here, in case the location changes from pointing
+ // to a indirect symbol to a regular symbol.
owner->SetIsIndirect(false);
if (owner->ShouldResolveIndirectFunctions()) {
@@ -1915,8 +1900,7 @@ Process::CreateBreakpointSite(const Brea
BreakpointSiteSP bp_site_sp;
// Look up this breakpoint site. If it exists, then add this new owner,
- // otherwise
- // create a new breakpoint site and add it.
+ // otherwise create a new breakpoint site and add it.
bp_site_sp = m_breakpoint_site_list.FindByAddress(load_addr);
@@ -2164,7 +2148,8 @@ Status Process::DisableSoftwareBreakpoin
return error;
}
-// Uncomment to verify memory caching works after making changes to caching code
+// Uncomment to verify memory caching works after making changes to caching
+// code
//#define VERIFY_MEMORY_READS
size_t Process::ReadMemory(addr_t addr, void *buf, size_t size, Status &error) {
@@ -2218,8 +2203,8 @@ size_t Process::ReadCStringFromMemory(ad
if (length == 0)
break;
out_str.append(buf, length);
- // If we got "length - 1" bytes, we didn't get the whole C string, we
- // need to read some more characters
+ // If we got "length - 1" bytes, we didn't get the whole C string, we need
+ // to read some more characters
if (length == sizeof(buf) - 1)
curr_addr += length;
else
@@ -2232,7 +2217,8 @@ size_t Process::ReadStringFromMemory(add
Status &error, size_t type_width) {
size_t total_bytes_read = 0;
if (dst && max_bytes && type_width && max_bytes >= type_width) {
- // Ensure a null terminator independent of the number of bytes that is read.
+ // Ensure a null terminator independent of the number of bytes that is
+ // read.
memset(dst, 0, max_bytes);
size_t bytes_left = max_bytes - type_width;
@@ -2279,8 +2265,7 @@ size_t Process::ReadStringFromMemory(add
}
// Deprecated in favor of ReadStringFromMemory which has wchar support and
-// correct code to find
-// null terminators.
+// correct code to find null terminators.
size_t Process::ReadCStringFromMemory(addr_t addr, char *dst,
size_t dst_max_len,
Status &result_error) {
@@ -2454,16 +2439,16 @@ size_t Process::WriteMemory(addr_t addr,
// Check for bytes before this breakpoint
const addr_t curr_addr = addr + bytes_written;
if (intersect_addr > curr_addr) {
- // There are some bytes before this breakpoint that we need to
- // just write to memory
+ // There are some bytes before this breakpoint that we need to just
+ // write to memory
size_t curr_size = intersect_addr - curr_addr;
size_t curr_bytes_written = WriteMemoryPrivate(
curr_addr, ubuf + bytes_written, curr_size, error);
bytes_written += curr_bytes_written;
if (curr_bytes_written != curr_size) {
- // We weren't able to write all of the requested bytes, we
- // are done looping and will return the number of bytes that
- // we have written so far.
+ // We weren't able to write all of the requested bytes, we are
+ // done looping and will return the number of bytes that we have
+ // written so far.
if (error.Success())
error.SetErrorToGenericError();
}
@@ -2697,8 +2682,8 @@ StateType
Process::WaitForProcessStopPrivate(EventSP &event_sp,
const Timeout<std::micro> &timeout) {
StateType state;
- // Now wait for the process to launch and return control to us, and then
- // call DidLaunch:
+ // Now wait for the process to launch and return control to us, and then call
+ // DidLaunch:
while (true) {
event_sp.reset();
state = GetStateChangedEventsPrivate(event_sp, timeout);
@@ -2779,8 +2764,8 @@ Status Process::Launch(ProcessLaunchInfo
StateType state = WaitForProcessStopPrivate(event_sp, seconds(10));
if (state == eStateInvalid || !event_sp) {
- // We were able to launch the process, but we failed to
- // catch the initial stop.
+ // We were able to launch the process, but we failed to catch the
+ // initial stop.
error.SetErrorString("failed to catch stop after launch");
SetExitStatus(0, "failed to catch stop after launch");
Destroy(false);
@@ -2800,18 +2785,15 @@ Status Process::Launch(ProcessLaunchInfo
if (!m_os_ap)
LoadOperatingSystemPlugin(false);
- // We successfully launched the process and stopped,
- // now it the right time to set up signal filters before resuming.
+ // We successfully launched the process and stopped, now it the
+ // right time to set up signal filters before resuming.
UpdateAutomaticSignalFiltering();
// Note, the stop event was consumed above, but not handled. This
- // was done
- // to give DidLaunch a chance to run. The target is either stopped
- // or crashed.
- // Directly set the state. This is done to prevent a stop message
- // with a bunch
- // of spurious output on thread status, as well as not pop a
- // ProcessIOHandler.
+ // was done to give DidLaunch a chance to run. The target is either
+ // stopped or crashed. Directly set the state. This is done to
+ // prevent a stop message with a bunch of spurious output on thread
+ // status, as well as not pop a ProcessIOHandler.
SetPublicState(state, false);
if (PrivateStateThreadIsValid())
@@ -2820,15 +2802,13 @@ Status Process::Launch(ProcessLaunchInfo
StartPrivateStateThread();
// Target was stopped at entry as was intended. Need to notify the
- // listeners
- // about it.
+ // listeners about it.
if (state == eStateStopped &&
launch_info.GetFlags().Test(eLaunchFlagStopAtEntry))
HandlePrivateEvent(event_sp);
} else if (state == eStateExited) {
// We exited while trying to launch somehow. Don't call DidLaunch
- // as that's
- // not likely to work, and return an invalid pid.
+ // as that's not likely to work, and return an invalid pid.
HandlePrivateEvent(event_sp);
}
}
@@ -2867,8 +2847,7 @@ Status Process::LoadCore() {
LoadOperatingSystemPlugin(false);
// We successfully loaded a core file, now pretend we stopped so we can
- // show all of the threads in the core file and explore the crashed
- // state.
+ // show all of the threads in the core file and explore the crashed state.
SetPrivateState(eStateStopped);
// Wait for a stopped event since we just posted one above...
@@ -2944,8 +2923,8 @@ Process::AttachCompletionHandler::Perfor
// During attach, prior to sending the eStateStopped event,
// lldb_private::Process subclasses must set the new process ID.
assert(m_process->GetID() != LLDB_INVALID_PROCESS_ID);
- // We don't want these events to be reported, so go set the ShouldReportStop
- // here:
+ // We don't want these events to be reported, so go set the
+ // ShouldReportStop here:
m_process->GetThreadList().SetShouldReportStop(eVoteNo);
if (m_exec_count > 0) {
@@ -3139,8 +3118,8 @@ void Process::CompleteAttach() {
}
// We just attached. If we have a platform, ask it for the process
- // architecture, and if it isn't
- // the same as the one we've already set, switch architectures.
+ // architecture, and if it isn't the same as the one we've already set,
+ // switch architectures.
PlatformSP platform_sp(GetTarget().GetPlatform());
assert(platform_sp);
if (platform_sp) {
@@ -3277,21 +3256,20 @@ Status Process::PrivateResume() {
m_mod_id.GetStopID(), StateAsCString(m_public_state.GetValue()),
StateAsCString(m_private_state.GetValue()));
- // If signals handing status changed we might want to update
- // our signal filters before resuming.
+ // If signals handing status changed we might want to update our signal
+ // filters before resuming.
UpdateAutomaticSignalFiltering();
Status error(WillResume());
// Tell the process it is about to resume before the thread list
if (error.Success()) {
- // Now let the thread list know we are about to resume so it
- // can let all of our threads know that they are about to be
- // resumed. Threads will each be called with
- // Thread::WillResume(StateType) where StateType contains the state
- // that they are supposed to have when the process is resumed
- // (suspended/running/stepping). Threads should also check
- // their resume signal in lldb::Thread::GetResumeSignal()
- // to see if they are supposed to start back up with a signal.
+ // Now let the thread list know we are about to resume so it can let all of
+ // our threads know that they are about to be resumed. Threads will each be
+ // called with Thread::WillResume(StateType) where StateType contains the
+ // state that they are supposed to have when the process is resumed
+ // (suspended/running/stepping). Threads should also check their resume
+ // signal in lldb::Thread::GetResumeSignal() to see if they are supposed to
+ // start back up with a signal.
if (m_thread_list.WillResume()) {
// Last thing, do the PreResumeActions.
if (!RunPreResumeActions()) {
@@ -3308,11 +3286,10 @@ Status Process::PrivateResume() {
}
}
} else {
- // Somebody wanted to run without running (e.g. we were faking a step from
- // one frame of a set of inlined
- // frames that share the same PC to another.) So generate a continue & a
- // stopped event,
- // and let the world handle them.
+ // Somebody wanted to run without running (e.g. we were faking a step
+ // from one frame of a set of inlined frames that share the same PC to
+ // another.) So generate a continue & a stopped event, and let the world
+ // handle them.
if (log)
log->Printf(
"Process::PrivateResume() asked to simulate a start & stop.");
@@ -3330,9 +3307,8 @@ Status Process::Halt(bool clear_thread_p
if (!StateIsRunningState(m_public_state.GetValue()))
return Status("Process is not running.");
- // Don't clear the m_clear_thread_plans_on_stop, only set it to true if
- // in case it was already set and some thread plan logic calls halt on its
- // own.
+ // Don't clear the m_clear_thread_plans_on_stop, only set it to true if in
+ // case it was already set and some thread plan logic calls halt on its own.
m_clear_thread_plans_on_stop |= clear_thread_plans;
ListenerSP halt_listener_sp(
@@ -3344,8 +3320,8 @@ Status Process::Halt(bool clear_thread_p
SendAsyncInterrupt();
if (m_public_state.GetValue() == eStateAttaching) {
- // Don't hijack and eat the eStateExited as the code that was doing
- // the attach will be waiting for this event...
+ // Don't hijack and eat the eStateExited as the code that was doing the
+ // attach will be waiting for this event...
RestoreProcessEvents();
SetExitStatus(SIGKILL, "Cancelled async attach.");
Destroy(false);
@@ -3371,8 +3347,8 @@ Status Process::StopForDestroyOrDetach(l
Status error;
// Check both the public & private states here. If we're hung evaluating an
- // expression, for instance, then
- // the public state will be stopped, but we still need to interrupt.
+ // expression, for instance, then the public state will be stopped, but we
+ // still need to interrupt.
if (m_public_state.GetValue() == eStateRunning ||
m_private_state.GetValue() == eStateRunning) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
@@ -3392,10 +3368,9 @@ Status Process::StopForDestroyOrDetach(l
RestoreProcessEvents();
// If the process exited while we were waiting for it to stop, put the
- // exited event into
- // the shared pointer passed in and return. Our caller doesn't need to do
- // anything else, since
- // they don't have a process anymore...
+ // exited event into the shared pointer passed in and return. Our caller
+ // doesn't need to do anything else, since they don't have a process
+ // anymore...
if (state == eStateExited || m_private_state.GetValue() == eStateExited) {
if (log)
@@ -3410,9 +3385,8 @@ Status Process::StopForDestroyOrDetach(l
log->Printf("Process::%s() failed to stop, state is: %s", __FUNCTION__,
StateAsCString(state));
// If we really couldn't stop the process then we should just error out
- // here, but if the
- // lower levels just bobbled sending the event and we really are stopped,
- // then continue on.
+ // here, but if the lower levels just bobbled sending the event and we
+ // really are stopped, then continue on.
StateType private_state = m_private_state.GetValue();
if (private_state != eStateStopped) {
return Status(
@@ -3460,20 +3434,18 @@ Status Process::Detach(bool keep_stopped
}
m_destroy_in_process = false;
- // If we exited when we were waiting for a process to stop, then
- // forward the event here so we don't lose the event
+ // If we exited when we were waiting for a process to stop, then forward the
+ // event here so we don't lose the event
if (exit_event_sp) {
- // Directly broadcast our exited event because we shut down our
- // private state thread above
+ // Directly broadcast our exited event because we shut down our private
+ // state thread above
BroadcastEvent(exit_event_sp);
}
// If we have been interrupted (to kill us) in the middle of running, we may
- // not end up propagating
- // the last events through the event system, in which case we might strand the
- // write lock. Unlock
- // it here so when we do to tear down the process we don't get an error
- // destroying the lock.
+ // not end up propagating the last events through the event system, in which
+ // case we might strand the write lock. Unlock it here so when we do to tear
+ // down the process we don't get an error destroying the lock.
m_public_run_lock.SetStopped();
return error;
@@ -3482,9 +3454,8 @@ Status Process::Detach(bool keep_stopped
Status Process::Destroy(bool force_kill) {
// Tell ourselves we are in the process of destroying the process, so that we
- // don't do any unnecessary work
- // that might hinder the destruction. Remember to set this back to false when
- // we are done. That way if the attempt
+ // don't do any unnecessary work that might hinder the destruction. Remember
+ // to set this back to false when we are done. That way if the attempt
// failed and the process stays around for some reason it won't be in a
// confused state.
@@ -3507,12 +3478,11 @@ Status Process::Destroy(bool force_kill)
}
if (m_public_state.GetValue() != eStateRunning) {
- // Ditch all thread plans, and remove all our breakpoints: in case we have
- // to restart the target to
- // kill it, we don't want it hitting a breakpoint...
- // Only do this if we've stopped, however, since if we didn't manage to
- // halt it above, then
- // we're not going to have much luck doing this now.
+ // Ditch all thread plans, and remove all our breakpoints: in case we
+ // have to restart the target to kill it, we don't want it hitting a
+ // breakpoint... Only do this if we've stopped, however, since if we
+ // didn't manage to halt it above, then we're not going to have much luck
+ // doing this now.
m_thread_list.DiscardThreadPlans();
DisableAllBreakpointSites();
}
@@ -3532,20 +3502,18 @@ Status Process::Destroy(bool force_kill)
m_process_input_reader.reset();
}
- // If we exited when we were waiting for a process to stop, then
- // forward the event here so we don't lose the event
+ // If we exited when we were waiting for a process to stop, then forward
+ // the event here so we don't lose the event
if (exit_event_sp) {
- // Directly broadcast our exited event because we shut down our
- // private state thread above
+ // Directly broadcast our exited event because we shut down our private
+ // state thread above
BroadcastEvent(exit_event_sp);
}
- // If we have been interrupted (to kill us) in the middle of running, we may
- // not end up propagating
- // the last events through the event system, in which case we might strand
- // the write lock. Unlock
- // it here so when we do to tear down the process we don't get an error
- // destroying the lock.
+ // If we have been interrupted (to kill us) in the middle of running, we
+ // may not end up propagating the last events through the event system, in
+ // which case we might strand the write lock. Unlock it here so when we do
+ // to tear down the process we don't get an error destroying the lock.
m_public_run_lock.SetStopped();
}
@@ -3612,11 +3580,11 @@ bool Process::ShouldBroadcastEvent(Event
break;
case eStateRunning:
case eStateStepping:
- // If we've started the target running, we handle the cases where we
- // are already running and where there is a transition from stopped to
- // running differently.
- // running -> running: Automatically suppress extra running events
- // stopped -> running: Report except when there is one or more no votes
+ // If we've started the target running, we handle the cases where we are
+ // already running and where there is a transition from stopped to running
+ // differently. running -> running: Automatically suppress extra running
+ // events stopped -> running: Report except when there is one or more no
+ // votes
// and no yes votes.
SynchronouslyNotifyStateChanged(state);
if (m_force_next_event_delivery)
@@ -3630,11 +3598,10 @@ bool Process::ShouldBroadcastEvent(Event
break;
default:
// TODO: make this work correctly. For now always report
- // run if we aren't running so we don't miss any running
- // events. If I run the lldb/test/thread/a.out file and
- // break at main.cpp:58, run and hit the breakpoints on
- // multiple threads, then somehow during the stepping over
- // of all breakpoints no run gets reported.
+ // run if we aren't running so we don't miss any running events. If I
+ // run the lldb/test/thread/a.out file and break at main.cpp:58, run
+ // and hit the breakpoints on multiple threads, then somehow during the
+ // stepping over of all breakpoints no run gets reported.
// This is a transition from stop to run.
switch (m_thread_list.ShouldReportRun(event_ptr)) {
@@ -3653,11 +3620,10 @@ bool Process::ShouldBroadcastEvent(Event
case eStateStopped:
case eStateCrashed:
case eStateSuspended:
- // We've stopped. First see if we're going to restart the target.
- // If we are going to stop, then we always broadcast the event.
- // If we aren't going to stop, let the thread plans decide if we're going to
- // report this event.
- // If no thread has an opinion, we don't report it.
+ // We've stopped. First see if we're going to restart the target. If we
+ // are going to stop, then we always broadcast the event. If we aren't
+ // going to stop, let the thread plans decide if we're going to report this
+ // event. If no thread has an opinion, we don't report it.
m_stdio_communication.SynchronizeWithReadThread();
RefreshStateAfterStop();
@@ -3667,8 +3633,7 @@ bool Process::ShouldBroadcastEvent(Event
"interrupt, state: %s",
static_cast<void *>(event_ptr), StateAsCString(state));
// Even though we know we are going to stop, we should let the threads
- // have a look at the stop,
- // so they can properly set their state.
+ // have a look at the stop, so they can properly set their state.
m_thread_list.ShouldStop(event_ptr);
return_value = true;
} else {
@@ -3676,10 +3641,8 @@ bool Process::ShouldBroadcastEvent(Event
bool should_resume = false;
// It makes no sense to ask "ShouldStop" if we've already been
- // restarted...
- // Asking the thread list is also not likely to go well, since we are
- // running again.
- // So in that case just report the event.
+ // restarted... Asking the thread list is also not likely to go well,
+ // since we are running again. So in that case just report the event.
if (!was_restarted)
should_resume = !m_thread_list.ShouldStop(event_ptr);
@@ -3722,16 +3685,13 @@ bool Process::ShouldBroadcastEvent(Event
m_force_next_event_delivery = false;
// We do some coalescing of events (for instance two consecutive running
- // events get coalesced.)
- // But we only coalesce against events we actually broadcast. So we use
- // m_last_broadcast_state
- // to track that. NB - you can't use "m_public_state.GetValue()" for that
- // purpose, as was originally done,
- // because the PublicState reflects the last event pulled off the queue, and
- // there may be several
- // events stacked up on the queue unserviced. So the PublicState may not
- // reflect the last broadcasted event
- // yet. m_last_broadcast_state gets updated here.
+ // events get coalesced.) But we only coalesce against events we actually
+ // broadcast. So we use m_last_broadcast_state to track that. NB - you
+ // can't use "m_public_state.GetValue()" for that purpose, as was originally
+ // done, because the PublicState reflects the last event pulled off the
+ // queue, and there may be several events stacked up on the queue unserviced.
+ // So the PublicState may not reflect the last broadcasted event yet.
+ // m_last_broadcast_state gets updated here.
if (return_value)
m_last_broadcast_state = state;
@@ -3757,8 +3717,8 @@ bool Process::StartPrivateStateThread(bo
if (!is_secondary_thread && already_running)
return true;
- // Create a thread that watches our internal state and controls which
- // events make it to clients (into the DCProcess event queue).
+ // Create a thread that watches our internal state and controls which events
+ // make it to clients (into the DCProcess event queue).
char thread_name[1024];
uint32_t max_len = llvm::get_max_thread_name_length();
if (max_len > 0 && max_len <= 30) {
@@ -3823,10 +3783,10 @@ void Process::ControlPrivateStateThread(
// Signal the private state thread
if (m_private_state_thread.IsJoinable()) {
// Broadcast the event.
- // It is important to do this outside of the if below, because
- // it's possible that the thread state is invalid but that the
- // thread is waiting on a control event instead of simply being
- // on its way out (this should not happen, but it apparently can).
+ // It is important to do this outside of the if below, because it's
+ // possible that the thread state is invalid but that the thread is waiting
+ // on a control event instead of simply being on its way out (this should
+ // not happen, but it apparently can).
if (log)
log->Printf("Sending control event of type: %d.", signal);
std::shared_ptr<EventDataReceipt> event_receipt_sp(new EventDataReceipt());
@@ -3838,13 +3798,13 @@ void Process::ControlPrivateStateThread(
if (PrivateStateThreadIsValid()) {
while (!receipt_received) {
bool timed_out = false;
- // Check for a receipt for 2 seconds and then check if the private state
- // thread is still around.
+ // Check for a receipt for 2 seconds and then check if the private
+ // state thread is still around.
receipt_received = event_receipt_sp->WaitForEventReceived(
std::chrono::seconds(2), &timed_out);
if (!receipt_received) {
- // Check if the private state thread is still around. If it isn't then
- // we are done waiting
+ // Check if the private state thread is still around. If it isn't
+ // then we are done waiting
if (!PrivateStateThreadIsValid())
break; // Private state thread exited or is exiting, we are done
}
@@ -3894,9 +3854,9 @@ void Process::HandlePrivateEvent(EventSP
break;
case NextEventAction::eEventActionExit:
- // Handle Exiting Here. If we already got an exited event,
- // we should just propagate it. Otherwise, swallow this event,
- // and set our state to exit so the next event will kill us.
+ // Handle Exiting Here. If we already got an exited event, we should
+ // just propagate it. Otherwise, swallow this event, and set our state
+ // to exit so the next event will kill us.
if (new_state != eStateExited) {
// FIXME: should cons up an exited event, and discard this one.
SetExitStatus(0, m_next_event_action_ap->GetExitString());
@@ -3922,9 +3882,9 @@ void Process::HandlePrivateEvent(EventSP
}
Process::ProcessEventData::SetUpdateStateOnRemoval(event_sp.get());
if (StateIsRunningState(new_state)) {
- // Only push the input handler if we aren't fowarding events,
- // as this means the curses GUI is in use...
- // Or don't push it if we are launching since it will come up stopped.
+ // Only push the input handler if we aren't fowarding events, as this
+ // means the curses GUI is in use... Or don't push it if we are launching
+ // since it will come up stopped.
if (!GetTarget().GetDebugger().IsForwardingEvents() &&
new_state != eStateLaunching && new_state != eStateAttaching) {
PushProcessIOHandler();
@@ -3936,27 +3896,26 @@ void Process::HandlePrivateEvent(EventSP
}
} else if (StateIsStoppedState(new_state, false)) {
if (!Process::ProcessEventData::GetRestartedFromEvent(event_sp.get())) {
- // If the lldb_private::Debugger is handling the events, we don't
- // want to pop the process IOHandler here, we want to do it when
- // we receive the stopped event so we can carefully control when
- // the process IOHandler is popped because when we stop we want to
- // display some text stating how and why we stopped, then maybe some
- // process/thread/frame info, and then we want the "(lldb) " prompt
- // to show up. If we pop the process IOHandler here, then we will
- // cause the command interpreter to become the top IOHandler after
- // the process pops off and it will update its prompt right away...
- // See the Debugger.cpp file where it calls the function as
+ // If the lldb_private::Debugger is handling the events, we don't want
+ // to pop the process IOHandler here, we want to do it when we receive
+ // the stopped event so we can carefully control when the process
+ // IOHandler is popped because when we stop we want to display some
+ // text stating how and why we stopped, then maybe some
+ // process/thread/frame info, and then we want the "(lldb) " prompt to
+ // show up. If we pop the process IOHandler here, then we will cause
+ // the command interpreter to become the top IOHandler after the
+ // process pops off and it will update its prompt right away... See the
+ // Debugger.cpp file where it calls the function as
// "process_sp->PopProcessIOHandler()" to see where I am talking about.
// Otherwise we end up getting overlapping "(lldb) " prompts and
// garbled output.
//
// If we aren't handling the events in the debugger (which is indicated
- // by "m_target.GetDebugger().IsHandlingEvents()" returning false) or we
- // are hijacked, then we always pop the process IO handler manually.
+ // by "m_target.GetDebugger().IsHandlingEvents()" returning false) or
+ // we are hijacked, then we always pop the process IO handler manually.
// Hijacking happens when the internal process state thread is running
- // thread plans, or when commands want to run in synchronous mode
- // and they call "process->WaitForProcessToStop()". An example of
- // something
+ // thread plans, or when commands want to run in synchronous mode and
+ // they call "process->WaitForProcessToStop()". An example of something
// that will hijack the events is a simple expression:
//
// (lldb) expr (int)puts("hello")
@@ -4059,23 +4018,19 @@ thread_result_t Process::RunPrivateState
") failed to halt the process: %s",
__FUNCTION__, static_cast<void *>(this), GetID(),
error.AsCString());
- // Halt should generate a stopped event. Make a note of the fact that we
- // were
- // doing the interrupt, so we can set the interrupted flag after we
- // receive the
- // event. We deliberately set this to true even if HaltPrivate failed,
- // so that we
- // can interrupt on the next natural stop.
+ // Halt should generate a stopped event. Make a note of the fact that
+ // we were doing the interrupt, so we can set the interrupted flag
+ // after we receive the event. We deliberately set this to true even if
+ // HaltPrivate failed, so that we can interrupt on the next natural
+ // stop.
interrupt_requested = true;
} else {
// This can happen when someone (e.g. Process::Halt) sees that we are
- // running and
- // sends an interrupt request, but the process actually stops before we
- // receive
- // it. In that case, we can just ignore the request. We use
- // m_last_broadcast_state, because the Stopped event may not have been
- // popped of
- // the event queue yet, which is when the public state gets updated.
+ // running and sends an interrupt request, but the process actually
+ // stops before we receive it. In that case, we can just ignore the
+ // request. We use m_last_broadcast_state, because the Stopped event
+ // may not have been popped of the event queue yet, which is when the
+ // public state gets updated.
if (log)
log->Printf(
"Process::%s ignoring interrupt as we have already stopped.",
@@ -4097,8 +4052,7 @@ thread_result_t Process::RunPrivateState
if (interrupt_requested) {
if (StateIsStoppedState(internal_state, true)) {
// We requested the interrupt, so mark this as such in the stop event
- // so
- // clients can tell an interrupted process from a natural stop
+ // so clients can tell an interrupted process from a natural stop
ProcessEventData::SetInterruptedInEvent(event_sp.get(), true);
interrupt_requested = false;
} else if (log) {
@@ -4129,10 +4083,8 @@ thread_result_t Process::RunPrivateState
__FUNCTION__, static_cast<void *>(this), GetID());
// If we are a secondary thread, then the primary thread we are working for
- // will have already
- // acquired the public_run_lock, and isn't done with what it was doing yet, so
- // don't
- // try to change it on the way out.
+ // will have already acquired the public_run_lock, and isn't done with what
+ // it was doing yet, so don't try to change it on the way out.
if (!is_secondary_thread)
m_public_run_lock.SetStopped();
return NULL;
@@ -4172,14 +4124,12 @@ void Process::ProcessEventData::DoOnRemo
return;
// This function gets called twice for each event, once when the event gets
- // pulled
- // off of the private process event queue, and then any number of times, first
- // when it gets pulled off of
- // the public event queue, then other times when we're pretending that this is
- // where we stopped at the
- // end of expression evaluation. m_update_state is used to distinguish these
- // three cases; it is 0 when we're just pulling it off for private handling,
- // and > 1 for expression evaluation, and we don't want to do the breakpoint
+ // pulled off of the private process event queue, and then any number of
+ // times, first when it gets pulled off of the public event queue, then other
+ // times when we're pretending that this is where we stopped at the end of
+ // expression evaluation. m_update_state is used to distinguish these three
+ // cases; it is 0 when we're just pulling it off for private handling, and >
+ // 1 for expression evaluation, and we don't want to do the breakpoint
// command handling then.
if (m_update_state != 1)
return;
@@ -4188,16 +4138,15 @@ void Process::ProcessEventData::DoOnRemo
m_state, Process::ProcessEventData::GetRestartedFromEvent(event_ptr));
if (m_state == eStateStopped && !m_restarted) {
- // Let process subclasses know we are about to do a public stop and
- // do anything they might need to in order to speed up register and
- // memory accesses.
+ // Let process subclasses know we are about to do a public stop and do
+ // anything they might need to in order to speed up register and memory
+ // accesses.
process_sp->WillPublicStop();
}
// If this is a halt event, even if the halt stopped with some reason other
- // than a plain interrupt (e.g. we had
- // already stopped for a breakpoint when the halt request came through) don't
- // do the StopInfo actions, as they may
+ // than a plain interrupt (e.g. we had already stopped for a breakpoint when
+ // the halt request came through) don't do the StopInfo actions, as they may
// end up restarting the process.
if (m_interrupted)
return;
@@ -4209,37 +4158,32 @@ void Process::ProcessEventData::DoOnRemo
uint32_t idx;
// The actions might change one of the thread's stop_info's opinions about
- // whether we should
- // stop the process, so we need to query that as we go.
+ // whether we should stop the process, so we need to query that as we go.
// One other complication here, is that we try to catch any case where the
- // target has run (except for expressions)
- // and immediately exit, but if we get that wrong (which is possible) then
- // the thread list might have changed, and
- // that would cause our iteration here to crash. We could make a copy of
- // the thread list, but we'd really like
- // to also know if it has changed at all, so we make up a vector of the
- // thread ID's and check what we get back
- // against this list & bag out if anything differs.
+ // target has run (except for expressions) and immediately exit, but if we
+ // get that wrong (which is possible) then the thread list might have
+ // changed, and that would cause our iteration here to crash. We could
+ // make a copy of the thread list, but we'd really like to also know if it
+ // has changed at all, so we make up a vector of the thread ID's and check
+ // what we get back against this list & bag out if anything differs.
std::vector<uint32_t> thread_index_array(num_threads);
for (idx = 0; idx < num_threads; ++idx)
thread_index_array[idx] =
curr_thread_list.GetThreadAtIndex(idx)->GetIndexID();
// Use this to track whether we should continue from here. We will only
- // continue the target running if
- // no thread says we should stop. Of course if some thread's PerformAction
- // actually sets the target running,
- // then it doesn't matter what the other threads say...
+ // continue the target running if no thread says we should stop. Of course
+ // if some thread's PerformAction actually sets the target running, then it
+ // doesn't matter what the other threads say...
bool still_should_stop = false;
// Sometimes - for instance if we have a bug in the stub we are talking to,
- // we stop but no thread has a
- // valid stop reason. In that case we should just stop, because we have no
- // way of telling what the right
- // thing to do is, and it's better to let the user decide than continue
- // behind their backs.
+ // we stop but no thread has a valid stop reason. In that case we should
+ // just stop, because we have no way of telling what the right thing to do
+ // is, and it's better to let the user decide than continue behind their
+ // backs.
bool does_anybody_have_an_opinion = false;
@@ -4276,13 +4220,11 @@ void Process::ProcessEventData::DoOnRemo
stop_info_sp->GetOverriddenShouldStopValue();
} else {
stop_info_sp->PerformAction(event_ptr);
- // The stop action might restart the target. If it does, then we want
- // to mark that in the
- // event so that whoever is receiving it will know to wait for the
- // running event and reflect
- // that state appropriately.
- // We also need to stop processing actions, since they aren't
- // expecting the target to be running.
+ // The stop action might restart the target. If it does, then we
+ // want to mark that in the event so that whoever is receiving it
+ // will know to wait for the running event and reflect that state
+ // appropriately. We also need to stop processing actions, since they
+ // aren't expecting the target to be running.
// FIXME: we might have run.
if (stop_info_sp->HasTargetRunSinceMe()) {
@@ -4302,12 +4244,12 @@ void Process::ProcessEventData::DoOnRemo
if (!still_should_stop && does_anybody_have_an_opinion) {
// We've been asked to continue, so do that here.
SetRestarted(true);
- // Use the public resume method here, since this is just
- // extending a public resume.
+ // Use the public resume method here, since this is just extending a
+ // public resume.
process_sp->PrivateResume();
} else {
- // If we didn't restart, run the Stop Hooks here:
- // They might also restart the target, so watch for that.
+ // If we didn't restart, run the Stop Hooks here: They might also
+ // restart the target, so watch for that.
process_sp->GetTarget().RunStopHooks();
if (process_sp->GetPrivateState() == eStateRunning)
SetRestarted(true);
@@ -4579,9 +4521,8 @@ public:
~IOHandlerProcessSTDIO() override = default;
- // Each IOHandler gets to run until it is done. It should read data
- // from the "in" and place output into "out" and "err and return
- // when done.
+ // Each IOHandler gets to run until it is done. It should read data from the
+ // "in" and place output into "out" and "err and return when done.
void Run() override {
if (!m_read_file.IsValid() || !m_write_file.IsValid() ||
!m_pipe.CanRead() || !m_pipe.CanWrite()) {
@@ -4645,9 +4586,8 @@ public:
void Cancel() override {
SetIsDone(true);
// Only write to our pipe to cancel if we are in
- // IOHandlerProcessSTDIO::Run().
- // We can end up with a python command that is being run from the command
- // interpreter:
+ // IOHandlerProcessSTDIO::Run(). We can end up with a python command that
+ // is being run from the command interpreter:
//
// (lldb) step_process_thousands_of_times
//
@@ -4664,12 +4604,11 @@ public:
}
bool Interrupt() override {
- // Do only things that are safe to do in an interrupt context (like in
- // a SIGINT handler), like write 1 byte to a file descriptor. This will
+ // Do only things that are safe to do in an interrupt context (like in a
+ // SIGINT handler), like write 1 byte to a file descriptor. This will
// interrupt the IOHandlerProcessSTDIO::Run() and we can look at the byte
// that was written to the pipe and then call
- // m_process->SendAsyncInterrupt()
- // from a much safer location in code.
+ // m_process->SendAsyncInterrupt() from a much safer location in code.
if (m_active) {
char ch = 'i'; // Send 'i' for interrupt
size_t bytes_written = 0;
@@ -4677,16 +4616,13 @@ public:
return result.Success();
} else {
// This IOHandler might be pushed on the stack, but not being run
- // currently
- // so do the right thing if we aren't actively watching for STDIN by
- // sending
- // the interrupt to the process. Otherwise the write to the pipe above
- // would
- // do nothing. This can happen when the command interpreter is running and
- // gets a "expression ...". It will be on the IOHandler thread and sending
- // the input is complete to the delegate which will cause the expression
- // to
- // run, which will push the process IO handler, but not run it.
+ // currently so do the right thing if we aren't actively watching for
+ // STDIN by sending the interrupt to the process. Otherwise the write to
+ // the pipe above would do nothing. This can happen when the command
+ // interpreter is running and gets a "expression ...". It will be on the
+ // IOHandler thread and sending the input is complete to the delegate
+ // which will cause the expression to run, which will push the process IO
+ // handler, but not run it.
if (StateIsRunningState(m_process->GetState())) {
m_process->SendAsyncInterrupt();
@@ -4761,12 +4697,10 @@ void Process::SettingsInitialize() { Thr
void Process::SettingsTerminate() { Thread::SettingsTerminate(); }
namespace {
-// RestorePlanState is used to record the "is private", "is master" and "okay to
-// discard" fields of
-// the plan we are running, and reset it on Clean or on destruction.
-// It will only reset the state once, so you can call Clean and then monkey with
-// the state and it
-// won't get reset on you again.
+// RestorePlanState is used to record the "is private", "is master" and "okay
+// to discard" fields of the plan we are running, and reset it on Clean or on
+// destruction. It will only reset the state once, so you can call Clean and
+// then monkey with the state and it won't get reset on you again.
class RestorePlanState {
public:
@@ -4822,8 +4756,8 @@ GetOneThreadExpressionTimeout(const Eval
static Timeout<std::micro>
GetExpressionTimeout(const EvaluateExpressionOptions &options,
bool before_first_timeout) {
- // If we are going to run all threads the whole time, or if we are only
- // going to run one thread, we can just return the overall timeout.
+ // If we are going to run all threads the whole time, or if we are only going
+ // to run one thread, we can just return the overall timeout.
if (!options.GetStopOthers() || !options.GetTryAllThreads())
return options.GetTimeout();
@@ -4860,7 +4794,8 @@ HandleStoppedEvent(Thread &thread, const
if (!options.DoesIgnoreBreakpoints()) {
// Restore the plan state and then force Private to false. We are going
// to stop because of this plan so we need it to become a public plan or
- // it won't report correctly when we continue to its termination later on.
+ // it won't report correctly when we continue to its termination later
+ // on.
restorer.Clean();
thread_plan_sp->SetPrivate(false);
event_to_broadcast_sp = event_sp;
@@ -4915,23 +4850,20 @@ Process::RunThreadPlan(ExecutionContext
}
// We need to change some of the thread plan attributes for the thread plan
- // runner. This will restore them
- // when we are done:
+ // runner. This will restore them when we are done:
RestorePlanState thread_plan_restorer(thread_plan_sp);
- // We rely on the thread plan we are running returning "PlanCompleted" if when
- // it successfully completes.
- // For that to be true the plan can't be private - since private plans
- // suppress themselves in the
- // GetCompletedPlan call.
+ // We rely on the thread plan we are running returning "PlanCompleted" if
+ // when it successfully completes. For that to be true the plan can't be
+ // private - since private plans suppress themselves in the GetCompletedPlan
+ // call.
thread_plan_sp->SetPrivate(false);
// The plans run with RunThreadPlan also need to be terminal master plans or
- // when they are done we will end
- // up asking the plan above us whether we should stop, which may give the
- // wrong answer.
+ // when they are done we will end up asking the plan above us whether we
+ // should stop, which may give the wrong answer.
thread_plan_sp->SetIsMasterPlan(true);
thread_plan_sp->SetOkayToDiscard(false);
@@ -4958,8 +4890,8 @@ Process::RunThreadPlan(ExecutionContext
}
}
- // Make sure the timeout values make sense. The one thread timeout needs to be
- // smaller than the overall timeout.
+ // Make sure the timeout values make sense. The one thread timeout needs to
+ // be smaller than the overall timeout.
if (options.GetOneThreadTimeout() && options.GetTimeout() &&
*options.GetTimeout() < *options.GetOneThreadTimeout()) {
diagnostic_manager.PutString(eDiagnosticSeverityError,
@@ -4971,8 +4903,8 @@ Process::RunThreadPlan(ExecutionContext
StackID ctx_frame_id = selected_frame_sp->GetStackID();
// N.B. Running the target may unset the currently selected thread and frame.
- // We don't want to do that either,
- // so we should arrange to reset them as well.
+ // We don't want to do that either, so we should arrange to reset them as
+ // well.
lldb::ThreadSP selected_thread_sp = GetThreadList().GetSelectedThread();
@@ -4993,11 +4925,10 @@ Process::RunThreadPlan(ExecutionContext
LIBLLDB_LOG_PROCESS));
if (m_private_state_thread.EqualsThread(Host::GetCurrentThread())) {
// Yikes, we are running on the private state thread! So we can't wait for
- // public events on this thread, since
- // we are the thread that is generating public events.
- // The simplest thing to do is to spin up a temporary thread to handle
- // private state thread events while
- // we are fielding public events here.
+ // public events on this thread, since we are the thread that is generating
+ // public events. The simplest thing to do is to spin up a temporary thread
+ // to handle private state thread events while we are fielding public
+ // events here.
if (log)
log->Printf("Running thread plan on private state thread, spinning up "
"another state thread to handle the events.");
@@ -5005,15 +4936,12 @@ Process::RunThreadPlan(ExecutionContext
backup_private_state_thread = m_private_state_thread;
// One other bit of business: we want to run just this thread plan and
- // anything it pushes, and then stop,
- // returning control here.
- // But in the normal course of things, the plan above us on the stack would
- // be given a shot at the stop
- // event before deciding to stop, and we don't want that. So we insert a
- // "stopper" base plan on the stack
- // before the plan we want to run. Since base plans always stop and return
- // control to the user, that will
- // do just what we want.
+ // anything it pushes, and then stop, returning control here. But in the
+ // normal course of things, the plan above us on the stack would be given a
+ // shot at the stop event before deciding to stop, and we don't want that.
+ // So we insert a "stopper" base plan on the stack before the plan we want
+ // to run. Since base plans always stop and return control to the user,
+ // that will do just what we want.
stopper_base_plan_sp.reset(new ThreadPlanBase(*thread));
thread->QueueThreadPlan(stopper_base_plan_sp, false);
// Have to make sure our public state is stopped, since otherwise the
@@ -5029,15 +4957,13 @@ Process::RunThreadPlan(ExecutionContext
thread_plan_sp, false); // This used to pass "true" does that make sense?
if (options.GetDebug()) {
- // In this case, we aren't actually going to run, we just want to stop right
- // away.
- // Flush this thread so we will refetch the stacks and show the correct
- // backtrace.
+ // In this case, we aren't actually going to run, we just want to stop
+ // right away. Flush this thread so we will refetch the stacks and show the
+ // correct backtrace.
// FIXME: To make this prettier we should invent some stop reason for this,
// but that
// is only cosmetic, and this functionality is only of use to lldb
- // developers who can
- // live with not pretty...
+ // developers who can live with not pretty...
thread->Flush();
return eExpressionStoppedForDebug;
}
@@ -5049,12 +4975,11 @@ Process::RunThreadPlan(ExecutionContext
{
// This process event hijacker Hijacks the Public events and its destructor
- // makes sure that the process events get
- // restored on exit to the function.
+ // makes sure that the process events get restored on exit to the function.
//
// If the event needs to propagate beyond the hijacker (e.g., the process
- // exits during execution), then the event
- // is put into event_to_broadcast_sp for rebroadcasting.
+ // exits during execution), then the event is put into
+ // event_to_broadcast_sp for rebroadcasting.
ProcessEventHijacker run_thread_plan_hijacker(*this, listener_sp);
@@ -5089,10 +5014,10 @@ Process::RunThreadPlan(ExecutionContext
options.GetStopOthers(), options.GetTryAllThreads(),
before_first_timeout);
- // This isn't going to work if there are unfetched events on the queue.
- // Are there cases where we might want to run the remaining events here, and
- // then try to
- // call the function? That's probably being too tricky for our own good.
+ // This isn't going to work if there are unfetched events on the queue. Are
+ // there cases where we might want to run the remaining events here, and
+ // then try to call the function? That's probably being too tricky for our
+ // own good.
Event *other_events = listener_sp->PeekAtNextEvent();
if (other_events != nullptr) {
@@ -5103,32 +5028,29 @@ Process::RunThreadPlan(ExecutionContext
}
// We also need to make sure that the next event is delivered. We might be
- // calling a function as part of
- // a thread plan, in which case the last delivered event could be the
- // running event, and we don't want
- // event coalescing to cause us to lose OUR running event...
+ // calling a function as part of a thread plan, in which case the last
+ // delivered event could be the running event, and we don't want event
+ // coalescing to cause us to lose OUR running event...
ForceNextEventDelivery();
// This while loop must exit out the bottom, there's cleanup that we need to do
-// when we are done.
-// So don't call return anywhere within it.
+// when we are done. So don't call return anywhere within it.
#ifdef LLDB_RUN_THREAD_HALT_WITH_EVENT
- // It's pretty much impossible to write test cases for things like:
- // One thread timeout expires, I go to halt, but the process already stopped
- // on the function call stop breakpoint. Turning on this define will make
- // us not
- // fetch the first event till after the halt. So if you run a quick
- // function, it will have
- // completed, and the completion event will be waiting, when you interrupt
- // for halt.
- // The expression evaluation should still succeed.
+ // It's pretty much impossible to write test cases for things like: One
+ // thread timeout expires, I go to halt, but the process already stopped on
+ // the function call stop breakpoint. Turning on this define will make us
+ // not fetch the first event till after the halt. So if you run a quick
+ // function, it will have completed, and the completion event will be
+ // waiting, when you interrupt for halt. The expression evaluation should
+ // still succeed.
bool miss_first_event = true;
#endif
while (true) {
- // We usually want to resume the process if we get to the top of the loop.
- // The only exception is if we get two running events with no intervening
- // stop, which can happen, we will just wait for then next stop event.
+ // We usually want to resume the process if we get to the top of the
+ // loop. The only exception is if we get two running events with no
+ // intervening stop, which can happen, we will just wait for then next
+ // stop event.
if (log)
log->Printf("Top of while loop: do_resume: %i handle_running_event: %i "
"before_first_timeout: %i.",
@@ -5187,9 +5109,8 @@ Process::RunThreadPlan(ExecutionContext
if (restarted) {
// This is probably an overabundance of caution, I don't think I
- // should ever get a stopped & restarted
- // event here. But if I do, the best thing is to Halt and then get
- // out of here.
+ // should ever get a stopped & restarted event here. But if I do,
+ // the best thing is to Halt and then get out of here.
const bool clear_thread_plans = false;
const bool use_run_lock = false;
Halt(clear_thread_plans, use_run_lock);
@@ -5205,14 +5126,11 @@ Process::RunThreadPlan(ExecutionContext
if (log)
log->PutCString("Process::RunThreadPlan(): resuming succeeded.");
- // We need to call the function synchronously, so spin waiting for it to
- // return.
- // If we get interrupted while executing, we're going to lose our
- // context, and
- // won't be able to gather the result at this point.
- // We set the timeout AFTER the resume, since the resume takes some time
- // and we
- // don't want to charge that to the timeout.
+ // We need to call the function synchronously, so spin waiting for it
+ // to return. If we get interrupted while executing, we're going to
+ // lose our context, and won't be able to gather the result at this
+ // point. We set the timeout AFTER the resume, since the resume takes
+ // some time and we don't want to charge that to the timeout.
} else {
if (log)
log->PutCString("Process::RunThreadPlan(): waiting for next event.");
@@ -5304,9 +5222,8 @@ Process::RunThreadPlan(ExecutionContext
case lldb::eStateRunning:
// This shouldn't really happen, but sometimes we do get two
- // running events without an
- // intervening stop, and in that case we should just go back to
- // waiting for the stop.
+ // running events without an intervening stop, and in that case
+ // we should just go back to waiting for the stop.
do_resume = false;
keep_going = true;
handle_running_event = false;
@@ -5341,10 +5258,10 @@ Process::RunThreadPlan(ExecutionContext
break;
}
} else {
- // If we didn't get an event that means we've timed out...
- // We will interrupt the process here. Depending on what we were asked
- // to do we will
- // either exit, or try with all threads running for the same timeout.
+ // If we didn't get an event that means we've timed out... We will
+ // interrupt the process here. Depending on what we were asked to do
+ // we will either exit, or try with all threads running for the same
+ // timeout.
if (log) {
if (options.GetTryAllThreads()) {
@@ -5362,14 +5279,13 @@ Process::RunThreadPlan(ExecutionContext
}
// It is possible that between the time we issued the Halt, and we get
- // around to calling Halt the target
- // could have stopped. That's fine, Halt will figure that out and send
- // the appropriate Stopped event.
+ // around to calling Halt the target could have stopped. That's fine,
+ // Halt will figure that out and send the appropriate Stopped event.
// BUT it is also possible that we stopped & restarted (e.g. hit a
// signal with "stop" set to false.) In
// that case, we'll get the stopped & restarted event, and we should go
- // back to waiting for the Halt's
- // stopped event. That's what this while loop does.
+ // back to waiting for the Halt's stopped event. That's what this
+ // while loop does.
bool back_to_top = true;
uint32_t try_halt_again = 0;
@@ -5418,8 +5334,8 @@ Process::RunThreadPlan(ExecutionContext
}
// Between the time we initiated the Halt and the time we
- // delivered it, the process could have
- // already finished its job. Check that here:
+ // delivered it, the process could have already finished its
+ // job. Check that here:
const bool handle_interrupts = false;
if (auto result = HandleStoppedEvent(
*thread, thread_plan_sp, thread_plan_restorer, event_sp,
@@ -5482,8 +5398,8 @@ Process::RunThreadPlan(ExecutionContext
}
} // END WAIT LOOP
- // If we had to start up a temporary private state thread to run this thread
- // plan, shut it down now.
+ // If we had to start up a temporary private state thread to run this
+ // thread plan, shut it down now.
if (backup_private_state_thread.IsJoinable()) {
StopPrivateStateThread();
Status error;
@@ -5503,11 +5419,9 @@ Process::RunThreadPlan(ExecutionContext
log->PutString(s.GetString());
}
// Restore the thread state if we are going to discard the plan execution.
- // There are three cases where this
- // could happen:
- // 1) The execution successfully completed
- // 2) We hit a breakpoint, and ignore_breakpoints was true
- // 3) We got some other error, and discard_on_error was true
+ // There are three cases where this could happen: 1) The execution
+ // successfully completed 2) We hit a breakpoint, and ignore_breakpoints
+ // was true 3) We got some other error, and discard_on_error was true
bool should_unwind = (return_value == eExpressionInterrupted &&
options.DoesUnwindOnError()) ||
(return_value == eExpressionHitBreakpoint &&
@@ -5647,18 +5561,15 @@ Process::RunThreadPlan(ExecutionContext
}
// Thread we ran the function in may have gone away because we ran the
- // target
- // Check that it's still there, and if it is put it back in the context.
- // Also restore the
- // frame in the context if it is still present.
+ // target Check that it's still there, and if it is put it back in the
+ // context. Also restore the frame in the context if it is still present.
thread = GetThreadList().FindThreadByIndexID(thread_idx_id, true).get();
if (thread) {
exe_ctx.SetFrameSP(thread->GetFrameWithStackID(ctx_frame_id));
}
// Also restore the current process'es selected frame & thread, since this
- // function calling may
- // be done behind the user's back.
+ // function calling may be done behind the user's back.
if (selected_tid != LLDB_INVALID_THREAD_ID) {
if (GetThreadList().SetSelectedThreadByIndexID(selected_tid) &&
@@ -5749,10 +5660,9 @@ size_t Process::GetThreadStatus(Stream &
size_t num_thread_infos_dumped = 0;
// You can't hold the thread list lock while calling Thread::GetStatus. That
- // very well might run code (e.g. if we need it
- // to get return values or arguments.) For that to work the process has to be
- // able to acquire it. So instead copy the thread
- // ID's, and look them up one by one:
+ // very well might run code (e.g. if we need it to get return values or
+ // arguments.) For that to work the process has to be able to acquire it.
+ // So instead copy the thread ID's, and look them up one by one:
uint32_t num_threads;
std::vector<lldb::tid_t> thread_id_array;
@@ -5865,12 +5775,12 @@ void Process::DidExec() {
DoDidExec();
CompleteAttach();
// Flush the process (threads and all stack frames) after running
- // CompleteAttach()
- // in case the dynamic loader loaded things in new locations.
+ // CompleteAttach() in case the dynamic loader loaded things in new
+ // locations.
Flush();
- // After we figure out what was loaded/unloaded in CompleteAttach,
- // we need to let the target know so it can do any cleanup it needs to.
+ // After we figure out what was loaded/unloaded in CompleteAttach, we need to
+ // let the target know so it can do any cleanup it needs to.
target.DidExec();
}
@@ -5921,17 +5831,17 @@ void Process::ModulesDidLoad(ModuleList
runtime->ModulesDidLoad(module_list);
}
- // Let any language runtimes we have already created know
- // about the modules that loaded.
+ // Let any language runtimes we have already created know about the modules
+ // that loaded.
- // Iterate over a copy of this language runtime list in case
- // the language runtime ModulesDidLoad somehow causes the language
- // riuntime to be unloaded.
+ // Iterate over a copy of this language runtime list in case the language
+ // runtime ModulesDidLoad somehow causes the language riuntime to be
+ // unloaded.
LanguageRuntimeCollection language_runtimes(m_language_runtimes);
for (const auto &pair : language_runtimes) {
- // We must check language_runtime_sp to make sure it is not
- // nullptr as we might cache the fact that we didn't have a
- // language runtime for a language.
+ // We must check language_runtime_sp to make sure it is not nullptr as we
+ // might cache the fact that we didn't have a language runtime for a
+ // language.
LanguageRuntimeSP language_runtime_sp = pair.second;
if (language_runtime_sp)
language_runtime_sp->ModulesDidLoad(module_list);
@@ -6131,9 +6041,9 @@ Process::GetMemoryRegions(std::vector<ll
Status
Process::ConfigureStructuredData(const ConstString &type_name,
const StructuredData::ObjectSP &config_sp) {
- // If you get this, the Process-derived class needs to implement a method
- // to enable an already-reported asynchronous structured data feature.
- // See ProcessGDBRemote for an example implementation over gdb-remote.
+ // If you get this, the Process-derived class needs to implement a method to
+ // enable an already-reported asynchronous structured data feature. See
+ // ProcessGDBRemote for an example implementation over gdb-remote.
return Status("unimplemented");
}
@@ -6175,9 +6085,9 @@ void Process::MapSupportedStructuredData
return true;
});
- // For each StructuredDataPlugin, if the plugin handles any of the
- // types in the supported_type_names, map that type name to that plugin.
- // Stop when we've consumed all the type names.
+ // For each StructuredDataPlugin, if the plugin handles any of the types in
+ // the supported_type_names, map that type name to that plugin. Stop when
+ // we've consumed all the type names.
// FIXME: should we return an error if there are type names nobody
// supports?
for (uint32_t plugin_index = 0; !const_type_names.empty(); plugin_index++) {
@@ -6190,13 +6100,12 @@ void Process::MapSupportedStructuredData
// Create the plugin.
StructuredDataPluginSP plugin_sp = (*create_instance)(*this);
if (!plugin_sp) {
- // This plugin doesn't think it can work with the process.
- // Move on to the next.
+ // This plugin doesn't think it can work with the process. Move on to the
+ // next.
continue;
}
- // For any of the remaining type names, map any that this plugin
- // supports.
+ // For any of the remaining type names, map any that this plugin supports.
std::vector<ConstString> names_to_remove;
for (auto &type_name : const_type_names) {
if (plugin_sp->SupportsStructuredDataType(type_name)) {
@@ -6223,8 +6132,8 @@ bool Process::RouteAsyncStructuredData(
if (!object_sp)
return false;
- // The contract is this must be a dictionary, so we can look up the
- // routing key via the top-level 'type' string value within the dictionary.
+ // The contract is this must be a dictionary, so we can look up the routing
+ // key via the top-level 'type' string value within the dictionary.
StructuredData::Dictionary *dictionary = object_sp->GetAsDictionary();
if (!dictionary)
return false;
Modified: lldb/trunk/source/Target/ProcessInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ProcessInfo.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ProcessInfo.cpp (original)
+++ lldb/trunk/source/Target/ProcessInfo.cpp Mon Apr 30 09:49:04 2018
@@ -93,9 +93,9 @@ void ProcessInfo::SetArguments(char cons
if (first_arg_is_executable) {
const char *first_arg = m_arguments.GetArgumentAtIndex(0);
if (first_arg) {
- // Yes the first argument is an executable, set it as the executable
- // in the launch options. Don't resolve the file path as the path
- // could be a remote platform path
+ // Yes the first argument is an executable, set it as the executable in
+ // the launch options. Don't resolve the file path as the path could be a
+ // remote platform path
const bool resolve = false;
m_executable.SetFile(first_arg, resolve);
}
@@ -110,9 +110,9 @@ void ProcessInfo::SetArguments(const Arg
if (first_arg_is_executable) {
const char *first_arg = m_arguments.GetArgumentAtIndex(0);
if (first_arg) {
- // Yes the first argument is an executable, set it as the executable
- // in the launch options. Don't resolve the file path as the path
- // could be a remote platform path
+ // Yes the first argument is an executable, set it as the executable in
+ // the launch options. Don't resolve the file path as the path could be a
+ // remote platform path
const bool resolve = false;
m_executable.SetFile(first_arg, resolve);
}
Modified: lldb/trunk/source/Target/ProcessLaunchInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ProcessLaunchInfo.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ProcessLaunchInfo.cpp (original)
+++ lldb/trunk/source/Target/ProcessLaunchInfo.cpp Mon Apr 30 09:49:04 2018
@@ -210,8 +210,7 @@ void ProcessLaunchInfo::FinalizeFileActi
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
// If nothing for stdin or stdout or stderr was specified, then check the
- // process for any default
- // settings that were set with "settings set"
+ // process for any default settings that were set with "settings set"
if (GetFileActionForFD(STDIN_FILENO) == nullptr ||
GetFileActionForFD(STDOUT_FILENO) == nullptr ||
GetFileActionForFD(STDERR_FILENO) == nullptr) {
@@ -221,8 +220,8 @@ void ProcessLaunchInfo::FinalizeFileActi
__FUNCTION__);
if (m_flags.Test(eLaunchFlagLaunchInTTY)) {
- // Do nothing, if we are launching in a remote terminal
- // no file actions should be done at all.
+ // Do nothing, if we are launching in a remote terminal no file actions
+ // should be done at all.
return;
}
@@ -235,16 +234,15 @@ void ProcessLaunchInfo::FinalizeFileActi
AppendSuppressFileAction(STDOUT_FILENO, false, true);
AppendSuppressFileAction(STDERR_FILENO, false, true);
} else {
- // Check for any values that might have gotten set with any of:
- // (lldb) settings set target.input-path
- // (lldb) settings set target.output-path
+ // Check for any values that might have gotten set with any of: (lldb)
+ // settings set target.input-path (lldb) settings set target.output-path
// (lldb) settings set target.error-path
FileSpec in_file_spec;
FileSpec out_file_spec;
FileSpec err_file_spec;
if (target) {
- // Only override with the target settings if we don't already have
- // an action for in, out or error
+ // Only override with the target settings if we don't already have an
+ // action for in, out or error
if (GetFileActionForFD(STDIN_FILENO) == nullptr)
in_file_spec = target->GetStandardInputPath();
if (GetFileActionForFD(STDOUT_FILENO) == nullptr)
@@ -295,9 +293,9 @@ void ProcessLaunchInfo::FinalizeFileActi
int open_flags = O_RDWR | O_NOCTTY;
#if !defined(_WIN32)
- // We really shouldn't be specifying platform specific flags
- // that are intended for a system call in generic code. But
- // this will have to do for now.
+ // We really shouldn't be specifying platform specific flags that are
+ // intended for a system call in generic code. But this will have to
+ // do for now.
open_flags |= O_CLOEXEC;
#endif
if (m_pty->OpenFirstAvailableMaster(open_flags, nullptr, 0)) {
@@ -351,14 +349,13 @@ bool ProcessLaunchInfo::ConvertArguments
StreamString shell_command;
if (will_debug) {
- // Add a modified PATH environment variable in case argv[0]
- // is a relative path.
+ // Add a modified PATH environment variable in case argv[0] is a
+ // relative path.
const char *argv0 = argv[0];
FileSpec arg_spec(argv0, false);
if (arg_spec.IsRelative()) {
- // We have a relative path to our executable which may not work if
- // we just try to run "a.out" (without it being converted to
- // "./a.out")
+ // We have a relative path to our executable which may not work if we
+ // just try to run "a.out" (without it being converted to "./a.out")
FileSpec working_dir = GetWorkingDirectory();
// Be sure to put quotes around PATH's value in case any paths have
// spaces...
@@ -410,8 +407,8 @@ bool ProcessLaunchInfo::ConvertArguments
}
if (first_arg_is_full_shell_command) {
- // There should only be one argument that is the shell command itself to
- // be used as is
+ // There should only be one argument that is the shell command itself
+ // to be used as is
if (argv[0] && !argv[1])
shell_command.Printf("%s", argv[0]);
else
Modified: lldb/trunk/source/Target/RegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/RegisterContext.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/RegisterContext.cpp (original)
+++ lldb/trunk/source/Target/RegisterContext.cpp Mon Apr 30 09:49:04 2018
@@ -76,8 +76,7 @@ RegisterContext::UpdateDynamicRegisterSi
ExecutionContext exe_ctx(CalculateThread());
// In MIPS, the floating point registers size is depends on FR bit of SR
- // register.
- // if SR.FR == 1 then all floating point registers are 64 bits.
+ // register. if SR.FR == 1 then all floating point registers are 64 bits.
// else they are all 32 bits.
int expr_result;
@@ -262,8 +261,7 @@ bool RegisterContext::CopyFromRegisterCo
RegisterValue reg_value;
// If we can reconstruct the register from the frame we are copying from,
- // then do so, otherwise
- // use the value from frame 0.
+ // then do so, otherwise use the value from frame 0.
if (context->ReadRegister(reg_info, reg_value)) {
WriteRegister(reg_info, reg_value);
} else if (frame_zero_context->ReadRegister(reg_info, reg_value)) {
@@ -355,12 +353,11 @@ Status RegisterContext::ReadRegisterValu
return error;
}
- // We now have a memory buffer that contains the part or all of the register
- // value. Set the register value using this memory data.
+ // We now have a memory buffer that contains the part or all of the
+ // register value. Set the register value using this memory data.
// TODO: we might need to add a parameter to this function in case the byte
// order of the memory data doesn't match the process. For now we are
- // assuming
- // they are the same.
+ // assuming they are the same.
reg_value.SetFromMemoryData(reg_info, src, src_len,
process_sp->GetByteOrder(), error);
} else
@@ -381,8 +378,7 @@ Status RegisterContext::WriteRegisterVal
// TODO: we might need to add a parameter to this function in case the byte
// order of the memory data doesn't match the process. For now we are
- // assuming
- // they are the same.
+ // assuming they are the same.
const uint32_t bytes_copied = reg_value.GetAsMemoryData(
reg_info, dst, dst_len, process_sp->GetByteOrder(), error);
@@ -431,9 +427,9 @@ ThreadSP RegisterContext::CalculateThrea
}
StackFrameSP RegisterContext::CalculateStackFrame() {
- // Register contexts might belong to many frames if we have inlined
- // functions inside a frame since all inlined functions share the
- // same registers, so we can't definitively say which frame we come from...
+ // Register contexts might belong to many frames if we have inlined functions
+ // inside a frame since all inlined functions share the same registers, so we
+ // can't definitively say which frame we come from...
return StackFrameSP();
}
Modified: lldb/trunk/source/Target/SectionLoadHistory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/SectionLoadHistory.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/SectionLoadHistory.cpp (original)
+++ lldb/trunk/source/Target/SectionLoadHistory.cpp Mon Apr 30 09:49:04 2018
@@ -43,13 +43,12 @@ SectionLoadHistory::GetSectionLoadListFo
if (!m_stop_id_to_section_load_list.empty()) {
if (read_only) {
// The section load list is for reading data only so we don't need to
- // create
- // a new SectionLoadList for the current stop ID, just return the section
- // load list for the stop ID that is equal to or less than the current
- // stop ID
+ // create a new SectionLoadList for the current stop ID, just return the
+ // section load list for the stop ID that is equal to or less than the
+ // current stop ID
if (stop_id == eStopIDNow) {
- // If we are asking for the latest and greatest value, it is always
- // at the end of our list because that will be the highest stop ID.
+ // If we are asking for the latest and greatest value, it is always at
+ // the end of our list because that will be the highest stop ID.
StopIDToSectionLoadList::reverse_iterator rpos =
m_stop_id_to_section_load_list.rbegin();
return rpos->second.get();
@@ -70,10 +69,8 @@ SectionLoadHistory::GetSectionLoadListFo
assert(stop_id != eStopIDNow);
// We are updating the section load list (not read only), so if the stop
- // ID
- // passed in isn't the same as the last stop ID in our collection, then
- // create
- // a new node using the current stop ID
+ // ID passed in isn't the same as the last stop ID in our collection,
+ // then create a new node using the current stop ID
StopIDToSectionLoadList::iterator pos =
m_stop_id_to_section_load_list.lower_bound(stop_id);
if (pos != m_stop_id_to_section_load_list.end() &&
Modified: lldb/trunk/source/Target/SectionLoadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/SectionLoadList.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/SectionLoadList.cpp (original)
+++ lldb/trunk/source/Target/SectionLoadList.cpp Mon Apr 30 09:49:04 2018
@@ -97,12 +97,12 @@ bool SectionLoadList::SetSectionLoadAddr
// we have multiple load addresses that correspond to a section, we will
// always attribute the section to the be last section that claims it
// exists at that address. Sometimes it is ok for more that one section
- // to be loaded at a specific load address, and other times it isn't.
- // The "warn_multiple" parameter tells us if we should warn in this case
- // or not. The DynamicLoader plug-in subclasses should know which
- // sections should warn and which shouldn't (darwin shared cache modules
- // all shared the same "__LINKEDIT" sections, so the dynamic loader can
- // pass false for "warn_multiple").
+ // to be loaded at a specific load address, and other times it isn't. The
+ // "warn_multiple" parameter tells us if we should warn in this case or
+ // not. The DynamicLoader plug-in subclasses should know which sections
+ // should warn and which shouldn't (darwin shared cache modules all
+ // shared the same "__LINKEDIT" sections, so the dynamic loader can pass
+ // false for "warn_multiple").
if (warn_multiple && section != ats_pos->second) {
ModuleSP module_sp(section->GetModule());
if (module_sp) {
@@ -228,8 +228,8 @@ bool SectionLoadList::ResolveLoadAddress
}
}
} else {
- // There are no entries that have an address that is >= load_addr,
- // so we need to check the last entry on our collection.
+ // There are no entries that have an address that is >= load_addr, so we
+ // need to check the last entry on our collection.
addr_to_sect_collection::const_reverse_iterator rpos =
m_addr_to_sect.rbegin();
if (load_addr >= rpos->first) {
Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Mon Apr 30 09:49:04 2018
@@ -60,8 +60,8 @@ StackFrame::StackFrame(const ThreadSP &t
m_is_history_frame(is_history_frame), m_variable_list_sp(),
m_variable_list_value_objects(), m_disassembly(), m_mutex() {
// If we don't have a CFA value, use the frame index for our StackID so that
- // recursive
- // functions properly aren't confused with one another on a history stack.
+ // recursive functions properly aren't confused with one another on a history
+ // stack.
if (m_is_history_frame && !m_cfa_is_valid) {
m_id.SetCFA(m_frame_index);
}
@@ -136,17 +136,17 @@ StackFrame::~StackFrame() = default;
StackID &StackFrame::GetStackID() {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- // Make sure we have resolved the StackID object's symbol context scope if
- // we already haven't looked it up.
+ // Make sure we have resolved the StackID object's symbol context scope if we
+ // already haven't looked it up.
if (m_flags.IsClear(RESOLVED_FRAME_ID_SYMBOL_SCOPE)) {
if (m_id.GetSymbolContextScope()) {
- // We already have a symbol context scope, we just don't have our
- // flag bit set.
+ // We already have a symbol context scope, we just don't have our flag
+ // bit set.
m_flags.Set(RESOLVED_FRAME_ID_SYMBOL_SCOPE);
} else {
- // Calculate the frame block and use this for the stack ID symbol
- // context scope if we have one.
+ // Calculate the frame block and use this for the stack ID symbol context
+ // scope if we have one.
SymbolContextScope *scope = GetFrameBlock();
if (scope == nullptr) {
// We don't have a block, so use the symbol
@@ -247,13 +247,13 @@ Block *StackFrame::GetFrameBlock() {
if (m_sc.block) {
Block *inline_block = m_sc.block->GetContainingInlinedBlock();
if (inline_block) {
- // Use the block with the inlined function info
- // as the frame block we want this frame to have only the variables
- // for the inlined function and its non-inlined block child blocks.
+ // Use the block with the inlined function info as the frame block we
+ // want this frame to have only the variables for the inlined function
+ // and its non-inlined block child blocks.
return inline_block;
} else {
- // This block is not contained within any inlined function blocks
- // with so we want to use the top most function block.
+ // This block is not contained within any inlined function blocks with so
+ // we want to use the top most function block.
return &m_sc.function->GetBlock(false);
}
}
@@ -263,8 +263,8 @@ Block *StackFrame::GetFrameBlock() {
//----------------------------------------------------------------------
// Get the symbol context if we already haven't done so by resolving the
// PC address as much as possible. This way when we pass around a
-// StackFrame object, everyone will have as much information as
-// possible and no one will ever have to look things up manually.
+// StackFrame object, everyone will have as much information as possible and no
+// one will ever have to look things up manually.
//----------------------------------------------------------------------
const SymbolContext &StackFrame::GetSymbolContext(uint32_t resolve_scope) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
@@ -279,15 +279,15 @@ const SymbolContext &StackFrame::GetSymb
resolved |= eSymbolContextTarget;
}
- // Resolve our PC to section offset if we haven't already done so
- // and if we don't have a module. The resolved address section will
- // contain the module to which it belongs
+ // Resolve our PC to section offset if we haven't already done so and if we
+ // don't have a module. The resolved address section will contain the
+ // module to which it belongs
if (!m_sc.module_sp && m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR))
GetFrameCodeAddress();
- // If this is not frame zero, then we need to subtract 1 from the PC
- // value when doing address lookups since the PC will be on the
- // instruction following the function call instruction...
+ // If this is not frame zero, then we need to subtract 1 from the PC value
+ // when doing address lookups since the PC will be on the instruction
+ // following the function call instruction...
Address lookup_addr(GetFrameCodeAddress());
if (m_frame_index > 0 && lookup_addr.IsValid()) {
@@ -296,10 +296,9 @@ const SymbolContext &StackFrame::GetSymb
lookup_addr.SetOffset(offset - 1);
} else {
- // lookup_addr is the start of a section. We need
- // do the math on the actual load address and re-compute
- // the section. We're working with a 'noreturn' function
- // at the end of a section.
+ // lookup_addr is the start of a section. We need do the math on the
+ // actual load address and re-compute the section. We're working with
+ // a 'noreturn' function at the end of a section.
ThreadSP thread_sp(GetThread());
if (thread_sp) {
TargetSP target_sp(thread_sp->CalculateTarget());
@@ -315,9 +314,9 @@ const SymbolContext &StackFrame::GetSymb
}
if (m_sc.module_sp) {
- // We have something in our stack frame symbol context, lets check
- // if we haven't already tried to lookup one of those things. If we
- // haven't then we will do the query.
+ // We have something in our stack frame symbol context, lets check if we
+ // haven't already tried to lookup one of those things. If we haven't
+ // then we will do the query.
uint32_t actual_resolve_scope = 0;
@@ -367,17 +366,16 @@ const SymbolContext &StackFrame::GetSymb
}
if (actual_resolve_scope) {
- // We might be resolving less information than what is already
- // in our current symbol context so resolve into a temporary
- // symbol context "sc" so we don't clear out data we have
- // already found in "m_sc"
+ // We might be resolving less information than what is already in our
+ // current symbol context so resolve into a temporary symbol context
+ // "sc" so we don't clear out data we have already found in "m_sc"
SymbolContext sc;
// Set flags that indicate what we have tried to resolve
resolved |= m_sc.module_sp->ResolveSymbolContextForAddress(
lookup_addr, actual_resolve_scope, sc);
- // Only replace what we didn't already have as we may have
- // information for an inlined function scope that won't match
- // what a standard lookup by address would match
+ // Only replace what we didn't already have as we may have information
+ // for an inlined function scope that won't match what a standard
+ // lookup by address would match
if ((resolved & eSymbolContextCompUnit) && m_sc.comp_unit == nullptr)
m_sc.comp_unit = sc.comp_unit;
if ((resolved & eSymbolContextFunction) && m_sc.function == nullptr)
@@ -404,9 +402,9 @@ const SymbolContext &StackFrame::GetSymb
// Update our internal flags so we remember what we have tried to locate so
// we don't have to keep trying when more calls to this function are made.
- // We might have dug up more information that was requested (for example
- // if we were asked to only get the block, we will have gotten the
- // compile unit, and function) so set any additional bits that we resolved
+ // We might have dug up more information that was requested (for example if
+ // we were asked to only get the block, we will have gotten the compile
+ // unit, and function) so set any additional bits that we resolved
m_flags.Set(resolve_scope | resolved);
}
@@ -546,8 +544,8 @@ ValueObjectSP StackFrame::GetValueForVar
}
if (!var_sp && (options & eExpressionPathOptionsAllowDirectIVarAccess)) {
- // Check for direct ivars access which helps us with implicit
- // access to ivars with the "this->" or "self->"
+ // Check for direct ivars access which helps us with implicit access to
+ // ivars with the "this->" or "self->"
GetSymbolContext(eSymbolContextFunction | eSymbolContextBlock);
lldb::LanguageType method_language = eLanguageTypeUnknown;
bool is_instance_method = false;
@@ -622,9 +620,8 @@ ValueObjectSP StackFrame::GetValueForVar
valobj_sp->GetCompilerType().GetTypeInfo(nullptr);
if ((pointer_type_flags & eTypeIsObjC) &&
(pointer_type_flags & eTypeIsPointer)) {
- // This was an objective C object pointer and
- // it was requested we skip any fragile ivars
- // so return nothing here
+ // This was an objective C object pointer and it was requested we
+ // skip any fragile ivars so return nothing here
return ValueObjectSP();
}
}
@@ -659,15 +656,14 @@ ValueObjectSP StackFrame::GetValueForVar
ConstString child_name(var_expr.substr(0, var_expr.find_first_of(".-[")));
if (check_ptr_vs_member) {
- // We either have a pointer type and need to verify
- // valobj_sp is a pointer, or we have a member of a
- // class/union/struct being accessed with the . syntax
- // and need to verify we don't have a pointer.
+ // We either have a pointer type and need to verify valobj_sp is a
+ // pointer, or we have a member of a class/union/struct being accessed
+ // with the . syntax and need to verify we don't have a pointer.
const bool actual_is_ptr = valobj_sp->IsPointerType();
if (actual_is_ptr != expr_is_ptr) {
- // Incorrect use of "." with a pointer, or "->" with
- // a class/union/struct instance or reference.
+ // Incorrect use of "." with a pointer, or "->" with a
+ // class/union/struct instance or reference.
valobj_sp->GetExpressionPath(var_expr_path_strm, false);
if (actual_is_ptr)
error.SetErrorStringWithFormat(
@@ -697,10 +693,8 @@ ValueObjectSP StackFrame::GetValueForVar
// No child member with name "child_name"
if (synthetically_added_instance_object) {
// We added a "this->" or "self->" to the beginning of the
- // expression
- // and this is the first pointer ivar access, so just return
- // the normal
- // error
+ // expression and this is the first pointer ivar access, so just
+ // return the normal error
error.SetErrorStringWithFormat(
"no variable or instance variable named '%s' found in "
"this frame",
@@ -735,8 +729,8 @@ ValueObjectSP StackFrame::GetValueForVar
} break;
case '[': {
- // Array member access, or treating pointer as an array
- // Need at least two brackets and a number
+ // Array member access, or treating pointer as an array Need at least two
+ // brackets and a number
if (var_expr.size() <= 2) {
error.SetErrorStringWithFormat(
"invalid square bracket encountered after \"%s\" in \"%s\"",
@@ -790,11 +784,10 @@ ValueObjectSP StackFrame::GetValueForVar
deref = false;
} else if (valobj_sp->GetCompilerType().IsArrayOfScalarType() &&
deref) {
- // what we have is *arr[low]. the most similar C++ syntax is
- // to get arr[0]
- // (an operation that is equivalent to deref-ing arr)
- // and extract bit low out of it. reading array item low
- // would be done by saying arr[low], without a deref * sign
+ // what we have is *arr[low]. the most similar C++ syntax is to get
+ // arr[0] (an operation that is equivalent to deref-ing arr) and
+ // extract bit low out of it. reading array item low would be done by
+ // saying arr[low], without a deref * sign
Status error;
ValueObjectSP temp(valobj_sp->GetChildAtIndex(0, true));
if (error.Fail()) {
@@ -828,8 +821,8 @@ ValueObjectSP StackFrame::GetValueForVar
return ValueObjectSP();
} else if (is_objc_pointer) {
- // dereferencing ObjC variables is not valid.. so let's try
- // and recur to synthetic children
+ // dereferencing ObjC variables is not valid.. so let's try and
+ // recur to synthetic children
ValueObjectSP synthetic = valobj_sp->GetSyntheticValue();
if (!synthetic /* no synthetic */
|| synthetic == valobj_sp) /* synthetic is the same as
@@ -874,9 +867,8 @@ ValueObjectSP StackFrame::GetValueForVar
}
} else if (valobj_sp->GetCompilerType().IsArrayType(
nullptr, nullptr, &is_incomplete_array)) {
- // Pass false to dynamic_value here so we can tell the
- // difference between
- // no dynamic value and no member of this type...
+ // Pass false to dynamic_value here so we can tell the difference
+ // between no dynamic value and no member of this type...
child_valobj_sp = valobj_sp->GetChildAtIndex(child_index, true);
if (!child_valobj_sp && (is_incomplete_array || !no_synth_child))
child_valobj_sp =
@@ -976,8 +968,8 @@ ValueObjectSP StackFrame::GetValueForVar
if (valobj_sp->GetCompilerType().IsPointerToScalarType() && deref) {
// what we have is *ptr[low-high]. the most similar C++ syntax is to
// deref ptr and extract bits low thru high out of it. reading array
- // items low thru high would be done by saying ptr[low-high], without
- // a deref * sign
+ // items low thru high would be done by saying ptr[low-high], without a
+ // deref * sign
Status error;
ValueObjectSP temp(valobj_sp->Dereference(error));
if (error.Fail()) {
@@ -991,10 +983,10 @@ ValueObjectSP StackFrame::GetValueForVar
valobj_sp = temp;
deref = false;
} else if (valobj_sp->GetCompilerType().IsArrayOfScalarType() && deref) {
- // what we have is *arr[low-high]. the most similar C++ syntax is to get
- // arr[0] (an operation that is equivalent to deref-ing arr) and extract
- // bits low thru high out of it. reading array items low thru high would
- // be done by saying arr[low-high], without a deref * sign
+ // what we have is *arr[low-high]. the most similar C++ syntax is to
+ // get arr[0] (an operation that is equivalent to deref-ing arr) and
+ // extract bits low thru high out of it. reading array items low thru
+ // high would be done by saying arr[low-high], without a deref * sign
Status error;
ValueObjectSP temp(valobj_sp->GetChildAtIndex(0, true));
if (error.Fail()) {
@@ -1091,8 +1083,8 @@ bool StackFrame::GetFrameBaseValue(Scala
if (m_sc.function->GetFrameBaseExpression().Evaluate(
&exe_ctx, nullptr, loclist_base_addr, nullptr, nullptr,
expr_value, &m_frame_base_error) == false) {
- // We should really have an error if evaluate returns, but in case
- // we don't, lets set the error to something at least.
+ // We should really have an error if evaluate returns, but in case we
+ // don't, lets set the error to something at least.
if (m_frame_base_error.Success())
m_frame_base_error.SetErrorString(
"Evaluation of the frame base expression failed.");
@@ -1420,8 +1412,8 @@ ValueObjectSP GetValueForDereferincingOf
ValueObjectSP &base,
int64_t offset) {
// base is a pointer to something
- // offset is the thing to add to the pointer
- // We return the most sensible ValueObject for the result of *(base+offset)
+ // offset is the thing to add to the pointer We return the most sensible
+ // ValueObject for the result of *(base+offset)
if (!base->IsPointerOrReferenceType()) {
return ValueObjectSP();
@@ -1486,8 +1478,8 @@ lldb::ValueObjectSP DoGuessValueAt(Stack
//
// f, a pointer to a struct, is known to be at -0x8(%rbp).
//
- // DoGuessValueAt(frame, rdi, 4, dis, vars, 0x22) finds the instruction at +18
- // that assigns to rdi, and calls itself recursively for that dereference
+ // DoGuessValueAt(frame, rdi, 4, dis, vars, 0x22) finds the instruction at
+ // +18 that assigns to rdi, and calls itself recursively for that dereference
// DoGuessValueAt(frame, rdi, 8, dis, vars, 0x18) finds the instruction at
// +14 that assigns to rdi, and calls itself recursively for that
// derefernece
@@ -1533,9 +1525,9 @@ lldb::ValueObjectSP DoGuessValueAt(Stack
for (uint32_t ii = current_inst - 1; ii != (uint32_t)-1; --ii) {
// This is not an exact algorithm, and it sacrifices accuracy for
- // generality. Recognizing "mov" and "ld" instructions –– and which are
- // their source and destination operands -- is something the disassembler
- // should do for us.
+ // generality. Recognizing "mov" and "ld" instructions –– and which
+ // are their source and destination operands -- is something the
+ // disassembler should do for us.
InstructionSP instruction_sp =
disassembler.GetInstructionList().GetInstructionAtIndex(ii);
Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Mon Apr 30 09:49:04 2018
@@ -51,8 +51,8 @@ StackFrameList::StackFrameList(Thread &t
}
StackFrameList::~StackFrameList() {
- // Call clear since this takes a lock and clears the stack frame list
- // in case another thread is currently using this stack frame list
+ // Call clear since this takes a lock and clears the stack frame list in case
+ // another thread is currently using this stack frame list
Clear();
}
@@ -95,13 +95,12 @@ void StackFrameList::ResetCurrentInlined
log->Printf(
"ResetCurrentInlinedDepth: Invalidating current inlined depth.\n");
} else {
- // We only need to do something special about inlined blocks when we
- // are at the beginning of an inlined function:
+ // We only need to do something special about inlined blocks when we are
+ // at the beginning of an inlined function:
// FIXME: We probably also have to do something special if the PC is at
// the END
// of an inlined function, which coincides with the end of either its
- // containing
- // function or another inlined function.
+ // containing function or another inlined function.
lldb::addr_t curr_pc = m_thread.GetRegisterContext()->GetPC();
Block *block_ptr = m_frames[0]->GetFrameBlock();
@@ -114,19 +113,15 @@ void StackFrameList::ResetCurrentInlined
containing_range)) {
if (pc_as_address == containing_range.GetBaseAddress()) {
// If we got here because of a breakpoint hit, then set the inlined
- // depth depending on where
- // the breakpoint was set.
- // If we got here because of a crash, then set the inlined depth to
- // the deepest most block.
- // Otherwise, we stopped here naturally as the result of a step, so
- // set ourselves in the
- // containing frame of the whole set of nested inlines, so the user
- // can then "virtually"
- // step into the frames one by one, or next over the whole mess.
- // Note: We don't have to handle being somewhere in the middle of
- // the stack here, since
- // ResetCurrentInlinedDepth doesn't get called if there is a valid
- // inlined depth set.
+ // depth depending on where the breakpoint was set. If we got here
+ // because of a crash, then set the inlined depth to the deepest
+ // most block. Otherwise, we stopped here naturally as the result
+ // of a step, so set ourselves in the containing frame of the whole
+ // set of nested inlines, so the user can then "virtually" step
+ // into the frames one by one, or next over the whole mess. Note:
+ // We don't have to handle being somewhere in the middle of the
+ // stack here, since ResetCurrentInlinedDepth doesn't get called if
+ // there is a valid inlined depth set.
StopInfoSP stop_info_sp = m_thread.GetStopInfo();
if (stop_info_sp) {
switch (stop_info_sp->GetStopReason()) {
@@ -134,7 +129,8 @@ void StackFrameList::ResetCurrentInlined
case eStopReasonException:
case eStopReasonExec:
case eStopReasonSignal:
- // In all these cases we want to stop in the deepest most frame.
+ // In all these cases we want to stop in the deepest most
+ // frame.
m_current_inlined_pc = curr_pc;
m_current_inlined_depth = 0;
break;
@@ -142,17 +138,14 @@ void StackFrameList::ResetCurrentInlined
// FIXME: Figure out what this break point is doing, and set the
// inline depth
// appropriately. Be careful to take into account breakpoints
- // that implement
- // step over prologue, since that should do the default
- // calculation.
- // For now, if the breakpoints corresponding to this hit are all
- // internal,
+ // that implement step over prologue, since that should do the
+ // default calculation. For now, if the breakpoints
+ // corresponding to this hit are all internal,
// I set the stop location to the top of the inlined stack,
// since that will make
- // things like stepping over prologues work right. But if there
- // are any non-internal
- // breakpoints I do to the bottom of the stack, since that was
- // the old behavior.
+ // things like stepping over prologues work right. But if
+ // there are any non-internal breakpoints I do to the bottom of
+ // the stack, since that was the old behavior.
uint32_t bp_site_id = stop_info_sp->GetValue();
BreakpointSiteSP bp_site_sp(
m_thread.GetProcess()->GetBreakpointSiteList().FindByID(
@@ -177,10 +170,9 @@ void StackFrameList::ResetCurrentInlined
LLVM_FALLTHROUGH;
default: {
// Otherwise, we should set ourselves at the container of the
- // inlining, so that the
- // user can descend into them.
- // So first we check whether we have more than one inlined block
- // sharing this PC:
+ // inlining, so that the user can descend into them. So first
+ // we check whether we have more than one inlined block sharing
+ // this PC:
int num_inlined_functions = 0;
for (Block *container_ptr = block_ptr->GetInlinedParent();
@@ -250,13 +242,11 @@ void StackFrameList::GetFramesUpTo(uint3
#if defined(DEBUG_STACK_FRAMES)
StreamFile s(stdout, false);
#endif
- // If we are hiding some frames from the outside world, we need to add those
- // onto the total count of
- // frames to fetch. However, we don't need to do that if end_idx is 0 since
- // in that case we always
- // get the first concrete frame and all the inlined frames below it... And
- // of course, if end_idx is
- // UINT32_MAX that means get all, so just do that...
+ // If we are hiding some frames from the outside world, we need to add
+ // those onto the total count of frames to fetch. However, we don't need
+ // to do that if end_idx is 0 since in that case we always get the first
+ // concrete frame and all the inlined frames below it... And of course, if
+ // end_idx is UINT32_MAX that means get all, so just do that...
uint32_t inlined_depth = 0;
if (end_idx > 0 && end_idx != UINT32_MAX) {
@@ -273,17 +263,17 @@ void StackFrameList::GetFramesUpTo(uint3
lldb::addr_t pc = LLDB_INVALID_ADDRESS;
lldb::addr_t cfa = LLDB_INVALID_ADDRESS;
if (idx == 0) {
- // We might have already created frame zero, only create it
- // if we need to
+ // We might have already created frame zero, only create it if we need
+ // to
if (m_frames.empty()) {
RegisterContextSP reg_ctx_sp(m_thread.GetRegisterContext());
if (reg_ctx_sp) {
const bool success =
unwinder && unwinder->GetFrameInfoAtIndex(idx, cfa, pc);
- // There shouldn't be any way not to get the frame info for frame 0.
- // But if the unwinder can't make one, lets make one by hand with
- // the
+ // There shouldn't be any way not to get the frame info for frame
+ // 0. But if the unwinder can't make one, lets make one by hand
+ // with the
// SP as the CFA and see if that gets any further.
if (!success) {
cfa = reg_ctx_sp->GetSP();
@@ -323,18 +313,16 @@ void StackFrameList::GetFramesUpTo(uint3
if (unwind_block) {
Address curr_frame_address(unwind_frame_sp->GetFrameCodeAddress());
TargetSP target_sp = m_thread.CalculateTarget();
- // Be sure to adjust the frame address to match the address
- // that was used to lookup the symbol context above. If we are
- // in the first concrete frame, then we lookup using the current
- // address, else we decrement the address by one to get the correct
- // location.
+ // Be sure to adjust the frame address to match the address that was
+ // used to lookup the symbol context above. If we are in the first
+ // concrete frame, then we lookup using the current address, else we
+ // decrement the address by one to get the correct location.
if (idx > 0) {
if (curr_frame_address.GetOffset() == 0) {
// If curr_frame_address points to the first address in a section
- // then after
- // adjustment it will point to an other section. In that case
- // resolve the
- // address again to the correct section plus offset form.
+ // then after adjustment it will point to an other section. In that
+ // case resolve the address again to the correct section plus
+ // offset form.
addr_t load_addr = curr_frame_address.GetOpcodeLoadAddress(
target_sp.get(), eAddressClassCode);
curr_frame_address.SetOpcodeLoadAddress(
@@ -414,8 +402,8 @@ void StackFrameList::GetFramesUpTo(uint3
break;
prev_frame->UpdatePreviousFrameFromCurrentFrame(*curr_frame);
- // Now copy the fixed up previous frame into the current frames
- // so the pointer doesn't change
+ // Now copy the fixed up previous frame into the current frames so the
+ // pointer doesn't change
m_frames[curr_frame_idx] = prev_frame_sp;
// curr_frame->UpdateCurrentFrameFromPreviousFrame (*prev_frame);
@@ -495,9 +483,8 @@ StackFrameSP StackFrameList::GetFrameAtI
if (frame_sp)
return frame_sp;
- // GetFramesUpTo will fill m_frames with as many frames as you asked for,
- // if there are that many. If there weren't then you asked for too many
- // frames.
+ // GetFramesUpTo will fill m_frames with as many frames as you asked for, if
+ // there are that many. If there weren't then you asked for too many frames.
GetFramesUpTo(idx);
if (idx < m_frames.size()) {
if (m_show_inlined_frames) {
@@ -519,8 +506,8 @@ StackFrameSP StackFrameList::GetFrameAtI
Function *function =
frame_sp->GetSymbolContext(eSymbolContextFunction).function;
if (function) {
- // When we aren't showing inline functions we always use
- // the top most function block as the scope.
+ // When we aren't showing inline functions we always use the top
+ // most function block as the scope.
frame_sp->SetSymbolContextScope(&function->GetBlock(false));
} else {
// Set the symbol scope from the symbol regardless if it is nullptr
@@ -534,9 +521,8 @@ StackFrameSP StackFrameList::GetFrameAtI
}
} else if (original_idx == 0) {
// There should ALWAYS be a frame at index 0. If something went wrong with
- // the CurrentInlinedDepth such that
- // there weren't as many frames as we thought taking that into account, then
- // reset the current inlined depth
+ // the CurrentInlinedDepth such that there weren't as many frames as we
+ // thought taking that into account, then reset the current inlined depth
// and return the real zeroth frame.
if (m_frames.empty()) {
// Why do we have a thread with zero frames, that should not ever
@@ -554,11 +540,11 @@ StackFrameSP StackFrameList::GetFrameAtI
StackFrameSP
StackFrameList::GetFrameWithConcreteFrameIndex(uint32_t unwind_idx) {
// First try assuming the unwind index is the same as the frame index. The
- // unwind index is always greater than or equal to the frame index, so it
- // is a good place to start. If we have inlined frames we might have 5
- // concrete frames (frame unwind indexes go from 0-4), but we might have 15
- // frames after we make all the inlined frames. Most of the time the unwind
- // frame index (or the concrete frame index) is the same as the frame index.
+ // unwind index is always greater than or equal to the frame index, so it is
+ // a good place to start. If we have inlined frames we might have 5 concrete
+ // frames (frame unwind indexes go from 0-4), but we might have 15 frames
+ // after we make all the inlined frames. Most of the time the unwind frame
+ // index (or the concrete frame index) is the same as the frame index.
uint32_t frame_idx = unwind_idx;
StackFrameSP frame_sp(GetFrameAtIndex(frame_idx));
while (frame_sp) {
@@ -719,9 +705,9 @@ void StackFrameList::Merge(std::unique_p
#if defined(DEBUG_STACK_FRAMES)
s.PutCString("No previous frames, so use current frames...\n");
#endif
- // We either don't have any previous frames, or since we have more than
- // one current frames it means we have all the frames and can safely
- // replace our previous frames.
+ // We either don't have any previous frames, or since we have more than one
+ // current frames it means we have all the frames and can safely replace
+ // our previous frames.
prev_sp.reset(curr_ap.release());
return;
}
@@ -733,8 +719,8 @@ void StackFrameList::Merge(std::unique_p
s.PutCString(
"We have more than one current frame, so use current frames...\n");
#endif
- // We have more than one current frames it means we have all the frames
- // and can safely replace our previous frames.
+ // We have more than one current frames it means we have all the frames and
+ // can safely replace our previous frames.
prev_sp.reset(curr_ap.release());
#if defined(DEBUG_STACK_FRAMES)
Modified: lldb/trunk/source/Target/StackID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackID.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackID.cpp (original)
+++ lldb/trunk/source/Target/StackID.cpp Mon Apr 30 09:49:04 2018
@@ -69,12 +69,11 @@ bool lldb_private::operator<(const Stack
// FIXME: We are assuming that the stacks grow downward in memory. That's not
// necessary, but true on
// all the machines we care about at present. If this changes, we'll have to
- // deal with that. The ABI is the
- // agent who knows this ordering, but the StackID has no access to the ABI.
- // The most straightforward way
- // to handle this is to add a "m_grows_downward" bool to the StackID, and set
- // it in the constructor.
- // But I'm not going to waste a bool per StackID on this till we need it.
+ // deal with that. The ABI is the agent who knows this ordering, but the
+ // StackID has no access to the ABI. The most straightforward way to handle
+ // this is to add a "m_grows_downward" bool to the StackID, and set it in the
+ // constructor. But I'm not going to waste a bool per StackID on this till we
+ // need it.
if (lhs_cfa != rhs_cfa)
return lhs_cfa < rhs_cfa;
Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Mon Apr 30 09:49:04 2018
@@ -63,12 +63,10 @@ bool StopInfo::HasTargetRunSinceMe() {
return true;
} else if (ret_type == eStateStopped) {
// This is a little tricky. We want to count "run and stopped again
- // before you could
- // ask this question as a "TRUE" answer to HasTargetRunSinceMe. But we
- // don't want to
- // include any running of the target done for expressions. So we track
- // both resumes,
- // and resumes caused by expressions, and check if there are any resumes
+ // before you could ask this question as a "TRUE" answer to
+ // HasTargetRunSinceMe. But we don't want to include any running of the
+ // target done for expressions. So we track both resumes, and resumes
+ // caused by expressions, and check if there are any resumes
// NOT caused
// by expressions.
@@ -199,8 +197,7 @@ public:
if (bp_site_sp) {
StreamString strm;
// If we have just hit an internal breakpoint, and it has a kind
- // description, print that instead of the
- // full breakpoint printing:
+ // description, print that instead of the full breakpoint printing:
if (bp_site_sp->IsInternal()) {
size_t num_owners = bp_site_sp->GetNumberOfOwners();
for (size_t idx = 0; idx < num_owners; idx++) {
@@ -258,9 +255,9 @@ public:
protected:
bool ShouldStop(Event *event_ptr) override {
- // This just reports the work done by PerformAction or the synchronous stop.
- // It should
- // only ever get called after they have had a chance to run.
+ // This just reports the work done by PerformAction or the synchronous
+ // stop. It should only ever get called after they have had a chance to
+ // run.
assert(m_should_stop_is_valid);
return m_should_stop;
}
@@ -293,54 +290,47 @@ protected:
if (bp_site_sp) {
// Let's copy the owners list out of the site and store them in a local
- // list. That way if
- // one of the breakpoint actions changes the site, then we won't be
- // operating on a bad list.
+ // list. That way if one of the breakpoint actions changes the site,
+ // then we won't be operating on a bad list.
BreakpointLocationCollection site_locations;
size_t num_owners = bp_site_sp->CopyOwnersList(site_locations);
if (num_owners == 0) {
m_should_stop = true;
} else {
- // We go through each location, and test first its precondition - this
- // overrides everything. Note,
- // we only do this once per breakpoint - not once per location...
- // Then check the condition. If the condition says to stop,
- // then we run the callback for that location. If that callback says
- // to stop as well, then
- // we set m_should_stop to true; we are going to stop.
- // But we still want to give all the breakpoints whose conditions say
- // we are going to stop a
- // chance to run their callbacks.
- // Of course if any callback restarts the target by putting "continue"
- // in the callback, then
+ // We go through each location, and test first its precondition -
+ // this overrides everything. Note, we only do this once per
+ // breakpoint - not once per location... Then check the condition.
+ // If the condition says to stop, then we run the callback for that
+ // location. If that callback says to stop as well, then we set
+ // m_should_stop to true; we are going to stop. But we still want to
+ // give all the breakpoints whose conditions say we are going to stop
+ // a chance to run their callbacks. Of course if any callback
+ // restarts the target by putting "continue" in the callback, then
// we're going to restart, without running the rest of the callbacks.
- // And in this case we will
- // end up not stopping even if another location said we should stop.
- // But that's better than not
- // running all the callbacks.
+ // And in this case we will end up not stopping even if another
+ // location said we should stop. But that's better than not running
+ // all the callbacks.
m_should_stop = false;
// We don't select threads as we go through them testing breakpoint
- // conditions and running commands.
- // So we need to set the thread for expression evaluation here:
+ // conditions and running commands. So we need to set the thread for
+ // expression evaluation here:
ThreadList::ExpressionExecutionThreadPusher thread_pusher(thread_sp);
ExecutionContext exe_ctx(thread_sp->GetStackFrameAtIndex(0));
Process *process = exe_ctx.GetProcessPtr();
if (process->GetModIDRef().IsLastResumeForUserExpression()) {
// If we are in the middle of evaluating an expression, don't run
- // asynchronous breakpoint commands or
- // expressions. That could lead to infinite recursion if the
- // command or condition re-calls the function
- // with this breakpoint.
+ // asynchronous breakpoint commands or expressions. That could
+ // lead to infinite recursion if the command or condition re-calls
+ // the function with this breakpoint.
// TODO: We can keep a list of the breakpoints we've seen while
// running expressions in the nested
// PerformAction calls that can arise when the action runs a
- // function that hits another breakpoint,
- // and only stop running commands when we see the same breakpoint
- // hit a second time.
+ // function that hits another breakpoint, and only stop running
+ // commands when we see the same breakpoint hit a second time.
m_should_stop_is_valid = true;
if (log)
@@ -377,12 +367,11 @@ protected:
StoppointCallbackContext context(event_ptr, exe_ctx, false);
// For safety's sake let's also grab an extra reference to the
- // breakpoint owners of the locations we're
- // going to examine, since the locations are going to have to get back
- // to their breakpoints, and the
- // locations don't keep their owners alive. I'm just sticking the
- // BreakpointSP's in a vector since
- // I'm only using it to locally increment their retain counts.
+ // breakpoint owners of the locations we're going to examine, since
+ // the locations are going to have to get back to their breakpoints,
+ // and the locations don't keep their owners alive. I'm just
+ // sticking the BreakpointSP's in a vector since I'm only using it to
+ // locally increment their retain counts.
std::vector<lldb::BreakpointSP> location_owners;
@@ -404,8 +393,8 @@ protected:
continue;
// The breakpoint site may have many locations associated with it,
- // not all of them valid for
- // this thread. Skip the ones that aren't:
+ // not all of them valid for this thread. Skip the ones that
+ // aren't:
if (!bp_loc_sp->ValidForThisThread(thread_sp.get())) {
if (log) {
log->Printf("Breakpoint %s hit on thread 0x%llx but it was not "
@@ -419,8 +408,7 @@ protected:
internal_breakpoint = bp_loc_sp->GetBreakpoint().IsInternal();
// First run the precondition, but since the precondition is per
- // breakpoint, only run it once
- // per breakpoint.
+ // breakpoint, only run it once per breakpoint.
std::pair<std::unordered_set<break_id_t>::iterator, bool> result =
precondition_breakpoints.insert(
bp_loc_sp->GetBreakpoint().GetID());
@@ -433,9 +421,8 @@ protected:
continue;
// Next run the condition for the breakpoint. If that says we
- // should stop, then we'll run
- // the callback for the breakpoint. If the callback says we
- // shouldn't stop that will win.
+ // should stop, then we'll run the callback for the breakpoint. If
+ // the callback says we shouldn't stop that will win.
if (bp_loc_sp->GetConditionText() != nullptr) {
Status condition_error;
@@ -470,9 +457,8 @@ protected:
}
if (!condition_says_stop) {
// We don't want to increment the hit count of breakpoints if
- // the condition fails.
- // We've already bumped it by the time we get here, so undo
- // the bump:
+ // the condition fails. We've already bumped it by the time
+ // we get here, so undo the bump:
bp_loc_sp->UndoBumpHitCount();
continue;
}
@@ -524,8 +510,8 @@ protected:
thread_sp->GetProcess()->GetTarget().RemoveBreakpointByID(
bp_loc_sp->GetBreakpoint().GetID());
}
- // Also make sure that the callback hasn't continued the target.
- // If it did, when we'll set m_should_start to false and get out of
+ // Also make sure that the callback hasn't continued the target. If
+ // it did, when we'll set m_should_start to false and get out of
// here.
if (HasTargetRunSinceMe()) {
m_should_stop = false;
@@ -551,13 +537,13 @@ protected:
if ((m_should_stop == false || internal_breakpoint)
&& thread_sp->CompletedPlanOverridesBreakpoint()) {
- // Override should_stop decision when we have
- // completed step plan additionally to the breakpoint
+ // Override should_stop decision when we have completed step plan
+ // additionally to the breakpoint
m_should_stop = true;
- // Here we clean the preset stop info so the next
- // GetStopInfo call will find the appropriate stop info,
- // which should be the stop info related to the completed plan
+ // Here we clean the preset stop info so the next GetStopInfo call will
+ // find the appropriate stop info, which should be the stop info
+ // related to the completed plan
thread_sp->ResetStopInfo();
}
@@ -652,8 +638,8 @@ public:
protected:
bool ShouldStopSynchronous(Event *event_ptr) override {
- // ShouldStop() method is idempotent and should not affect hit count.
- // See Process::RunPrivateStateThread()->Process()->HandlePrivateEvent()
+ // ShouldStop() method is idempotent and should not affect hit count. See
+ // Process::RunPrivateStateThread()->Process()->HandlePrivateEvent()
// -->Process()::ShouldBroadcastEvent()->ThreadList::ShouldStop()->
// Thread::ShouldStop()->ThreadPlanBase::ShouldStop()->
// StopInfoWatchpoint::ShouldStop() and
@@ -689,9 +675,9 @@ protected:
}
bool ShouldStop(Event *event_ptr) override {
- // This just reports the work done by PerformAction or the synchronous stop.
- // It should
- // only ever get called after they have had a chance to run.
+ // This just reports the work done by PerformAction or the synchronous
+ // stop. It should only ever get called after they have had a chance to
+ // run.
assert(m_should_stop_is_valid);
return m_should_stop;
}
@@ -699,8 +685,8 @@ protected:
void PerformAction(Event *event_ptr) override {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS);
// We're going to calculate if we should stop or not in some way during the
- // course of
- // this code. Also by default we're going to stop, so set that here.
+ // course of this code. Also by default we're going to stop, so set that
+ // here.
m_should_stop = true;
@@ -716,10 +702,8 @@ protected:
{
// check if this process is running on an architecture where
- // watchpoints trigger
- // before the associated instruction runs. if so, disable the WP,
- // single-step and then
- // re-enable the watchpoint
+ // watchpoints trigger before the associated instruction runs. if so,
+ // disable the WP, single-step and then re-enable the watchpoint
if (process_sp) {
uint32_t num;
bool wp_triggers_after;
@@ -727,10 +711,9 @@ protected:
if (process_sp->GetWatchpointSupportInfo(num, wp_triggers_after)
.Success()) {
if (!wp_triggers_after) {
- // We need to preserve the watch_index before watchpoint
- // is disable. Since Watchpoint::SetEnabled will clear the
- // watch index.
- // This will fix TestWatchpointIter failure
+ // We need to preserve the watch_index before watchpoint is
+ // disable. Since Watchpoint::SetEnabled will clear the watch
+ // index. This will fix TestWatchpointIter failure
Watchpoint *wp = wp_sp.get();
uint32_t watch_index = wp->GetHardwareIndex();
process_sp->DisableWatchpoint(wp, false);
@@ -759,8 +742,8 @@ protected:
}
// This sentry object makes sure the current watchpoint is disabled
- // while performing watchpoint actions,
- // and it is then enabled after we are finished.
+ // while performing watchpoint actions, and it is then enabled after we
+ // are finished.
WatchpointSentry sentry(process_sp, wp_sp);
/*
@@ -789,16 +772,13 @@ protected:
// TODO: This condition should be checked in the synchronous part of the
// watchpoint code
// (Watchpoint::ShouldStop), so that we avoid pulling an event even if
- // the watchpoint fails
- // the ignore count condition. It is moved here temporarily, because for
- // archs with
- // watchpoint_exceptions_received=before, the code in the previous lines
- // takes care of moving
- // the inferior to next PC. We have to check the ignore count condition
- // after this is done,
- // otherwise we will hit same watchpoint multiple times until we pass
- // ignore condition, but we
- // won't actually be ignoring them.
+ // the watchpoint fails the ignore count condition. It is moved here
+ // temporarily, because for archs with
+ // watchpoint_exceptions_received=before, the code in the previous
+ // lines takes care of moving the inferior to next PC. We have to check
+ // the ignore count condition after this is done, otherwise we will hit
+ // same watchpoint multiple times until we pass ignore condition, but
+ // we won't actually be ignoring them.
if (wp_sp->GetHitCount() <= wp_sp->GetIgnoreCount())
m_should_stop = false;
@@ -824,9 +804,9 @@ protected:
if (result_value_sp->ResolveValue(scalar_value)) {
if (scalar_value.ULongLong(1) == 0) {
// We have been vetoed. This takes precedence over querying
- // the watchpoint whether it should stop (aka ignore count and
- // friends). See also StopInfoWatchpoint::ShouldStop() as
- // well as Process::ProcessEventData::DoOnRemoval().
+ // the watchpoint whether it should stop (aka ignore count
+ // and friends). See also StopInfoWatchpoint::ShouldStop()
+ // as well as Process::ProcessEventData::DoOnRemoval().
m_should_stop = false;
} else
m_should_stop = true;
@@ -877,9 +857,8 @@ protected:
debugger.SetAsyncExecution(old_async);
- // Also make sure that the callback hasn't continued the target.
- // If it did, when we'll set m_should_stop to false and get out of
- // here.
+ // Also make sure that the callback hasn't continued the target. If
+ // it did, when we'll set m_should_stop to false and get out of here.
if (HasTargetRunSinceMe())
m_should_stop = false;
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Apr 30 09:49:04 2018
@@ -382,8 +382,8 @@ BreakpointSP Target::CreateBreakpoint(ll
// Check for any reason we want to move this breakpoint to other address.
addr = GetBreakableLoadAddress(addr);
- // Attempt to resolve our load address if possible, though it is ok if
- // it doesn't resolve to section/offset.
+ // Attempt to resolve our load address if possible, though it is ok if it
+ // doesn't resolve to section/offset.
// Try and resolve as a load address if possible
GetSectionLoadList().ResolveLoadAddress(addr, so_addr);
@@ -537,8 +537,7 @@ SearchFilterSP Target::GetSearchFilterFo
SearchFilterSP filter_sp;
if (containingModules == nullptr) {
// We could make a special "CU List only SearchFilter". Better yet was if
- // these could be composable,
- // but that will take a little reworking.
+ // these could be composable, but that will take a little reworking.
filter_sp.reset(new SearchFilterByModuleListAndCU(
shared_from_this(), FileSpecList(), *containingSourceFiles));
@@ -744,8 +743,8 @@ static bool CheckIfWatchpointsExhausted(
return true;
}
-// See also Watchpoint::SetWatchpointType(uint32_t type) and
-// the OptionGroupWatchpoint::WatchType enum type.
+// See also Watchpoint::SetWatchpointType(uint32_t type) and the
+// OptionGroupWatchpoint::WatchType enum type.
WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size,
const CompilerType *type, uint32_t kind,
Status &error) {
@@ -776,8 +775,8 @@ WatchpointSP Target::CreateWatchpoint(ll
if (!CheckIfWatchpointsExhausted(this, error))
return wp_sp;
- // Currently we only support one watchpoint per address, with total number
- // of watchpoints limited by the hardware which the inferior is running on.
+ // Currently we only support one watchpoint per address, with total number of
+ // watchpoints limited by the hardware which the inferior is running on.
// Grab the list mutex while doing operations.
const bool notify = false; // Don't notify about all the state changes we do
@@ -814,9 +813,8 @@ WatchpointSP Target::CreateWatchpoint(ll
wp_sp->GetID());
if (error.Fail()) {
- // Enabling the watchpoint on the device side failed.
- // Remove the said watchpoint from the list maintained by the target
- // instance.
+ // Enabling the watchpoint on the device side failed. Remove the said
+ // watchpoint from the list maintained by the target instance.
m_watchpoint_list.Remove(wp_sp->GetID(), true);
// See if we could provide more helpful error message.
if (!OptionGroupWatchpoint::IsWatchSizeSupported(size))
@@ -1028,8 +1026,7 @@ Status Target::SerializeBreakpointsToFil
Breakpoint *bp = GetBreakpointByID(bp_id).get();
StructuredData::ObjectSP bkpt_save_sp = bp->SerializeToStructuredData();
// If the user explicitly asked to serialize a breakpoint, and we
- // can't, then
- // raise an error:
+ // can't, then raise an error:
if (!bkpt_save_sp) {
error.SetErrorStringWithFormat("Unable to serialize breakpoint %d",
bp_id);
@@ -1142,8 +1139,8 @@ bool Target::RemoveAllWatchpoints(bool e
return true; // Success!
}
-// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end to
-// end operations.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end
+// to end operations.
bool Target::DisableAllWatchpoints(bool end_to_end) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
if (log)
@@ -1172,8 +1169,8 @@ bool Target::DisableAllWatchpoints(bool
return true; // Success!
}
-// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end to
-// end operations.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end
+// to end operations.
bool Target::EnableAllWatchpoints(bool end_to_end) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
if (log)
@@ -1236,8 +1233,8 @@ bool Target::ClearAllWatchpointHistoricV
return true; // Success!
}
-// Assumption: Caller holds the list mutex lock for m_watchpoint_list
-// during these operations.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list during
+// these operations.
bool Target::IgnoreAllWatchpoints(uint32_t ignore_count) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
if (log)
@@ -1460,7 +1457,8 @@ bool Target::SetArchitecture(const ArchS
if (compatible_local_arch || missing_local_arch) {
// If we haven't got a valid arch spec, or the architectures are compatible
- // update the architecture, unless the one we already have is more specified
+ // update the architecture, unless the one we already have is more
+ // specified
if (replace_local_arch)
m_arch = other;
LLDB_LOG(log, "set architecture to {0} ({1})",
@@ -1503,8 +1501,8 @@ bool Target::SetArchitecture(const ArchS
bool Target::MergeArchitecture(const ArchSpec &arch_spec) {
if (arch_spec.IsValid()) {
if (m_arch.GetSpec().IsCompatibleMatch(arch_spec)) {
- // The current target arch is compatible with "arch_spec", see if we
- // can improve our current architecture using bits from "arch_spec"
+ // The current target arch is compatible with "arch_spec", see if we can
+ // improve our current architecture using bits from "arch_spec"
// Merge bits from arch_spec into "merged_arch" and set our architecture
ArchSpec merged_arch(m_arch.GetSpec());
@@ -1663,8 +1661,8 @@ size_t Target::ReadMemory(const Address
lldb::addr_t *load_addr_ptr) {
error.Clear();
- // if we end up reading this from process memory, we will fill this
- // with the actual load address
+ // if we end up reading this from process memory, we will fill this with the
+ // actual load address
if (load_addr_ptr)
*load_addr_ptr = LLDB_INVALID_ADDRESS;
@@ -1676,16 +1674,16 @@ size_t Target::ReadMemory(const Address
if (!addr.IsSectionOffset()) {
SectionLoadList §ion_load_list = GetSectionLoadList();
if (section_load_list.IsEmpty()) {
- // No sections are loaded, so we must assume we are not running
- // yet and anything we are given is a file address.
+ // No sections are loaded, so we must assume we are not running yet and
+ // anything we are given is a file address.
file_addr = addr.GetOffset(); // "addr" doesn't have a section, so its
// offset is the file address
m_images.ResolveFileAddress(file_addr, resolved_addr);
} else {
- // We have at least one section loaded. This can be because
- // we have manually loaded some sections with "target modules load ..."
- // or because we have have a live process that has sections loaded
- // through the dynamic loader
+ // We have at least one section loaded. This can be because we have
+ // manually loaded some sections with "target modules load ..." or
+ // because we have have a live process that has sections loaded through
+ // the dynamic loader
load_addr = addr.GetOffset(); // "addr" doesn't have a section, so its
// offset is the load address
section_load_list.ResolveLoadAddress(load_addr, resolved_addr);
@@ -1732,19 +1730,19 @@ size_t Target::ReadMemory(const Address
*load_addr_ptr = load_addr;
return bytes_read;
}
- // If the address is not section offset we have an address that
- // doesn't resolve to any address in any currently loaded shared
- // libraries and we failed to read memory so there isn't anything
- // more we can do. If it is section offset, we might be able to
- // read cached memory from the object file.
+ // If the address is not section offset we have an address that doesn't
+ // resolve to any address in any currently loaded shared libraries and we
+ // failed to read memory so there isn't anything more we can do. If it is
+ // section offset, we might be able to read cached memory from the object
+ // file.
if (!resolved_addr.IsSectionOffset())
return 0;
}
}
if (!prefer_file_cache && resolved_addr.IsSectionOffset()) {
- // If we didn't already try and read from the object file cache, then
- // try it after failing to read from the process.
+ // If we didn't already try and read from the object file cache, then try
+ // it after failing to read from the process.
return ReadMemoryFromFileCache(resolved_addr, dst, dst_len, error);
}
return 0;
@@ -1761,8 +1759,8 @@ size_t Target::ReadCStringFromMemory(con
if (length == 0)
break;
out_str.append(buf, length);
- // If we got "length - 1" bytes, we didn't get the whole C string, we
- // need to read some more characters
+ // If we got "length - 1" bytes, we didn't get the whole C string, we need
+ // to read some more characters
if (length == sizeof(buf) - 1)
curr_addr += length;
else
@@ -1783,9 +1781,9 @@ size_t Target::ReadCStringFromMemory(con
addr_t curr_addr = addr.GetLoadAddress(this);
Address address(addr);
- // We could call m_process_sp->GetMemoryCacheLineSize() but I don't
- // think this really needs to be tied to the memory cache subsystem's
- // cache line size, so leave this as a fixed constant.
+ // We could call m_process_sp->GetMemoryCacheLineSize() but I don't think
+ // this really needs to be tied to the memory cache subsystem's cache line
+ // size, so leave this as a fixed constant.
const size_t cache_line_size = 512;
size_t bytes_left = dst_max_len - 1;
@@ -1876,18 +1874,18 @@ bool Target::ReadPointerFromMemory(const
if (pointer_vm_addr != LLDB_INVALID_ADDRESS) {
SectionLoadList §ion_load_list = GetSectionLoadList();
if (section_load_list.IsEmpty()) {
- // No sections are loaded, so we must assume we are not running
- // yet and anything we are given is a file address.
+ // No sections are loaded, so we must assume we are not running yet and
+ // anything we are given is a file address.
m_images.ResolveFileAddress(pointer_vm_addr, pointer_addr);
} else {
- // We have at least one section loaded. This can be because
- // we have manually loaded some sections with "target modules load ..."
- // or because we have have a live process that has sections loaded
- // through the dynamic loader
+ // We have at least one section loaded. This can be because we have
+ // manually loaded some sections with "target modules load ..." or
+ // because we have have a live process that has sections loaded through
+ // the dynamic loader
section_load_list.ResolveLoadAddress(pointer_vm_addr, pointer_addr);
}
- // We weren't able to resolve the pointer value, so just return
- // an address with no section
+ // We weren't able to resolve the pointer value, so just return an
+ // address with no section
if (!pointer_addr.IsValid())
pointer_addr.SetOffset(pointer_vm_addr);
return true;
@@ -1903,9 +1901,8 @@ ModuleSP Target::GetSharedModule(const M
Status error;
// First see if we already have this module in our module list. If we do,
- // then we're done, we don't need
- // to consult the shared modules list. But only do this if we are passed a
- // UUID.
+ // then we're done, we don't need to consult the shared modules list. But
+ // only do this if we are passed a UUID.
if (module_spec.GetUUID().IsValid())
module_sp = m_images.FindFirstModule(module_spec);
@@ -1960,8 +1957,8 @@ ModuleSP Target::GetSharedModule(const M
}
// We found a module that wasn't in our target list. Let's make sure that
- // there wasn't an equivalent
- // module in the list already, and if there was, let's remove it.
+ // there wasn't an equivalent module in the list already, and if there was,
+ // let's remove it.
if (module_sp) {
ObjectFile *objfile = module_sp->GetObjectFile();
if (objfile) {
@@ -1995,18 +1992,14 @@ ModuleSP Target::GetSharedModule(const M
return ModuleSP();
}
// GetSharedModule is not guaranteed to find the old shared module, for
- // instance
- // in the common case where you pass in the UUID, it is only going to
- // find the one
- // module matching the UUID. In fact, it has no good way to know what
- // the "old module"
- // relevant to this target is, since there might be many copies of a
- // module with this file spec
- // in various running debug sessions, but only one of them will belong
- // to this target.
- // So let's remove the UUID from the module list, and look in the
- // target's module list.
- // Only do this if there is SOMETHING else in the module spec...
+ // instance in the common case where you pass in the UUID, it is only
+ // going to find the one module matching the UUID. In fact, it has no
+ // good way to know what the "old module" relevant to this target is,
+ // since there might be many copies of a module with this file spec in
+ // various running debug sessions, but only one of them will belong to
+ // this target. So let's remove the UUID from the module list, and look
+ // in the target's module list. Only do this if there is SOMETHING else
+ // in the module spec...
if (!old_module_sp) {
if (module_spec.GetUUID().IsValid() &&
!module_spec.GetFileSpec().GetFilename().IsEmpty() &&
@@ -2286,8 +2279,8 @@ ExpressionResults Target::EvaluateExpres
if (expr.empty())
return execution_results;
- // We shouldn't run stop hooks in expressions.
- // Be sure to reset this if you return anywhere within this function.
+ // We shouldn't run stop hooks in expressions. Be sure to reset this if you
+ // return anywhere within this function.
bool old_suppress_value = m_suppress_stop_hooks;
m_suppress_stop_hooks = true;
@@ -2301,8 +2294,8 @@ ExpressionResults Target::EvaluateExpres
CalculateExecutionContext(exe_ctx);
}
- // Make sure we aren't just trying to see the value of a persistent
- // variable (something like "$0")
+ // Make sure we aren't just trying to see the value of a persistent variable
+ // (something like "$0")
lldb::ExpressionVariableSP persistent_var_sp;
// Only check for persistent variables the expression starts with a '$'
if (expr[0] == '$')
@@ -2404,8 +2397,7 @@ lldb::addr_t Target::GetCallableLoadAddr
code_addr |= 1ull;
} else if (addr_class == eAddressClassCodeAlternateISA) {
// We checked the address and the address claims to be the alternate
- // ISA
- // which means thumb, so set bit zero.
+ // ISA which means thumb, so set bit zero.
code_addr |= 1ull;
}
}
@@ -2471,8 +2463,8 @@ lldb::addr_t Target::GetBreakableLoadAdd
SectionLoadList §ion_load_list = GetSectionLoadList();
if (section_load_list.IsEmpty())
- // No sections are loaded, so we must assume we are not running yet
- // and need to operate only on file address.
+ // No sections are loaded, so we must assume we are not running yet and
+ // need to operate only on file address.
m_images.ResolveFileAddress(addr, resolved_addr);
else
section_load_list.ResolveLoadAddress(addr, resolved_addr);
@@ -2547,30 +2539,29 @@ lldb::addr_t Target::GetBreakableLoadAdd
} else if (i == 2) {
// Here we may get one 4-byte instruction or two 2-byte instructions.
if (num_insns == 2) {
- // Looks like there are two 2-byte instructions above our breakpoint
- // target address.
- // Now the upper 2-byte instruction is either a valid 2-byte
- // instruction or could be a part of it's upper 4-byte instruction.
- // In both cases we don't care because in this case lower 2-byte
- // instruction is definitely a valid instruction
- // and whatever i=1 iteration has found out is true.
+ // Looks like there are two 2-byte instructions above our
+ // breakpoint target address. Now the upper 2-byte instruction is
+ // either a valid 2-byte instruction or could be a part of it's
+ // upper 4-byte instruction. In both cases we don't care because in
+ // this case lower 2-byte instruction is definitely a valid
+ // instruction and whatever i=1 iteration has found out is true.
inst_to_choose = 1;
break;
} else if (insn_size == 4) {
// This instruction claims its a valid 4-byte instruction. But it
- // could be a part of it's upper 4-byte instruction.
- // Lets try scanning upper 2 bytes to verify this.
+ // could be a part of it's upper 4-byte instruction. Lets try
+ // scanning upper 2 bytes to verify this.
instruction_list.Append(prev_insn);
inst_to_choose = 2;
}
} else if (i == 3) {
if (insn_size == 4)
// FIXME: We reached here that means instruction at [target - 4] has
- // already claimed to be a 4-byte instruction,
- // and now instruction at [target - 6] is also claiming that it's a
- // 4-byte instruction. This can not be true.
- // In this case we can not decide the valid previous instruction so
- // we let lldb set the breakpoint at the address given by user.
+ // already claimed to be a 4-byte instruction, and now instruction
+ // at [target - 6] is also claiming that it's a 4-byte instruction.
+ // This can not be true. In this case we can not decide the valid
+ // previous instruction so we let lldb set the breakpoint at the
+ // address given by user.
inst_to_choose = 0;
else
// This is straight-forward
@@ -2686,8 +2677,8 @@ void Target::RunStopHooks() {
return;
// <rdar://problem/12027563> make sure we check that we are not stopped
- // because of us running a user expression
- // since in that case we do not want to run the stop-hooks
+ // because of us running a user expression since in that case we do not want
+ // to run the stop-hooks
if (m_process_sp->GetModIDRef().IsLastResumeForUserExpression())
return;
@@ -2976,18 +2967,16 @@ Status Target::Launch(ProcessLaunchInfo
launch_info.GetFlags().Set(eLaunchFlagDebug);
// Get the value of synchronous execution here. If you wait till after you
- // have started to
- // run, then you could have hit a breakpoint, whose command might switch the
- // value, and
- // then you'll pick up that incorrect value.
+ // have started to run, then you could have hit a breakpoint, whose command
+ // might switch the value, and then you'll pick up that incorrect value.
Debugger &debugger = GetDebugger();
const bool synchronous_execution =
debugger.GetCommandInterpreter().GetSynchronous();
PlatformSP platform_sp(GetPlatform());
- // Finalize the file actions, and if none were given, default to opening
- // up a pseudo terminal
+ // Finalize the file actions, and if none were given, default to opening up a
+ // pseudo terminal
const bool default_to_use_pty = platform_sp ? platform_sp->IsHost() : false;
if (log)
log->Printf("Target::%s have platform=%s, platform_sp->IsHost()=%s, "
@@ -3026,10 +3015,10 @@ Status Target::Launch(ProcessLaunchInfo
GetPlatform()->DebugProcess(launch_info, debugger, this, error);
// Cleanup the old process since someone might still have a strong
- // reference to this process and we would like to allow it to cleanup
- // as much as it can without the object being destroyed. We try to
- // lock the shared pointer and if that works, then someone else still
- // has a strong reference to the process.
+ // reference to this process and we would like to allow it to cleanup as
+ // much as it can without the object being destroyed. We try to lock the
+ // shared pointer and if that works, then someone else still has a strong
+ // reference to the process.
ProcessSP old_process_sp(process_wp.lock());
if (old_process_sp)
@@ -3153,8 +3142,8 @@ Status Target::Attach(ProcessAttachInfo
const ModuleSP old_exec_module_sp = GetExecutableModule();
- // If no process info was specified, then use the target executable
- // name as the process to attach to by default
+ // If no process info was specified, then use the target executable name as
+ // the process to attach to by default
if (!attach_info.ProcessInfoSpecified()) {
if (old_exec_module_sp)
attach_info.GetExecutableFile().GetFilename() =
@@ -3581,9 +3570,8 @@ public:
bool will_modify,
uint32_t idx) const override {
// When getting the value for a key from the target options, we will always
- // try and grab the setting from the current target if there is one. Else we
- // just
- // use the one from this instance.
+ // try and grab the setting from the current target if there is one. Else
+ // we just use the one from this instance.
if (idx == ePropertyEnvVars)
GetHostEnvironmentIfNeeded();
@@ -3674,8 +3662,8 @@ TargetProperties::TargetProperties(Targe
m_collection_sp.reset(
new TargetOptionValueProperties(target, Target::GetGlobalProperties()));
- // Set callbacks to update launch_info whenever "settins set" updated any of
- // these properties
+ // Set callbacks to update launch_info whenever "settins set" updated any
+ // of these properties
m_collection_sp->SetValueChangedCallback(
ePropertyArg0, TargetProperties::Arg0ValueChangedCallback, this);
m_collection_sp->SetValueChangedCallback(
Modified: lldb/trunk/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/TargetList.cpp (original)
+++ lldb/trunk/source/Target/TargetList.cpp Mon Apr 30 09:49:04 2018
@@ -84,9 +84,9 @@ Status TargetList::CreateTargetInternal(
Status error;
PlatformSP platform_sp;
- // This is purposely left empty unless it is specified by triple_cstr.
- // If not initialized via triple_cstr, then the currently selected platform
- // will set the architecture correctly.
+ // This is purposely left empty unless it is specified by triple_cstr. If not
+ // initialized via triple_cstr, then the currently selected platform will set
+ // the architecture correctly.
const ArchSpec arch(triple_str);
if (!triple_str.empty()) {
if (!arch.IsValid()) {
@@ -123,8 +123,7 @@ Status TargetList::CreateTargetInternal(
module_spec.GetFileSpec().SetFile(user_exe_path, true);
// Resolve the executable in case we are given a path to a application
- // bundle
- // like a .app bundle on MacOSX
+ // bundle like a .app bundle on MacOSX
Host::ResolveExecutableInBundle(module_spec.GetFileSpec());
lldb::offset_t file_offset = 0;
@@ -140,7 +139,8 @@ Status TargetList::CreateTargetInternal(
if (platform_arch.IsCompatibleMatch(
matching_module_spec.GetArchitecture())) {
// If the OS or vendor weren't specified, then adopt the module's
- // architecture so that the platform matching can be more accurate
+ // architecture so that the platform matching can be more
+ // accurate
if (!platform_arch.TripleOSWasSpecified() ||
!platform_arch.TripleVendorWasSpecified()) {
prefer_platform_arch = true;
@@ -194,7 +194,8 @@ Status TargetList::CreateTargetInternal(
}
}
- // Next check the host platform it if wasn't already checked above
+ // Next check the host platform it if wasn't already checked
+ // above
if (host_platform_sp &&
(!platform_sp ||
host_platform_sp->GetName() != platform_sp->GetName())) {
@@ -275,8 +276,7 @@ Status TargetList::CreateTargetInternal(
}
} else if (platform_arch.IsValid()) {
// if "arch" isn't valid, yet "platform_arch" is, it means we have an
- // executable file with
- // a single architecture which should be used
+ // executable file with a single architecture which should be used
ArchSpec fixed_platform_arch;
if (!platform_sp->IsCompatibleArchitecture(platform_arch, false,
&fixed_platform_arch)) {
@@ -410,8 +410,8 @@ Status TargetList::CreateTargetInternal(
sizeof(resolved_bundle_exe_path));
}
} else {
- // No file was specified, just create an empty target with any arch
- // if a valid arch was specified
+ // No file was specified, just create an empty target with any arch if a
+ // valid arch was specified
target_sp.reset(new Target(debugger, arch, platform_sp, is_dummy_target));
}
Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Mon Apr 30 09:49:04 2018
@@ -105,9 +105,8 @@ public:
bool will_modify,
uint32_t idx) const override {
// When getting the value for a key from the thread options, we will always
- // try and grab the setting from the current thread if there is one. Else we
- // just
- // use the one from this instance.
+ // try and grab the setting from the current thread if there is one. Else
+ // we just use the one from this instance.
if (exe_ctx) {
Thread *thread = exe_ctx->GetThreadPtr();
if (thread) {
@@ -275,8 +274,8 @@ Thread::~Thread() {
void Thread::DestroyThread() {
// Tell any plans on the plan stacks that the thread is being destroyed since
- // any plans that have a thread go away in the middle of might need
- // to do cleanup, or in some cases NOT do cleanup...
+ // any plans that have a thread go away in the middle of might need to do
+ // cleanup, or in some cases NOT do cleanup...
for (auto plan : m_plan_stack)
plan->ThreadDestroyed();
@@ -291,11 +290,10 @@ void Thread::DestroyThread() {
m_discarded_plan_stack.clear();
m_completed_plan_stack.clear();
- // Push a ThreadPlanNull on the plan stack. That way we can continue assuming
- // that the
- // plan stack is never empty, but if somebody errantly asks questions of a
- // destroyed thread
- // without checking first whether it is destroyed, they won't crash.
+ // Push a ThreadPlanNull on the plan stack. That way we can continue
+ // assuming that the plan stack is never empty, but if somebody errantly asks
+ // questions of a destroyed thread without checking first whether it is
+ // destroyed, they won't crash.
ThreadPlanSP null_plan_sp(new ThreadPlanNull(*this));
m_plan_stack.push_back(null_plan_sp);
@@ -385,11 +383,10 @@ lldb::StopInfoSP Thread::GetStopInfo() {
ProcessSP process_sp(GetProcess());
const uint32_t stop_id = process_sp ? process_sp->GetStopID() : UINT32_MAX;
- // Here we select the stop info according to priorirty:
- // - m_stop_info_sp (if not trace) - preset value
- // - completed plan stop info - new value with plan from completed plan stack
- // - m_stop_info_sp (trace stop reason is OK now)
- // - ask GetPrivateStopInfo to set stop info
+ // Here we select the stop info according to priorirty: - m_stop_info_sp (if
+ // not trace) - preset value - completed plan stop info - new value with plan
+ // from completed plan stack - m_stop_info_sp (trace stop reason is OK now) -
+ // ask GetPrivateStopInfo to set stop info
bool have_valid_stop_info = m_stop_info_sp &&
m_stop_info_sp ->IsValid() &&
@@ -432,13 +429,13 @@ lldb::StopInfoSP Thread::GetPrivateStopI
}
}
- // The stop info can be manually set by calling Thread::SetStopInfo()
- // prior to this function ever getting called, so we can't rely on
- // "m_stop_info_stop_id != process_stop_id" as the condition for
- // the if statement below, we must also check the stop info to see
- // if we need to override it. See the header documentation in
- // Process::GetStopInfoOverrideCallback() for more information on
- // the stop info override callback.
+ // The stop info can be manually set by calling Thread::SetStopInfo() prior
+ // to this function ever getting called, so we can't rely on
+ // "m_stop_info_stop_id != process_stop_id" as the condition for the if
+ // statement below, we must also check the stop info to see if we need to
+ // override it. See the header documentation in
+ // Process::GetStopInfoOverrideCallback() for more information on the stop
+ // info override callback.
if (m_stop_info_override_stop_id != process_stop_id) {
m_stop_info_override_stop_id = process_stop_id;
if (m_stop_info_sp) {
@@ -509,9 +506,8 @@ void Thread::SetShouldReportStop(Vote vo
void Thread::SetStopInfoToNothing() {
// Note, we can't just NULL out the private reason, or the native thread
- // implementation will try to
- // go calculate it again. For now, just set it to a Unix Signal with an
- // invalid signal number.
+ // implementation will try to go calculate it again. For now, just set it to
+ // a Unix Signal with an invalid signal number.
SetStopInfo(
StopInfo::CreateStopReasonWithSignal(*this, LLDB_INVALID_SIGNAL_NUMBER));
}
@@ -604,10 +600,8 @@ void Thread::WillStop() {
void Thread::SetupForResume() {
if (GetResumeState() != eStateSuspended) {
// If we're at a breakpoint push the step-over breakpoint plan. Do this
- // before
- // telling the current plan it will resume, since we might change what the
- // current
- // plan is.
+ // before telling the current plan it will resume, since we might change
+ // what the current plan is.
lldb::RegisterContextSP reg_ctx_sp(GetRegisterContext());
if (reg_ctx_sp) {
@@ -615,9 +609,8 @@ void Thread::SetupForResume() {
BreakpointSiteSP bp_site_sp =
GetProcess()->GetBreakpointSiteList().FindByAddress(thread_pc);
if (bp_site_sp) {
- // Note, don't assume there's a ThreadPlanStepOverBreakpoint, the target
- // may not require anything
- // special to step over a breakpoint.
+ // Note, don't assume there's a ThreadPlanStepOverBreakpoint, the
+ // target may not require anything special to step over a breakpoint.
ThreadPlan *cur_plan = GetCurrentPlan();
@@ -669,11 +662,9 @@ bool Thread::ShouldResume(StateType resu
GetPrivateStopInfo();
// This is a little dubious, but we are trying to limit how often we actually
- // fetch stop info from
- // the target, 'cause that slows down single stepping. So assume that if we
- // got to the point where
- // we're about to resume, and we haven't yet had to fetch the stop reason,
- // then it doesn't need to know
+ // fetch stop info from the target, 'cause that slows down single stepping.
+ // So assume that if we got to the point where we're about to resume, and we
+ // haven't yet had to fetch the stop reason, then it doesn't need to know
// about the fact that we are resuming...
const uint32_t process_stop_id = GetProcess()->GetStopID();
if (m_stop_info_stop_id == process_stop_id &&
@@ -684,9 +675,9 @@ bool Thread::ShouldResume(StateType resu
}
// Tell all the plans that we are about to resume in case they need to clear
- // any state.
- // We distinguish between the plan on the top of the stack and the lower
- // plans in case a plan needs to do any special business before it runs.
+ // any state. We distinguish between the plan on the top of the stack and the
+ // lower plans in case a plan needs to do any special business before it
+ // runs.
bool need_to_resume = false;
ThreadPlan *plan_ptr = GetCurrentPlan();
@@ -698,8 +689,7 @@ bool Thread::ShouldResume(StateType resu
}
// If the WillResume for the plan says we are faking a resume, then it will
- // have set an appropriate stop info.
- // In that case, don't reset it here.
+ // have set an appropriate stop info. In that case, don't reset it here.
if (need_to_resume && resume_state != eStateSuspended) {
m_stop_info_sp.reset();
@@ -743,9 +733,8 @@ bool Thread::ShouldStop(Event *event_ptr
}
// Based on the current thread plan and process stop info, check if this
- // thread caused the process to stop. NOTE: this must take place before
- // the plan is moved from the current plan stack to the completed plan
- // stack.
+ // thread caused the process to stop. NOTE: this must take place before the
+ // plan is moved from the current plan stack to the completed plan stack.
if (!ThreadStoppedForAReason()) {
if (log)
log->Printf("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
@@ -775,10 +764,9 @@ bool Thread::ShouldStop(Event *event_ptr
current_plan->DoTraceLog();
// First query the stop info's ShouldStopSynchronous. This handles
- // "synchronous" stop reasons, for example the breakpoint
- // command on internal breakpoints. If a synchronous stop reason says we
- // should not stop, then we don't have to
- // do any more work on this stop.
+ // "synchronous" stop reasons, for example the breakpoint command on internal
+ // breakpoints. If a synchronous stop reason says we should not stop, then
+ // we don't have to do any more work on this stop.
StopInfoSP private_stop_info(GetPrivateStopInfo());
if (private_stop_info &&
!private_stop_info->ShouldStopSynchronous(event_ptr)) {
@@ -788,8 +776,8 @@ bool Thread::ShouldStop(Event *event_ptr
return false;
}
- // If we've already been restarted, don't query the plans since the state they
- // would examine is not current.
+ // If we've already been restarted, don't query the plans since the state
+ // they would examine is not current.
if (Process::ProcessEventData::GetRestartedFromEvent(event_ptr))
return false;
@@ -798,12 +786,10 @@ bool Thread::ShouldStop(Event *event_ptr
GetStackFrameList()->CalculateCurrentInlinedDepth();
// If the base plan doesn't understand why we stopped, then we have to find a
- // plan that does.
- // If that plan is still working, then we don't need to do any more work. If
- // the plan that explains
- // the stop is done, then we should pop all the plans below it, and pop it,
- // and then let the plans above it decide
- // whether they still need to do more work.
+ // plan that does. If that plan is still working, then we don't need to do
+ // any more work. If the plan that explains the stop is done, then we should
+ // pop all the plans below it, and pop it, and then let the plans above it
+ // decide whether they still need to do more work.
bool done_processing_current_plan = false;
@@ -812,16 +798,16 @@ bool Thread::ShouldStop(Event *event_ptr
done_processing_current_plan = true;
should_stop = false;
} else {
- // If the current plan doesn't explain the stop, then find one that
- // does and let it handle the situation.
+ // If the current plan doesn't explain the stop, then find one that does
+ // and let it handle the situation.
ThreadPlan *plan_ptr = current_plan;
while ((plan_ptr = GetPreviousPlan(plan_ptr)) != nullptr) {
if (plan_ptr->PlanExplainsStop(event_ptr)) {
should_stop = plan_ptr->ShouldStop(event_ptr);
- // plan_ptr explains the stop, next check whether plan_ptr is done, if
- // so, then we should take it
- // and all the plans below it off the stack.
+ // plan_ptr explains the stop, next check whether plan_ptr is done,
+ // if so, then we should take it and all the plans below it off the
+ // stack.
if (plan_ptr->MischiefManaged()) {
// We're going to pop the plans up to and including the plan that
@@ -833,9 +819,9 @@ bool Thread::ShouldStop(Event *event_ptr
current_plan->WillStop();
PopPlan();
} while ((current_plan = GetCurrentPlan()) != prev_plan_ptr);
- // Now, if the responsible plan was not "Okay to discard" then we're
- // done,
- // otherwise we forward this to the next plan in the stack below.
+ // Now, if the responsible plan was not "Okay to discard" then
+ // we're done, otherwise we forward this to the next plan in the
+ // stack below.
done_processing_current_plan =
(plan_ptr->IsMasterPlan() && !plan_ptr->OkayToDiscard());
} else
@@ -860,9 +846,9 @@ bool Thread::ShouldStop(Event *event_ptr
if (log)
log->Printf("Base plan says should stop: %i.", should_stop);
} else {
- // Otherwise, don't let the base plan override what the other plans say to
- // do, since
- // presumably if there were other plans they would know what to do...
+ // Otherwise, don't let the base plan override what the other plans say
+ // to do, since presumably if there were other plans they would know what
+ // to do...
while (1) {
if (PlanIsBasePlan(current_plan))
break;
@@ -875,9 +861,8 @@ bool Thread::ShouldStop(Event *event_ptr
if (should_stop)
current_plan->WillStop();
- // If a Master Plan wants to stop, and wants to stick on the stack, we
- // let it.
- // Otherwise, see if the plan's parent wants to stop.
+ // If a Master Plan wants to stop, and wants to stick on the stack,
+ // we let it. Otherwise, see if the plan's parent wants to stop.
if (should_stop && current_plan->IsMasterPlan() &&
!current_plan->OkayToDiscard()) {
@@ -902,18 +887,16 @@ bool Thread::ShouldStop(Event *event_ptr
}
// One other potential problem is that we set up a master plan, then stop in
- // before it is complete - for instance
- // by hitting a breakpoint during a step-over - then do some step/finish/etc
- // operations that wind up
- // past the end point condition of the initial plan. We don't want to strand
- // the original plan on the stack,
- // This code clears stale plans off the stack.
+ // before it is complete - for instance by hitting a breakpoint during a
+ // step-over - then do some step/finish/etc operations that wind up past the
+ // end point condition of the initial plan. We don't want to strand the
+ // original plan on the stack, This code clears stale plans off the stack.
if (should_stop) {
ThreadPlan *plan_ptr = GetCurrentPlan();
- // Discard the stale plans and all plans below them in the stack,
- // plus move the completed plans to the completed plan stack
+ // Discard the stale plans and all plans below them in the stack, plus move
+ // the completed plans to the completed plan stack
while (!PlanIsBasePlan(plan_ptr)) {
bool stale = plan_ptr->IsPlanStale();
ThreadPlan *examined_plan = plan_ptr;
@@ -928,8 +911,9 @@ bool Thread::ShouldStop(Event *event_ptr
DiscardPlan();
}
if (examined_plan->IsPlanComplete()) {
- // plan is complete but does not explain the stop (example: step to a line
- // with breakpoint), let us move the plan to completed_plan_stack anyway
+ // plan is complete but does not explain the stop (example: step to a
+ // line with breakpoint), let us move the plan to
+ // completed_plan_stack anyway
PopPlan();
} else
DiscardPlan();
@@ -1097,8 +1081,8 @@ void Thread::DiscardPlan() {
}
ThreadPlan *Thread::GetCurrentPlan() {
- // There will always be at least the base plan. If somebody is mucking with a
- // thread with an empty plan stack, we should assert right away.
+ // There will always be at least the base plan. If somebody is mucking with
+ // a thread with an empty plan stack, we should assert right away.
return m_plan_stack.empty() ? nullptr : m_plan_stack.back().get();
}
@@ -1212,8 +1196,7 @@ void Thread::SetTracer(lldb::ThreadPlanT
bool Thread::DiscardUserThreadPlansUpToIndex(uint32_t thread_index) {
// Count the user thread plans from the back end to get the number of the one
- // we want
- // to discard:
+ // we want to discard:
uint32_t idx = 0;
ThreadPlan *up_to_plan_ptr = nullptr;
@@ -1249,8 +1232,7 @@ void Thread::DiscardThreadPlansUpToPlan(
int stack_size = m_plan_stack.size();
// If the input plan is nullptr, discard all plans. Otherwise make sure this
- // plan is in the
- // stack, and if so discard up to and including it.
+ // plan is in the stack, and if so discard up to and including it.
if (up_to_plan_ptr == nullptr) {
for (int i = stack_size - 1; i > 0; i--)
@@ -1314,8 +1296,7 @@ void Thread::DiscardThreadPlans(bool for
// Now discard the master plan itself.
// The bottom-most plan never gets discarded. "OkayToDiscard" for it
- // means
- // discard it's dependent plans, but not it...
+ // means discard it's dependent plans, but not it...
if (master_plan_idx > 0) {
DiscardPlan();
}
@@ -1340,8 +1321,7 @@ Status Thread::UnwindInnermostExpression
int stack_size = m_plan_stack.size();
// If the input plan is nullptr, discard all plans. Otherwise make sure this
- // plan is in the
- // stack, and if so discard up to and including it.
+ // plan is in the stack, and if so discard up to and including it.
for (int i = stack_size - 1; i > 0; i--) {
if (m_plan_stack[i]->GetKind() == ThreadPlan::eKindCallFunction) {
@@ -1380,7 +1360,8 @@ ThreadPlanSP Thread::QueueThreadPlanForS
return thread_plan_sp;
}
-// Call the QueueThreadPlanForStepOverRange method which takes an address range.
+// Call the QueueThreadPlanForStepOverRange method which takes an address
+// range.
ThreadPlanSP Thread::QueueThreadPlanForStepOverRange(
bool abort_other_plans, const LineEntry &line_entry,
const SymbolContext &addr_context, lldb::RunMode stop_other_threads,
@@ -1500,11 +1481,9 @@ lldb::ThreadPlanSP Thread::QueueThreadPl
ThreadPlanSP thread_plan_sp(new ThreadPlanPython(*this, class_name));
QueueThreadPlan(thread_plan_sp, abort_other_plans);
// This seems a little funny, but I don't want to have to split up the
- // constructor and the
- // DidPush in the scripted plan, that seems annoying.
- // That means the constructor has to be in DidPush.
- // So I have to validate the plan AFTER pushing it, and then take it off
- // again...
+ // constructor and the DidPush in the scripted plan, that seems annoying.
+ // That means the constructor has to be in DidPush. So I have to validate the
+ // plan AFTER pushing it, and then take it off again...
if (!thread_plan_sp->ValidatePlan(nullptr)) {
DiscardThreadPlansUpToPlan(thread_plan_sp);
return ThreadPlanSP();
@@ -1701,10 +1680,9 @@ Status Thread::ReturnFromFrame(lldb::Sta
return return_error;
}
- // Now write the return registers for the chosen frame:
- // Note, we can't use ReadAllRegisterValues->WriteAllRegisterValues, since the
- // read & write
- // cook their data
+ // Now write the return registers for the chosen frame: Note, we can't use
+ // ReadAllRegisterValues->WriteAllRegisterValues, since the read & write cook
+ // their data
StackFrameSP youngest_frame_sp = thread->GetStackFrameAtIndex(0);
if (youngest_frame_sp) {
@@ -1754,13 +1732,11 @@ Status Thread::JumpToLine(const FileSpec
target->GetImages().FindAddressesForLine(target_sp, file, line, sc.function,
within_function, outside_function);
- // If possible, we try and stay within the current function.
- // Within a function, we accept multiple locations (optimized code may do
- // this,
- // there's no solution here so we do the best we can).
- // However if we're trying to leave the function, we don't know how to pick
- // the
- // right location, so if there's more than one then we bail.
+ // If possible, we try and stay within the current function. Within a
+ // function, we accept multiple locations (optimized code may do this,
+ // there's no solution here so we do the best we can). However if we're
+ // trying to leave the function, we don't know how to pick the right
+ // location, so if there's more than one then we bail.
if (!within_function.empty())
candidates = within_function;
else if (outside_function.size() == 1 && can_leave_function)
@@ -1836,8 +1812,8 @@ lldb::addr_t Thread::GetThreadPointer()
addr_t Thread::GetThreadLocalData(const ModuleSP module,
lldb::addr_t tls_file_addr) {
- // The default implementation is to ask the dynamic loader for it.
- // This can be overridden for specific platforms.
+ // The default implementation is to ask the dynamic loader for it. This can
+ // be overridden for specific platforms.
DynamicLoader *loader = GetProcess()->GetDynamicLoader();
if (loader)
return loader->GetThreadLocalData(module, shared_from_this(),
@@ -2096,10 +2072,8 @@ void Thread::Flush() {
bool Thread::IsStillAtLastBreakpointHit() {
// If we are currently stopped at a breakpoint, always return that stopinfo
- // and don't reset it.
- // This allows threads to maintain their breakpoint stopinfo, such as when
- // thread-stepping in
- // multithreaded programs.
+ // and don't reset it. This allows threads to maintain their breakpoint
+ // stopinfo, such as when thread-stepping in multithreaded programs.
if (m_stop_info_sp) {
StopReason stop_reason = m_stop_info_sp->GetStopReason();
if (stop_reason == lldb::eStopReasonBreakpoint) {
Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Mon Apr 30 09:49:04 2018
@@ -40,8 +40,8 @@ ThreadList::ThreadList(const ThreadList
const ThreadList &ThreadList::operator=(const ThreadList &rhs) {
if (this != &rhs) {
- // Lock both mutexes to make sure neither side changes anyone on us
- // while the assignment occurs
+ // Lock both mutexes to make sure neither side changes anyone on us while
+ // the assignment occurs
std::lock_guard<std::recursive_mutex> guard(GetMutex());
std::lock_guard<std::recursive_mutex> rhs_guard(rhs.GetMutex());
@@ -54,9 +54,8 @@ const ThreadList &ThreadList::operator=(
}
ThreadList::~ThreadList() {
- // Clear the thread list. Clear will take the mutex lock
- // which will ensure that if anyone is using the list
- // they won't get it removed while using it.
+ // Clear the thread list. Clear will take the mutex lock which will ensure
+ // that if anyone is using the list they won't get it removed while using it.
Clear();
}
@@ -231,13 +230,13 @@ bool ThreadList::ShouldStop(Event *event
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- // The ShouldStop method of the threads can do a whole lot of work,
- // figuring out whether the thread plan conditions are met. So we don't want
- // to keep the ThreadList locked the whole time we are doing this.
+ // The ShouldStop method of the threads can do a whole lot of work, figuring
+ // out whether the thread plan conditions are met. So we don't want to keep
+ // the ThreadList locked the whole time we are doing this.
// FIXME: It is possible that running code could cause new threads
- // to be created. If that happens, we will miss asking them whether
- // they should stop. This is not a big deal since we haven't had
- // a chance to hang any interesting operations on those threads yet.
+ // to be created. If that happens, we will miss asking them whether they
+ // should stop. This is not a big deal since we haven't had a chance to hang
+ // any interesting operations on those threads yet.
collection threads_copy;
{
@@ -247,25 +246,21 @@ bool ThreadList::ShouldStop(Event *event
m_process->UpdateThreadListIfNeeded();
for (lldb::ThreadSP thread_sp : m_threads) {
// This is an optimization... If we didn't let a thread run in between
- // the previous stop and this
- // one, we shouldn't have to consult it for ShouldStop. So just leave it
- // off the list we are going to
- // inspect.
- // On Linux, if a thread-specific conditional breakpoint was hit, it won't
- // necessarily be the thread
- // that hit the breakpoint itself that evaluates the conditional
- // expression, so the thread that hit
- // the breakpoint could still be asked to stop, even though it hasn't been
- // allowed to run since the
- // previous stop.
+ // the previous stop and this one, we shouldn't have to consult it for
+ // ShouldStop. So just leave it off the list we are going to inspect. On
+ // Linux, if a thread-specific conditional breakpoint was hit, it won't
+ // necessarily be the thread that hit the breakpoint itself that
+ // evaluates the conditional expression, so the thread that hit the
+ // breakpoint could still be asked to stop, even though it hasn't been
+ // allowed to run since the previous stop.
if (thread_sp->GetTemporaryResumeState() != eStateSuspended ||
thread_sp->IsStillAtLastBreakpointHit())
threads_copy.push_back(thread_sp);
}
// It is possible the threads we were allowing to run all exited and then
- // maybe the user interrupted
- // or something, then fall back on looking at all threads:
+ // maybe the user interrupted or something, then fall back on looking at
+ // all threads:
if (threads_copy.size() == 0)
threads_copy = m_threads;
@@ -296,12 +291,11 @@ bool ThreadList::ShouldStop(Event *event
}
// Now we run through all the threads and get their stop info's. We want to
- // make sure to do this first before
- // we start running the ShouldStop, because one thread's ShouldStop could
- // destroy information (like deleting a
- // thread specific breakpoint another thread had stopped at) which could lead
- // us to compute the StopInfo incorrectly.
- // We don't need to use it here, we just want to make sure it gets computed.
+ // make sure to do this first before we start running the ShouldStop, because
+ // one thread's ShouldStop could destroy information (like deleting a thread
+ // specific breakpoint another thread had stopped at) which could lead us to
+ // compute the StopInfo incorrectly. We don't need to use it here, we just
+ // want to make sure it gets computed.
for (pos = threads_copy.begin(); pos != end; ++pos) {
ThreadSP thread_sp(*pos);
@@ -312,27 +306,24 @@ bool ThreadList::ShouldStop(Event *event
ThreadSP thread_sp(*pos);
// We should never get a stop for which no thread had a stop reason, but
- // sometimes we do see this -
- // for instance when we first connect to a remote stub. In that case we
- // should stop, since we can't figure out
- // the right thing to do and stopping gives the user control over what to do
- // in this instance.
+ // sometimes we do see this - for instance when we first connect to a
+ // remote stub. In that case we should stop, since we can't figure out the
+ // right thing to do and stopping gives the user control over what to do in
+ // this instance.
//
// Note, this causes a problem when you have a thread specific breakpoint,
- // and a bunch of threads hit the breakpoint,
- // but not the thread which we are waiting for. All the threads that are
- // not "supposed" to hit the breakpoint
- // are marked as having no stop reason, which is right, they should not show
- // a stop reason. But that triggers this
- // code and causes us to stop seemingly for no reason.
+ // and a bunch of threads hit the breakpoint, but not the thread which we
+ // are waiting for. All the threads that are not "supposed" to hit the
+ // breakpoint are marked as having no stop reason, which is right, they
+ // should not show a stop reason. But that triggers this code and causes
+ // us to stop seemingly for no reason.
//
// Since the only way we ever saw this error was on first attach, I'm only
- // going to trigger set did_anybody_stop_for_a_reason
- // to true unless this is the first stop.
+ // going to trigger set did_anybody_stop_for_a_reason to true unless this
+ // is the first stop.
//
// If this becomes a problem, we'll have to have another StopReason like
- // "StopInfoHidden" which will look invalid
- // everywhere but at this check.
+ // "StopInfoHidden" which will look invalid everywhere but at this check.
if (thread_sp->GetProcess()->GetStopID() > 1)
did_anybody_stop_for_a_reason = true;
@@ -379,8 +370,8 @@ Vote ThreadList::ShouldReportStop(Event
log->Printf("ThreadList::%s %" PRIu64 " threads", __FUNCTION__,
(uint64_t)m_threads.size());
- // Run through the threads and ask whether we should report this event.
- // For stopping, a YES vote wins over everything. A NO vote wins over NO
+ // Run through the threads and ask whether we should report this event. For
+ // stopping, a YES vote wins over everything. A NO vote wins over NO
// opinion.
for (pos = m_threads.begin(); pos != end; ++pos) {
ThreadSP thread_sp(*pos);
@@ -427,8 +418,8 @@ Vote ThreadList::ShouldReportRun(Event *
m_process->UpdateThreadListIfNeeded();
collection::iterator pos, end = m_threads.end();
- // Run through the threads and ask whether we should report this event.
- // The rule is NO vote wins over everything, a YES vote wins over no opinion.
+ // Run through the threads and ask whether we should report this event. The
+ // rule is NO vote wins over everything, a YES vote wins over no opinion.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
@@ -485,8 +476,8 @@ void ThreadList::RefreshStateAfterStop()
}
void ThreadList::DiscardThreadPlans() {
- // You don't need to update the thread list here, because only threads
- // that you currently know about have any thread plans.
+ // You don't need to update the thread list here, because only threads that
+ // you currently know about have any thread plans.
std::lock_guard<std::recursive_mutex> guard(GetMutex());
collection::iterator pos, end = m_threads.end();
@@ -495,9 +486,9 @@ void ThreadList::DiscardThreadPlans() {
}
bool ThreadList::WillResume() {
- // Run through the threads and perform their momentary actions.
- // But we only do this for threads that are running, user suspended
- // threads stay where they are.
+ // Run through the threads and perform their momentary actions. But we only
+ // do this for threads that are running, user suspended threads stay where
+ // they are.
std::lock_guard<std::recursive_mutex> guard(GetMutex());
m_process->UpdateThreadListIfNeeded();
@@ -505,14 +496,11 @@ bool ThreadList::WillResume() {
collection::iterator pos, end = m_threads.end();
// See if any thread wants to run stopping others. If it does, then we won't
- // setup the other threads for resume, since they aren't going to get a chance
- // to run. This is necessary because the SetupForResume might add
- // "StopOthers"
- // plans which would then get to be part of the who-gets-to-run negotiation,
- // but
- // they're coming in after the fact, and the threads that are already set up
- // should
- // take priority.
+ // setup the other threads for resume, since they aren't going to get a
+ // chance to run. This is necessary because the SetupForResume might add
+ // "StopOthers" plans which would then get to be part of the who-gets-to-run
+ // negotiation, but they're coming in after the fact, and the threads that
+ // are already set up should take priority.
bool wants_solo_run = false;
@@ -544,11 +532,9 @@ bool ThreadList::WillResume() {
}
// Give all the threads that are likely to run a last chance to set up their
- // state before we
- // negotiate who is actually going to get a chance to run...
+ // state before we negotiate who is actually going to get a chance to run...
// Don't set to resume suspended threads, and if any thread wanted to stop
- // others, only
- // call setup on the threads that request StopOthers...
+ // others, only call setup on the threads that request StopOthers...
for (pos = m_threads.begin(); pos != end; ++pos) {
if ((*pos)->GetResumeState() != eStateSuspended &&
@@ -650,13 +636,12 @@ void ThreadList::DidStop() {
std::lock_guard<std::recursive_mutex> guard(GetMutex());
collection::iterator pos, end = m_threads.end();
for (pos = m_threads.begin(); pos != end; ++pos) {
- // Notify threads that the process just stopped.
- // Note, this currently assumes that all threads in the list
- // stop when the process stops. In the future we will want to support
- // a debugging model where some threads continue to run while others
- // are stopped. We either need to handle that somehow here or
- // create a special thread list containing only threads which will
- // stop in the code that calls this method (currently
+ // Notify threads that the process just stopped. Note, this currently
+ // assumes that all threads in the list stop when the process stops. In
+ // the future we will want to support a debugging model where some threads
+ // continue to run while others are stopped. We either need to handle that
+ // somehow here or create a special thread list containing only threads
+ // which will stop in the code that calls this method (currently
// Process::SetPrivateState).
ThreadSP thread_sp(*pos);
if (StateIsRunningState(thread_sp->GetState()))
@@ -717,8 +702,8 @@ void ThreadList::NotifySelectedThreadCha
void ThreadList::Update(ThreadList &rhs) {
if (this != &rhs) {
- // Lock both mutexes to make sure neither side changes anyone on us
- // while the assignment occurs
+ // Lock both mutexes to make sure neither side changes anyone on us while
+ // the assignment occurs
std::lock_guard<std::recursive_mutex> guard(GetMutex());
m_process = rhs.m_process;
@@ -726,13 +711,12 @@ void ThreadList::Update(ThreadList &rhs)
m_threads.swap(rhs.m_threads);
m_selected_tid = rhs.m_selected_tid;
- // Now we look for threads that we are done with and
- // make sure to clear them up as much as possible so
- // anyone with a shared pointer will still have a reference,
- // but the thread won't be of much use. Using std::weak_ptr
- // for all backward references (such as a thread to a process)
- // will eventually solve this issue for us, but for now, we
- // need to work around the issue
+ // Now we look for threads that we are done with and make sure to clear
+ // them up as much as possible so anyone with a shared pointer will still
+ // have a reference, but the thread won't be of much use. Using
+ // std::weak_ptr for all backward references (such as a thread to a
+ // process) will eventually solve this issue for us, but for now, we need
+ // to work around the issue
collection::iterator rhs_pos, rhs_end = rhs.m_threads.end();
for (rhs_pos = rhs.m_threads.begin(); rhs_pos != rhs_end; ++rhs_pos) {
const lldb::tid_t tid = (*rhs_pos)->GetID();
Modified: lldb/trunk/source/Target/ThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlan.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlan.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlan.cpp Mon Apr 30 09:49:04 2018
@@ -100,8 +100,8 @@ bool ThreadPlan::StopOthers() {
}
void ThreadPlan::SetStopOthers(bool new_value) {
- // SetStopOthers doesn't work up the hierarchy. You have to set the
- // explicit ThreadPlan you want to affect.
+ // SetStopOthers doesn't work up the hierarchy. You have to set the explicit
+ // ThreadPlan you want to affect.
}
bool ThreadPlan::WillResume(StateType resume_state, bool current_plan) {
Modified: lldb/trunk/source/Target/ThreadPlanBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanBase.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanBase.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanBase.cpp Mon Apr 30 09:49:04 2018
@@ -28,8 +28,8 @@ using namespace lldb;
using namespace lldb_private;
//----------------------------------------------------------------------
-// ThreadPlanBase: This one always stops, and never has anything particular
-// to do.
+// ThreadPlanBase: This one always stops, and never has anything particular to
+// do.
// FIXME: The "signal handling" policies should probably go here.
//----------------------------------------------------------------------
@@ -59,8 +59,8 @@ void ThreadPlanBase::GetDescription(Stre
bool ThreadPlanBase::ValidatePlan(Stream *error) { return true; }
bool ThreadPlanBase::DoPlanExplainsStop(Event *event_ptr) {
- // The base plan should defer to its tracer, since by default it
- // always handles the stop.
+ // The base plan should defer to its tracer, since by default it always
+ // handles the stop.
if (TracerExplainsStop())
return false;
else
@@ -99,10 +99,9 @@ bool ThreadPlanBase::ShouldStop(Event *e
case eStopReasonBreakpoint:
case eStopReasonWatchpoint:
if (stop_info_sp->ShouldStopSynchronous(event_ptr)) {
- // If we are going to stop for a breakpoint, then unship the other plans
- // at this point. Don't force the discard, however, so Master plans can
- // stay
- // in place if they want to.
+ // If we are going to stop for a breakpoint, then unship the other
+ // plans at this point. Don't force the discard, however, so Master
+ // plans can stay in place if they want to.
if (log)
log->Printf(
"Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
@@ -112,9 +111,8 @@ bool ThreadPlanBase::ShouldStop(Event *e
return true;
}
// If we aren't going to stop at this breakpoint, and it is internal,
- // don't report this stop or the subsequent running event.
- // Otherwise we will post the stopped & running, but the stopped event
- // will get marked
+ // don't report this stop or the subsequent running event. Otherwise we
+ // will post the stopped & running, but the stopped event will get marked
// with "restarted" so the UI will know to wait and expect the consequent
// "running".
if (stop_info_sp->ShouldNotify(event_ptr)) {
@@ -131,10 +129,9 @@ bool ThreadPlanBase::ShouldStop(Event *e
break;
case eStopReasonException:
- // If we crashed, discard thread plans and stop. Don't force the discard,
- // however,
- // since on rerun the target may clean up this exception and continue
- // normally from there.
+ // If we crashed, discard thread plans and stop. Don't force the
+ // discard, however, since on rerun the target may clean up this
+ // exception and continue normally from there.
if (log)
log->Printf(
"Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
@@ -144,10 +141,9 @@ bool ThreadPlanBase::ShouldStop(Event *e
return true;
case eStopReasonExec:
- // If we crashed, discard thread plans and stop. Don't force the discard,
- // however,
- // since on rerun the target may clean up this exception and continue
- // normally from there.
+ // If we crashed, discard thread plans and stop. Don't force the
+ // discard, however, since on rerun the target may clean up this
+ // exception and continue normally from there.
if (log)
log->Printf(
"Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
@@ -198,8 +194,7 @@ bool ThreadPlanBase::WillStop() { return
bool ThreadPlanBase::DoWillResume(lldb::StateType resume_state,
bool current_plan) {
// Reset these to the default values so we don't set them wrong, then not get
- // asked
- // for a while, then return the wrong answer.
+ // asked for a while, then return the wrong answer.
m_run_vote = eVoteNoOpinion;
m_stop_vote = eVoteNo;
return true;
Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Mon Apr 30 09:49:04 2018
@@ -56,8 +56,7 @@ bool ThreadPlanCallFunction::Constructor
m_function_sp = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize();
// If we can't read memory at the point of the process where we are planning
- // to put our function, we're
- // not going to get any further...
+ // to put our function, we're not going to get any further...
Status error;
process_sp->ReadUnsignedIntegerFromMemory(m_function_sp, 4, 0, error);
if (!error.Success()) {
@@ -278,9 +277,8 @@ bool ThreadPlanCallFunction::DoPlanExpla
LIBLLDB_LOG_PROCESS));
m_real_stop_info_sp = GetPrivateStopInfo();
- // If our subplan knows why we stopped, even if it's done (which would forward
- // the question to us)
- // we answer yes.
+ // If our subplan knows why we stopped, even if it's done (which would
+ // forward the question to us) we answer yes.
if (m_subplan_sp && m_subplan_sp->PlanExplainsStop(event_ptr)) {
SetPlanComplete();
return true;
@@ -302,8 +300,8 @@ bool ThreadPlanCallFunction::DoPlanExpla
return true;
// One more quirk here. If this event was from Halt interrupting the target,
- // then we should not consider
- // ourselves complete. Return true to acknowledge the stop.
+ // then we should not consider ourselves complete. Return true to
+ // acknowledge the stop.
if (Process::ProcessEventData::GetInterruptedFromEvent(event_ptr)) {
if (log)
log->Printf("ThreadPlanCallFunction::PlanExplainsStop: The event is an "
@@ -312,8 +310,8 @@ bool ThreadPlanCallFunction::DoPlanExpla
}
// We control breakpoints separately from other "stop reasons." So first,
// check the case where we stopped for an internal breakpoint, in that case,
- // continue on.
- // If it is not an internal breakpoint, consult m_ignore_breakpoints.
+ // continue on. If it is not an internal breakpoint, consult
+ // m_ignore_breakpoints.
if (stop_reason == eStopReasonBreakpoint) {
ProcessSP process_sp(m_thread.CalculateProcess());
@@ -364,15 +362,13 @@ bool ThreadPlanCallFunction::DoPlanExpla
// should be propagated up the stack.
return false;
} else {
- // If the subplan is running, any crashes are attributable to us.
- // If we want to discard the plan, then we say we explain the stop
- // but if we are going to be discarded, let whoever is above us
- // explain the stop.
- // But don't discard the plan if the stop would restart itself (for instance
- // if it is a
- // signal that is set not to stop. Check that here first. We just say we
- // explain the stop
- // but aren't done and everything will continue on from there.
+ // If the subplan is running, any crashes are attributable to us. If we
+ // want to discard the plan, then we say we explain the stop but if we are
+ // going to be discarded, let whoever is above us explain the stop. But
+ // don't discard the plan if the stop would restart itself (for instance if
+ // it is a signal that is set not to stop. Check that here first. We just
+ // say we explain the stop but aren't done and everything will continue on
+ // from there.
if (m_real_stop_info_sp &&
m_real_stop_info_sp->ShouldStopSynchronous(event_ptr)) {
@@ -385,8 +381,8 @@ bool ThreadPlanCallFunction::DoPlanExpla
bool ThreadPlanCallFunction::ShouldStop(Event *event_ptr) {
// We do some computation in DoPlanExplainsStop that may or may not set the
- // plan as complete.
- // We need to do that here to make sure our state is correct.
+ // plan as complete. We need to do that here to make sure our state is
+ // correct.
DoPlanExplainsStop(event_ptr);
if (IsPlanComplete()) {
@@ -405,9 +401,8 @@ void ThreadPlanCallFunction::DidPush() {
//#define SINGLE_STEP_EXPRESSIONS
// Now set the thread state to "no reason" so we don't run with whatever
- // signal was outstanding...
- // Wait till the plan is pushed so we aren't changing the stop info till we're
- // about to run.
+ // signal was outstanding... Wait till the plan is pushed so we aren't
+ // changing the stop info till we're about to run.
GetThread().SetStopInfoToNothing();
@@ -483,10 +478,9 @@ bool ThreadPlanCallFunction::Breakpoints
SetPlanComplete(false);
- // If the user has set the ObjC language breakpoint, it would normally get
- // priority over our internal
- // catcher breakpoint, but in this case we can't let that happen, so force
- // the ShouldStop here.
+ // If the user has set the ObjC language breakpoint, it would normally
+ // get priority over our internal catcher breakpoint, but in this case we
+ // can't let that happen, so force the ShouldStop here.
stop_info_sp->OverrideShouldStop(true);
return true;
}
Modified: lldb/trunk/source/Target/ThreadPlanCallOnFunctionExit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallOnFunctionExit.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallOnFunctionExit.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallOnFunctionExit.cpp Mon Apr 30 09:49:04 2018
@@ -23,8 +23,8 @@ ThreadPlanCallOnFunctionExit::ThreadPlan
}
void ThreadPlanCallOnFunctionExit::DidPush() {
- // We now want to queue the "step out" thread plan so it executes
- // and completes.
+ // We now want to queue the "step out" thread plan so it executes and
+ // completes.
// Set stop vote to eVoteNo.
m_step_out_threadplan_sp = GetThread().QueueThreadPlanForStepOut(
@@ -59,9 +59,9 @@ bool ThreadPlanCallOnFunctionExit::Valid
}
bool ThreadPlanCallOnFunctionExit::ShouldStop(Event *event_ptr) {
- // If this is where we find out that an internal stop came in, then:
- // Check if the step-out plan completed. If it did, then we want to
- // run the callback here (our reason for living...)
+ // If this is where we find out that an internal stop came in, then: Check if
+ // the step-out plan completed. If it did, then we want to run the callback
+ // here (our reason for living...)
if (m_step_out_threadplan_sp && m_step_out_threadplan_sp->IsPlanComplete()) {
m_callback();
@@ -71,8 +71,8 @@ bool ThreadPlanCallOnFunctionExit::Shoul
// Indicate that this plan is done and can be discarded.
SetPlanComplete();
- // We're done now, but we want to return false so that we
- // don't cause the thread to really stop.
+ // We're done now, but we want to return false so that we don't cause the
+ // thread to really stop.
}
return false;
@@ -80,21 +80,20 @@ bool ThreadPlanCallOnFunctionExit::Shoul
bool ThreadPlanCallOnFunctionExit::WillStop() {
// The code looks like the return value is ignored via ThreadList::
- // ShouldStop().
- // This is called when we really are going to stop. We don't care
- // and don't need to do anything here.
+ // ShouldStop(). This is called when we really are going to stop. We don't
+ // care and don't need to do anything here.
return false;
}
bool ThreadPlanCallOnFunctionExit::DoPlanExplainsStop(Event *event_ptr) {
- // We don't ever explain a stop. The only stop that is relevant
- // to us directly is the step_out plan we added to do the heavy lifting
- // of getting us past the current method.
+ // We don't ever explain a stop. The only stop that is relevant to us
+ // directly is the step_out plan we added to do the heavy lifting of getting
+ // us past the current method.
return false;
}
lldb::StateType ThreadPlanCallOnFunctionExit::GetPlanRunState() {
- // This value doesn't matter - we'll never be the top thread plan, so
- // nobody will ask us this question.
+ // This value doesn't matter - we'll never be the top thread plan, so nobody
+ // will ask us this question.
return eStateRunning;
}
Modified: lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp Mon Apr 30 09:49:04 2018
@@ -44,8 +44,8 @@ ThreadPlanCallUserExpression::ThreadPlan
lldb::UserExpressionSP &user_expression_sp)
: ThreadPlanCallFunction(thread, function, CompilerType(), args, options),
m_user_expression_sp(user_expression_sp) {
- // User expressions are generally "User generated" so we should set them up to
- // stop when done.
+ // User expressions are generally "User generated" so we should set them up
+ // to stop when done.
SetIsMasterPlan(true);
SetOkayToDiscard(false);
}
Modified: lldb/trunk/source/Target/ThreadPlanPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanPython.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanPython.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanPython.cpp Mon Apr 30 09:49:04 2018
@@ -59,8 +59,7 @@ bool ThreadPlanPython::ValidatePlan(Stre
void ThreadPlanPython::DidPush() {
// We set up the script side in DidPush, so that it can push other plans in
- // the constructor,
- // and doesn't have to care about the details of DidPush.
+ // the constructor, and doesn't have to care about the details of DidPush.
if (!m_class_name.empty()) {
ScriptInterpreter *script_interp = m_thread.GetProcess()
Modified: lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp Mon Apr 30 09:49:04 2018
@@ -133,8 +133,7 @@ void ThreadPlanRunToAddress::GetDescript
}
bool ThreadPlanRunToAddress::ValidatePlan(Stream *error) {
- // If we couldn't set the breakpoint for some reason, then this won't
- // work.
+ // If we couldn't set the breakpoint for some reason, then this won't work.
bool all_bps_good = true;
size_t num_break_ids = m_break_ids.size();
Modified: lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp Mon Apr 30 09:49:04 2018
@@ -86,8 +86,8 @@ bool ThreadPlanShouldStopHere::DefaultSh
// Always avoid code with line number 0.
// FIXME: At present the ShouldStop and the StepFromHere calculate this
// independently. If this ever
- // becomes expensive (this one isn't) we can try to have this set a state that
- // the StepFromHere can use.
+ // becomes expensive (this one isn't) we can try to have this set a state
+ // that the StepFromHere can use.
if (frame) {
SymbolContext sc;
sc = frame->GetSymbolContext(eSymbolContextLineEntry);
@@ -104,9 +104,8 @@ ThreadPlanSP ThreadPlanShouldStopHere::D
const bool stop_others = false;
const size_t frame_index = 0;
ThreadPlanSP return_plan_sp;
- // If we are stepping through code at line number 0, then we need to step over
- // this range. Otherwise
- // we will step out.
+ // If we are stepping through code at line number 0, then we need to step
+ // over this range. Otherwise we will step out.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get();
@@ -119,8 +118,7 @@ ThreadPlanSP ThreadPlanShouldStopHere::D
AddressRange range = sc.line_entry.range;
// If the whole function is marked line 0 just step out, that's easier &
- // faster than continuing
- // to step through it.
+ // faster than continuing to step through it.
bool just_step_out = false;
if (sc.symbol && sc.symbol->ValueIsAddress()) {
Address symbol_end = sc.symbol->GetAddress();
Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Mon Apr 30 09:49:04 2018
@@ -35,8 +35,7 @@ uint32_t ThreadPlanStepInRange::s_defaul
//----------------------------------------------------------------------
// ThreadPlanStepInRange: Step through a stack range, either stepping over or
-// into
-// based on the value of \a type.
+// into based on the value of \a type.
//----------------------------------------------------------------------
ThreadPlanStepInRange::ThreadPlanStepInRange(
@@ -164,15 +163,14 @@ bool ThreadPlanStepInRange::ShouldStop(E
if (m_virtual_step) {
// If we've just completed a virtual step, all we need to do is check for a
- // ShouldStopHere plan, and otherwise
- // we're done.
+ // ShouldStopHere plan, and otherwise we're done.
// FIXME - This can be both a step in and a step out. Probably should
// record which in the m_virtual_step.
m_sub_plan_sp = CheckShouldStopHereAndQueueStepOut(eFrameCompareYounger);
} else {
// Stepping through should be done running other threads in general, since
- // we're setting a breakpoint and
- // continuing. So only stop others if we are explicitly told to do so.
+ // we're setting a breakpoint and continuing. So only stop others if we
+ // are explicitly told to do so.
bool stop_others = (m_stop_others == lldb::eOnlyThisThread);
@@ -185,9 +183,8 @@ bool ThreadPlanStepInRange::ShouldStop(E
// A caveat to this is if we think the frame is older but we're actually
// in a trampoline.
// I'm going to make the assumption that you wouldn't RETURN to a
- // trampoline. So if we are
- // in a trampoline we think the frame is older because the trampoline
- // confused the backtracer.
+ // trampoline. So if we are in a trampoline we think the frame is older
+ // because the trampoline confused the backtracer.
m_sub_plan_sp = m_thread.QueueThreadPlanForStepThrough(m_stack_id, false,
stop_others);
if (!m_sub_plan_sp) {
@@ -204,19 +201,15 @@ bool ThreadPlanStepInRange::ShouldStop(E
"Thought I stepped out, but in fact arrived at a trampoline.");
}
} else if (frame_order == eFrameCompareEqual && InSymbol()) {
- // If we are not in a place we should step through, we're done.
- // One tricky bit here is that some stubs don't push a frame, so we have
- // to check
- // both the case of a frame that is younger, or the same as this frame.
- // However, if the frame is the same, and we are still in the symbol we
- // started
- // in, the we don't need to do this. This first check isn't strictly
- // necessary,
- // but it is more efficient.
+ // If we are not in a place we should step through, we're done. One
+ // tricky bit here is that some stubs don't push a frame, so we have to
+ // check both the case of a frame that is younger, or the same as this
+ // frame. However, if the frame is the same, and we are still in the
+ // symbol we started in, the we don't need to do this. This first check
+ // isn't strictly necessary, but it is more efficient.
// If we're still in the range, keep going, either by running to the next
- // branch breakpoint, or by
- // stepping.
+ // branch breakpoint, or by stepping.
if (InRange()) {
SetNextBranchBreakpoint();
return false;
@@ -244,15 +237,13 @@ bool ThreadPlanStepInRange::ShouldStop(E
log->Printf("No step through plan found.");
}
- // If not, give the "should_stop" callback a chance to push a plan to get us
- // out of here.
- // But only do that if we actually have stepped in.
+ // If not, give the "should_stop" callback a chance to push a plan to get
+ // us out of here. But only do that if we actually have stepped in.
if (!m_sub_plan_sp && frame_order == eFrameCompareYounger)
m_sub_plan_sp = CheckShouldStopHereAndQueueStepOut(frame_order);
// If we've stepped in and we are going to stop here, check to see if we
- // were asked to
- // run past the prologue, and if so do that.
+ // were asked to run past the prologue, and if so do that.
if (!m_sub_plan_sp && frame_order == eFrameCompareYounger &&
m_step_past_prologue) {
@@ -413,8 +404,8 @@ bool ThreadPlanStepInRange::DefaultShoul
SymbolContext sc = frame->GetSymbolContext(
eSymbolContextFunction | eSymbolContextBlock | eSymbolContextSymbol);
if (sc.symbol != nullptr) {
- // First try an exact match, since that's cheap with ConstStrings. Then
- // do a strstr compare.
+ // First try an exact match, since that's cheap with ConstStrings.
+ // Then do a strstr compare.
if (step_in_range_plan->m_step_into_target == sc.GetFunctionName()) {
should_stop_here = true;
} else {
@@ -449,25 +440,19 @@ bool ThreadPlanStepInRange::DefaultShoul
bool ThreadPlanStepInRange::DoPlanExplainsStop(Event *event_ptr) {
// We always explain a stop. Either we've just done a single step, in which
- // case we'll do our ordinary processing, or we stopped for some
- // reason that isn't handled by our sub-plans, in which case we want to just
- // stop right
- // away.
- // In general, we don't want to mark the plan as complete for unexplained
- // stops.
- // For instance, if you step in to some code with no debug info, so you step
- // out
- // and in the course of that hit a breakpoint, then you want to stop & show
- // the user
- // the breakpoint, but not unship the step in plan, since you still may want
- // to complete that
- // plan when you continue. This is particularly true when doing "step in to
- // target function."
+ // case we'll do our ordinary processing, or we stopped for some reason that
+ // isn't handled by our sub-plans, in which case we want to just stop right
+ // away. In general, we don't want to mark the plan as complete for
+ // unexplained stops. For instance, if you step in to some code with no debug
+ // info, so you step out and in the course of that hit a breakpoint, then you
+ // want to stop & show the user the breakpoint, but not unship the step in
+ // plan, since you still may want to complete that plan when you continue.
+ // This is particularly true when doing "step in to target function."
// stepping.
//
- // The only variation is that if we are doing "step by running to next branch"
- // in which case
- // if we hit our branch breakpoint we don't set the plan to complete.
+ // The only variation is that if we are doing "step by running to next
+ // branch" in which case if we hit our branch breakpoint we don't set the
+ // plan to complete.
bool return_value = false;
Modified: lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp Mon Apr 30 09:49:04 2018
@@ -76,8 +76,8 @@ void ThreadPlanStepInstruction::GetDescr
}
bool ThreadPlanStepInstruction::ValidatePlan(Stream *error) {
- // Since we read the instruction we're stepping over from the thread,
- // this plan will always work.
+ // Since we read the instruction we're stepping over from the thread, this
+ // plan will always work.
return true;
}
@@ -106,8 +106,8 @@ bool ThreadPlanStepInstruction::IsPlanSt
return (m_thread.GetRegisterContext()->GetPC(0) != m_instruction_addr);
} else if (cur_frame_id < m_stack_id) {
// If the current frame is younger than the start frame and we are stepping
- // over, then we need to continue,
- // but if we are doing just one step, we're done.
+ // over, then we need to continue, but if we are doing just one step, we're
+ // done.
return !m_step_over;
} else {
if (log) {
@@ -140,8 +140,7 @@ bool ThreadPlanStepInstruction::ShouldSt
return true;
} else {
// We are still stepping, reset the start pc, and in case we've
- // stepped out,
- // reset the current stack id.
+ // stepped out, reset the current stack id.
SetUpState();
return false;
}
@@ -154,9 +153,8 @@ bool ThreadPlanStepInstruction::ShouldSt
if (return_frame->GetStackID() != m_parent_frame_id ||
m_start_has_symbol) {
// next-instruction shouldn't step out of inlined functions. But we
- // may have stepped into a
- // real function that starts with an inlined function, and we do want
- // to step out of that...
+ // may have stepped into a real function that starts with an inlined
+ // function, and we do want to step out of that...
if (cur_frame_sp->IsInlined()) {
StackFrameSP parent_frame_sp =
@@ -190,9 +188,8 @@ bool ThreadPlanStepInstruction::ShouldSt
log->Printf("%s.", s.GetData());
}
- // StepInstruction should probably have the tri-state RunMode, but for
- // now it is safer to
- // run others.
+ // StepInstruction should probably have the tri-state RunMode, but
+ // for now it is safer to run others.
const bool stop_others = false;
m_thread.QueueThreadPlanForStepOutNoShouldStop(
false, nullptr, true, stop_others, eVoteNo, eVoteNoOpinion, 0);
@@ -222,8 +219,7 @@ bool ThreadPlanStepInstruction::ShouldSt
return true;
} else {
// We are still stepping, reset the start pc, and in case we've stepped
- // in or out,
- // reset the current stack id.
+ // in or out, reset the current stack id.
SetUpState();
return false;
}
Modified: lldb/trunk/source/Target/ThreadPlanStepOut.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOut.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOut.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOut.cpp Mon Apr 30 09:49:04 2018
@@ -63,17 +63,14 @@ ThreadPlanStepOut::ThreadPlanStepOut(
m_step_out_to_id = return_frame_sp->GetStackID();
m_immediate_step_from_id = immediate_return_from_sp->GetStackID();
- // If the frame directly below the one we are returning to is inlined, we have
- // to be
- // a little more careful. It is non-trivial to determine the real "return
- // code address" for
- // an inlined frame, so we have to work our way to that frame and then step
- // out.
+ // If the frame directly below the one we are returning to is inlined, we
+ // have to be a little more careful. It is non-trivial to determine the real
+ // "return code address" for an inlined frame, so we have to work our way to
+ // that frame and then step out.
if (immediate_return_from_sp && immediate_return_from_sp->IsInlined()) {
if (frame_idx > 0) {
// First queue a plan that gets us to this inlined frame, and when we get
- // there we'll queue a second
- // plan that walks us out of this frame.
+ // there we'll queue a second plan that walks us out of this frame.
m_step_out_to_inline_plan_sp.reset(new ThreadPlanStepOut(
m_thread, nullptr, false, stop_others, eVoteNoOpinion, eVoteNoOpinion,
frame_idx - 1, eLazyBoolNo, continue_to_next_branch));
@@ -81,8 +78,8 @@ ThreadPlanStepOut::ThreadPlanStepOut(
->SetShouldStopHereCallbacks(nullptr, nullptr);
m_step_out_to_inline_plan_sp->SetPrivate(true);
} else {
- // If we're already at the inlined frame we're stepping through, then just
- // do that now.
+ // If we're already at the inlined frame we're stepping through, then
+ // just do that now.
QueueInlinedStepPlan(false);
}
} else if (return_frame_sp) {
@@ -217,8 +214,8 @@ bool ThreadPlanStepOut::ValidatePlan(Str
}
bool ThreadPlanStepOut::DoPlanExplainsStop(Event *event_ptr) {
- // If the step out plan is done, then we just need to step through the inlined
- // frame.
+ // If the step out plan is done, then we just need to step through the
+ // inlined frame.
if (m_step_out_to_inline_plan_sp) {
return m_step_out_to_inline_plan_sp->MischiefManaged();
} else if (m_step_through_inline_plan_sp) {
@@ -233,15 +230,14 @@ bool ThreadPlanStepOut::DoPlanExplainsSt
}
// We don't explain signals or breakpoints (breakpoints that handle stepping
- // in or
- // out will be handled by a child plan.
+ // in or out will be handled by a child plan.
StopInfoSP stop_info_sp = GetPrivateStopInfo();
if (stop_info_sp) {
StopReason reason = stop_info_sp->GetStopReason();
if (reason == eStopReasonBreakpoint) {
- // If this is OUR breakpoint, we're fine, otherwise we don't know why this
- // happened...
+ // If this is OUR breakpoint, we're fine, otherwise we don't know why
+ // this happened...
BreakpointSiteSP site_sp(
m_thread.GetProcess()->GetBreakpointSiteList().FindByID(
stop_info_sp->GetValue()));
@@ -268,11 +264,10 @@ bool ThreadPlanStepOut::DoPlanExplainsSt
}
// If there was only one owner, then we're done. But if we also hit
- // some
- // user breakpoint on our way out, we should mark ourselves as done, but
- // also not claim to explain the stop, since it is more important to
- // report
- // the user breakpoint than the step out completion.
+ // some user breakpoint on our way out, we should mark ourselves as
+ // done, but also not claim to explain the stop, since it is more
+ // important to report the user breakpoint than the step out
+ // completion.
if (site_sp->GetNumberOfOwners() == 1)
return true;
@@ -320,9 +315,8 @@ bool ThreadPlanStepOut::ShouldStop(Event
done = !(frame_zero_id < m_step_out_to_id);
}
- // The normal step out computations think we are done, so all we need to do is
- // consult the ShouldStopHere,
- // and we are done.
+ // The normal step out computations think we are done, so all we need to do
+ // is consult the ShouldStopHere, and we are done.
if (done) {
if (InvokeShouldStopHereCallback(eFrameCompareOlder)) {
@@ -377,8 +371,7 @@ bool ThreadPlanStepOut::MischiefManaged(
// I also check the stack depth, since if we've blown past the breakpoint
// for some
// reason and we're now stopping for some other reason altogether, then
- // we're done
- // with this step out operation.
+ // we're done with this step out operation.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (log)
@@ -397,10 +390,8 @@ bool ThreadPlanStepOut::MischiefManaged(
bool ThreadPlanStepOut::QueueInlinedStepPlan(bool queue_now) {
// Now figure out the range of this inlined block, and set up a "step through
- // range"
- // plan for that. If we've been provided with a context, then use the block
- // in that
- // context.
+ // range" plan for that. If we've been provided with a context, then use the
+ // block in that context.
StackFrameSP immediate_return_from_sp(m_thread.GetStackFrameAtIndex(0));
if (!immediate_return_from_sp)
return false;
@@ -477,8 +468,8 @@ void ThreadPlanStepOut::CalculateReturnV
}
bool ThreadPlanStepOut::IsPlanStale() {
- // If we are still lower on the stack than the frame we are returning to, then
- // there's something for us to do. Otherwise, we're stale.
+ // If we are still lower on the stack than the frame we are returning to,
+ // then there's something for us to do. Otherwise, we're stale.
StackID frame_zero_id = m_thread.GetStackFrameAtIndex(0)->GetStackID();
return !(frame_zero_id < m_step_out_to_id);
Modified: lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp Mon Apr 30 09:49:04 2018
@@ -31,8 +31,8 @@ ThreadPlanStepOverBreakpoint::ThreadPlan
ThreadPlan::eKindStepOverBreakpoint, "Step over breakpoint trap",
thread, eVoteNo,
eVoteNoOpinion), // We need to report the run since this happens
- // first in the thread plan stack when stepping
- // over a breakpoint
+ // first in the thread plan stack when stepping over
+ // a breakpoint
m_breakpoint_addr(LLDB_INVALID_ADDRESS),
m_auto_continue(false), m_reenabled_breakpoint_site(false)
@@ -57,16 +57,15 @@ bool ThreadPlanStepOverBreakpoint::DoPla
StopInfoSP stop_info_sp = GetPrivateStopInfo();
if (stop_info_sp) {
// It's a little surprising that we stop here for a breakpoint hit.
- // However, when you single step ONTO a breakpoint
- // we still want to call that a breakpoint hit, and trigger the actions,
- // etc. Otherwise you would see the
+ // However, when you single step ONTO a breakpoint we still want to call
+ // that a breakpoint hit, and trigger the actions, etc. Otherwise you
+ // would see the
// PC at the breakpoint without having triggered the actions, then you'd
// continue, the PC wouldn't change,
- // and you'd see the breakpoint hit, which would be odd.
- // So the lower levels fake "step onto breakpoint address" and return that
- // as a breakpoint. So our trace
- // step COULD appear as a breakpoint hit if the next instruction also
- // contained a breakpoint.
+ // and you'd see the breakpoint hit, which would be odd. So the lower
+ // levels fake "step onto breakpoint address" and return that as a
+ // breakpoint. So our trace step COULD appear as a breakpoint hit if the
+ // next instruction also contained a breakpoint.
StopReason reason = stop_info_sp->GetStopReason();
switch (reason) {
@@ -75,20 +74,17 @@ bool ThreadPlanStepOverBreakpoint::DoPla
return true;
case eStopReasonBreakpoint:
// It's a little surprising that we stop here for a breakpoint hit.
- // However, when you single step ONTO a
- // breakpoint we still want to call that a breakpoint hit, and trigger the
- // actions, etc. Otherwise you
+ // However, when you single step ONTO a breakpoint we still want to call
+ // that a breakpoint hit, and trigger the actions, etc. Otherwise you
// would see the PC at the breakpoint without having triggered the
- // actions, then you'd continue, the PC
- // wouldn't change, and you'd see the breakpoint hit, which would be odd.
- // So the lower levels fake "step onto breakpoint address" and return that
- // as a breakpoint hit. So our trace
- // step COULD appear as a breakpoint hit if the next instruction also
- // contained a breakpoint. We don't want
- // to handle that, since we really don't know what to do with breakpoint
- // hits. But make sure we don't set
- // ourselves to auto-continue or we'll wrench control away from the plans
- // that can deal with this.
+ // actions, then you'd continue, the PC wouldn't change, and you'd see
+ // the breakpoint hit, which would be odd. So the lower levels fake "step
+ // onto breakpoint address" and return that as a breakpoint hit. So our
+ // trace step COULD appear as a breakpoint hit if the next instruction
+ // also contained a breakpoint. We don't want to handle that, since we
+ // really don't know what to do with breakpoint hits. But make sure we
+ // don't set ourselves to auto-continue or we'll wrench control away from
+ // the plans that can deal with this.
SetAutoContinue(false);
return false;
default:
@@ -130,8 +126,7 @@ bool ThreadPlanStepOverBreakpoint::Misch
if (pc_addr == m_breakpoint_addr) {
// If we are still at the PC of our breakpoint, then for some reason we
- // didn't
- // get a chance to run.
+ // didn't get a chance to run.
return false;
} else {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Modified: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Mon Apr 30 09:49:04 2018
@@ -32,8 +32,7 @@ uint32_t ThreadPlanStepOverRange::s_defa
//----------------------------------------------------------------------
// ThreadPlanStepOverRange: Step through a stack range, either stepping over or
-// into
-// based on the value of \a type.
+// into based on the value of \a type.
//----------------------------------------------------------------------
ThreadPlanStepOverRange::ThreadPlanStepOverRange(
@@ -91,21 +90,17 @@ void ThreadPlanStepOverRange::SetupAvoid
else
GetFlags().Clear(ThreadPlanShouldStopHere::eStepOutAvoidNoDebug);
// Step Over plans should always avoid no-debug on step in. Seems like you
- // shouldn't
- // have to say this, but a tail call looks more like a step in that a step
- // out, so
- // we want to catch this case.
+ // shouldn't have to say this, but a tail call looks more like a step in that
+ // a step out, so we want to catch this case.
GetFlags().Set(ThreadPlanShouldStopHere::eStepInAvoidNoDebug);
}
bool ThreadPlanStepOverRange::IsEquivalentContext(
const SymbolContext &context) {
- // Match as much as is specified in the m_addr_context:
- // This is a fairly loose sanity check. Note, sometimes the target doesn't
- // get filled
- // in so I left out the target check. And sometimes the module comes in as
- // the .o file from the
- // inlined range, so I left that out too...
+ // Match as much as is specified in the m_addr_context: This is a fairly
+ // loose sanity check. Note, sometimes the target doesn't get filled in so I
+ // left out the target check. And sometimes the module comes in as the .o
+ // file from the inlined range, so I left that out too...
if (m_addr_context.comp_unit) {
if (m_addr_context.comp_unit != context.comp_unit)
return false;
@@ -113,8 +108,8 @@ bool ThreadPlanStepOverRange::IsEquivale
if (m_addr_context.function != context.function)
return false;
// It is okay to return to a different block of a straight function, we
- // only have to
- // be more careful if returning from one inlined block to another.
+ // only have to be more careful if returning from one inlined block to
+ // another.
if (m_addr_context.block->GetInlinedFunctionInfo() == nullptr &&
context.block->GetInlinedFunctionInfo() == nullptr)
return true;
@@ -140,8 +135,8 @@ bool ThreadPlanStepOverRange::ShouldStop
}
// If we're out of the range but in the same frame or in our caller's frame
- // then we should stop.
- // When stepping out we only stop others if we are forcing running one thread.
+ // then we should stop. When stepping out we only stop others if we are
+ // forcing running one thread.
bool stop_others = (m_stop_others == lldb::eOnlyThisThread);
ThreadPlanSP new_plan_sp;
FrameComparison frame_order = CompareCurrentFrameToStartFrame();
@@ -152,11 +147,9 @@ bool ThreadPlanStepOverRange::ShouldStop
// A caveat to this is if we think the frame is older but we're actually in
// a trampoline.
// I'm going to make the assumption that you wouldn't RETURN to a
- // trampoline. So if we are
- // in a trampoline we think the frame is older because the trampoline
- // confused the backtracer.
- // As below, we step through first, and then try to figure out how to get
- // back out again.
+ // trampoline. So if we are in a trampoline we think the frame is older
+ // because the trampoline confused the backtracer. As below, we step
+ // through first, and then try to figure out how to get back out again.
new_plan_sp =
m_thread.QueueThreadPlanForStepThrough(m_stack_id, false, stop_others);
@@ -166,8 +159,7 @@ bool ThreadPlanStepOverRange::ShouldStop
"Thought I stepped out, but in fact arrived at a trampoline.");
} else if (frame_order == eFrameCompareYounger) {
// Make sure we really are in a new frame. Do that by unwinding and seeing
- // if the
- // start function really is our start function...
+ // if the start function really is our start function...
for (uint32_t i = 1;; ++i) {
StackFrameSP older_frame_sp = m_thread.GetStackFrameAtIndex(i);
if (!older_frame_sp) {
@@ -200,28 +192,23 @@ bool ThreadPlanStepOverRange::ShouldStop
if (!InSymbol()) {
// This one is a little tricky. Sometimes we may be in a stub or
- // something similar,
- // in which case we need to get out of there. But if we are in a stub
- // then it's
- // likely going to be hard to get out from here. It is probably easiest
- // to step into the
- // stub, and then it will be straight-forward to step out.
+ // something similar, in which case we need to get out of there. But if
+ // we are in a stub then it's likely going to be hard to get out from
+ // here. It is probably easiest to step into the stub, and then it will
+ // be straight-forward to step out.
new_plan_sp = m_thread.QueueThreadPlanForStepThrough(m_stack_id, false,
stop_others);
} else {
- // The current clang (at least through 424) doesn't always get the address
- // range for the
- // DW_TAG_inlined_subroutines right, so that when you leave the inlined
- // range the line table says
- // you are still in the source file of the inlining function. This is
- // bad, because now you are missing
- // the stack frame for the function containing the inlining, and if you
- // sensibly do "finish" to get
- // out of this function you will instead exit the containing function.
- // To work around this, we check whether we are still in the source file
- // we started in, and if not assume
- // it is an error, and push a plan to get us out of this line and back to
- // the containing file.
+ // The current clang (at least through 424) doesn't always get the
+ // address range for the DW_TAG_inlined_subroutines right, so that when
+ // you leave the inlined range the line table says you are still in the
+ // source file of the inlining function. This is bad, because now you
+ // are missing the stack frame for the function containing the inlining,
+ // and if you sensibly do "finish" to get out of this function you will
+ // instead exit the containing function. To work around this, we check
+ // whether we are still in the source file we started in, and if not
+ // assume it is an error, and push a plan to get us out of this line and
+ // back to the containing file.
if (m_addr_context.line_entry.IsValid()) {
SymbolContext sc;
@@ -244,14 +231,11 @@ bool ThreadPlanStepOverRange::ShouldStop
bool step_past_remaining_inline = false;
if (entry_idx > 0) {
// We require the previous line entry and the current line
- // entry come
- // from the same file.
- // The other requirement is that the previous line table entry
- // be part of an
- // inlined block, we don't want to step past cases where
- // people have inlined
- // some code fragment by using #include <source-fragment.c>
- // directly.
+ // entry come from the same file. The other requirement is
+ // that the previous line table entry be part of an inlined
+ // block, we don't want to step past cases where people have
+ // inlined some code fragment by using #include <source-
+ // fragment.c> directly.
LineEntry prev_line_entry;
if (line_table->GetLineEntryAtIndex(entry_idx - 1,
prev_line_entry) &&
@@ -338,8 +322,7 @@ bool ThreadPlanStepOverRange::ShouldStop
if (!new_plan_sp) {
// For efficiencies sake, we know we're done here so we don't have to do
- // this
- // calculation again in MischiefManaged.
+ // this calculation again in MischiefManaged.
SetPlanComplete();
return true;
} else
@@ -347,16 +330,12 @@ bool ThreadPlanStepOverRange::ShouldStop
}
bool ThreadPlanStepOverRange::DoPlanExplainsStop(Event *event_ptr) {
- // For crashes, breakpoint hits, signals, etc, let the base plan (or some plan
- // above us)
- // handle the stop. That way the user can see the stop, step around, and then
- // when they
- // are done, continue and have their step complete. The exception is if we've
- // hit our
- // "run to next branch" breakpoint.
- // Note, unlike the step in range plan, we don't mark ourselves complete if we
- // hit an
- // unexplained breakpoint/crash.
+ // For crashes, breakpoint hits, signals, etc, let the base plan (or some
+ // plan above us) handle the stop. That way the user can see the stop, step
+ // around, and then when they are done, continue and have their step
+ // complete. The exception is if we've hit our "run to next branch"
+ // breakpoint. Note, unlike the step in range plan, we don't mark ourselves
+ // complete if we hit an unexplained breakpoint/crash.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
StopInfoSP stop_info_sp = GetPrivateStopInfo();
@@ -387,8 +366,8 @@ bool ThreadPlanStepOverRange::DoWillResu
m_first_resume = false;
if (resume_state == eStateStepping && current_plan) {
// See if we are about to step over an inlined call in the middle of the
- // inlined stack, if so figure
- // out its extents and reset our range to step over that.
+ // inlined stack, if so figure out its extents and reset our range to
+ // step over that.
bool in_inlined_stack = m_thread.DecrementCurrentInlinedDepth();
if (in_inlined_stack) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Mon Apr 30 09:49:04 2018
@@ -31,8 +31,8 @@ using namespace lldb;
using namespace lldb_private;
//----------------------------------------------------------------------
-// ThreadPlanStepRange: Step through a stack range, either stepping over or into
-// based on the value of \a type.
+// ThreadPlanStepRange: Step through a stack range, either stepping over or
+// into based on the value of \a type.
//----------------------------------------------------------------------
ThreadPlanStepRange::ThreadPlanStepRange(ThreadPlanKind kind, const char *name,
@@ -74,15 +74,14 @@ Vote ThreadPlanStepRange::ShouldReportSt
}
void ThreadPlanStepRange::AddRange(const AddressRange &new_range) {
- // For now I'm just adding the ranges. At some point we may want to
- // condense the ranges if they overlap, though I don't think it is likely
- // to be very important.
+ // For now I'm just adding the ranges. At some point we may want to condense
+ // the ranges if they overlap, though I don't think it is likely to be very
+ // important.
m_address_ranges.push_back(new_range);
// Fill the slot for this address range with an empty DisassemblerSP in the
- // instruction ranges. I want the
- // indices to match, but I don't want to do the work to disassemble this range
- // if I don't step into it.
+ // instruction ranges. I want the indices to match, but I don't want to do
+ // the work to disassemble this range if I don't step into it.
m_instruction_ranges.push_back(DisassemblerSP());
}
@@ -158,12 +157,11 @@ bool ThreadPlanStepRange::InRange() {
} else if (new_context.line_entry.range.GetBaseAddress().GetLoadAddress(
m_thread.CalculateTarget().get()) != pc_load_addr) {
// Another thing that sometimes happens here is that we step out of
- // one line into the MIDDLE of another
- // line. So far I mostly see this due to bugs in the debug
- // information.
- // But we probably don't want to be in the middle of a line range, so
- // in that case reset the stepping
- // range to the line we've stepped into the middle of and continue.
+ // one line into the MIDDLE of another line. So far I mostly see
+ // this due to bugs in the debug information. But we probably don't
+ // want to be in the middle of a line range, so in that case reset
+ // the stepping range to the line we've stepped into the middle of
+ // and continue.
m_addr_context = new_context;
m_address_ranges.clear();
AddRange(m_addr_context.line_entry.range);
@@ -260,9 +258,8 @@ InstructionList *ThreadPlanStepRange::Ge
return nullptr;
else {
// Find where we are in the instruction list as well. If we aren't at
- // an instruction,
- // return nullptr. In this case, we're probably lost, and shouldn't try
- // to do anything fancy.
+ // an instruction, return nullptr. In this case, we're probably lost,
+ // and shouldn't try to do anything fancy.
insn_offset =
m_instruction_ranges[i]
@@ -297,8 +294,7 @@ bool ThreadPlanStepRange::SetNextBranchB
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
// Stepping through ranges using breakpoints doesn't work yet, but with this
- // off we fall back to instruction
- // single stepping.
+ // off we fall back to instruction single stepping.
if (!m_use_fast_step)
return false;
@@ -383,9 +379,8 @@ bool ThreadPlanStepRange::NextRangeBreak
size_t num_owners = bp_site_sp->GetNumberOfOwners();
bool explains_stop = true;
// If all the owners are internal, then we are probably just stepping over
- // this range from multiple threads,
- // or multiple frames, so we want to continue. If one is not internal, then
- // we should not explain the stop,
+ // this range from multiple threads, or multiple frames, so we want to
+ // continue. If one is not internal, then we should not explain the stop,
// and let the user breakpoint handle the stop.
for (size_t i = 0; i < num_owners; i++) {
if (!bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().IsInternal()) {
@@ -418,8 +413,8 @@ bool ThreadPlanStepRange::MischiefManage
// I do this check first because we might have stepped somewhere that will
// fool InRange into
// thinking it needs to step past the end of that line. This happens, for
- // instance, when stepping
- // over inlined code that is in the middle of the current line.
+ // instance, when stepping over inlined code that is in the middle of the
+ // current line.
if (!m_no_more_plans)
return false;
@@ -457,8 +452,8 @@ bool ThreadPlanStepRange::IsPlanStale()
}
return true;
} else if (frame_order == eFrameCompareEqual && InSymbol()) {
- // If we are not in a place we should step through, we've gotten stale.
- // One tricky bit here is that some stubs don't push a frame, so we should.
+ // If we are not in a place we should step through, we've gotten stale. One
+ // tricky bit here is that some stubs don't push a frame, so we should.
// check that we are in the same symbol.
if (!InRange()) {
// Set plan Complete when we reach next instruction just after the range
Modified: lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepThrough.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepThrough.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepThrough.cpp Mon Apr 30 09:49:04 2018
@@ -26,9 +26,8 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// ThreadPlanStepThrough: If the current instruction is a trampoline, step
-// through it
-// If it is the beginning of the prologue of a function, step through that as
-// well.
+// through it If it is the beginning of the prologue of a function, step
+// through that as well.
// FIXME: At present only handles DYLD trampolines.
//----------------------------------------------------------------------
@@ -49,9 +48,8 @@ ThreadPlanStepThrough::ThreadPlanStepThr
m_start_address = GetThread().GetRegisterContext()->GetPC(0);
// We are going to return back to the concrete frame 1, we might pass by
- // some inlined code that we're in
- // the middle of by doing this, but it's easier than trying to figure out
- // where the inlined code might return to.
+ // some inlined code that we're in the middle of by doing this, but it's
+ // easier than trying to figure out where the inlined code might return to.
StackFrameSP return_frame_sp = m_thread.GetFrameWithStackID(m_stack_id);
@@ -136,10 +134,8 @@ bool ThreadPlanStepThrough::ValidatePlan
bool ThreadPlanStepThrough::DoPlanExplainsStop(Event *event_ptr) {
// If we have a sub-plan, it will have been asked first if we explain the
- // stop, and
- // we won't get asked. The only time we would be the one directly asked this
- // question
- // is if we hit our backstop breakpoint.
+ // stop, and we won't get asked. The only time we would be the one directly
+ // asked this question is if we hit our backstop breakpoint.
return HitOurBackstopBreakpoint();
}
@@ -156,8 +152,7 @@ bool ThreadPlanStepThrough::ShouldStop(E
}
// If we don't have a sub-plan, then we're also done (can't see how we would
- // ever get here
- // without a plan, but just in case.
+ // ever get here without a plan, but just in case.
if (!m_sub_plan_sp) {
SetPlanComplete();
@@ -165,15 +160,13 @@ bool ThreadPlanStepThrough::ShouldStop(E
}
// If the current sub plan is not done, we don't want to stop. Actually, we
- // probably won't
- // ever get here in this state, since we generally won't get asked any
- // questions if out
- // current sub-plan is not done...
+ // probably won't ever get here in this state, since we generally won't get
+ // asked any questions if out current sub-plan is not done...
if (!m_sub_plan_sp->IsPlanComplete())
return false;
- // If our current sub plan failed, then let's just run to our backstop. If we
- // can't do that then just stop.
+ // If our current sub plan failed, then let's just run to our backstop. If
+ // we can't do that then just stop.
if (!m_sub_plan_sp->PlanSucceeded()) {
if (m_backstop_bkpt_id != LLDB_INVALID_BREAK_ID) {
m_sub_plan_sp.reset();
@@ -185,8 +178,7 @@ bool ThreadPlanStepThrough::ShouldStop(E
}
// Next see if there is a specific step through plan at our current pc (these
- // might
- // chain, for instance stepping through a dylib trampoline to the objc
+ // might chain, for instance stepping through a dylib trampoline to the objc
// dispatch function...)
LookForPlanToStepThroughFromCurrentPC();
if (m_sub_plan_sp) {
Modified: lldb/trunk/source/Target/ThreadPlanStepUntil.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepUntil.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepUntil.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepUntil.cpp Mon Apr 30 09:49:04 2018
@@ -151,8 +151,8 @@ void ThreadPlanStepUntil::AnalyzeStop()
StopReason reason = stop_info_sp->GetStopReason();
if (reason == eStopReasonBreakpoint) {
- // If this is OUR breakpoint, we're fine, otherwise we don't know why this
- // happened...
+ // If this is OUR breakpoint, we're fine, otherwise we don't know why
+ // this happened...
BreakpointSiteSP this_site =
m_thread.GetProcess()->GetBreakpointSiteList().FindByID(
stop_info_sp->GetValue());
@@ -163,18 +163,13 @@ void ThreadPlanStepUntil::AnalyzeStop()
if (this_site->IsBreakpointAtThisSite(m_return_bp_id)) {
// If we are at our "step out" breakpoint, and the stack depth has
- // shrunk, then
- // this is indeed our stop.
- // If the stack depth has grown, then we've hit our step out breakpoint
- // recursively.
- // If we are the only breakpoint at that location, then we do explain
- // the stop, and
- // we'll just continue.
- // If there was another breakpoint here, then we don't explain the stop,
- // but we won't
- // mark ourselves Completed, because maybe that breakpoint will
- // continue, and then
- // we'll finish the "until".
+ // shrunk, then this is indeed our stop. If the stack depth has grown,
+ // then we've hit our step out breakpoint recursively. If we are the
+ // only breakpoint at that location, then we do explain the stop, and
+ // we'll just continue. If there was another breakpoint here, then we
+ // don't explain the stop, but we won't mark ourselves Completed,
+ // because maybe that breakpoint will continue, and then we'll finish
+ // the "until".
bool done;
StackID cur_frame_zero_id;
@@ -209,8 +204,8 @@ void ThreadPlanStepUntil::AnalyzeStop()
else {
StackFrameSP older_frame_sp = m_thread.GetStackFrameAtIndex(1);
- // But if we can't even unwind one frame we should just get out of
- // here & stop...
+ // But if we can't even unwind one frame we should just get out
+ // of here & stop...
if (older_frame_sp) {
const SymbolContext &older_context =
older_frame_sp->GetSymbolContext(eSymbolContextEverything);
@@ -230,8 +225,8 @@ void ThreadPlanStepUntil::AnalyzeStop()
// Otherwise we've hit this breakpoint recursively. If we're the
// only breakpoint here, then we do explain the stop, and we'll
- // continue.
- // If not then we should let higher plans handle this stop.
+ // continue. If not then we should let higher plans handle this
+ // stop.
if (this_site->GetNumberOfOwners() == 1)
m_explains_stop = true;
else {
@@ -242,8 +237,8 @@ void ThreadPlanStepUntil::AnalyzeStop()
}
}
}
- // If we get here we haven't hit any of our breakpoints, so let the higher
- // plans take care of the stop.
+ // If we get here we haven't hit any of our breakpoints, so let the
+ // higher plans take care of the stop.
m_explains_stop = false;
return;
} else if (IsUsuallyUnexplainedStopReason(reason)) {
@@ -256,16 +251,15 @@ void ThreadPlanStepUntil::AnalyzeStop()
bool ThreadPlanStepUntil::DoPlanExplainsStop(Event *event_ptr) {
// We don't explain signals or breakpoints (breakpoints that handle stepping
- // in or
- // out will be handled by a child plan.
+ // in or out will be handled by a child plan.
AnalyzeStop();
return m_explains_stop;
}
bool ThreadPlanStepUntil::ShouldStop(Event *event_ptr) {
- // If we've told our self in ExplainsStop that we plan to continue, then
- // do so here. Otherwise, as long as this thread has stopped for a reason,
- // we will stop.
+ // If we've told our self in ExplainsStop that we plan to continue, then do
+ // so here. Otherwise, as long as this thread has stopped for a reason, we
+ // will stop.
StopInfoSP stop_info_sp = GetPrivateStopInfo();
if (!stop_info_sp || stop_info_sp->GetStopReason() == eStopReasonNone)
Modified: lldb/trunk/source/Target/UnixSignals.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/UnixSignals.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Target/UnixSignals.cpp (original)
+++ lldb/trunk/source/Target/UnixSignals.cpp Mon Apr 30 09:49:04 2018
@@ -66,9 +66,8 @@ UnixSignals::~UnixSignals() = default;
void UnixSignals::Reset() {
// This builds one standard set of Unix Signals. If yours aren't quite in
- // this
- // order, you can either subclass this class, and use Add & Remove to change
- // them
+ // this order, you can either subclass this class, and use Add & Remove to
+ // change them
// or you can subclass and build them afresh in your constructor;
//
// Note: the signals below are the Darwin signals. Do not change these!
@@ -306,8 +305,8 @@ UnixSignals::GetFilteredSignals(llvm::Op
bool signal_notify = false;
GetSignalInfo(signo, signal_suppress, signal_stop, signal_notify);
- // If any of filtering conditions are not met,
- // we move on to the next signal.
+ // If any of filtering conditions are not met, we move on to the next
+ // signal.
if (should_suppress.hasValue() &&
signal_suppress != should_suppress.getValue())
continue;
Modified: lldb/trunk/source/Utility/ArchSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ArchSpec.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/ArchSpec.cpp (original)
+++ lldb/trunk/source/Utility/ArchSpec.cpp Mon Apr 30 09:49:04 2018
@@ -223,8 +223,8 @@ static const CoreDefinition g_core_defin
"kalimba5"}};
// Ensure that we have an entry in the g_core_definitions for each core. If you
-// comment out an entry above,
-// you will need to comment out the corresponding ArchSpec::Core enumeration.
+// comment out an entry above, you will need to comment out the corresponding
+// ArchSpec::Core enumeration.
static_assert(sizeof(g_core_definitions) / sizeof(CoreDefinition) ==
ArchSpec::kNumCores,
"make sure we have one core definition for each core");
@@ -891,9 +891,9 @@ void ArchSpec::MergeFrom(const ArchSpec
if (GetTriple().getArch() == llvm::Triple::UnknownArch) {
GetTriple().setArch(other.GetTriple().getArch());
- // MachO unknown64 isn't really invalid as the debugger can
- // still obtain information from the binary, e.g. line tables.
- // As such, we don't update the core here.
+ // MachO unknown64 isn't really invalid as the debugger can still obtain
+ // information from the binary, e.g. line tables. As such, we don't update
+ // the core here.
if (other.GetCore() != eCore_uknownMach64)
UpdateCore();
}
@@ -903,9 +903,8 @@ void ArchSpec::MergeFrom(const ArchSpec
GetTriple().setEnvironment(other.GetTriple().getEnvironment());
}
// If this and other are both arm ArchSpecs and this ArchSpec is a generic
- // "some kind of arm"
- // spec but the other ArchSpec is a specific arm core, adopt the specific arm
- // core.
+ // "some kind of arm" spec but the other ArchSpec is a specific arm core,
+ // adopt the specific arm core.
if (GetTriple().getArch() == llvm::Triple::arm &&
other.GetTriple().getArch() == llvm::Triple::arm &&
IsCompatibleMatch(other) && GetCore() == ArchSpec::eCore_arm_generic &&
@@ -931,24 +930,21 @@ bool ArchSpec::SetArchitecture(Architect
if (core_def) {
m_core = core_def->core;
update_triple = false;
- // Always use the architecture name because it might be more descriptive
- // than the architecture enum ("armv7" -> llvm::Triple::arm).
+ // Always use the architecture name because it might be more
+ // descriptive than the architecture enum ("armv7" ->
+ // llvm::Triple::arm).
m_triple.setArchName(llvm::StringRef(core_def->name));
if (arch_type == eArchTypeMachO) {
m_triple.setVendor(llvm::Triple::Apple);
// Don't set the OS. It could be simulator, macosx, ios, watchos,
- // tvos. We could
- // get close with the cpu type - but we can't get it right all of the
- // time. Better
- // to leave this unset so other sections of code will set it when they
- // have more
- // information.
+ // tvos. We could get close with the cpu type - but we can't get it
+ // right all of the time. Better to leave this unset so other
+ // sections of code will set it when they have more information.
// NB: don't call m_triple.setOS (llvm::Triple::UnknownOS). That sets
// the OSName to
// "unknown" and the ArchSpec::TripleVendorWasSpecified() method says
- // that any
- // OSName setting means it was specified.
+ // that any OSName setting means it was specified.
} else if (arch_type == eArchTypeELF) {
switch (os) {
case llvm::ELF::ELFOSABI_AIX:
@@ -977,7 +973,8 @@ bool ArchSpec::SetArchitecture(Architect
m_triple.setVendor(llvm::Triple::UnknownVendor);
m_triple.setOS(llvm::Triple::UnknownOS);
}
- // Fall back onto setting the machine type if the arch by name failed...
+ // Fall back onto setting the machine type if the arch by name
+ // failed...
if (m_triple.getArch() == llvm::Triple::UnknownArch)
m_triple.setArch(core_def->machine);
}
@@ -1020,10 +1017,9 @@ static bool isCompatibleEnvironment(llvm
return true;
// If one of the environment is Android and the other one is EABI then they
- // are considered to
- // be compatible. This is required as a workaround for shared libraries
- // compiled for Android
- // without the NOTE section indicating that they are using the Android ABI.
+ // are considered to be compatible. This is required as a workaround for
+ // shared libraries compiled for Android without the NOTE section indicating
+ // that they are using the Android ABI.
if ((lhs == llvm::Triple::Android && rhs == llvm::Triple::EABI) ||
(rhs == llvm::Triple::Android && lhs == llvm::Triple::EABI) ||
(lhs == llvm::Triple::GNUEABI && rhs == llvm::Triple::EABI) ||
@@ -1055,8 +1051,8 @@ bool ArchSpec::IsEqualTo(const ArchSpec
if (lhs_triple_vendor != rhs_triple_vendor) {
const bool rhs_vendor_specified = rhs.TripleVendorWasSpecified();
const bool lhs_vendor_specified = TripleVendorWasSpecified();
- // Both architectures had the vendor specified, so if they aren't
- // equal then we return false
+ // Both architectures had the vendor specified, so if they aren't equal
+ // then we return false
if (rhs_vendor_specified && lhs_vendor_specified)
return false;
@@ -1071,8 +1067,8 @@ bool ArchSpec::IsEqualTo(const ArchSpec
if (lhs_triple_os != rhs_triple_os) {
const bool rhs_os_specified = rhs.TripleOSWasSpecified();
const bool lhs_os_specified = TripleOSWasSpecified();
- // Both architectures had the OS specified, so if they aren't
- // equal then we return false
+ // Both architectures had the OS specified, so if they aren't equal then
+ // we return false
if (rhs_os_specified && lhs_os_specified)
return false;
@@ -1099,9 +1095,9 @@ void ArchSpec::UpdateCore() {
const CoreDefinition *core_def = FindCoreDefinition(arch_name);
if (core_def) {
m_core = core_def->core;
- // Set the byte order to the default byte order for an architecture.
- // This can be modified if needed for cases when cores handle both
- // big and little endian
+ // Set the byte order to the default byte order for an architecture. This
+ // can be modified if needed for cases when cores handle both big and
+ // little endian
m_byte_order = core_def->default_byte_order;
} else {
Clear();
@@ -1198,9 +1194,8 @@ static bool cores_match(const ArchSpec::
break;
// v. https://en.wikipedia.org/wiki/ARM_Cortex-M#Silicon_customization
- // Cortex-M0 - ARMv6-M - armv6m
- // Cortex-M3 - ARMv7-M - armv7m
- // Cortex-M4 - ARMv7E-M - armv7em
+ // Cortex-M0 - ARMv6-M - armv6m Cortex-M3 - ARMv7-M - armv7m Cortex-M4 -
+ // ARMv7E-M - armv7em
case ArchSpec::eCore_arm_armv7em:
if (!enforce_exact_match) {
if (core2 == ArchSpec::eCore_arm_generic)
@@ -1216,9 +1211,8 @@ static bool cores_match(const ArchSpec::
break;
// v. https://en.wikipedia.org/wiki/ARM_Cortex-M#Silicon_customization
- // Cortex-M0 - ARMv6-M - armv6m
- // Cortex-M3 - ARMv7-M - armv7m
- // Cortex-M4 - ARMv7E-M - armv7em
+ // Cortex-M0 - ARMv6-M - armv6m Cortex-M3 - ARMv7-M - armv7m Cortex-M4 -
+ // ARMv7E-M - armv7em
case ArchSpec::eCore_arm_armv7m:
if (!enforce_exact_match) {
if (core2 == ArchSpec::eCore_arm_generic)
@@ -1466,9 +1460,8 @@ bool ArchSpec::IsAlwaysThumbInstructions
// Cortex-M0 through Cortex-M7 are ARM processor cores which can only
// execute thumb instructions. We map the cores to arch names like this:
//
- // Cortex-M0, Cortex-M0+, Cortex-M1: armv6m
- // Cortex-M3: armv7m
- // Cortex-M4, Cortex-M7: armv7em
+ // Cortex-M0, Cortex-M0+, Cortex-M1: armv6m Cortex-M3: armv7m Cortex-M4,
+ // Cortex-M7: armv7em
if (GetCore() == ArchSpec::Core::eCore_arm_armv7m ||
GetCore() == ArchSpec::Core::eCore_arm_armv7em ||
Modified: lldb/trunk/source/Utility/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Args.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/Args.cpp (original)
+++ lldb/trunk/source/Utility/Args.cpp Mon Apr 30 09:49:04 2018
@@ -19,12 +19,9 @@ using namespace lldb_private;
// A helper function for argument parsing.
// Parses the initial part of the first argument using normal double quote
-// rules:
-// backslash escapes the double quote and itself. The parsed string is appended
-// to the second
-// argument. The function returns the unparsed portion of the string, starting
-// at the closing
-// quote.
+// rules: backslash escapes the double quote and itself. The parsed string is
+// appended to the second argument. The function returns the unparsed portion
+// of the string, starting at the closing quote.
static llvm::StringRef ParseDoubleQuotes(llvm::StringRef quoted,
std::string &result) {
// Inside double quotes, '\' and '"' are special.
@@ -49,8 +46,7 @@ static llvm::StringRef ParseDoubleQuotes
}
// If the character after the backslash is not a whitelisted escapable
- // character, we
- // leave the character sequence untouched.
+ // character, we leave the character sequence untouched.
if (strchr(k_escapable_characters, quoted.front()) == nullptr)
result += '\\';
@@ -84,10 +80,10 @@ ParseSingleArgument(llvm::StringRef comm
// strings.
std::string arg;
- // Since we can have multiple quotes that form a single command
- // in a command like: "Hello "world'!' (which will make a single
- // argument "Hello world!") we remember the first quote character
- // we encounter and use that for the quote character.
+ // Since we can have multiple quotes that form a single command in a command
+ // like: "Hello "world'!' (which will make a single argument "Hello world!")
+ // we remember the first quote character we encounter and use that for the
+ // quote character.
char first_quote_char = '\0';
bool arg_complete = false;
@@ -110,8 +106,7 @@ ParseSingleArgument(llvm::StringRef comm
}
// If the character after the backslash is not a whitelisted escapable
- // character, we
- // leave the character sequence untouched.
+ // character, we leave the character sequence untouched.
if (strchr(" \t\\'\"`", command.front()) == nullptr)
arg += '\\';
@@ -122,8 +117,8 @@ ParseSingleArgument(llvm::StringRef comm
case ' ':
case '\t':
- // We are not inside any quotes, we just found a space after an
- // argument. We are done.
+ // We are not inside any quotes, we just found a space after an argument.
+ // We are done.
arg_complete = true;
break;
@@ -138,8 +133,7 @@ ParseSingleArgument(llvm::StringRef comm
command = ParseDoubleQuotes(command, arg);
else {
// For single quotes, we simply skip ahead to the matching quote
- // character
- // (or the end of the string).
+ // character (or the end of the string).
size_t quoted = command.find(special);
arg += command.substr(0, quoted);
command = command.substr(quoted);
@@ -274,9 +268,9 @@ char **Args::GetArgumentVector() {
assert(!m_argv.empty());
// TODO: functions like execve and posix_spawnp exhibit undefined behavior
// when argv or envp is null. So the code below is actually wrong. However,
- // other code in LLDB depends on it being null. The code has been acting this
- // way for some time, so it makes sense to leave it this way until someone
- // has the time to come along and fix it.
+ // other code in LLDB depends on it being null. The code has been acting
+ // this way for some time, so it makes sense to leave it this way until
+ // someone has the time to come along and fix it.
return (m_argv.size() > 1) ? m_argv.data() : nullptr;
}
@@ -555,17 +549,17 @@ void Args::EncodeEscapeSequences(const c
case '0':
// 1 to 3 octal chars
{
- // Make a string that can hold onto the initial zero char,
- // up to 3 octal digits, and a terminating NULL.
+ // Make a string that can hold onto the initial zero char, up to 3
+ // octal digits, and a terminating NULL.
char oct_str[5] = {'\0', '\0', '\0', '\0', '\0'};
int i;
for (i = 0; (p[i] >= '0' && p[i] <= '7') && i < 4; ++i)
oct_str[i] = p[i];
- // We don't want to consume the last octal character since
- // the main for loop will do this for us, so we advance p by
- // one less than i (even if i is zero)
+ // We don't want to consume the last octal character since the main
+ // for loop will do this for us, so we advance p by one less than i
+ // (even if i is zero)
p += i - 1;
unsigned long octal_value = ::strtoul(oct_str, nullptr, 8);
if (octal_value <= UINT8_MAX) {
@@ -596,8 +590,8 @@ void Args::EncodeEscapeSequences(const c
break;
default:
- // Just desensitize any other character by just printing what
- // came after the '\'
+ // Just desensitize any other character by just printing what came
+ // after the '\'
dst.append(1, *p);
break;
}
Modified: lldb/trunk/source/Utility/ConstString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ConstString.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/ConstString.cpp (original)
+++ lldb/trunk/source/Utility/ConstString.cpp Mon Apr 30 09:49:04 2018
@@ -43,8 +43,8 @@ public:
static size_t GetConstCStringLength(const char *ccstr) {
if (ccstr != nullptr) {
- // Since the entry is read only, and we derive the entry entirely from the
- // pointer, we don't need the lock.
+ // Since the entry is read only, and we derive the entry entirely from
+ // the pointer, we don't need the lock.
const StringPoolEntryType &entry = GetStringMapEntryFromKeyData(ccstr);
return entry.getKey().size();
}
@@ -155,9 +155,8 @@ public:
}
//------------------------------------------------------------------
- // Return the size in bytes that this object and any items in its
- // collection of uniqued strings + data count values takes in
- // memory.
+ // Return the size in bytes that this object and any items in its collection
+ // of uniqued strings + data count values takes in memory.
//------------------------------------------------------------------
size_t MemorySize() const {
size_t mem_size = sizeof(Pool);
@@ -184,15 +183,14 @@ protected:
};
//----------------------------------------------------------------------
-// Frameworks and dylibs aren't supposed to have global C++
-// initializers so we hide the string pool in a static function so
-// that it will get initialized on the first call to this static
-// function.
+// Frameworks and dylibs aren't supposed to have global C++ initializers so we
+// hide the string pool in a static function so that it will get initialized on
+// the first call to this static function.
//
-// Note, for now we make the string pool a pointer to the pool, because
-// we can't guarantee that some objects won't get destroyed after the
-// global destructor chain is run, and trying to make sure no destructors
-// touch ConstStrings is difficult. So we leak the pool instead.
+// Note, for now we make the string pool a pointer to the pool, because we
+// can't guarantee that some objects won't get destroyed after the global
+// destructor chain is run, and trying to make sure no destructors touch
+// ConstStrings is difficult. So we leak the pool instead.
//----------------------------------------------------------------------
static Pool &StringPool() {
static llvm::once_flag g_pool_initialization_flag;
@@ -246,8 +244,8 @@ bool ConstString::Equals(const ConstStri
return true;
// Since the pointers weren't equal, and identical ConstStrings always have
- // identical pointers,
- // the result must be false for case sensitive equality test.
+ // identical pointers, the result must be false for case sensitive equality
+ // test.
if (case_sensitive)
return false;
Modified: lldb/trunk/source/Utility/DataBufferHeap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/DataBufferHeap.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/DataBufferHeap.cpp (original)
+++ lldb/trunk/source/Utility/DataBufferHeap.cpp Mon Apr 30 09:49:04 2018
@@ -22,8 +22,7 @@ using namespace lldb_private;
DataBufferHeap::DataBufferHeap() : m_data() {}
//----------------------------------------------------------------------
-// Initialize this class with "n" characters and fill the buffer
-// with "ch".
+// Initialize this class with "n" characters and fill the buffer with "ch".
//----------------------------------------------------------------------
DataBufferHeap::DataBufferHeap(lldb::offset_t n, uint8_t ch) : m_data() {
if (n < m_data.max_size())
@@ -31,8 +30,7 @@ DataBufferHeap::DataBufferHeap(lldb::off
}
//----------------------------------------------------------------------
-// Initialize this class with a copy of the "n" bytes from the "bytes"
-// buffer.
+// Initialize this class with a copy of the "n" bytes from the "bytes" buffer.
//----------------------------------------------------------------------
DataBufferHeap::DataBufferHeap(const void *src, lldb::offset_t src_len)
: m_data() {
@@ -40,22 +38,21 @@ DataBufferHeap::DataBufferHeap(const voi
}
//----------------------------------------------------------------------
-// Virtual destructor since this class inherits from a pure virtual
-// base class.
+// Virtual destructor since this class inherits from a pure virtual base class.
//----------------------------------------------------------------------
DataBufferHeap::~DataBufferHeap() = default;
//----------------------------------------------------------------------
-// Return a pointer to the bytes owned by this object, or nullptr if
-// the object contains no bytes.
+// Return a pointer to the bytes owned by this object, or nullptr if the object
+// contains no bytes.
//----------------------------------------------------------------------
uint8_t *DataBufferHeap::GetBytes() {
return (m_data.empty() ? nullptr : m_data.data());
}
//----------------------------------------------------------------------
-// Return a const pointer to the bytes owned by this object, or nullptr
-// if the object contains no bytes.
+// Return a const pointer to the bytes owned by this object, or nullptr if the
+// object contains no bytes.
//----------------------------------------------------------------------
const uint8_t *DataBufferHeap::GetBytes() const {
return (m_data.empty() ? nullptr : m_data.data());
@@ -67,8 +64,8 @@ const uint8_t *DataBufferHeap::GetBytes(
uint64_t DataBufferHeap::GetByteSize() const { return m_data.size(); }
//----------------------------------------------------------------------
-// Sets the number of bytes that this object should be able to
-// contain. This can be used prior to copying data into the buffer.
+// Sets the number of bytes that this object should be able to contain. This
+// can be used prior to copying data into the buffer.
//----------------------------------------------------------------------
uint64_t DataBufferHeap::SetByteSize(uint64_t new_size) {
m_data.resize(new_size);
Modified: lldb/trunk/source/Utility/DataEncoder.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/DataEncoder.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/DataEncoder.cpp (original)
+++ lldb/trunk/source/Utility/DataEncoder.cpp Mon Apr 30 09:49:04 2018
@@ -34,8 +34,8 @@ DataEncoder::DataEncoder()
m_data_sp() {}
//----------------------------------------------------------------------
-// This constructor allows us to use data that is owned by someone else.
-// The data must stay around as long as this object is valid.
+// This constructor allows us to use data that is owned by someone else. The
+// data must stay around as long as this object is valid.
//----------------------------------------------------------------------
DataEncoder::DataEncoder(void *data, uint32_t length, ByteOrder endian,
uint8_t addr_size)
@@ -43,11 +43,10 @@ DataEncoder::DataEncoder(void *data, uin
m_byte_order(endian), m_addr_size(addr_size), m_data_sp() {}
//----------------------------------------------------------------------
-// Make a shared pointer reference to the shared data in "data_sp" and
-// set the endian swapping setting to "swap", and the address size to
-// "addr_size". The shared data reference will ensure the data lives
-// as long as any DataEncoder objects exist that have a reference to
-// this data.
+// Make a shared pointer reference to the shared data in "data_sp" and set the
+// endian swapping setting to "swap", and the address size to "addr_size". The
+// shared data reference will ensure the data lives as long as any DataEncoder
+// objects exist that have a reference to this data.
//----------------------------------------------------------------------
DataEncoder::DataEncoder(const DataBufferSP &data_sp, ByteOrder endian,
uint8_t addr_size)
@@ -59,9 +58,8 @@ DataEncoder::DataEncoder(const DataBuffe
DataEncoder::~DataEncoder() = default;
//------------------------------------------------------------------
-// Clears the object contents back to a default invalid state, and
-// release any references to shared data that this object may
-// contain.
+// Clears the object contents back to a default invalid state, and release any
+// references to shared data that this object may contain.
//------------------------------------------------------------------
void DataEncoder::Clear() {
m_start = nullptr;
@@ -72,8 +70,8 @@ void DataEncoder::Clear() {
}
//------------------------------------------------------------------
-// If this object contains shared data, this function returns the
-// offset into that shared data. Else zero is returned.
+// If this object contains shared data, this function returns the offset into
+// that shared data. Else zero is returned.
//------------------------------------------------------------------
size_t DataEncoder::GetSharedDataOffset() const {
if (m_start != nullptr) {
@@ -90,13 +88,12 @@ size_t DataEncoder::GetSharedDataOffset(
}
//----------------------------------------------------------------------
-// Set the data with which this object will extract from to data
-// starting at BYTES and set the length of the data to LENGTH bytes
-// long. The data is externally owned must be around at least as
-// long as this object points to the data. No copy of the data is
-// made, this object just refers to this data and can extract from
-// it. If this object refers to any shared data upon entry, the
-// reference to that data will be released. Is SWAP is set to true,
+// Set the data with which this object will extract from to data starting at
+// BYTES and set the length of the data to LENGTH bytes long. The data is
+// externally owned must be around at least as long as this object points to
+// the data. No copy of the data is made, this object just refers to this data
+// and can extract from it. If this object refers to any shared data upon
+// entry, the reference to that data will be released. Is SWAP is set to true,
// any data extracted will be endian swapped.
//----------------------------------------------------------------------
uint32_t DataEncoder::SetData(void *bytes, uint32_t length, ByteOrder endian) {
@@ -113,18 +110,17 @@ uint32_t DataEncoder::SetData(void *byte
}
//----------------------------------------------------------------------
-// Assign the data for this object to be a subrange of the shared
-// data in "data_sp" starting "data_offset" bytes into "data_sp"
-// and ending "data_length" bytes later. If "data_offset" is not
-// a valid offset into "data_sp", then this object will contain no
-// bytes. If "data_offset" is within "data_sp" yet "data_length" is
-// too large, the length will be capped at the number of bytes
-// remaining in "data_sp". A ref counted pointer to the data in
-// "data_sp" will be made in this object IF the number of bytes this
-// object refers to in greater than zero (if at least one byte was
-// available starting at "data_offset") to ensure the data stays
-// around as long as it is needed. The address size and endian swap
-// settings will remain unchanged from their current settings.
+// Assign the data for this object to be a subrange of the shared data in
+// "data_sp" starting "data_offset" bytes into "data_sp" and ending
+// "data_length" bytes later. If "data_offset" is not a valid offset into
+// "data_sp", then this object will contain no bytes. If "data_offset" is
+// within "data_sp" yet "data_length" is too large, the length will be capped
+// at the number of bytes remaining in "data_sp". A ref counted pointer to the
+// data in "data_sp" will be made in this object IF the number of bytes this
+// object refers to in greater than zero (if at least one byte was available
+// starting at "data_offset") to ensure the data stays around as long as it is
+// needed. The address size and endian swap settings will remain unchanged from
+// their current settings.
//----------------------------------------------------------------------
uint32_t DataEncoder::SetData(const DataBufferSP &data_sp, uint32_t data_offset,
uint32_t data_length) {
@@ -149,8 +145,8 @@ uint32_t DataEncoder::SetData(const Data
uint32_t new_size = GetByteSize();
- // Don't hold a shared pointer to the data buffer if we don't share
- // any valid bytes in the shared buffer.
+ // Don't hold a shared pointer to the data buffer if we don't share any valid
+ // bytes in the shared buffer.
if (new_size == 0)
m_data_sp.reset();
@@ -158,8 +154,8 @@ uint32_t DataEncoder::SetData(const Data
}
//----------------------------------------------------------------------
-// Extract a single unsigned char from the binary data and update
-// the offset pointed to by "offset_ptr".
+// Extract a single unsigned char from the binary data and update the offset
+// pointed to by "offset_ptr".
//
// RETURNS the byte that was extracted, or zero on failure.
//----------------------------------------------------------------------
@@ -208,12 +204,12 @@ uint32_t DataEncoder::PutU64(uint32_t of
}
//----------------------------------------------------------------------
-// Extract a single integer value from the data and update the offset
-// pointed to by "offset_ptr". The size of the extracted integer
-// is specified by the "byte_size" argument. "byte_size" should have
-// a value >= 1 and <= 8 since the return value is only 64 bits
-// wide. Any "byte_size" values less than 1 or greater than 8 will
-// result in nothing being extracted, and zero being returned.
+// Extract a single integer value from the data and update the offset pointed
+// to by "offset_ptr". The size of the extracted integer is specified by the
+// "byte_size" argument. "byte_size" should have a value >= 1 and <= 8 since
+// the return value is only 64 bits wide. Any "byte_size" values less than 1 or
+// greater than 8 will result in nothing being extracted, and zero being
+// returned.
//
// RETURNS the integer value that was extracted, or zero on failure.
//----------------------------------------------------------------------
Modified: lldb/trunk/source/Utility/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/DataExtractor.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/DataExtractor.cpp (original)
+++ lldb/trunk/source/Utility/DataExtractor.cpp Mon Apr 30 09:49:04 2018
@@ -126,8 +126,8 @@ DataExtractor::DataExtractor()
m_data_sp(), m_target_byte_size(1) {}
//----------------------------------------------------------------------
-// This constructor allows us to use data that is owned by someone else.
-// The data must stay around as long as this object is valid.
+// This constructor allows us to use data that is owned by someone else. The
+// data must stay around as long as this object is valid.
//----------------------------------------------------------------------
DataExtractor::DataExtractor(const void *data, offset_t length,
ByteOrder endian, uint32_t addr_size,
@@ -143,11 +143,10 @@ DataExtractor::DataExtractor(const void
}
//----------------------------------------------------------------------
-// Make a shared pointer reference to the shared data in "data_sp" and
-// set the endian swapping setting to "swap", and the address size to
-// "addr_size". The shared data reference will ensure the data lives
-// as long as any DataExtractor objects exist that have a reference to
-// this data.
+// Make a shared pointer reference to the shared data in "data_sp" and set the
+// endian swapping setting to "swap", and the address size to "addr_size". The
+// shared data reference will ensure the data lives as long as any
+// DataExtractor objects exist that have a reference to this data.
//----------------------------------------------------------------------
DataExtractor::DataExtractor(const DataBufferSP &data_sp, ByteOrder endian,
uint32_t addr_size,
@@ -162,11 +161,11 @@ DataExtractor::DataExtractor(const DataB
}
//----------------------------------------------------------------------
-// Initialize this object with a subset of the data bytes in "data".
-// If "data" contains shared data, then a reference to this shared
-// data will added and the shared data will stay around as long
-// as any object contains a reference to that data. The endian
-// swap and address size settings are copied from "data".
+// Initialize this object with a subset of the data bytes in "data". If "data"
+// contains shared data, then a reference to this shared data will added and
+// the shared data will stay around as long as any object contains a reference
+// to that data. The endian swap and address size settings are copied from
+// "data".
//----------------------------------------------------------------------
DataExtractor::DataExtractor(const DataExtractor &data, offset_t offset,
offset_t length, uint32_t target_byte_size /*=1*/)
@@ -210,9 +209,8 @@ const DataExtractor &DataExtractor::oper
DataExtractor::~DataExtractor() = default;
//------------------------------------------------------------------
-// Clears the object contents back to a default invalid state, and
-// release any references to shared data that this object may
-// contain.
+// Clears the object contents back to a default invalid state, and release any
+// references to shared data that this object may contain.
//------------------------------------------------------------------
void DataExtractor::Clear() {
m_start = nullptr;
@@ -223,8 +221,8 @@ void DataExtractor::Clear() {
}
//------------------------------------------------------------------
-// If this object contains shared data, this function returns the
-// offset into that shared data. Else zero is returned.
+// If this object contains shared data, this function returns the offset into
+// that shared data. Else zero is returned.
//------------------------------------------------------------------
size_t DataExtractor::GetSharedDataOffset() const {
if (m_start != nullptr) {
@@ -241,13 +239,12 @@ size_t DataExtractor::GetSharedDataOffse
}
//----------------------------------------------------------------------
-// Set the data with which this object will extract from to data
-// starting at BYTES and set the length of the data to LENGTH bytes
-// long. The data is externally owned must be around at least as
-// long as this object points to the data. No copy of the data is
-// made, this object just refers to this data and can extract from
-// it. If this object refers to any shared data upon entry, the
-// reference to that data will be released. Is SWAP is set to true,
+// Set the data with which this object will extract from to data starting at
+// BYTES and set the length of the data to LENGTH bytes long. The data is
+// externally owned must be around at least as long as this object points to
+// the data. No copy of the data is made, this object just refers to this data
+// and can extract from it. If this object refers to any shared data upon
+// entry, the reference to that data will be released. Is SWAP is set to true,
// any data extracted will be endian swapped.
//----------------------------------------------------------------------
lldb::offset_t DataExtractor::SetData(const void *bytes, offset_t length,
@@ -265,18 +262,16 @@ lldb::offset_t DataExtractor::SetData(co
}
//----------------------------------------------------------------------
-// Assign the data for this object to be a subrange in "data"
-// starting "data_offset" bytes into "data" and ending "data_length"
-// bytes later. If "data_offset" is not a valid offset into "data",
-// then this object will contain no bytes. If "data_offset" is
-// within "data" yet "data_length" is too large, the length will be
-// capped at the number of bytes remaining in "data". If "data"
-// contains a shared pointer to other data, then a ref counted
-// pointer to that data will be made in this object. If "data"
-// doesn't contain a shared pointer to data, then the bytes referred
-// to in "data" will need to exist at least as long as this object
-// refers to those bytes. The address size and endian swap settings
-// are copied from the current values in "data".
+// Assign the data for this object to be a subrange in "data" starting
+// "data_offset" bytes into "data" and ending "data_length" bytes later. If
+// "data_offset" is not a valid offset into "data", then this object will
+// contain no bytes. If "data_offset" is within "data" yet "data_length" is too
+// large, the length will be capped at the number of bytes remaining in "data".
+// If "data" contains a shared pointer to other data, then a ref counted
+// pointer to that data will be made in this object. If "data" doesn't contain
+// a shared pointer to data, then the bytes referred to in "data" will need to
+// exist at least as long as this object refers to those bytes. The address
+// size and endian swap settings are copied from the current values in "data".
//----------------------------------------------------------------------
lldb::offset_t DataExtractor::SetData(const DataExtractor &data,
offset_t data_offset,
@@ -303,18 +298,17 @@ lldb::offset_t DataExtractor::SetData(co
}
//----------------------------------------------------------------------
-// Assign the data for this object to be a subrange of the shared
-// data in "data_sp" starting "data_offset" bytes into "data_sp"
-// and ending "data_length" bytes later. If "data_offset" is not
-// a valid offset into "data_sp", then this object will contain no
-// bytes. If "data_offset" is within "data_sp" yet "data_length" is
-// too large, the length will be capped at the number of bytes
-// remaining in "data_sp". A ref counted pointer to the data in
-// "data_sp" will be made in this object IF the number of bytes this
-// object refers to in greater than zero (if at least one byte was
-// available starting at "data_offset") to ensure the data stays
-// around as long as it is needed. The address size and endian swap
-// settings will remain unchanged from their current settings.
+// Assign the data for this object to be a subrange of the shared data in
+// "data_sp" starting "data_offset" bytes into "data_sp" and ending
+// "data_length" bytes later. If "data_offset" is not a valid offset into
+// "data_sp", then this object will contain no bytes. If "data_offset" is
+// within "data_sp" yet "data_length" is too large, the length will be capped
+// at the number of bytes remaining in "data_sp". A ref counted pointer to the
+// data in "data_sp" will be made in this object IF the number of bytes this
+// object refers to in greater than zero (if at least one byte was available
+// starting at "data_offset") to ensure the data stays around as long as it is
+// needed. The address size and endian swap settings will remain unchanged from
+// their current settings.
//----------------------------------------------------------------------
lldb::offset_t DataExtractor::SetData(const DataBufferSP &data_sp,
offset_t data_offset,
@@ -340,8 +334,8 @@ lldb::offset_t DataExtractor::SetData(co
size_t new_size = GetByteSize();
- // Don't hold a shared pointer to the data buffer if we don't share
- // any valid bytes in the shared buffer.
+ // Don't hold a shared pointer to the data buffer if we don't share any valid
+ // bytes in the shared buffer.
if (new_size == 0)
m_data_sp.reset();
@@ -349,8 +343,8 @@ lldb::offset_t DataExtractor::SetData(co
}
//----------------------------------------------------------------------
-// Extract a single unsigned char from the binary data and update
-// the offset pointed to by "offset_ptr".
+// Extract a single unsigned char from the binary data and update the offset
+// pointed to by "offset_ptr".
//
// RETURNS the byte that was extracted, or zero on failure.
//----------------------------------------------------------------------
@@ -362,13 +356,12 @@ uint8_t DataExtractor::GetU8(offset_t *o
}
//----------------------------------------------------------------------
-// Extract "count" unsigned chars from the binary data and update the
-// offset pointed to by "offset_ptr". The extracted data is copied into
-// "dst".
+// Extract "count" unsigned chars from the binary data and update the offset
+// pointed to by "offset_ptr". The extracted data is copied into "dst".
//
// RETURNS the non-nullptr buffer pointer upon successful extraction of
-// all the requested bytes, or nullptr when the data is not available in
-// the buffer due to being out of bounds, or insufficient data.
+// all the requested bytes, or nullptr when the data is not available in the
+// buffer due to being out of bounds, or insufficient data.
//----------------------------------------------------------------------
void *DataExtractor::GetU8(offset_t *offset_ptr, void *dst,
uint32_t count) const {
@@ -384,8 +377,8 @@ void *DataExtractor::GetU8(offset_t *off
}
//----------------------------------------------------------------------
-// Extract a single uint16_t from the data and update the offset
-// pointed to by "offset_ptr".
+// Extract a single uint16_t from the data and update the offset pointed to by
+// "offset_ptr".
//
// RETURNS the uint16_t that was extracted, or zero on failure.
//----------------------------------------------------------------------
@@ -432,13 +425,12 @@ uint64_t DataExtractor::GetU64_unchecked
}
//----------------------------------------------------------------------
-// Extract "count" uint16_t values from the binary data and update
-// the offset pointed to by "offset_ptr". The extracted data is
-// copied into "dst".
+// Extract "count" uint16_t values from the binary data and update the offset
+// pointed to by "offset_ptr". The extracted data is copied into "dst".
//
// RETURNS the non-nullptr buffer pointer upon successful extraction of
-// all the requested bytes, or nullptr when the data is not available
-// in the buffer due to being out of bounds, or insufficient data.
+// all the requested bytes, or nullptr when the data is not available in the
+// buffer due to being out of bounds, or insufficient data.
//----------------------------------------------------------------------
void *DataExtractor::GetU16(offset_t *offset_ptr, void *void_dst,
uint32_t count) const {
@@ -465,8 +457,8 @@ void *DataExtractor::GetU16(offset_t *of
}
//----------------------------------------------------------------------
-// Extract a single uint32_t from the data and update the offset
-// pointed to by "offset_ptr".
+// Extract a single uint32_t from the data and update the offset pointed to by
+// "offset_ptr".
//
// RETURNS the uint32_t that was extracted, or zero on failure.
//----------------------------------------------------------------------
@@ -484,13 +476,12 @@ uint32_t DataExtractor::GetU32(offset_t
}
//----------------------------------------------------------------------
-// Extract "count" uint32_t values from the binary data and update
-// the offset pointed to by "offset_ptr". The extracted data is
-// copied into "dst".
+// Extract "count" uint32_t values from the binary data and update the offset
+// pointed to by "offset_ptr". The extracted data is copied into "dst".
//
// RETURNS the non-nullptr buffer pointer upon successful extraction of
-// all the requested bytes, or nullptr when the data is not available
-// in the buffer due to being out of bounds, or insufficient data.
+// all the requested bytes, or nullptr when the data is not available in the
+// buffer due to being out of bounds, or insufficient data.
//----------------------------------------------------------------------
void *DataExtractor::GetU32(offset_t *offset_ptr, void *void_dst,
uint32_t count) const {
@@ -517,8 +508,8 @@ void *DataExtractor::GetU32(offset_t *of
}
//----------------------------------------------------------------------
-// Extract a single uint64_t from the data and update the offset
-// pointed to by "offset_ptr".
+// Extract a single uint64_t from the data and update the offset pointed to by
+// "offset_ptr".
//
// RETURNS the uint64_t that was extracted, or zero on failure.
//----------------------------------------------------------------------
@@ -538,9 +529,9 @@ uint64_t DataExtractor::GetU64(offset_t
//----------------------------------------------------------------------
// GetU64
//
-// Get multiple consecutive 64 bit values. Return true if the entire
-// read succeeds and increment the offset pointed to by offset_ptr, else
-// return false and leave the offset pointed to by offset_ptr unchanged.
+// Get multiple consecutive 64 bit values. Return true if the entire read
+// succeeds and increment the offset pointed to by offset_ptr, else return
+// false and leave the offset pointed to by offset_ptr unchanged.
//----------------------------------------------------------------------
void *DataExtractor::GetU64(offset_t *offset_ptr, void *void_dst,
uint32_t count) const {
@@ -708,10 +699,10 @@ long double DataExtractor::GetLongDouble
}
//------------------------------------------------------------------
-// Extract a single address from the data and update the offset
-// pointed to by "offset_ptr". The size of the extracted address
-// comes from the "this->m_addr_size" member variable and should be
-// set correctly prior to extracting any address values.
+// Extract a single address from the data and update the offset pointed to by
+// "offset_ptr". The size of the extracted address comes from the
+// "this->m_addr_size" member variable and should be set correctly prior to
+// extracting any address values.
//
// RETURNS the address that was extracted, or zero on failure.
//------------------------------------------------------------------
@@ -730,10 +721,10 @@ uint64_t DataExtractor::GetAddress_unche
}
//------------------------------------------------------------------
-// Extract a single pointer from the data and update the offset
-// pointed to by "offset_ptr". The size of the extracted pointer
-// comes from the "this->m_addr_size" member variable and should be
-// set correctly prior to extracting any pointer values.
+// Extract a single pointer from the data and update the offset pointed to by
+// "offset_ptr". The size of the extracted pointer comes from the
+// "this->m_addr_size" member variable and should be set correctly prior to
+// extracting any pointer values.
//
// RETURNS the pointer that was extracted, or zero on failure.
//------------------------------------------------------------------
@@ -804,9 +795,9 @@ DataExtractor::CopyByteOrderedData(offse
const uint8_t *src = (const uint8_t *)PeekData(src_offset, src_len);
if (src) {
if (dst_len >= src_len) {
- // We are copying the entire value from src into dst.
- // Calculate how many, if any, zeroes we need for the most
- // significant bytes if "dst_len" is greater than "src_len"...
+ // We are copying the entire value from src into dst. Calculate how many,
+ // if any, zeroes we need for the most significant bytes if "dst_len" is
+ // greater than "src_len"...
const size_t num_zeroes = dst_len - src_len;
if (dst_byte_order == eByteOrderBig) {
// Big endian, so we lead with zeroes...
@@ -863,15 +854,13 @@ DataExtractor::CopyByteOrderedData(offse
}
//----------------------------------------------------------------------
-// Extracts a variable length NULL terminated C string from
-// the data at the offset pointed to by "offset_ptr". The
-// "offset_ptr" will be updated with the offset of the byte that
-// follows the NULL terminator byte.
-//
-// If the offset pointed to by "offset_ptr" is out of bounds, or if
-// "length" is non-zero and there aren't enough available
-// bytes, nullptr will be returned and "offset_ptr" will not be
-// updated.
+// Extracts a variable length NULL terminated C string from the data at the
+// offset pointed to by "offset_ptr". The "offset_ptr" will be updated with
+// the offset of the byte that follows the NULL terminator byte.
+//
+// If the offset pointed to by "offset_ptr" is out of bounds, or if "length" is
+// non-zero and there aren't enough available bytes, nullptr will be returned
+// and "offset_ptr" will not be updated.
//----------------------------------------------------------------------
const char *DataExtractor::GetCStr(offset_t *offset_ptr) const {
const char *cstr = (const char *)PeekData(*offset_ptr, 1);
@@ -890,23 +879,21 @@ const char *DataExtractor::GetCStr(offse
}
// We reached the end of the data without finding a NULL C string
- // terminator. Fall through and return nullptr otherwise anyone that
- // would have used the result as a C string can wander into
- // unknown memory...
+ // terminator. Fall through and return nullptr otherwise anyone that would
+ // have used the result as a C string can wander into unknown memory...
}
return nullptr;
}
//----------------------------------------------------------------------
-// Extracts a NULL terminated C string from the fixed length field of
-// length "len" at the offset pointed to by "offset_ptr".
-// The "offset_ptr" will be updated with the offset of the byte that
-// follows the fixed length field.
-//
-// If the offset pointed to by "offset_ptr" is out of bounds, or if
-// the offset plus the length of the field is out of bounds, or if the
-// field does not contain a NULL terminator byte, nullptr will be returned
-// and "offset_ptr" will not be updated.
+// Extracts a NULL terminated C string from the fixed length field of length
+// "len" at the offset pointed to by "offset_ptr". The "offset_ptr" will be
+// updated with the offset of the byte that follows the fixed length field.
+//
+// If the offset pointed to by "offset_ptr" is out of bounds, or if the offset
+// plus the length of the field is out of bounds, or if the field does not
+// contain a NULL terminator byte, nullptr will be returned and "offset_ptr"
+// will not be updated.
//----------------------------------------------------------------------
const char *DataExtractor::GetCStr(offset_t *offset_ptr, offset_t len) const {
const char *cstr = (const char *)PeekData(*offset_ptr, len);
@@ -921,22 +908,22 @@ const char *DataExtractor::GetCStr(offse
}
//------------------------------------------------------------------
-// Peeks at a string in the contained data. No verification is done
-// to make sure the entire string lies within the bounds of this
-// object's data, only "offset" is verified to be a valid offset.
+// Peeks at a string in the contained data. No verification is done to make
+// sure the entire string lies within the bounds of this object's data, only
+// "offset" is verified to be a valid offset.
//
-// Returns a valid C string pointer if "offset" is a valid offset in
-// this object's data, else nullptr is returned.
+// Returns a valid C string pointer if "offset" is a valid offset in this
+// object's data, else nullptr is returned.
//------------------------------------------------------------------
const char *DataExtractor::PeekCStr(offset_t offset) const {
return (const char *)PeekData(offset, 1);
}
//----------------------------------------------------------------------
-// Extracts an unsigned LEB128 number from this object's data
-// starting at the offset pointed to by "offset_ptr". The offset
-// pointed to by "offset_ptr" will be updated with the offset of the
-// byte following the last extracted byte.
+// Extracts an unsigned LEB128 number from this object's data starting at the
+// offset pointed to by "offset_ptr". The offset pointed to by "offset_ptr"
+// will be updated with the offset of the byte following the last extracted
+// byte.
//
// Returned the extracted integer value.
//----------------------------------------------------------------------
@@ -968,10 +955,10 @@ uint64_t DataExtractor::GetULEB128(offse
}
//----------------------------------------------------------------------
-// Extracts an signed LEB128 number from this object's data
-// starting at the offset pointed to by "offset_ptr". The offset
-// pointed to by "offset_ptr" will be updated with the offset of the
-// byte following the last extracted byte.
+// Extracts an signed LEB128 number from this object's data starting at the
+// offset pointed to by "offset_ptr". The offset pointed to by "offset_ptr"
+// will be updated with the offset of the byte following the last extracted
+// byte.
//
// Returned the extracted integer value.
//----------------------------------------------------------------------
@@ -1010,10 +997,10 @@ int64_t DataExtractor::GetSLEB128(offset
}
//----------------------------------------------------------------------
-// Skips a ULEB128 number (signed or unsigned) from this object's
-// data starting at the offset pointed to by "offset_ptr". The
-// offset pointed to by "offset_ptr" will be updated with the offset
-// of the byte following the last extracted byte.
+// Skips a ULEB128 number (signed or unsigned) from this object's data starting
+// at the offset pointed to by "offset_ptr". The offset pointed to by
+// "offset_ptr" will be updated with the offset of the byte following the last
+// extracted byte.
//
// Returns the number of bytes consumed during the extraction.
//----------------------------------------------------------------------
@@ -1036,15 +1023,14 @@ uint32_t DataExtractor::Skip_LEB128(offs
//----------------------------------------------------------------------
// Dumps bytes from this object's data to the stream "s" starting
-// "start_offset" bytes into this data, and ending with the byte
-// before "end_offset". "base_addr" will be added to the offset
-// into the dumped data when showing the offset into the data in the
-// output information. "num_per_line" objects of type "type" will
-// be dumped with the option to override the format for each object
-// with "type_format". "type_format" is a printf style formatting
-// string. If "type_format" is nullptr, then an appropriate format
-// string will be used for the supplied "type". If the stream "s"
-// is nullptr, then the output will be send to Log().
+// "start_offset" bytes into this data, and ending with the byte before
+// "end_offset". "base_addr" will be added to the offset into the dumped data
+// when showing the offset into the data in the output information.
+// "num_per_line" objects of type "type" will be dumped with the option to
+// override the format for each object with "type_format". "type_format" is a
+// printf style formatting string. If "type_format" is nullptr, then an
+// appropriate format string will be used for the supplied "type". If the
+// stream "s" is nullptr, then the output will be send to Log().
//----------------------------------------------------------------------
lldb::offset_t DataExtractor::PutToLog(Log *log, offset_t start_offset,
offset_t length, uint64_t base_addr,
Modified: lldb/trunk/source/Utility/FastDemangle.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/FastDemangle.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/FastDemangle.cpp (original)
+++ lldb/trunk/source/Utility/FastDemangle.cpp Mon Apr 30 09:49:04 2018
@@ -200,8 +200,7 @@ private:
if (growth > 1 << 20)
growth = 1 << 20;
- // ... but never grow by less than requested,
- // or 1K, whichever is greater
+ // ... but never grow by less than requested, or 1K, whichever is greater
if (min_growth < 1024)
min_growth = 1024;
if (growth < min_growth)
@@ -282,9 +281,8 @@ private:
if (index == m_rewrite_ranges_size)
break;
- // Affected ranges are either shuffled forward when after the
- // insertion but before the source, or backward when inside the
- // source
+ // Affected ranges are either shuffled forward when after the insertion
+ // but before the source, or backward when inside the source
int candidate_offset = m_rewrite_ranges[index].offset;
if (candidate_offset >= insertion_point_cookie) {
if (candidate_offset < source_range.offset) {
@@ -402,8 +400,7 @@ private:
//----------------------------------------------------
// Rewrite methods
//
- // Write another copy of content already present
- // earlier in the output buffer
+ // Write another copy of content already present earlier in the output buffer
//----------------------------------------------------
void RewriteRange(BufferRange range) {
@@ -436,11 +433,11 @@ private:
//----------------------------------------------------
// TryParse methods
//
- // Provide information with return values instead of
- // writing to the output buffer
+ // Provide information with return values instead of writing to the output
+ // buffer
//
- // Values indicating failure guarantee that the pre-
- // call m_read_ptr is unchanged
+ // Values indicating failure guarantee that the pre- call m_read_ptr is
+ // unchanged
//----------------------------------------------------
int TryParseNumber() {
@@ -820,8 +817,8 @@ private:
}
// <CV-qualifiers> ::= [r] [V] [K]
- // <ref-qualifier> ::= R # & ref-qualifier
- // <ref-qualifier> ::= O # && ref-qualifier
+ // <ref-qualifier> ::= R # & ref-qualifier <ref-qualifier>
+ // ::= O # && ref-qualifier
int TryParseQualifiers(bool allow_cv, bool allow_ro) {
int qualifiers = QualifierNone;
@@ -890,11 +887,10 @@ private:
//----------------------------------------------------
// Parse methods
//
- // Consume input starting from m_read_ptr and produce
- // buffered output at m_write_ptr
+ // Consume input starting from m_read_ptr and produce buffered output at
+ // m_write_ptr
//
- // Failures return false and may leave m_read_ptr in an
- // indeterminate state
+ // Failures return false and may leave m_read_ptr in an indeterminate state
//----------------------------------------------------
bool Parse(char character) {
@@ -932,17 +928,14 @@ private:
// <substitution> ::= S <seq-id> _
// ::= S_
- // <substitution> ::= Sa # ::std::allocator
- // <substitution> ::= Sb # ::std::basic_string
- // <substitution> ::= Ss # ::std::basic_string < char,
+ // <substitution> ::= Sa # ::std::allocator <substitution> ::= Sb #
+ // ::std::basic_string <substitution> ::= Ss # ::std::basic_string < char,
// ::std::char_traits<char>,
// ::std::allocator<char> >
// <substitution> ::= Si # ::std::basic_istream<char, std::char_traits<char>
- // >
- // <substitution> ::= So # ::std::basic_ostream<char, std::char_traits<char>
- // >
- // <substitution> ::= Sd # ::std::basic_iostream<char, std::char_traits<char>
- // >
+ // > <substitution> ::= So # ::std::basic_ostream<char,
+ // std::char_traits<char> > <substitution> ::= Sd #
+ // ::std::basic_iostream<char, std::char_traits<char> >
bool ParseSubstitution() {
const char *substitution;
@@ -967,7 +960,8 @@ private:
break;
default:
// A failed attempt to parse a number will return -1 which turns out to be
- // perfect here as S_ is the first substitution, S0_ the next and so forth
+ // perfect here as S_ is the first substitution, S0_ the next and so
+ // forth
int substitution_index = TryParseBase36Number();
if (*m_read_ptr++ != '_') {
#ifdef DEBUG_FAILURES
@@ -984,17 +978,17 @@ private:
// <function-type> ::= F [Y] <bare-function-type> [<ref-qualifier>] E
//
- // <bare-function-type> ::= <signature type>+ # types are possible return
- // type, then parameter types
+ // <bare-function-type> ::= <signature type>+ # types are possible
+ // return type, then parameter types
bool ParseFunctionType(int inner_qualifiers = QualifierNone) {
#ifdef DEBUG_FAILURES
printf("*** Function types not supported\n");
#endif
// TODO: first steps toward an implementation follow, but they're far
- // from complete. Function types tend to bracket other types eg:
- // int (*)() when used as the type for "name" becomes int (*name)().
- // This makes substitution et al ... interesting.
+ // from complete. Function types tend to bracket other types eg: int (*)()
+ // when used as the type for "name" becomes int (*name)(). This makes
+ // substitution et al ... interesting.
return false;
#if 0 // TODO
@@ -1154,8 +1148,8 @@ private:
if (!Parse('_'))
return false;
- // When no number is present we get -1, which is convenient since
- // T_ is the zeroth element T0_ is element 1, and so on
+ // When no number is present we get -1, which is convenient since T_ is the
+ // zeroth element T0_ is element 1, and so on
return RewriteTemplateArg(count + 1);
}
@@ -1193,13 +1187,13 @@ private:
// ::= G <type> # imaginary (C 2000)
// ::= Dp <type> # pack expansion (C++0x)
// ::= U <source-name> <type> # vendor extended type qualifier
- // extension := U <objc-name> <objc-type> # objc-type<identifier>
- // extension := <vector-type> # <vector-type> starts with Dv
+ // extension := U <objc-name> <objc-type> # objc-type<identifier> extension
+ // := <vector-type> # <vector-type> starts with Dv
// <objc-name> ::= <k0 number> objcproto <k1 number> <identifier> # k0 = 9 +
- // <number of digits in k1> + k1
- // <objc-type> := <source-name> # PU<11+>objcproto 11objc_object<source-name>
- // 11objc_object -> id<source-name>
+ // <number of digits in k1> + k1 <objc-type> := <source-name> #
+ // PU<11+>objcproto 11objc_object<source-name> 11objc_object -> id<source-
+ // name>
bool ParseType() {
#ifdef DEBUG_FAILURES
@@ -1476,8 +1470,8 @@ private:
// ::= <unnamed-type-name>
bool ParseUnqualifiedName(NameState &name_state) {
- // Note that these are detected directly in ParseNestedName for
- // performance rather than switching on the same options twice
+ // Note that these are detected directly in ParseNestedName for performance
+ // rather than switching on the same options twice
char next = *m_read_ptr;
switch (next) {
case 'C':
@@ -1943,7 +1937,8 @@ private:
break;
}
- // Record a substitution candidate for all prefixes, but not the full name
+ // Record a substitution candidate for all prefixes, but not the full
+ // name
if (suppress_substitution)
suppress_substitution = false;
else
@@ -2247,9 +2242,9 @@ private:
if (next == 'E' || next == '\0' || next == '.')
return true;
- // Clang has a bad habit of making unique manglings by just sticking numbers
- // on the end of a symbol,
- // which is ambiguous with malformed source name manglings
+ // Clang has a bad habit of making unique manglings by just sticking
+ // numbers on the end of a symbol, which is ambiguous with malformed source
+ // name manglings
const char *before_clang_uniquing_test = m_read_ptr;
if (TryParseNumber()) {
if (*m_read_ptr == '\0')
Modified: lldb/trunk/source/Utility/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/FileSpec.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/FileSpec.cpp (original)
+++ lldb/trunk/source/Utility/FileSpec.cpp Mon Apr 30 09:49:04 2018
@@ -166,8 +166,7 @@ void FileSpec::Resolve(llvm::SmallVector
FileSpec::FileSpec() : m_syntax(GetNativeSyntax()) {}
//------------------------------------------------------------------
-// Default constructor that can take an optional full path to a
-// file on disk.
+// Default constructor that can take an optional full path to a file on disk.
//------------------------------------------------------------------
FileSpec::FileSpec(llvm::StringRef path, bool resolve_path, PathSyntax syntax)
: m_syntax(syntax) {
@@ -307,15 +306,15 @@ const FileSpec &FileSpec::operator=(cons
}
//------------------------------------------------------------------
-// Update the contents of this object with a new path. The path will
-// be split up into a directory and filename and stored as uniqued
-// string values for quick comparison and efficient memory usage.
+// Update the contents of this object with a new path. The path will be split
+// up into a directory and filename and stored as uniqued string values for
+// quick comparison and efficient memory usage.
//------------------------------------------------------------------
void FileSpec::SetFile(llvm::StringRef pathname, bool resolve,
PathSyntax syntax) {
// CLEANUP: Use StringRef for string handling. This function is kind of a
- // mess and the unclear semantics of RootDirStart and ParentPathEnd make
- // it very difficult to understand this function. There's no reason this
+ // mess and the unclear semantics of RootDirStart and ParentPathEnd make it
+ // very difficult to understand this function. There's no reason this
// function should be particularly complicated or difficult to understand.
m_filename.Clear();
m_directory.Clear();
@@ -369,8 +368,8 @@ void FileSpec::SetFile(llvm::StringRef p
}
//----------------------------------------------------------------------
-// Convert to pointer operator. This allows code to check any FileSpec
-// objects to see if they contain anything valid using code such as:
+// Convert to pointer operator. This allows code to check any FileSpec objects
+// to see if they contain anything valid using code such as:
//
// if (file_spec)
// {}
@@ -378,8 +377,8 @@ void FileSpec::SetFile(llvm::StringRef p
FileSpec::operator bool() const { return m_filename || m_directory; }
//----------------------------------------------------------------------
-// Logical NOT operator. This allows code to check any FileSpec
-// objects to see if they are invalid using code such as:
+// Logical NOT operator. This allows code to check any FileSpec objects to see
+// if they are invalid using code such as:
//
// if (!file_spec)
// {}
@@ -406,12 +405,10 @@ bool FileSpec::operator==(const FileSpec
return true;
// TODO: determine if we want to keep this code in here.
- // The code below was added to handle a case where we were
- // trying to set a file and line breakpoint and one path
- // was resolved, and the other not and the directory was
- // in a mount point that resolved to a more complete path:
- // "/tmp/a.c" == "/private/tmp/a.c". I might end up pulling
- // this out...
+ // The code below was added to handle a case where we were trying to set a
+ // file and line breakpoint and one path was resolved, and the other not and
+ // the directory was in a mount point that resolved to a more complete path:
+ // "/tmp/a.c" == "/private/tmp/a.c". I might end up pulling this out...
if (IsResolved() && rhs.IsResolved()) {
// Both paths are resolved, no need to look further...
return false;
@@ -423,8 +420,8 @@ bool FileSpec::operator==(const FileSpec
if (!IsResolved()) {
if (resolved_lhs.ResolvePath()) {
// This path wasn't resolved but now it is. Check if the resolved
- // directory is the same as our unresolved directory, and if so,
- // we can mark this object as resolved to avoid more future resolves
+ // directory is the same as our unresolved directory, and if so, we can
+ // mark this object as resolved to avoid more future resolves
m_is_resolved = (m_directory == resolved_lhs.m_directory);
} else
return false;
@@ -434,16 +431,16 @@ bool FileSpec::operator==(const FileSpec
if (!rhs.IsResolved()) {
if (resolved_rhs.ResolvePath()) {
// rhs's path wasn't resolved but now it is. Check if the resolved
- // directory is the same as rhs's unresolved directory, and if so,
- // we can mark this object as resolved to avoid more future resolves
+ // directory is the same as rhs's unresolved directory, and if so, we can
+ // mark this object as resolved to avoid more future resolves
rhs.m_is_resolved = (rhs.m_directory == resolved_rhs.m_directory);
} else
return false;
}
- // If we reach this point in the code we were able to resolve both paths
- // and since we only resolve the paths if the basenames are equal, then
- // we can just check if both directories are equal...
+ // If we reach this point in the code we were able to resolve both paths and
+ // since we only resolve the paths if the basenames are equal, then we can
+ // just check if both directories are equal...
return DirectoryEquals(rhs);
}
@@ -468,8 +465,8 @@ Stream &lldb_private::operator<<(Stream
}
//------------------------------------------------------------------
-// Clear this object by releasing both the directory and filename
-// string values and making them both the empty string.
+// Clear this object by releasing both the directory and filename string values
+// and making them both the empty string.
//------------------------------------------------------------------
void FileSpec::Clear() {
m_directory.Clear();
@@ -477,15 +474,14 @@ void FileSpec::Clear() {
}
//------------------------------------------------------------------
-// Compare two FileSpec objects. If "full" is true, then both
-// the directory and the filename must match. If "full" is false,
-// then the directory names for "a" and "b" are only compared if
-// they are both non-empty. This allows a FileSpec object to only
-// contain a filename and it can match FileSpec objects that have
-// matching filenames with different paths.
+// Compare two FileSpec objects. If "full" is true, then both the directory and
+// the filename must match. If "full" is false, then the directory names for
+// "a" and "b" are only compared if they are both non-empty. This allows a
+// FileSpec object to only contain a filename and it can match FileSpec objects
+// that have matching filenames with different paths.
//
-// Return -1 if the "a" is less than "b", 0 if "a" is equal to "b"
-// and "1" if "a" is greater than "b".
+// Return -1 if the "a" is less than "b", 0 if "a" is equal to "b" and "1" if
+// "a" is greater than "b".
//------------------------------------------------------------------
int FileSpec::Compare(const FileSpec &a, const FileSpec &b, bool full) {
int result = 0;
@@ -495,10 +491,10 @@ int FileSpec::Compare(const FileSpec &a,
// If full is true, then we must compare both the directory and filename.
- // If full is false, then if either directory is empty, then we match on
- // the basename only, and if both directories have valid values, we still
- // do a full compare. This allows for matching when we just have a filename
- // in one of the FileSpec objects.
+ // If full is false, then if either directory is empty, then we match on the
+ // basename only, and if both directories have valid values, we still do a
+ // full compare. This allows for matching when we just have a filename in one
+ // of the FileSpec objects.
if (full || (a.m_directory && b.m_directory)) {
result = ConstString::Compare(a.m_directory, b.m_directory, case_sensitive);
@@ -527,9 +523,9 @@ bool FileSpec::Equal(const FileSpec &a,
}
//------------------------------------------------------------------
-// Dump the object to the supplied stream. If the object contains
-// a valid directory name, it will be displayed followed by a
-// directory delimiter, and the filename.
+// Dump the object to the supplied stream. If the object contains a valid
+// directory name, it will be displayed followed by a directory delimiter, and
+// the filename.
//------------------------------------------------------------------
void FileSpec::Dump(Stream *s) const {
if (s) {
@@ -572,8 +568,7 @@ bool FileSpec::ResolveExecutableLocation
return true;
else {
// If FindProgramByName found the file, it returns the directory +
- // filename in its return results.
- // We need to separate them.
+ // filename in its return results. We need to separate them.
FileSpec tmp_file(dir_ref.data(), false);
if (tmp_file.Exists()) {
m_directory = tmp_file.m_directory;
@@ -635,9 +630,8 @@ ConstString &FileSpec::GetFilename() { r
const ConstString &FileSpec::GetFilename() const { return m_filename; }
//------------------------------------------------------------------
-// Extract the directory and path into a fixed buffer. This is
-// needed as the directory and path are stored in separate string
-// values.
+// Extract the directory and path into a fixed buffer. This is needed as the
+// directory and path are stored in separate string values.
//------------------------------------------------------------------
size_t FileSpec::GetPath(char *path, size_t path_max_len,
bool denormalize) const {
@@ -698,9 +692,8 @@ ConstString FileSpec::GetFileNameStrippi
}
//------------------------------------------------------------------
-// Return the size in bytes that this object takes in memory. This
-// returns the size in bytes of this object, not any shared string
-// values it may refer to.
+// Return the size in bytes that this object takes in memory. This returns the
+// size in bytes of this object, not any shared string values it may refer to.
//------------------------------------------------------------------
size_t FileSpec::MemorySize() const {
return m_filename.MemorySize() + m_directory.MemorySize();
@@ -961,10 +954,9 @@ void llvm::format_provider<FileSpec>::fo
// Style is either D or empty, either way we need to print the directory.
if (!dir.empty()) {
- // Directory is stored in normalized form, which might be different
- // than preferred form. In order to handle this, we need to cut off
- // the filename, then denormalize, then write the entire denorm'ed
- // directory.
+ // Directory is stored in normalized form, which might be different than
+ // preferred form. In order to handle this, we need to cut off the
+ // filename, then denormalize, then write the entire denorm'ed directory.
llvm::SmallString<64> denormalized_dir = dir;
Denormalize(denormalized_dir, F.GetPathSyntax());
Stream << denormalized_dir;
Modified: lldb/trunk/source/Utility/JSON.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/JSON.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/JSON.cpp (original)
+++ lldb/trunk/source/Utility/JSON.cpp Mon Apr 30 09:49:04 2018
@@ -449,8 +449,7 @@ int JSONParser::GetEscapedChar(bool &was
JSONValue::SP JSONParser::ParseJSONObject() {
// The "JSONParser::Token::ObjectStart" token should have already been
- // consumed
- // by the time this function is called
+ // consumed by the time this function is called
std::unique_ptr<JSONObject> dict_up(new JSONObject());
std::string value;
@@ -481,8 +480,7 @@ JSONValue::SP JSONParser::ParseJSONObjec
JSONValue::SP JSONParser::ParseJSONArray() {
// The "JSONParser::Token::ObjectStart" token should have already been
- // consumed
- // by the time this function is called
+ // consumed by the time this function is called
std::unique_ptr<JSONArray> array_up(new JSONArray());
std::string value;
Modified: lldb/trunk/source/Utility/Log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Log.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/Log.cpp (original)
+++ lldb/trunk/source/Utility/Log.cpp Mon Apr 30 09:49:04 2018
@@ -121,9 +121,9 @@ void Log::Printf(const char *format, ...
}
//----------------------------------------------------------------------
-// All logging eventually boils down to this function call. If we have
-// a callback registered, then we call the logging callback. If we have
-// a valid file handle, we also log to the file.
+// All logging eventually boils down to this function call. If we have a
+// callback registered, then we call the logging callback. If we have a valid
+// file handle, we also log to the file.
//----------------------------------------------------------------------
void Log::VAPrintf(const char *format, va_list args) {
llvm::SmallString<64> FinalMessage;
@@ -156,8 +156,7 @@ void Log::VAError(const char *format, va
}
//----------------------------------------------------------------------
-// Printing of warnings that are not fatal only if verbose mode is
-// enabled.
+// Printing of warnings that are not fatal only if verbose mode is enabled.
//----------------------------------------------------------------------
void Log::Verbose(const char *format, ...) {
if (!GetVerbose())
@@ -302,8 +301,8 @@ void Log::WriteHeader(llvm::raw_ostream
}
void Log::WriteMessage(const std::string &message) {
- // Make a copy of our stream shared pointer in case someone disables our
- // log while we are logging and releases the stream
+ // Make a copy of our stream shared pointer in case someone disables our log
+ // while we are logging and releases the stream
auto stream_sp = GetStream();
if (!stream_sp)
return;
Modified: lldb/trunk/source/Utility/RegularExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/RegularExpression.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/RegularExpression.cpp (original)
+++ lldb/trunk/source/Utility/RegularExpression.cpp Mon Apr 30 09:49:04 2018
@@ -14,9 +14,8 @@
#include <string>
//----------------------------------------------------------------------
-// Enable enhanced mode if it is available. This allows for things like
-// \d for digit, \s for space, and many more, but it isn't available
-// everywhere.
+// Enable enhanced mode if it is available. This allows for things like \d for
+// digit, \s for space, and many more, but it isn't available everywhere.
//----------------------------------------------------------------------
#if defined(REG_ENHANCED)
#define DEFAULT_COMPILE_FLAGS (REG_ENHANCED | REG_EXTENDED)
@@ -31,8 +30,8 @@ RegularExpression::RegularExpression() :
}
//----------------------------------------------------------------------
-// Constructor that compiles "re" using "flags" and stores the
-// resulting compiled regular expression into this object.
+// Constructor that compiles "re" using "flags" and stores the resulting
+// compiled regular expression into this object.
//----------------------------------------------------------------------
RegularExpression::RegularExpression(llvm::StringRef str)
: m_re(), m_comp_err(1), m_preg() {
@@ -55,17 +54,16 @@ operator=(const RegularExpression &rhs)
//----------------------------------------------------------------------
// Destructor
//
-// Any previously compiled regular expression contained in this
-// object will be freed.
+// Any previously compiled regular expression contained in this object will be
+// freed.
//----------------------------------------------------------------------
RegularExpression::~RegularExpression() { Free(); }
//----------------------------------------------------------------------
-// Compile a regular expression using the supplied regular
-// expression text and flags. The compiled regular expression lives
-// in this object so that it can be readily used for regular
-// expression matches. Execute() can be called after the regular
-// expression is compiled. Any previously compiled regular
+// Compile a regular expression using the supplied regular expression text and
+// flags. The compiled regular expression lives in this object so that it can
+// be readily used for regular expression matches. Execute() can be called
+// after the regular expression is compiled. Any previously compiled regular
// expression contained in this object will be freed.
//
// RETURNS
@@ -75,20 +73,19 @@ RegularExpression::~RegularExpression()
bool RegularExpression::Compile(llvm::StringRef str) {
Free();
- // regcomp() on darwin does not recognize "" as a valid regular expression, so
- // we substitute it with an equivalent non-empty one.
+ // regcomp() on darwin does not recognize "" as a valid regular expression,
+ // so we substitute it with an equivalent non-empty one.
m_re = str.empty() ? "()" : str;
m_comp_err = ::regcomp(&m_preg, m_re.c_str(), DEFAULT_COMPILE_FLAGS);
return m_comp_err == 0;
}
//----------------------------------------------------------------------
-// Execute a regular expression match using the compiled regular
-// expression that is already in this object against the match
-// string "s". If any parens are used for regular expression
-// matches "match_count" should indicate the number of regmatch_t
-// values that are present in "match_ptr". The regular expression
-// will be executed using the "execute_flags".
+// Execute a regular expression match using the compiled regular expression
+// that is already in this object against the match string "s". If any parens
+// are used for regular expression matches "match_count" should indicate the
+// number of regmatch_t values that are present in "match_ptr". The regular
+// expression will be executed using the "execute_flags".
//---------------------------------------------------------------------
bool RegularExpression::Execute(llvm::StringRef str, Match *match) const {
int err = 1;
@@ -159,14 +156,12 @@ bool RegularExpression::Match::GetMatchS
}
//----------------------------------------------------------------------
-// Returns true if the regular expression compiled and is ready
-// for execution.
+// Returns true if the regular expression compiled and is ready for execution.
//----------------------------------------------------------------------
bool RegularExpression::IsValid() const { return m_comp_err == 0; }
//----------------------------------------------------------------------
-// Returns the text that was used to compile the current regular
-// expression.
+// Returns the text that was used to compile the current regular expression.
//----------------------------------------------------------------------
llvm::StringRef RegularExpression::GetText() const { return m_re; }
Modified: lldb/trunk/source/Utility/SelectHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/SelectHelper.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/SelectHelper.cpp (original)
+++ lldb/trunk/source/Utility/SelectHelper.cpp Mon Apr 30 09:49:04 2018
@@ -236,8 +236,9 @@ lldb_private::Status SelectHelper::Selec
error.SetErrorString("timed out");
return error;
} else {
- // One or more descriptors were set, update the FDInfo::select_is_set mask
- // so users can ask the SelectHelper class so clients can call one of:
+ // One or more descriptors were set, update the FDInfo::select_is_set
+ // mask so users can ask the SelectHelper class so clients can call one
+ // of:
for (auto &pair : m_fd_map) {
const int fd = pair.first;
Modified: lldb/trunk/source/Utility/SharingPtr.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/SharingPtr.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/SharingPtr.cpp (original)
+++ lldb/trunk/source/Utility/SharingPtr.cpp Mon Apr 30 09:49:04 2018
@@ -11,8 +11,8 @@
#if defined(ENABLE_SP_LOGGING)
-// If ENABLE_SP_LOGGING is defined, then log all shared pointer assignments
-// and allow them to be queried using a pointer by a call to:
+// If ENABLE_SP_LOGGING is defined, then log all shared pointer assignments and
+// allow them to be queried using a pointer by a call to:
#include <assert.h>
#include <execinfo.h>
@@ -96,8 +96,8 @@ extern "C" void track_sp(void *sp_this,
namespace lldb {
void dump_sp_refs(void *ptr) {
- // Use a specially crafted call to "track_sp" which will
- // dump info on all live shared pointers that reference "ptr"
+ // Use a specially crafted call to "track_sp" which will dump info on all
+ // live shared pointers that reference "ptr"
track_sp(NULL, ptr, 0);
}
}
Modified: lldb/trunk/source/Utility/Status.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Status.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/Status.cpp (original)
+++ lldb/trunk/source/Utility/Status.cpp Mon Apr 30 09:49:04 2018
@@ -107,9 +107,9 @@ const Status &Status::operator=(const St
Status::~Status() = default;
//----------------------------------------------------------------------
-// Get the error value as a NULL C string. The error string will be
-// fetched and cached on demand. The cached error string value will
-// remain until the error value is changed or cleared.
+// Get the error value as a NULL C string. The error string will be fetched and
+// cached on demand. The cached error string value will remain until the error
+// value is changed or cleared.
//----------------------------------------------------------------------
const char *Status::AsCString(const char *default_error_str) const {
if (Success())
@@ -161,8 +161,8 @@ Status::ValueType Status::GetError() con
ErrorType Status::GetType() const { return m_type; }
//----------------------------------------------------------------------
-// Returns true if this object contains a value that describes an
-// error or otherwise non-success result.
+// Returns true if this object contains a value that describes an error or
+// otherwise non-success result.
//----------------------------------------------------------------------
bool Status::Fail() const { return m_code != 0; }
@@ -210,8 +210,7 @@ void Status::SetError(ValueType err, Err
}
//----------------------------------------------------------------------
-// Update the error value to be "errno" and update the type to
-// be "POSIX".
+// Update the error value to be "errno" and update the type to be "POSIX".
//----------------------------------------------------------------------
void Status::SetErrorToErrno() {
m_code = errno;
@@ -220,8 +219,8 @@ void Status::SetErrorToErrno() {
}
//----------------------------------------------------------------------
-// Update the error value to be LLDB_GENERIC_ERROR and update the type
-// to be "Generic".
+// Update the error value to be LLDB_GENERIC_ERROR and update the type to be
+// "Generic".
//----------------------------------------------------------------------
void Status::SetErrorToGenericError() {
m_code = LLDB_GENERIC_ERROR;
@@ -230,15 +229,15 @@ void Status::SetErrorToGenericError() {
}
//----------------------------------------------------------------------
-// Set accessor for the error string value for a specific error.
-// This allows any string to be supplied as an error explanation.
-// The error string value will remain until the error value is
-// cleared or a new error value/type is assigned.
+// Set accessor for the error string value for a specific error. This allows
+// any string to be supplied as an error explanation. The error string value
+// will remain until the error value is cleared or a new error value/type is
+// assigned.
//----------------------------------------------------------------------
void Status::SetErrorString(llvm::StringRef err_str) {
if (!err_str.empty()) {
- // If we have an error string, we should always at least have an error
- // set to a generic value.
+ // If we have an error string, we should always at least have an error set
+ // to a generic value.
if (Success())
SetErrorToGenericError();
}
@@ -266,8 +265,8 @@ int Status::SetErrorStringWithFormat(con
int Status::SetErrorStringWithVarArg(const char *format, va_list args) {
if (format != nullptr && format[0]) {
- // If we have an error string, we should always at least have
- // an error set to a generic value.
+ // If we have an error string, we should always at least have an error set
+ // to a generic value.
if (Success())
SetErrorToGenericError();
@@ -282,8 +281,8 @@ int Status::SetErrorStringWithVarArg(con
}
//----------------------------------------------------------------------
-// Returns true if the error code in this object is considered a
-// successful return value.
+// Returns true if the error code in this object is considered a successful
+// return value.
//----------------------------------------------------------------------
bool Status::Success() const { return m_code == 0; }
Modified: lldb/trunk/source/Utility/Stream.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Stream.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/Stream.cpp (original)
+++ lldb/trunk/source/Utility/Stream.cpp Mon Apr 30 09:49:04 2018
@@ -41,14 +41,12 @@ ByteOrder Stream::SetByteOrder(ByteOrder
}
//------------------------------------------------------------------
-// Put an offset "uval" out to the stream using the printf format
-// in "format".
+// Put an offset "uval" out to the stream using the printf format in "format".
//------------------------------------------------------------------
void Stream::Offset(uint32_t uval, const char *format) { Printf(format, uval); }
//------------------------------------------------------------------
-// Put an SLEB128 "uval" out to the stream using the printf format
-// in "format".
+// Put an SLEB128 "uval" out to the stream using the printf format in "format".
//------------------------------------------------------------------
size_t Stream::PutSLEB128(int64_t sval) {
size_t bytes_written = 0;
@@ -73,8 +71,7 @@ size_t Stream::PutSLEB128(int64_t sval)
}
//------------------------------------------------------------------
-// Put an ULEB128 "uval" out to the stream using the printf format
-// in "format".
+// Put an ULEB128 "uval" out to the stream using the printf format in "format".
//------------------------------------------------------------------
size_t Stream::PutULEB128(uint64_t uval) {
size_t bytes_written = 0;
@@ -109,16 +106,16 @@ size_t Stream::PutCString(llvm::StringRe
}
//------------------------------------------------------------------
-// Print a double quoted NULL terminated C string to the stream
-// using the printf format in "format".
+// Print a double quoted NULL terminated C string to the stream using the
+// printf format in "format".
//------------------------------------------------------------------
void Stream::QuotedCString(const char *cstr, const char *format) {
Printf(format, cstr);
}
//------------------------------------------------------------------
-// Put an address "addr" out to the stream with optional prefix
-// and suffix strings.
+// Put an address "addr" out to the stream with optional prefix and suffix
+// strings.
//------------------------------------------------------------------
void Stream::Address(uint64_t addr, uint32_t addr_size, const char *prefix,
const char *suffix) {
@@ -132,8 +129,8 @@ void Stream::Address(uint64_t addr, uint
}
//------------------------------------------------------------------
-// Put an address range out to the stream with optional prefix
-// and suffix strings.
+// Put an address range out to the stream with optional prefix and suffix
+// strings.
//------------------------------------------------------------------
void Stream::AddressRange(uint64_t lo_addr, uint64_t hi_addr,
uint32_t addr_size, const char *prefix,
@@ -179,8 +176,8 @@ size_t Stream::PrintfVarArg(const char *
size_t Stream::EOL() { return PutChar('\n'); }
//------------------------------------------------------------------
-// Indent the current line using the current indentation level and
-// print an optional string following the indentation spaces.
+// Indent the current line using the current indentation level and print an
+// optional string following the indentation spaces.
//------------------------------------------------------------------
size_t Stream::Indent(const char *s) {
return Printf("%*.*s%s", m_indent_level, m_indent_level, "", s ? s : "");
Modified: lldb/trunk/source/Utility/StringExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringExtractor.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/StringExtractor.cpp (original)
+++ lldb/trunk/source/Utility/StringExtractor.cpp Mon Apr 30 09:49:04 2018
@@ -74,9 +74,8 @@ char StringExtractor::GetChar(char fail_
}
//----------------------------------------------------------------------
-// If a pair of valid hex digits exist at the head of the
-// StringExtractor they are decoded into an unsigned byte and returned
-// by this function
+// If a pair of valid hex digits exist at the head of the StringExtractor they
+// are decoded into an unsigned byte and returned by this function
//
// If there is not a pair of valid hex digits at the head of the
// StringExtractor, it is left unchanged and -1 is returned
@@ -96,12 +95,12 @@ int StringExtractor::DecodeHexU8() {
}
//----------------------------------------------------------------------
-// Extract an unsigned character from two hex ASCII chars in the packet
-// string, or return fail_value on failure
+// Extract an unsigned character from two hex ASCII chars in the packet string,
+// or return fail_value on failure
//----------------------------------------------------------------------
uint8_t StringExtractor::GetHexU8(uint8_t fail_value, bool set_eof_on_fail) {
- // On success, fail_value will be overwritten with the next
- // character in the stream
+ // On success, fail_value will be overwritten with the next character in the
+ // stream
GetHexU8Ex(fail_value, set_eof_on_fail);
return fail_value;
}
@@ -307,8 +306,8 @@ size_t StringExtractor::GetHexBytes(llvm
}
//----------------------------------------------------------------------
-// Decodes all valid hex encoded bytes at the head of the
-// StringExtractor, limited by dst_len.
+// Decodes all valid hex encoded bytes at the head of the StringExtractor,
+// limited by dst_len.
//
// Returns the number of bytes successfully decoded
//----------------------------------------------------------------------
@@ -390,9 +389,9 @@ size_t StringExtractor::GetHexByteString
bool StringExtractor::GetNameColonValue(llvm::StringRef &name,
llvm::StringRef &value) {
- // Read something in the form of NNNN:VVVV; where NNNN is any character
- // that is not a colon, followed by a ':' character, then a value (one or
- // more ';' chars), followed by a ';'
+ // Read something in the form of NNNN:VVVV; where NNNN is any character that
+ // is not a colon, followed by a ':' character, then a value (one or more ';'
+ // chars), followed by a ';'
if (m_index >= m_packet.size())
return fail();
Modified: lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp (original)
+++ lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp Mon Apr 30 09:49:04 2018
@@ -482,10 +482,9 @@ lldb_private::Status StringExtractorGDBR
size_t StringExtractorGDBRemote::GetEscapedBinaryData(std::string &str) {
// Just get the data bytes in the string as
- // GDBRemoteCommunication::CheckForPacket()
- // already removes any 0x7d escaped characters. If any 0x7d characters are
- // left in
- // the packet, then they are supposed to be there...
+ // GDBRemoteCommunication::CheckForPacket() already removes any 0x7d escaped
+ // characters. If any 0x7d characters are left in the packet, then they are
+ // supposed to be there...
str.clear();
const size_t bytes_left = GetBytesLeft();
if (bytes_left > 0) {
@@ -526,9 +525,9 @@ static bool JSONResponseValidator(void *
case StringExtractorGDBRemote::eResponse:
// JSON that is returned in from JSON query packets is currently always
- // either a dictionary which starts with a '{', or an array which
- // starts with a '['. This is a quick validator to just make sure the
- // response could be valid JSON without having to validate all of the
+ // either a dictionary which starts with a '{', or an array which starts
+ // with a '['. This is a quick validator to just make sure the response
+ // could be valid JSON without having to validate all of the
// JSON content.
switch (response.GetStringRef()[0]) {
case '{':
Modified: lldb/trunk/source/Utility/StructuredData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StructuredData.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/StructuredData.cpp (original)
+++ lldb/trunk/source/Utility/StructuredData.cpp Mon Apr 30 09:49:04 2018
@@ -85,8 +85,7 @@ static StructuredData::ObjectSP ParseJSO
static StructuredData::ObjectSP ParseJSONArray(JSONParser &json_parser) {
// The "JSONParser::Token::ObjectStart" token should have already been
- // consumed
- // by the time this function is called
+ // consumed by the time this function is called
auto array_up = llvm::make_unique<StructuredData::Array>();
std::string value;
@@ -162,8 +161,8 @@ StructuredData::Object::GetObjectForDotS
std::string key = match.first.str();
ObjectSP value = this->GetAsDictionary()->GetValueForKey(key);
if (value.get()) {
- // Do we have additional words to descend? If not, return the
- // value we're at right now.
+ // Do we have additional words to descend? If not, return the value
+ // we're at right now.
if (match.second.empty()) {
return value;
} else {
Modified: lldb/trunk/source/Utility/UUID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/UUID.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/UUID.cpp (original)
+++ lldb/trunk/source/Utility/UUID.cpp Mon Apr 30 09:49:04 2018
@@ -133,8 +133,8 @@ llvm::StringRef UUID::DecodeUUIDBytesFro
// Skip both hex digits
p = p.drop_front(2);
- // Increment the byte that we are decoding within the UUID value
- // and break out if we are done
+ // Increment the byte that we are decoding within the UUID value and
+ // break out if we are done
if (++uuid_byte_idx == num_uuid_bytes)
break;
} else if (p.front() == '-') {
Modified: lldb/trunk/source/Utility/VASprintf.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/VASprintf.cpp?rev=331197&r1=331196&r2=331197&view=diff
==============================================================================
--- lldb/trunk/source/Utility/VASprintf.cpp (original)
+++ lldb/trunk/source/Utility/VASprintf.cpp Mon Apr 30 09:49:04 2018
@@ -36,8 +36,8 @@ bool lldb_private::VASprintf(llvm::Small
}
if (size_t(length) >= buf.size()) {
- // The error formatted string didn't fit into our buffer, resize it
- // to the exact needed size, and retry
+ // The error formatted string didn't fit into our buffer, resize it to the
+ // exact needed size, and retry
buf.resize(length + 1);
length = ::vsnprintf(buf.data(), buf.size(), fmt, copy_args);
if (length < 0) {
More information about the lldb-commits
mailing list