[Lldb-commits] [lldb] r262450 - Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
Eugene Zelenko via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 1 18:18:18 PST 2016
Author: eugenezelenko
Date: Tue Mar 1 20:18:18 2016
New Revision: 262450
URL: http://llvm.org/viewvc/llvm-project?rev=262450&view=rev
Log:
Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
Modified:
lldb/trunk/source/Core/DataExtractor.cpp
lldb/trunk/source/Core/Debugger.cpp
Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=262450&r1=262449&r2=262450&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Tue Mar 1 20:18:18 2016
@@ -7,17 +7,17 @@
//
//===----------------------------------------------------------------------===//
-#include <assert.h>
-#include <stddef.h>
-
+// C Includes
+// C++ Includes
#include <bitset>
+#include <cassert>
+#include <cstddef>
+#include <cmath>
#include <limits>
#include <sstream>
#include <string>
-#include <math.h>
-
-#include "clang/AST/ASTContext.h"
+// Other libraries and framework includes
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
@@ -25,6 +25,9 @@
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MD5.h"
+#include "clang/AST/ASTContext.h"
+
+// Project includes
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/DataBuffer.h"
@@ -125,15 +128,13 @@ ReadSwapInt64(const void* ptr)
}
#define NON_PRINTABLE_CHAR '.'
-//----------------------------------------------------------------------
-// Default constructor.
-//----------------------------------------------------------------------
+
DataExtractor::DataExtractor () :
- m_start (NULL),
- m_end (NULL),
+ m_start(nullptr),
+ m_end(nullptr),
m_byte_order(endian::InlHostByteOrder()),
- m_addr_size (sizeof(void *)),
- m_data_sp (),
+ m_addr_size(sizeof(void *)),
+ m_data_sp(),
m_target_byte_size(1)
{
}
@@ -163,11 +164,11 @@ DataExtractor::DataExtractor (const void
// this data.
//----------------------------------------------------------------------
DataExtractor::DataExtractor (const DataBufferSP& data_sp, ByteOrder endian, uint32_t addr_size, uint32_t target_byte_size/*=1*/) :
- m_start (NULL),
- m_end (NULL),
+ m_start(nullptr),
+ m_end(nullptr),
m_byte_order(endian),
- m_addr_size (addr_size),
- m_data_sp (),
+ m_addr_size(addr_size),
+ m_data_sp(),
m_target_byte_size(target_byte_size)
{
#ifdef LLDB_CONFIGURATION_DEBUG
@@ -184,8 +185,8 @@ DataExtractor::DataExtractor (const Data
// 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*/) :
- m_start(NULL),
- m_end(NULL),
+ m_start(nullptr),
+ m_end(nullptr),
m_byte_order(data.m_byte_order),
m_addr_size(data.m_addr_size),
m_data_sp(),
@@ -233,12 +234,7 @@ DataExtractor::operator= (const DataExtr
return *this;
}
-//----------------------------------------------------------------------
-// Destructor
-//----------------------------------------------------------------------
-DataExtractor::~DataExtractor ()
-{
-}
+DataExtractor::~DataExtractor() = default;
//------------------------------------------------------------------
// Clears the object contents back to a default invalid state, and
@@ -248,8 +244,8 @@ DataExtractor::~DataExtractor ()
void
DataExtractor::Clear ()
{
- m_start = NULL;
- m_end = NULL;
+ m_start = nullptr;
+ m_end = nullptr;
m_byte_order = endian::InlHostByteOrder();
m_addr_size = sizeof(void *);
m_data_sp.reset();
@@ -262,13 +258,13 @@ DataExtractor::Clear ()
size_t
DataExtractor::GetSharedDataOffset () const
{
- if (m_start != NULL)
+ if (m_start != nullptr)
{
const DataBuffer * data = m_data_sp.get();
- if (data != NULL)
+ if (data != nullptr)
{
const uint8_t * data_bytes = data->GetBytes();
- if (data_bytes != NULL)
+ if (data_bytes != nullptr)
{
assert(m_start >= data_bytes);
return m_start - data_bytes;
@@ -293,10 +289,10 @@ DataExtractor::SetData (const void *byte
{
m_byte_order = endian;
m_data_sp.reset();
- if (bytes == NULL || length == 0)
+ if (bytes == nullptr || length == 0)
{
- m_start = NULL;
- m_end = NULL;
+ m_start = nullptr;
+ m_end = nullptr;
}
else
{
@@ -328,7 +324,7 @@ DataExtractor::SetData (const DataExtrac
assert (m_addr_size == 4 || m_addr_size == 8);
#endif
// If "data" contains shared pointer to data, then we can use that
- if (data.m_data_sp.get())
+ if (data.m_data_sp)
{
m_byte_order = data.m_byte_order;
return SetData(data.m_data_sp, data.GetSharedDataOffset() + data_offset, data_length);
@@ -361,12 +357,12 @@ DataExtractor::SetData (const DataExtrac
lldb::offset_t
DataExtractor::SetData (const DataBufferSP& data_sp, offset_t data_offset, offset_t data_length)
{
- m_start = m_end = NULL;
+ m_start = m_end = nullptr;
if (data_length > 0)
{
m_data_sp = data_sp;
- if (data_sp.get())
+ if (data_sp)
{
const size_t data_size = data_sp->GetByteSize();
if (data_offset < data_size)
@@ -412,8 +408,8 @@ DataExtractor::GetU8 (offset_t *offset_p
// offset pointed to by "offset_ptr". The extracted data is copied into
// "dst".
//
-// RETURNS the non-NULL buffer pointer upon successful extraction of
-// all the requested bytes, or NULL when the data is not available in
+// 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.
//----------------------------------------------------------------------
void *
@@ -424,10 +420,10 @@ DataExtractor::GetU8 (offset_t *offset_p
{
// Copy the data into the buffer
memcpy (dst, data, count);
- // Return a non-NULL pointer to the converted data as an indicator of success
+ // Return a non-nullptr pointer to the converted data as an indicator of success
return dst;
}
- return NULL;
+ return nullptr;
}
//----------------------------------------------------------------------
@@ -487,14 +483,13 @@ DataExtractor::GetU64_unchecked (offset_
return val;
}
-
//----------------------------------------------------------------------
// 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-NULL buffer pointer upon successful extraction of
-// all the requested bytes, or NULL when the data is not available
+// 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.
//----------------------------------------------------------------------
void *
@@ -520,10 +515,10 @@ DataExtractor::GetU16 (offset_t *offset_
{
memcpy (void_dst, src, src_size);
}
- // Return a non-NULL pointer to the converted data as an indicator of success
+ // Return a non-nullptr pointer to the converted data as an indicator of success
return void_dst;
}
- return NULL;
+ return nullptr;
}
//----------------------------------------------------------------------
@@ -556,8 +551,8 @@ DataExtractor::GetU32 (offset_t *offset_
// the offset pointed to by "offset_ptr". The extracted data is
// copied into "dst".
//
-// RETURNS the non-NULL buffer pointer upon successful extraction of
-// all the requested bytes, or NULL when the data is not available
+// 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.
//----------------------------------------------------------------------
void *
@@ -583,10 +578,10 @@ DataExtractor::GetU32 (offset_t *offset_
{
memcpy (void_dst, src, src_size);
}
- // Return a non-NULL pointer to the converted data as an indicator of success
+ // Return a non-nullptr pointer to the converted data as an indicator of success
return void_dst;
}
- return NULL;
+ return nullptr;
}
//----------------------------------------------------------------------
@@ -644,10 +639,10 @@ DataExtractor::GetU64 (offset_t *offset_
{
memcpy (void_dst, src, src_size);
}
- // Return a non-NULL pointer to the converted data as an indicator of success
+ // Return a non-nullptr pointer to the converted data as an indicator of success
return void_dst;
}
- return NULL;
+ return nullptr;
}
//----------------------------------------------------------------------
@@ -780,7 +775,7 @@ DataExtractor::GetFloat (offset_t *offse
{
const uint8_t *src_data = (const uint8_t *)src;
uint8_t *dst_data = (uint8_t *)&val;
- for (size_t i=0; i<sizeof(float_type); ++i)
+ for (size_t i = 0; i < sizeof(float_type); ++i)
dst_data[sizeof(float_type) - 1 - i] = src_data[i];
}
else
@@ -804,7 +799,7 @@ DataExtractor::GetDouble (offset_t *offs
{
const uint8_t *src_data = (const uint8_t *)src;
uint8_t *dst_data = (uint8_t *)&val;
- for (size_t i=0; i<sizeof(float_type); ++i)
+ for (size_t i = 0; i < sizeof(float_type); ++i)
dst_data[sizeof(float_type) - 1 - i] = src_data[i];
}
else
@@ -828,7 +823,6 @@ DataExtractor::GetLongDouble (offset_t *
return val;
}
-
//------------------------------------------------------------------
// Extract a single address from the data and update the offset
// pointed to by "offset_ptr". The size of the extracted address
@@ -941,7 +935,7 @@ DataExtractor::GetGNUEHPointer (offset_t
break;
default:
- break;
+ break;
}
// Decode the value part
@@ -963,9 +957,9 @@ DataExtractor::GetGNUEHPointer (offset_t
case DW_EH_PE_sdata4 : addressValue = (int32_t)GetU32(offset_ptr); break;
case DW_EH_PE_sdata8 : addressValue = (int64_t)GetU64(offset_ptr); break;
default:
- // Unhandled encoding type
- assert(eh_ptr_enc);
- break;
+ // Unhandled encoding type
+ assert(eh_ptr_enc);
+ break;
}
// Since we promote everything to 64 bit, we may need to sign extend
@@ -993,7 +987,7 @@ DataExtractor::ExtractBytes (offset_t of
assert (length == 1 || length == 2 || length == 4 || length == 8 ||
length == 10 || length == 16 || length == 32);
- for (uint32_t i=0; i<length; ++i)
+ for (uint32_t i = 0; i < length; ++i)
((uint8_t*)dst)[i] = src[length - i - 1];
}
else
@@ -1033,7 +1027,7 @@ DataExtractor::CopyByteOrderedData (offs
assert (m_byte_order == eByteOrderBig || m_byte_order == eByteOrderLittle);
// Validate the destination info
- assert (dst_void_ptr != NULL);
+ assert(dst_void_ptr != nullptr);
assert (dst_len > 0);
assert (dst_byte_order == eByteOrderBig || dst_byte_order == eByteOrderLittle);
@@ -1047,7 +1041,6 @@ DataExtractor::CopyByteOrderedData (offs
!(m_byte_order == eByteOrderBig || m_byte_order == eByteOrderLittle))
return 0;
- uint32_t i;
uint8_t* dst = (uint8_t*)dst_void_ptr;
const uint8_t* src = (const uint8_t *)PeekData (src_offset, src_len);
if (src)
@@ -1070,7 +1063,7 @@ DataExtractor::CopyByteOrderedData (offs
}
else
{
- for (i=0; i<src_len; ++i)
+ for (uint32_t i = 0; i < src_len; ++i)
dst[i+num_zeroes] = src[src_len - 1 - i];
}
}
@@ -1079,7 +1072,7 @@ DataExtractor::CopyByteOrderedData (offs
// Little endian destination, so we lead the value bytes
if (m_byte_order == eByteOrderBig)
{
- for (i=0; i<src_len; ++i)
+ for (uint32_t i = 0; i < src_len; ++i)
dst[i] = src[src_len - 1 - i];
}
else
@@ -1107,7 +1100,7 @@ DataExtractor::CopyByteOrderedData (offs
else
{
// Big endian dst, with little endian src
- for (i=0; i<dst_len; ++i)
+ for (uint32_t i = 0; i < dst_len; ++i)
dst[i] = src[dst_len - 1 - i];
}
}
@@ -1117,7 +1110,7 @@ DataExtractor::CopyByteOrderedData (offs
if (m_byte_order == eByteOrderBig)
{
// Little endian dst, with big endian src
- for (i=0; i<dst_len; ++i)
+ for (uint32_t i = 0; i < dst_len; ++i)
dst[i] = src[src_len - 1 - i];
}
else
@@ -1128,12 +1121,10 @@ DataExtractor::CopyByteOrderedData (offs
}
return dst_len;
}
-
}
return 0;
}
-
//----------------------------------------------------------------------
// Extracts a variable length NULL terminated C string from
// the data at the offset pointed to by "offset_ptr". The
@@ -1142,7 +1133,7 @@ DataExtractor::CopyByteOrderedData (offs
//
// 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, NULL will be returned and "offset_ptr" will not be
+// bytes, nullptr will be returned and "offset_ptr" will not be
// updated.
//----------------------------------------------------------------------
const char*
@@ -1166,11 +1157,11 @@ DataExtractor::GetCStr (offset_t *offset
}
// We reached the end of the data without finding a NULL C string
- // terminator. Fall through and return NULL otherwise anyone that
+ // terminator. Fall through and return nullptr otherwise anyone that
// would have used the result as a C string can wander into
// unknown memory...
}
- return NULL;
+ return nullptr;
}
//----------------------------------------------------------------------
@@ -1181,23 +1172,23 @@ DataExtractor::GetCStr (offset_t *offset
//
// 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, NULL will be returned
+// 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);
- if (cstr)
+ if (cstr != nullptr)
{
- if (memchr (cstr, '\0', len) == NULL)
+ if (memchr(cstr, '\0', len) == nullptr)
{
- return NULL;
+ return nullptr;
}
*offset_ptr += len;
return cstr;
}
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -1206,7 +1197,7 @@ DataExtractor::GetCStr (offset_t *offset
// 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 NULL is returned.
+// this object's data, else nullptr is returned.
//------------------------------------------------------------------
const char *
DataExtractor::PeekCStr (offset_t offset) const
@@ -1226,7 +1217,7 @@ uint64_t
DataExtractor::GetULEB128 (offset_t *offset_ptr) const
{
const uint8_t *src = (const uint8_t *)PeekData (*offset_ptr, 1);
- if (src == NULL)
+ if (src == nullptr)
return 0;
const uint8_t *end = m_end;
@@ -1266,7 +1257,7 @@ int64_t
DataExtractor::GetSLEB128 (offset_t *offset_ptr) const
{
const uint8_t *src = (const uint8_t *)PeekData (*offset_ptr, 1);
- if (src == NULL)
+ if (src == nullptr)
return 0;
const uint8_t *end = m_end;
@@ -1313,7 +1304,7 @@ DataExtractor::Skip_LEB128 (offset_t *of
{
uint32_t bytes_consumed = 0;
const uint8_t *src = (const uint8_t *)PeekData (*offset_ptr, 1);
- if (src == NULL)
+ if (src == nullptr)
return 0;
const uint8_t *end = m_end;
@@ -1435,7 +1426,7 @@ DataExtractor::Dump (Stream *s,
uint32_t item_bit_offset, // If "item_bit_size" is non-zero, this is the shift amount to apply to a bitfield
ExecutionContextScope *exe_scope) const
{
- if (s == NULL)
+ if (s == nullptr)
return start_offset;
if (item_format == eFormatPointer)
@@ -1453,7 +1444,7 @@ DataExtractor::Dump (Stream *s,
target_sp = exe_scope->CalculateTarget();
if (target_sp)
{
- DisassemblerSP disassembler_sp (Disassembler::FindPlugin(target_sp->GetArchitecture(), NULL, NULL));
+ DisassemblerSP disassembler_sp(Disassembler::FindPlugin(target_sp->GetArchitecture(), nullptr, nullptr));
if (disassembler_sp)
{
lldb::addr_t addr = base_addr + start_offset;
@@ -1515,16 +1506,14 @@ DataExtractor::Dump (Stream *s,
line_start_offset = offset;
}
- else
- if (item_format != eFormatChar &&
- item_format != eFormatCharPrintable &&
- item_format != eFormatCharArray &&
- count > 0)
+ else if (item_format != eFormatChar &&
+ item_format != eFormatCharPrintable &&
+ item_format != eFormatCharArray &&
+ count > 0)
{
s->PutChar(' ');
}
- uint32_t i;
switch (item_format)
{
case eFormatBoolean:
@@ -1545,7 +1534,7 @@ DataExtractor::Dump (Stream *s,
// earlier C++ libraries
std::string binary_value(64, '0');
std::bitset<64> bits(uval64);
- for (i = 0; i < 64; ++i)
+ for (uint32_t i = 0; i < 64; ++i)
if (bits[i])
binary_value[64 - 1 - i] = '1';
if (item_bit_size > 0)
@@ -1563,7 +1552,7 @@ DataExtractor::Dump (Stream *s,
case eFormatBytes:
case eFormatBytesWithASCII:
- for (i=0; i<item_byte_size; ++i)
+ for (uint32_t i = 0; i < item_byte_size; ++i)
{
s->Printf ("%2.2x", GetU8(&offset));
}
@@ -1656,7 +1645,7 @@ DataExtractor::Dump (Stream *s,
{
uint64_t uval64 = GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset);
s->PutChar('\'');
- for (i=0; i<item_byte_size; ++i)
+ for (uint32_t i = 0; i < item_byte_size; ++i)
{
uint8_t ch = (uint8_t)(uval64 >> ((item_byte_size - i - 1) * 8));
if (isprint(ch))
@@ -2079,23 +2068,20 @@ DataExtractor::Dump (Stream *s,
// 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 NULL, then an appropriate format
+// string. If "type_format" is nullptr, then an appropriate format
// string will be used for the supplied "type". If the stream "s"
-// is NULL, then the output will be send to Log().
+// 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,
- uint32_t num_per_line,
- DataExtractor::Type type,
- const char *format
-) const
+DataExtractor::PutToLog(Log *log,
+ offset_t start_offset,
+ offset_t length,
+ uint64_t base_addr,
+ uint32_t num_per_line,
+ DataExtractor::Type type,
+ const char *format) const
{
- if (log == NULL)
+ if (log == nullptr)
return start_offset;
offset_t offset;
@@ -2185,7 +2171,7 @@ DataExtractor::DumpHexBytes (Stream *s,
size_t
DataExtractor::Copy (DataExtractor &dest_data) const
{
- if (m_data_sp.get())
+ if (m_data_sp)
{
// we can pass along the SP to the data
dest_data.SetData(m_data_sp);
@@ -2213,10 +2199,10 @@ DataExtractor::Append(DataExtractor& rhs
size_t bytes = GetByteSize() + rhs.GetByteSize();
- DataBufferHeap *buffer_heap_ptr = NULL;
+ DataBufferHeap *buffer_heap_ptr = nullptr;
DataBufferSP buffer_sp(buffer_heap_ptr = new DataBufferHeap(bytes, 0));
- if (buffer_sp.get() == NULL || buffer_heap_ptr == NULL)
+ if (!buffer_sp || buffer_heap_ptr == nullptr)
return false;
uint8_t* bytes_ptr = buffer_heap_ptr->GetBytes();
@@ -2232,7 +2218,7 @@ DataExtractor::Append(DataExtractor& rhs
bool
DataExtractor::Append(void* buf, offset_t length)
{
- if (buf == NULL)
+ if (buf == nullptr)
return false;
if (length == 0)
@@ -2240,10 +2226,10 @@ DataExtractor::Append(void* buf, offset_
size_t bytes = GetByteSize() + length;
- DataBufferHeap *buffer_heap_ptr = NULL;
+ DataBufferHeap *buffer_heap_ptr = nullptr;
DataBufferSP buffer_sp(buffer_heap_ptr = new DataBufferHeap(bytes, 0));
- if (buffer_sp.get() == NULL || buffer_heap_ptr == NULL)
+ if (!buffer_sp || buffer_heap_ptr == nullptr)
return false;
uint8_t* bytes_ptr = buffer_heap_ptr->GetBytes();
@@ -2280,4 +2266,3 @@ DataExtractor::Checksum (llvm::SmallVect
result+16,
dest.begin());
}
-
Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=262450&r1=262449&r2=262450&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue Mar 1 20:18:18 2016
@@ -9,10 +9,15 @@
#include "lldb/Core/Debugger.h"
+// C Includes
+// C++ Includes
#include <map>
+// Other libraries and framework includes
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/DynamicLibrary.h"
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/FormatEntity.h"
#include "lldb/Core/Module.h"
@@ -54,12 +59,9 @@
#include "lldb/Target/Thread.h"
#include "lldb/Utility/AnsiTerminal.h"
-#include "llvm/Support/DynamicLibrary.h"
-
using namespace lldb;
using namespace lldb_private;
-
static lldb::user_id_t g_unique_id = 1;
static size_t g_debugger_event_thread_stack_bytes = 8 * 1024 * 1024;
@@ -90,7 +92,7 @@ g_show_disassembly_enum_values[] =
{ Debugger::eStopDisassemblyTypeNoDebugInfo, "no-debuginfo", "Show disassembly when there is no debug information."},
{ Debugger::eStopDisassemblyTypeNoSource, "no-source", "Show disassembly when there is no source information, or the source file is missing when displaying a stop context."},
{ Debugger::eStopDisassemblyTypeAlways, "always", "Always show disassembly when displaying a stop context."},
- { 0, NULL, NULL }
+ { 0, nullptr, nullptr }
};
OptionEnumValueElement
@@ -99,7 +101,7 @@ g_language_enumerators[] =
{ eScriptLanguageNone, "none", "Disable scripting languages."},
{ eScriptLanguagePython, "python", "Select python as the default scripting language."},
{ eScriptLanguageDefault, "default", "Select the lldb default as the default scripting language."},
- { 0, NULL, NULL }
+ { 0, nullptr, nullptr }
};
#define MODULE_WITH_FUNC "{ ${module.file.basename}{`${function.name-with-args}${function.pc-offset}}}"
@@ -140,30 +142,29 @@ g_language_enumerators[] =
// lldb's original format for disassembly would look like this format string -
// {${function.initial-function}{${module.file.basename}`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name-without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}:
-
static PropertyDefinition
g_properties[] =
{
-{ "auto-confirm", OptionValue::eTypeBoolean , true, false, NULL, NULL, "If true all confirmation prompts will receive their default reply." },
-{ "disassembly-format", OptionValue::eTypeFormatEntity, true, 0 , DEFAULT_DISASSEMBLY_FORMAT, NULL, "The default disassembly format string to use when disassembling instruction sequences." },
-{ "frame-format", OptionValue::eTypeFormatEntity, true, 0 , DEFAULT_FRAME_FORMAT, NULL, "The default frame format string to use when displaying stack frame information for threads." },
-{ "notify-void", OptionValue::eTypeBoolean , true, false, NULL, NULL, "Notify the user explicitly if an expression returns void (default: false)." },
-{ "prompt", OptionValue::eTypeString , true, OptionValueString::eOptionEncodeCharacterEscapeSequences, "(lldb) ", NULL, "The debugger command line prompt displayed for the user." },
-{ "script-lang", OptionValue::eTypeEnum , true, eScriptLanguagePython, NULL, g_language_enumerators, "The script language to be used for evaluating user-written scripts." },
-{ "stop-disassembly-count", OptionValue::eTypeSInt64 , true, 4 , NULL, NULL, "The number of disassembly lines to show when displaying a stopped context." },
-{ "stop-disassembly-display", OptionValue::eTypeEnum , true, Debugger::eStopDisassemblyTypeNoDebugInfo, NULL, g_show_disassembly_enum_values, "Control when to display disassembly when displaying a stopped context." },
-{ "stop-line-count-after", OptionValue::eTypeSInt64 , true, 3 , NULL, NULL, "The number of sources lines to display that come after the current source line when displaying a stopped context." },
-{ "stop-line-count-before", OptionValue::eTypeSInt64 , true, 3 , NULL, NULL, "The number of sources lines to display that come before the current source line when displaying a stopped context." },
-{ "term-width", OptionValue::eTypeSInt64 , true, 80 , NULL, NULL, "The maximum number of columns to use for displaying text." },
-{ "thread-format", OptionValue::eTypeFormatEntity, true, 0 , DEFAULT_THREAD_FORMAT, NULL, "The default thread format string to use when displaying thread information." },
-{ "use-external-editor", OptionValue::eTypeBoolean , true, false, NULL, NULL, "Whether to use an external editor or not." },
-{ "use-color", OptionValue::eTypeBoolean , true, true , NULL, NULL, "Whether to use Ansi color codes or not." },
-{ "auto-one-line-summaries", OptionValue::eTypeBoolean , true, true, NULL, NULL, "If true, LLDB will automatically display small structs in one-liner format (default: true)." },
-{ "auto-indent", OptionValue::eTypeBoolean , true, true , NULL, NULL, "If true, LLDB will auto indent/outdent code. Currently only supported in the REPL (default: true)." },
-{ "print-decls", OptionValue::eTypeBoolean , true, true , NULL, NULL, "If true, LLDB will print the values of variables declared in an expression. Currently only supported in the REPL (default: true)." },
-{ "tab-size", OptionValue::eTypeUInt64 , true, 4 , NULL, NULL, "The tab size to use when indenting code in multi-line input mode (default: 4)." },
-{ "escape-non-printables", OptionValue::eTypeBoolean , true, true, NULL, NULL, "If true, LLDB will automatically escape non-printable and escape characters when formatting strings." },
-{ NULL, OptionValue::eTypeInvalid , true, 0 , NULL, NULL, NULL }
+{ "auto-confirm", OptionValue::eTypeBoolean , true, false, nullptr, nullptr, "If true all confirmation prompts will receive their default reply." },
+{ "disassembly-format", OptionValue::eTypeFormatEntity, true, 0 , DEFAULT_DISASSEMBLY_FORMAT, nullptr, "The default disassembly format string to use when disassembling instruction sequences." },
+{ "frame-format", OptionValue::eTypeFormatEntity, true, 0 , DEFAULT_FRAME_FORMAT, nullptr, "The default frame format string to use when displaying stack frame information for threads." },
+{ "notify-void", OptionValue::eTypeBoolean , true, false, nullptr, nullptr, "Notify the user explicitly if an expression returns void (default: false)." },
+{ "prompt", OptionValue::eTypeString , true, OptionValueString::eOptionEncodeCharacterEscapeSequences, "(lldb) ", nullptr, "The debugger command line prompt displayed for the user." },
+{ "script-lang", OptionValue::eTypeEnum , true, eScriptLanguagePython, nullptr, g_language_enumerators, "The script language to be used for evaluating user-written scripts." },
+{ "stop-disassembly-count", OptionValue::eTypeSInt64 , true, 4 , nullptr, nullptr, "The number of disassembly lines to show when displaying a stopped context." },
+{ "stop-disassembly-display", OptionValue::eTypeEnum , true, Debugger::eStopDisassemblyTypeNoDebugInfo, nullptr, g_show_disassembly_enum_values, "Control when to display disassembly when displaying a stopped context." },
+{ "stop-line-count-after", OptionValue::eTypeSInt64 , true, 3 , nullptr, nullptr, "The number of sources lines to display that come after the current source line when displaying a stopped context." },
+{ "stop-line-count-before", OptionValue::eTypeSInt64 , true, 3 , nullptr, nullptr, "The number of sources lines to display that come before the current source line when displaying a stopped context." },
+{ "term-width", OptionValue::eTypeSInt64 , true, 80 , nullptr, nullptr, "The maximum number of columns to use for displaying text." },
+{ "thread-format", OptionValue::eTypeFormatEntity, true, 0 , DEFAULT_THREAD_FORMAT, nullptr, "The default thread format string to use when displaying thread information." },
+{ "use-external-editor", OptionValue::eTypeBoolean , true, false, nullptr, nullptr, "Whether to use an external editor or not." },
+{ "use-color", OptionValue::eTypeBoolean , true, true , nullptr, nullptr, "Whether to use Ansi color codes or not." },
+{ "auto-one-line-summaries", OptionValue::eTypeBoolean , true, true, nullptr, nullptr, "If true, LLDB will automatically display small structs in one-liner format (default: true)." },
+{ "auto-indent", OptionValue::eTypeBoolean , true, true , nullptr, nullptr, "If true, LLDB will auto indent/outdent code. Currently only supported in the REPL (default: true)." },
+{ "print-decls", OptionValue::eTypeBoolean , true, true , nullptr, nullptr, "If true, LLDB will print the values of variables declared in an expression. Currently only supported in the REPL (default: true)." },
+{ "tab-size", OptionValue::eTypeUInt64 , true, 4 , nullptr, nullptr, "The tab size to use when indenting code in multi-line input mode (default: 4)." },
+{ "escape-non-printables", OptionValue::eTypeBoolean , true, true, nullptr, nullptr, "If true, LLDB will automatically escape non-printable and escape characters when formatting strings." },
+{ nullptr, OptionValue::eTypeInvalid , true, 0 , nullptr, nullptr, nullptr }
};
enum
@@ -189,7 +190,7 @@ enum
ePropertyEscapeNonPrintables
};
-LoadPluginCallbackType Debugger::g_load_plugin_callback = NULL;
+LoadPluginCallbackType Debugger::g_load_plugin_callback = nullptr;
Error
Debugger::SetPropertyValue (const ExecutionContext *exe_ctx,
@@ -258,42 +259,42 @@ bool
Debugger::GetAutoConfirm () const
{
const uint32_t idx = ePropertyAutoConfirm;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, g_properties[idx].default_uint_value != 0);
}
const FormatEntity::Entry *
Debugger::GetDisassemblyFormat() const
{
const uint32_t idx = ePropertyDisassemblyFormat;
- return m_collection_sp->GetPropertyAtIndexAsFormatEntity(NULL, idx);
+ return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx);
}
const FormatEntity::Entry *
Debugger::GetFrameFormat() const
{
const uint32_t idx = ePropertyFrameFormat;
- return m_collection_sp->GetPropertyAtIndexAsFormatEntity(NULL, idx);
+ return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx);
}
bool
Debugger::GetNotifyVoid () const
{
const uint32_t idx = ePropertyNotiftVoid;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, g_properties[idx].default_uint_value != 0);
}
const char *
Debugger::GetPrompt() const
{
const uint32_t idx = ePropertyPrompt;
- return m_collection_sp->GetPropertyAtIndexAsString (NULL, idx, g_properties[idx].default_cstr_value);
+ return m_collection_sp->GetPropertyAtIndexAsString(nullptr, idx, g_properties[idx].default_cstr_value);
}
void
Debugger::SetPrompt(const char *p)
{
const uint32_t idx = ePropertyPrompt;
- m_collection_sp->SetPropertyAtIndexAsString (NULL, idx, p);
+ m_collection_sp->SetPropertyAtIndexAsString(nullptr, idx, p);
const char *new_prompt = GetPrompt();
std::string str = lldb_utility::ansi::FormatAnsiTerminalCodes (new_prompt, GetUseColor());
if (str.length())
@@ -305,63 +306,63 @@ const FormatEntity::Entry *
Debugger::GetThreadFormat() const
{
const uint32_t idx = ePropertyThreadFormat;
- return m_collection_sp->GetPropertyAtIndexAsFormatEntity(NULL, idx);
+ return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx);
}
lldb::ScriptLanguage
Debugger::GetScriptLanguage() const
{
const uint32_t idx = ePropertyScriptLanguage;
- return (lldb::ScriptLanguage)m_collection_sp->GetPropertyAtIndexAsEnumeration (NULL, idx, g_properties[idx].default_uint_value);
+ return (lldb::ScriptLanguage)m_collection_sp->GetPropertyAtIndexAsEnumeration(nullptr, idx, g_properties[idx].default_uint_value);
}
bool
Debugger::SetScriptLanguage (lldb::ScriptLanguage script_lang)
{
const uint32_t idx = ePropertyScriptLanguage;
- return m_collection_sp->SetPropertyAtIndexAsEnumeration (NULL, idx, script_lang);
+ return m_collection_sp->SetPropertyAtIndexAsEnumeration(nullptr, idx, script_lang);
}
uint32_t
Debugger::GetTerminalWidth () const
{
const uint32_t idx = ePropertyTerminalWidth;
- return m_collection_sp->GetPropertyAtIndexAsSInt64 (NULL, idx, g_properties[idx].default_uint_value);
+ return m_collection_sp->GetPropertyAtIndexAsSInt64(nullptr, idx, g_properties[idx].default_uint_value);
}
bool
Debugger::SetTerminalWidth (uint32_t term_width)
{
const uint32_t idx = ePropertyTerminalWidth;
- return m_collection_sp->SetPropertyAtIndexAsSInt64 (NULL, idx, term_width);
+ return m_collection_sp->SetPropertyAtIndexAsSInt64(nullptr, idx, term_width);
}
bool
Debugger::GetUseExternalEditor () const
{
const uint32_t idx = ePropertyUseExternalEditor;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, g_properties[idx].default_uint_value != 0);
}
bool
Debugger::SetUseExternalEditor (bool b)
{
const uint32_t idx = ePropertyUseExternalEditor;
- return m_collection_sp->SetPropertyAtIndexAsBoolean (NULL, idx, b);
+ return m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
}
bool
Debugger::GetUseColor () const
{
const uint32_t idx = ePropertyUseColor;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, g_properties[idx].default_uint_value != 0);
}
bool
Debugger::SetUseColor (bool b)
{
const uint32_t idx = ePropertyUseColor;
- bool ret = m_collection_sp->SetPropertyAtIndexAsBoolean (NULL, idx, b);
+ bool ret = m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
SetPrompt (GetPrompt());
return ret;
}
@@ -370,80 +371,79 @@ uint32_t
Debugger::GetStopSourceLineCount (bool before) const
{
const uint32_t idx = before ? ePropertyStopLineCountBefore : ePropertyStopLineCountAfter;
- return m_collection_sp->GetPropertyAtIndexAsSInt64 (NULL, idx, g_properties[idx].default_uint_value);
+ return m_collection_sp->GetPropertyAtIndexAsSInt64(nullptr, idx, g_properties[idx].default_uint_value);
}
Debugger::StopDisassemblyType
Debugger::GetStopDisassemblyDisplay () const
{
const uint32_t idx = ePropertyStopDisassemblyDisplay;
- return (Debugger::StopDisassemblyType)m_collection_sp->GetPropertyAtIndexAsEnumeration (NULL, idx, g_properties[idx].default_uint_value);
+ return (Debugger::StopDisassemblyType)m_collection_sp->GetPropertyAtIndexAsEnumeration(nullptr, idx, g_properties[idx].default_uint_value);
}
uint32_t
Debugger::GetDisassemblyLineCount () const
{
const uint32_t idx = ePropertyStopDisassemblyCount;
- return m_collection_sp->GetPropertyAtIndexAsSInt64 (NULL, idx, g_properties[idx].default_uint_value);
+ return m_collection_sp->GetPropertyAtIndexAsSInt64(nullptr, idx, g_properties[idx].default_uint_value);
}
bool
Debugger::GetAutoOneLineSummaries () const
{
const uint32_t idx = ePropertyAutoOneLineSummaries;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, true);
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, true);
}
bool
Debugger::GetEscapeNonPrintables () const
{
const uint32_t idx = ePropertyEscapeNonPrintables;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, true);
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, true);
}
bool
Debugger::GetAutoIndent () const
{
const uint32_t idx = ePropertyAutoIndent;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, true);
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, true);
}
bool
Debugger::SetAutoIndent (bool b)
{
const uint32_t idx = ePropertyAutoIndent;
- return m_collection_sp->SetPropertyAtIndexAsBoolean (NULL, idx, b);
+ return m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
}
bool
Debugger::GetPrintDecls () const
{
const uint32_t idx = ePropertyPrintDecls;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, true);
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, true);
}
bool
Debugger::SetPrintDecls (bool b)
{
const uint32_t idx = ePropertyPrintDecls;
- return m_collection_sp->SetPropertyAtIndexAsBoolean (NULL, idx, b);
+ return m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
}
uint32_t
Debugger::GetTabSize () const
{
const uint32_t idx = ePropertyTabSize;
- return m_collection_sp->GetPropertyAtIndexAsUInt64 (NULL, idx, g_properties[idx].default_uint_value);
+ return m_collection_sp->GetPropertyAtIndexAsUInt64(nullptr, idx, g_properties[idx].default_uint_value);
}
bool
Debugger::SetTabSize (uint32_t tab_size)
{
const uint32_t idx = ePropertyTabSize;
- return m_collection_sp->SetPropertyAtIndexAsUInt64 (NULL, idx, tab_size);
+ return m_collection_sp->SetPropertyAtIndexAsUInt64(nullptr, idx, tab_size);
}
-
#pragma mark Debugger
//const DebuggerPropertiesSP &
@@ -512,12 +512,9 @@ Debugger::LoadPlugin (const FileSpec& sp
}
static FileSpec::EnumerateDirectoryResult
-LoadPluginCallback
-(
- void *baton,
- FileSpec::FileType file_type,
- const FileSpec &file_spec
- )
+LoadPluginCallback(void *baton,
+ FileSpec::FileType file_type,
+ const FileSpec &file_spec)
{
Error error;
@@ -551,7 +548,6 @@ LoadPluginCallback
return FileSpec::eEnumerateDirectoryResultNext;
}
-
else if (file_type == FileSpec::eFileTypeUnknown ||
file_type == FileSpec::eFileTypeDirectory ||
file_type == FileSpec::eFileTypeSymbolicLink )
@@ -619,7 +615,7 @@ Debugger::CreateInstance (lldb::LogOutpu
void
Debugger::Destroy (DebuggerSP &debugger_sp)
{
- if (debugger_sp.get() == NULL)
+ if (!debugger_sp)
return;
debugger_sp->Clear();
@@ -652,7 +648,7 @@ Debugger::FindDebuggerWithInstanceName (
for (pos = debugger_list.begin(); pos != end; ++pos)
{
- if ((*pos).get()->m_instance_name == instance_name)
+ if ((*pos)->m_instance_name == instance_name)
{
debugger_sp = *pos;
break;
@@ -716,9 +712,9 @@ Debugger::Debugger(lldb::LogOutputCallba
m_input_reader_stack(),
m_instance_name(),
m_loaded_plugins(),
- m_event_handler_thread (),
- m_io_handler_thread (),
- m_sync_broadcaster (NULL, "lldb.debugger.sync")
+ m_event_handler_thread(),
+ m_io_handler_thread(),
+ m_sync_broadcaster(nullptr, "lldb.debugger.sync")
{
char instance_cstr[256];
snprintf(instance_cstr, sizeof(instance_cstr), "debugger_%d", (int)GetID());
@@ -728,7 +724,7 @@ Debugger::Debugger(lldb::LogOutputCallba
m_command_interpreter_ap->Initialize ();
// Always add our default platform to the platform list
PlatformSP default_platform_sp (Platform::GetHostPlatform());
- assert (default_platform_sp.get());
+ assert(default_platform_sp);
m_platform_list.Append (default_platform_sp, true);
m_collection_sp->Initialize (g_properties);
@@ -740,14 +736,14 @@ Debugger::Debugger(lldb::LogOutputCallba
ConstString("Platform settings."),
true,
Platform::GetGlobalPlatformProperties()->GetValueProperties());
- if (m_command_interpreter_ap.get())
+ if (m_command_interpreter_ap)
{
m_collection_sp->AppendProperty (ConstString("interpreter"),
ConstString("Settings specify to the debugger's command interpreter."),
true,
m_command_interpreter_ap->GetValueProperties());
}
- OptionValueSInt64 *term_width = m_collection_sp->GetPropertyAtIndexAsOptionValueSInt64 (NULL, ePropertyTerminalWidth);
+ OptionValueSInt64 *term_width = m_collection_sp->GetPropertyAtIndexAsOptionValueSInt64(nullptr, ePropertyTerminalWidth);
term_width->SetMinimumValue(10);
term_width->SetMaximumValue(1024);
@@ -817,7 +813,6 @@ Debugger::SetAsyncExecution (bool async_
m_command_interpreter_ap->SetSynchronous (!async_execution);
}
-
void
Debugger::SetInputFileHandle (FILE *fh, bool tranfer_ownership)
{
@@ -827,7 +822,7 @@ Debugger::SetInputFileHandle (FILE *fh,
m_input_file_sp.reset (new StreamFile (fh, tranfer_ownership));
File &in_file = m_input_file_sp->GetFile();
- if (in_file.IsValid() == false)
+ if (!in_file.IsValid())
in_file.SetStream (stdin, true);
// Save away the terminal state if that is relevant, so that we can restore it in RestoreInputState.
@@ -843,7 +838,7 @@ Debugger::SetOutputFileHandle (FILE *fh,
m_output_file_sp.reset (new StreamFile (fh, tranfer_ownership));
File &out_file = m_output_file_sp->GetFile();
- if (out_file.IsValid() == false)
+ if (!out_file.IsValid())
out_file.SetStream (stdout, false);
// do not create the ScriptInterpreter just for setting the output file handle
@@ -863,7 +858,7 @@ Debugger::SetErrorFileHandle (FILE *fh,
m_error_file_sp.reset (new StreamFile (fh, tranfer_ownership));
File &err_file = m_error_file_sp->GetFile();
- if (err_file.IsValid() == false)
+ if (!err_file.IsValid())
err_file.SetStream (stderr, false);
}
@@ -895,14 +890,14 @@ Debugger::GetSelectedExecutionContext ()
{
ProcessSP process_sp (target_sp->GetProcessSP());
exe_ctx.SetProcessSP (process_sp);
- if (process_sp && process_sp->IsRunning() == false)
+ if (process_sp && !process_sp->IsRunning())
{
ThreadSP thread_sp (process_sp->GetThreadList().GetSelectedThread());
if (thread_sp)
{
exe_ctx.SetThreadSP (thread_sp);
exe_ctx.SetFrameSP (thread_sp->GetSelectedFrame());
- if (exe_ctx.GetFramePtr() == NULL)
+ if (exe_ctx.GetFramePtr() == nullptr)
exe_ctx.SetFrameSP (thread_sp->GetStackFrameAtIndex (0));
}
}
@@ -944,7 +939,7 @@ Debugger::ClearIOHandlers ()
void
Debugger::ExecuteIOHandlers()
{
- while (1)
+ while (true)
{
IOHandlerSP reader_sp(m_input_reader_stack.Top());
if (!reader_sp)
@@ -953,7 +948,7 @@ Debugger::ExecuteIOHandlers()
reader_sp->Run();
// Remove all input readers that are done from the top of the stack
- while (1)
+ while (true)
{
IOHandlerSP top_reader_sp = m_input_reader_stack.Top();
if (top_reader_sp && top_reader_sp->GetIsDone())
@@ -1018,7 +1013,7 @@ Debugger::RunIOHandler (const IOHandlerS
break;
}
- while (1)
+ while (true)
{
top_reader_sp = m_input_reader_stack.Top();
if (top_reader_sp && top_reader_sp->GetIsDone())
@@ -1034,7 +1029,7 @@ Debugger::AdoptTopIOHandlerFilesIfInvali
{
// Before an IOHandler runs, it must have in/out/err streams.
// This function is called when one ore more of the streams
- // are NULL. We use the top input reader's in/out/err streams,
+ // are nullptr. We use the top input reader's in/out/err streams,
// or fall back to the debugger file handles, or we fall back
// onto stdin/stdout/stderr as a last resort.
@@ -1188,7 +1183,7 @@ Debugger::FindDebuggerWithID (lldb::user
DebuggerList::iterator pos, end = debugger_list.end();
for (pos = debugger_list.begin(); pos != end; ++pos)
{
- if ((*pos).get()->GetID() == id)
+ if ((*pos)->GetID() == id)
{
debugger_sp = *pos;
break;
@@ -1202,7 +1197,7 @@ Debugger::FindDebuggerWithID (lldb::user
static void
TestPromptFormats (StackFrame *frame)
{
- if (frame == NULL)
+ if (frame == nullptr)
return;
StreamString s;
@@ -1277,11 +1272,11 @@ Debugger::FormatDisassemblerAddress (con
{
FormatEntity::Entry format_entry;
- if (format == NULL)
+ if (format == nullptr)
{
- if (exe_ctx != NULL && exe_ctx->HasTargetScope())
+ if (exe_ctx != nullptr && exe_ctx->HasTargetScope())
format = exe_ctx->GetTargetRef().GetDebugger().GetDisassemblyFormat();
- if (format == NULL)
+ if (format == nullptr)
{
FormatEntity::Parse("${addr}: ", format_entry);
format = &format_entry;
@@ -1313,14 +1308,13 @@ Debugger::FormatDisassemblerAddress (con
// has no Function or Symbol -- if SymbolContext had an IsValid() method, it
// would return false. But we do get a prev_sc pointer.
if ((sc && (sc->function || sc->symbol))
- && prev_sc && (prev_sc->function == NULL && prev_sc->symbol == NULL))
+ && prev_sc && (prev_sc->function == nullptr && prev_sc->symbol == nullptr))
{
initial_function = true;
}
- return FormatEntity::Format(*format, s, sc, exe_ctx, addr, NULL, function_changed, initial_function);
+ return FormatEntity::Format(*format, s, sc, exe_ctx, addr, nullptr, function_changed, initial_function);
}
-
void
Debugger::SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton)
{
@@ -1340,7 +1334,7 @@ Debugger::EnableLog (const char *channel
// For now when using the callback mode you always get thread & timestamp.
log_options |= LLDB_LOG_OPTION_PREPEND_TIMESTAMP | LLDB_LOG_OPTION_PREPEND_THREAD_NAME;
}
- else if (log_file == NULL || *log_file == '\0')
+ else if (log_file == nullptr || *log_file == '\0')
{
log_stream_sp = GetOutputFile();
}
@@ -1360,7 +1354,7 @@ Debugger::EnableLog (const char *channel
m_log_streams[log_file] = log_stream_sp;
}
}
- assert (log_stream_sp.get());
+ assert(log_stream_sp);
if (log_options == 0)
log_options = LLDB_LOG_OPTION_PREPEND_THREAD_NAME | LLDB_LOG_OPTION_THREADSAFE;
@@ -1371,13 +1365,11 @@ Debugger::EnableLog (const char *channel
SourceManager &
Debugger::GetSourceManager ()
{
- if (m_source_manager_ap.get() == NULL)
+ if (!m_source_manager_ap)
m_source_manager_ap.reset (new SourceManager (shared_from_this()));
return *m_source_manager_ap;
}
-
-
// This function handles events that were broadcast by the process.
void
Debugger::HandleBreakpointEvent (const EventSP &event_sp)
@@ -1428,13 +1420,13 @@ size_t
Debugger::GetProcessSTDOUT (Process *process, Stream *stream)
{
size_t total_bytes = 0;
- if (stream == NULL)
+ if (stream == nullptr)
stream = GetOutputFile().get();
if (stream)
{
// The process has stuff waiting for stdout; get it and write it out to the appropriate place.
- if (process == NULL)
+ if (process == nullptr)
{
TargetSP target_sp = GetTargetList().GetSelectedTarget();
if (target_sp)
@@ -1460,13 +1452,13 @@ size_t
Debugger::GetProcessSTDERR (Process *process, Stream *stream)
{
size_t total_bytes = 0;
- if (stream == NULL)
+ if (stream == nullptr)
stream = GetOutputFile().get();
if (stream)
{
// The process has stuff waiting for stderr; get it and write it out to the appropriate place.
- if (process == NULL)
+ if (process == nullptr)
{
TargetSP target_sp = GetTargetList().GetSelectedTarget();
if (target_sp)
@@ -1620,7 +1612,7 @@ Debugger::DefaultEventHandler()
while (!done)
{
EventSP event_sp;
- if (listener.WaitForEvent(NULL, event_sp))
+ if (listener.WaitForEvent(nullptr, event_sp))
{
if (event_sp)
{
@@ -1706,17 +1698,18 @@ Debugger::StartEventHandlerThread()
listener.StartListeningForEvents(&m_sync_broadcaster, eBroadcastBitEventThreadIsListening);
// Use larger 8MB stack for this thread
- m_event_handler_thread = ThreadLauncher::LaunchThread("lldb.debugger.event-handler", EventHandlerThread,
+ m_event_handler_thread = ThreadLauncher::LaunchThread("lldb.debugger.event-handler",
+ EventHandlerThread,
this,
- NULL,
+ nullptr,
g_debugger_event_thread_stack_bytes);
// Make sure DefaultEventHandler() is running and listening to events before we return
// from this function. We are only listening for events of type
// eBroadcastBitEventThreadIsListening so we don't need to check the event, we just need
- // to wait an infinite amount of time for it (NULL timeout as the first parameter)
+ // to wait an infinite amount of time for it (nullptr timeout as the first parameter)
lldb::EventSP event_sp;
- listener.WaitForEvent(NULL, event_sp);
+ listener.WaitForEvent(nullptr, event_sp);
}
return m_event_handler_thread.IsJoinable();
}
@@ -1731,7 +1724,6 @@ Debugger::StopEventHandlerThread()
}
}
-
lldb::thread_result_t
Debugger::IOHandlerThread (lldb::thread_arg_t arg)
{
@@ -1751,11 +1743,11 @@ bool
Debugger::StartIOHandlerThread()
{
if (!m_io_handler_thread.IsJoinable())
- m_io_handler_thread = ThreadLauncher::LaunchThread ("lldb.debugger.io-handler",
- IOHandlerThread,
- this,
- NULL,
- 8*1024*1024); // Use larger 8MB stack for this thread
+ m_io_handler_thread = ThreadLauncher::LaunchThread("lldb.debugger.io-handler",
+ IOHandlerThread,
+ this,
+ nullptr,
+ 8*1024*1024); // Use larger 8MB stack for this thread
return m_io_handler_thread.IsJoinable();
}
@@ -1817,7 +1809,7 @@ Debugger::RunREPL (LanguageType language
{
language = *repl_languages.begin();
}
- else if (repl_languages.size() == 0)
+ else if (repl_languages.empty())
{
err.SetErrorStringWithFormat("LLDB isn't configured with support support for any REPLs.");
return err;
@@ -1849,4 +1841,3 @@ Debugger::RunREPL (LanguageType language
return err;
}
-
More information about the lldb-commits
mailing list