[Lldb-commits] [lldb] r237218 - Fixed a ton of gcc compile warnings
Vince Harron
vince at nethacker.com
Tue May 12 17:25:54 PDT 2015
Author: vharron
Date: Tue May 12 19:25:54 2015
New Revision: 237218
URL: http://llvm.org/viewvc/llvm-project?rev=237218&view=rev
Log:
Fixed a ton of gcc compile warnings
Removed some unused variables, added some consts, changed some casts
to const_cast. I don't think any of these changes are very
controversial.
Differential Revision: http://reviews.llvm.org/D9674
Modified:
lldb/trunk/include/lldb/Core/DataEncoder.h
lldb/trunk/include/lldb/Interpreter/CommandObject.h
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Core/DataBufferHeap.cpp
lldb/trunk/source/Core/DataEncoder.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/DataFormatters/StringPrinter.cpp
lldb/trunk/source/Expression/IRExecutionUnit.cpp
lldb/trunk/source/Host/common/Editline.cpp
lldb/trunk/source/Host/common/Symbols.cpp
lldb/trunk/source/Interpreter/Args.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Interpreter/Options.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h
lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
lldb/trunk/source/Symbol/Symtab.cpp
lldb/trunk/tools/driver/Driver.cpp
Modified: lldb/trunk/include/lldb/Core/DataEncoder.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/DataEncoder.h?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/DataEncoder.h (original)
+++ lldb/trunk/include/lldb/Core/DataEncoder.h Tue May 12 19:25:54 2015
@@ -357,7 +357,7 @@ public:
/// The number of bytes that this object now contains.
//------------------------------------------------------------------
uint32_t
- SetData (const void *bytes, uint32_t length, lldb::ByteOrder byte_order);
+ SetData (void *bytes, uint32_t length, lldb::ByteOrder byte_order);
//------------------------------------------------------------------
/// Adopt a subset of shared data in \a data_sp.
Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Tue May 12 19:25:54 2015
@@ -195,7 +195,7 @@ public:
static lldb::CommandArgumentType
LookupArgumentName (const char *arg_name);
- static ArgumentTableEntry *
+ static const ArgumentTableEntry *
FindArgumentDataByType (lldb::CommandArgumentType arg_type);
int
Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue May 12 19:25:54 2015
@@ -534,7 +534,7 @@ protected:
clang::TypeDecl *tdecl = target->GetPersistentVariables().GetPersistentType(ConstString(lookup_type_name));
if (tdecl)
{
- clang_ast_type.SetClangType(&tdecl->getASTContext(),(lldb::clang_type_t)tdecl->getTypeForDecl());
+ clang_ast_type.SetClangType(&tdecl->getASTContext(),(const lldb::clang_type_t)tdecl->getTypeForDecl());
}
}
Modified: lldb/trunk/source/Core/DataBufferHeap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataBufferHeap.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataBufferHeap.cpp (original)
+++ lldb/trunk/source/Core/DataBufferHeap.cpp Tue May 12 19:25:54 2015
@@ -106,7 +106,7 @@ DataBufferHeap::CopyData (const void *sr
void
DataBufferHeap::AppendData (const void *src, uint64_t src_len)
{
- m_data.insert(m_data.end(), (uint8_t *)src, (uint8_t *)src + src_len);
+ m_data.insert(m_data.end(), (const uint8_t *)src, (const uint8_t *)src + src_len);
}
void
Modified: lldb/trunk/source/Core/DataEncoder.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataEncoder.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataEncoder.cpp (original)
+++ lldb/trunk/source/Core/DataEncoder.cpp Tue May 12 19:25:54 2015
@@ -21,36 +21,36 @@ using namespace lldb;
using namespace lldb_private;
static inline void
-WriteInt16(const unsigned char* ptr, unsigned offset, uint16_t value)
+WriteInt16(unsigned char* ptr, unsigned offset, uint16_t value)
{
*(uint16_t *)(ptr + offset) = value;
}
static inline void
-WriteInt32 (const unsigned char* ptr, unsigned offset, uint32_t value)
+WriteInt32 (unsigned char* ptr, unsigned offset, uint32_t value)
{
*(uint32_t *)(ptr + offset) = value;
}
static inline void
-WriteInt64(const unsigned char* ptr, unsigned offset, uint64_t value)
+WriteInt64(unsigned char* ptr, unsigned offset, uint64_t value)
{
*(uint64_t *)(ptr + offset) = value;
}
static inline void
-WriteSwappedInt16(const unsigned char* ptr, unsigned offset, uint16_t value)
+WriteSwappedInt16(unsigned char* ptr, unsigned offset, uint16_t value)
{
*(uint16_t *)(ptr + offset) = llvm::ByteSwap_16(value);
}
static inline void
-WriteSwappedInt32 (const unsigned char* ptr, unsigned offset, uint32_t value)
+WriteSwappedInt32 (unsigned char* ptr, unsigned offset, uint32_t value)
{
*(uint32_t *)(ptr + offset) = llvm::ByteSwap_32(value);
}
static inline void
-WriteSwappedInt64(const unsigned char* ptr, unsigned offset, uint64_t value)
+WriteSwappedInt64(unsigned char* ptr, unsigned offset, uint64_t value)
{
*(uint64_t *)(ptr + offset) = llvm::ByteSwap_64(value);
}
@@ -153,7 +153,7 @@ DataEncoder::GetSharedDataOffset () cons
// any data extracted will be endian swapped.
//----------------------------------------------------------------------
uint32_t
-DataEncoder::SetData (const void *bytes, uint32_t length, ByteOrder endian)
+DataEncoder::SetData (void *bytes, uint32_t length, ByteOrder endian)
{
m_byte_order = endian;
m_data_sp.reset();
Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Tue May 12 19:25:54 2015
@@ -1299,13 +1299,11 @@ FormatEntity::Format (const Entry &entry
// Watch for the special "tid" format...
if (entry.printf_format == "tid")
{
- bool handled = false;
Target &target = thread->GetProcess()->GetTarget();
ArchSpec arch (target.GetArchitecture ());
llvm::Triple::OSType ostype = arch.IsValid() ? arch.GetTriple().getOS() : llvm::Triple::UnknownOS;
if ((ostype == llvm::Triple::FreeBSD) || (ostype == llvm::Triple::Linux))
{
- handled = true;
format = "%" PRIu64;
}
}
Modified: lldb/trunk/source/DataFormatters/StringPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/StringPrinter.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/StringPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/StringPrinter.cpp Tue May 12 19:25:54 2015
@@ -181,12 +181,13 @@ GetPrintableImpl<StringElementType::ASCI
break;
default:
if (isprint(*buffer))
- retval = {buffer,1};
+ retval = {buffer,1};
else
{
- retval = { new uint8_t[5],4,[] (const uint8_t* c) {delete[] c;} };
- sprintf((char*)retval.GetBytes(),"\\x%02x",*buffer);
- break;
+ uint8_t* data = new uint8_t[5];
+ sprintf((char*)data,"\\x%02x",*buffer);
+ retval = {data, 4, [] (const uint8_t* c) {delete[] c;} };
+ break;
}
}
@@ -288,8 +289,9 @@ GetPrintableImpl<StringElementType::UTF8
retval = {buffer,utf8_encoded_len};
else
{
- retval = { new uint8_t[11],10,[] (const uint8_t* c) {delete[] c;} };
- sprintf((char*)retval.GetBytes(),"\\U%08x",codepoint);
+ uint8_t* data = new uint8_t[11];
+ sprintf((char*)data,"\\U%08x",codepoint);
+ retval = { data,10,[] (const uint8_t* c) {delete[] c;} };
break;
}
}
@@ -352,8 +354,8 @@ DumpUTFBufferToStream (ConversionResult
sourceSize = bufferSPSize/(origin_encoding / 4);
}
- SourceDataType *data_ptr = (SourceDataType*)data.GetDataStart();
- SourceDataType *data_end_ptr = data_ptr + sourceSize;
+ const SourceDataType *data_ptr = (const SourceDataType*)data.GetDataStart();
+ const SourceDataType *data_end_ptr = data_ptr + sourceSize;
while (data_ptr < data_end_ptr)
{
@@ -365,7 +367,7 @@ DumpUTFBufferToStream (ConversionResult
data_ptr++;
}
- data_ptr = (SourceDataType*)data.GetDataStart();
+ data_ptr = (const SourceDataType*)data.GetDataStart();
lldb::DataBufferSP utf8_data_buffer_sp;
UTF8* utf8_data_ptr = nullptr;
@@ -376,7 +378,7 @@ DumpUTFBufferToStream (ConversionResult
utf8_data_buffer_sp.reset(new DataBufferHeap(4*bufferSPSize,0));
utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
utf8_data_end_ptr = utf8_data_ptr + utf8_data_buffer_sp->GetByteSize();
- ConvertFunction ( (const SourceDataType**)&data_ptr, data_end_ptr, &utf8_data_ptr, utf8_data_end_ptr, lenientConversion );
+ ConvertFunction ( &data_ptr, data_end_ptr, &utf8_data_ptr, utf8_data_end_ptr, lenientConversion );
utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes(); // needed because the ConvertFunction will change the value of the data_ptr
}
else
@@ -449,7 +451,6 @@ ReadStringAndDumpToStream<StringElementT
{
assert(options.GetStream() && "need a Stream to print the string to");
Error my_error;
- size_t my_data_read;
ProcessSP process_sp(options.GetProcessSP());
@@ -467,7 +468,7 @@ ReadStringAndDumpToStream<StringElementT
lldb::DataBufferSP buffer_sp(new DataBufferHeap(size,0));
- my_data_read = process_sp->ReadCStringFromMemory(options.GetLocation(), (char*)buffer_sp->GetBytes(), size, my_error);
+ process_sp->ReadCStringFromMemory(options.GetLocation(), (char*)buffer_sp->GetBytes(), size, my_error);
if (my_error.Fail())
return false;
@@ -568,11 +569,10 @@ ReadUTFBufferAndDumpToStream (const Read
Error error;
char *buffer = reinterpret_cast<char *>(buffer_sp->GetBytes());
- size_t data_read = 0;
if (needs_zero_terminator)
- data_read = process_sp->ReadStringFromMemory(options.GetLocation(), buffer, bufferSPSize, error, type_width);
+ process_sp->ReadStringFromMemory(options.GetLocation(), buffer, bufferSPSize, error, type_width);
else
- data_read = process_sp->ReadMemoryFromInferior(options.GetLocation(), (char*)buffer_sp->GetBytes(), bufferSPSize, error);
+ process_sp->ReadMemoryFromInferior(options.GetLocation(), (char*)buffer_sp->GetBytes(), bufferSPSize, error);
if (error.Fail())
{
Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Tue May 12 19:25:54 2015
@@ -605,8 +605,11 @@ IRExecutionUnit::MemoryManager::allocate
uint8_t *return_value = m_default_mm_ap->allocateDataSection(Size, Alignment, SectionID, SectionName, IsReadOnly);
+ uint32_t permissions = lldb::ePermissionsReadable;
+ if (!IsReadOnly)
+ permissions |= lldb::ePermissionsWritable;
m_parent.m_records.push_back(AllocationRecord((uintptr_t)return_value,
- lldb::ePermissionsReadable | (IsReadOnly ? 0 : lldb::ePermissionsWritable),
+ permissions,
GetSectionTypeFromSectionName (SectionName, AllocationKind::Data),
Size,
Alignment,
Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Tue May 12 19:25:54 2015
@@ -711,7 +711,7 @@ Editline::BreakLineCommand (int ch)
unsigned char
Editline::DeleteNextCharCommand (int ch)
{
- LineInfoW * info = (LineInfoW *)el_wline (m_editline);
+ LineInfoW * info = const_cast<LineInfoW *>(el_wline (m_editline));
// Just delete the next character normally if possible
if (info->cursor < info->lastchar)
@@ -755,7 +755,7 @@ Editline::DeleteNextCharCommand (int ch)
unsigned char
Editline::DeletePreviousCharCommand (int ch)
{
- LineInfoW * info = (LineInfoW *)el_wline (m_editline);
+ LineInfoW * info = const_cast<LineInfoW *>(el_wline (m_editline));
// Just delete the previous character normally when not at the start of a line
if (info->cursor > info->buffer)
@@ -861,7 +861,7 @@ Editline::FixIndentationCommand (int ch)
StringList lines = GetInputAsStringList (m_current_line_index + 1);
// Determine the cursor position
- LineInfoW * info = (LineInfoW *)el_wline (m_editline);
+ LineInfoW * info = const_cast<LineInfoW *>(el_wline (m_editline));
int cursor_position = info->cursor - info->buffer;
int indent_correction = m_fix_indentation_callback (this, lines, cursor_position, m_fix_indentation_callback_baton);
@@ -887,7 +887,7 @@ Editline::RevertLineCommand (int ch)
el_winsertstr (m_editline, m_input_lines[m_current_line_index].c_str());
if (m_revert_cursor_index >= 0)
{
- LineInfoW * info = (LineInfoW *)el_wline (m_editline);
+ LineInfoW * info = const_cast<LineInfoW *>(el_wline (m_editline));
info->cursor = info->buffer + m_revert_cursor_index;
if (info->cursor > info->lastchar)
{
Modified: lldb/trunk/source/Host/common/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Symbols.cpp (original)
+++ lldb/trunk/source/Host/common/Symbols.cpp Tue May 12 19:25:54 2015
@@ -136,7 +136,7 @@ LocateExecutableSymbolFileDsym (const Mo
"LocateExecutableSymbolFileDsym (file = %s, arch = %s, uuid = %p)",
exec_fspec ? exec_fspec->GetFilename().AsCString ("<NULL>") : "<NULL>",
arch ? arch->GetArchitectureName() : "<NULL>",
- uuid);
+ (void*)uuid);
FileSpec symbol_fspec;
// First try and find the dSYM in the same directory as the executable or in
@@ -159,7 +159,7 @@ Symbols::LocateExecutableObjectFile (con
"LocateExecutableObjectFile (file = %s, arch = %s, uuid = %p)",
exec_fspec ? exec_fspec->GetFilename().AsCString ("<NULL>") : "<NULL>",
arch ? arch->GetArchitectureName() : "<NULL>",
- uuid);
+ (void*)uuid);
FileSpec objfile_fspec;
ModuleSpecList module_specs;
Modified: lldb/trunk/source/Interpreter/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Args.cpp (original)
+++ lldb/trunk/source/Interpreter/Args.cpp Tue May 12 19:25:54 2015
@@ -1138,7 +1138,7 @@ Args::IsPositionalArgument (const char *
return false;
bool is_positional = true;
- char *cptr = (char *) arg;
+ const char *cptr = arg;
if (cptr[0] == '%')
{
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue May 12 19:25:54 2015
@@ -2247,7 +2247,7 @@ CommandInterpreter::BuildAliasCommandArg
}
cmd_args.Clear();
- cmd_args.SetArguments (new_args.GetArgumentCount(), (const char **) new_args.GetArgumentVector());
+ cmd_args.SetArguments (new_args.GetArgumentCount(), new_args.GetConstArgumentVector());
}
else
{
@@ -2258,7 +2258,7 @@ CommandInterpreter::BuildAliasCommandArg
if (wants_raw_input)
{
cmd_args.Clear();
- cmd_args.SetArguments (new_args.GetArgumentCount(), (const char **) new_args.GetArgumentVector());
+ cmd_args.SetArguments (new_args.GetArgumentCount(), new_args.GetConstArgumentVector());
}
return;
}
@@ -2274,7 +2274,7 @@ CommandInterpreter::GetOptionArgumentPos
int position = 0; // Any string that isn't an argument position, i.e. '%' followed by an integer, gets a position
// of zero.
- char *cptr = (char *) in_string;
+ const char *cptr = in_string;
// Does it start with '%'
if (cptr[0] == '%')
Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Tue May 12 19:25:54 2015
@@ -506,14 +506,14 @@ CommandObject::GetArgumentEntryAtIndex (
return nullptr;
}
-CommandObject::ArgumentTableEntry *
+const CommandObject::ArgumentTableEntry *
CommandObject::FindArgumentDataByType (CommandArgumentType arg_type)
{
const ArgumentTableEntry *table = CommandObject::GetArgumentTable();
for (int i = 0; i < eArgTypeLastArg; ++i)
if (table[i].arg_type == arg_type)
- return (ArgumentTableEntry *) &(table[i]);
+ return &(table[i]);
return nullptr;
}
@@ -522,7 +522,7 @@ void
CommandObject::GetArgumentHelp (Stream &str, CommandArgumentType arg_type, CommandInterpreter &interpreter)
{
const ArgumentTableEntry* table = CommandObject::GetArgumentTable();
- ArgumentTableEntry *entry = (ArgumentTableEntry *) &(table[arg_type]);
+ const ArgumentTableEntry *entry = &(table[arg_type]);
// The table is *supposed* to be kept in arg_type order, but someone *could* have messed it up...
@@ -556,7 +556,7 @@ CommandObject::GetArgumentHelp (Stream &
const char *
CommandObject::GetArgumentName (CommandArgumentType arg_type)
{
- ArgumentTableEntry *entry = (ArgumentTableEntry *) &(CommandObject::GetArgumentTable()[arg_type]);
+ const ArgumentTableEntry *entry = &(CommandObject::GetArgumentTable()[arg_type]);
// The table is *supposed* to be kept in arg_type order, but someone *could* have messed it up...
Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Tue May 12 19:25:54 2015
@@ -944,7 +944,7 @@ Options::HandleOptionArgumentCompletion
lldb::CommandArgumentType option_arg_type = opt_defs[opt_defs_index].argument_type;
if (option_arg_type != eArgTypeNone)
{
- CommandObject::ArgumentTableEntry *arg_entry = CommandObject::FindArgumentDataByType (opt_defs[opt_defs_index].argument_type);
+ const CommandObject::ArgumentTableEntry *arg_entry = CommandObject::FindArgumentDataByType (opt_defs[opt_defs_index].argument_type);
if (arg_entry)
completion_mask = arg_entry->completion_type;
}
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Tue May 12 19:25:54 2015
@@ -382,6 +382,13 @@ ScriptInterpreterPython::LeaveSession ()
m_session_is_active = false;
}
+static PyObject *
+PyFile_FromFile_Const(FILE *fp, const char *name, const char *mode, int (*close)(FILE *))
+{
+ // Read through the Python source, doesn't seem to modify these strings
+ return PyFile_FromFile(fp, const_cast<char*>(name), const_cast<char*>(mode), close);
+}
+
bool
ScriptInterpreterPython::EnterSession (uint16_t on_entry_flags,
FILE *in,
@@ -447,7 +454,7 @@ ScriptInterpreterPython::EnterSession (u
{
m_saved_stdin.Reset(sys_module_dict.GetItemForKey("stdin"));
// This call can deadlock your process if the file is locked
- PyObject *new_file = PyFile_FromFile (in, (char *) "", (char *) "r", nullptr);
+ PyObject *new_file = PyFile_FromFile_Const (in, "", "r", nullptr);
sys_module_dict.SetItemForKey ("stdin", new_file);
Py_DECREF (new_file);
}
@@ -459,7 +466,7 @@ ScriptInterpreterPython::EnterSession (u
{
m_saved_stdout.Reset(sys_module_dict.GetItemForKey("stdout"));
- PyObject *new_file = PyFile_FromFile (out, (char *) "", (char *) "w", nullptr);
+ PyObject *new_file = PyFile_FromFile_Const (out, "", "w", nullptr);
sys_module_dict.SetItemForKey ("stdout", new_file);
Py_DECREF (new_file);
}
@@ -472,7 +479,7 @@ ScriptInterpreterPython::EnterSession (u
{
m_saved_stderr.Reset(sys_module_dict.GetItemForKey("stderr"));
- PyObject *new_file = PyFile_FromFile (err, (char *) "", (char *) "w", nullptr);
+ PyObject *new_file = PyFile_FromFile_Const (err, "", "w", nullptr);
sys_module_dict.SetItemForKey ("stderr", new_file);
Py_DECREF (new_file);
}
Modified: lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp Tue May 12 19:25:54 2015
@@ -263,10 +263,9 @@ ABISysV_hexagon::PrepareTrivialCall ( Th
// update the argument with the target pointer
//XXX: This is a gross hack for getting around the const
- *((size_t*)(&arg.value)) = sp;
+ *const_cast<lldb::addr_t*>(&arg.value) = sp;
}
-
#if HEX_ABI_DEBUG
// print the original stack pointer
printf( "sp : %04" PRIx64 " \n", sp );
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Tue May 12 19:25:54 2015
@@ -1428,7 +1428,7 @@ DynamicLoaderMacOSXDYLD::DYLDImageInfo::
{
if (log == NULL)
return;
- uint8_t *u = (uint8_t *)uuid.GetBytes();
+ const uint8_t *u = (const uint8_t *)uuid.GetBytes();
if (address == LLDB_INVALID_ADDRESS)
{
Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp Tue May 12 19:25:54 2015
@@ -233,7 +233,7 @@ EmulationStateARM::WritePseudoMemory (Em
bool success;
EmulationStateARM *pseudo_state = (EmulationStateARM *) baton;
- uint64_t value = *((uint64_t *) dst);
+ uint64_t value = *((const uint64_t *) dst);
success = pseudo_state->StoreToPseudoAddress (addr, value, length);
if (success)
return length;
Modified: lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp Tue May 12 19:25:54 2015
@@ -178,7 +178,7 @@ AdbClient::ReadMessage (std::string &mes
if (error.Fail ())
return error;
- int packet_len = 0;
+ unsigned int packet_len = 0;
sscanf (buffer, "%x", &packet_len);
std::string result (packet_len, 0);
m_conn.Read (&result[0], packet_len, kConnTimeout, status, &error);
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Tue May 12 19:25:54 2015
@@ -1174,7 +1174,7 @@ PlatformDarwin::GetResumeCountForLaunchI
// /bin/sh re-exec's itself as /bin/bash requiring another resume.
// But it only does this if the COMMAND_MODE environment variable
// is set to "legacy".
- char * const *envp = (char * const*)launch_info.GetEnvironmentEntries().GetConstArgumentVector();
+ const char **envp = launch_info.GetEnvironmentEntries().GetConstArgumentVector();
if (envp != NULL)
{
for (int i = 0; envp[i] != NULL; i++)
@@ -1346,7 +1346,7 @@ PlatformDarwin::DirectoryEnumerator(void
}
return FileSpec::EnumerateDirectoryResult::eEnumerateDirectoryResultNext;
-};
+}
FileSpec
PlatformDarwin::FindSDKInXcodeForModules (SDKType sdk_type,
Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Tue May 12 19:25:54 2015
@@ -665,9 +665,9 @@ PlatformPOSIX::ConnectRemote (Args& args
if (m_options.get())
{
OptionGroupOptions* options = m_options.get();
- OptionGroupPlatformRSync* m_rsync_options = (OptionGroupPlatformRSync*)options->GetGroupWithOption('r');
- OptionGroupPlatformSSH* m_ssh_options = (OptionGroupPlatformSSH*)options->GetGroupWithOption('s');
- OptionGroupPlatformCaching* m_cache_options = (OptionGroupPlatformCaching*)options->GetGroupWithOption('c');
+ const OptionGroupPlatformRSync* m_rsync_options = (OptionGroupPlatformRSync*)options->GetGroupWithOption('r');
+ const OptionGroupPlatformSSH* m_ssh_options = (OptionGroupPlatformSSH*)options->GetGroupWithOption('s');
+ const OptionGroupPlatformCaching* m_cache_options = (OptionGroupPlatformCaching*)options->GetGroupWithOption('c');
if (m_rsync_options->m_rsync)
{
Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp Tue May 12 19:25:54 2015
@@ -49,7 +49,7 @@ namespace
ProcessSP
ProcessLinux::CreateInstance(Target &target, Listener &listener, const FileSpec *core_file)
{
- return ProcessSP(new ProcessLinux(target, listener, (FileSpec *)core_file));
+ return ProcessSP(new ProcessLinux(target, listener, core_file));
}
void
@@ -68,7 +68,7 @@ ProcessLinux::Initialize()
//------------------------------------------------------------------------------
// Constructors and destructors.
-ProcessLinux::ProcessLinux(Target& target, Listener &listener, FileSpec *core_file)
+ProcessLinux::ProcessLinux(Target& target, Listener &listener, const FileSpec *core_file)
: ProcessPOSIX(target, listener, GetStaticLinuxSignalsSP ()), m_core_file(core_file), m_stopping_threads(false)
{
#if 0
Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h Tue May 12 19:25:54 2015
@@ -53,7 +53,7 @@ public:
//------------------------------------------------------------------
ProcessLinux(Target& target,
Listener &listener,
- FileSpec *core_file);
+ const FileSpec *core_file);
Error
DoDetach(bool keep_stopped) override;
@@ -98,7 +98,7 @@ public:
private:
- FileSpec *m_core_file;
+ const FileSpec *m_core_file;
// Flag to avoid recursion when stopping all threads.
bool m_stopping_threads;
Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Tue May 12 19:25:54 2015
@@ -351,7 +351,7 @@ DoWriteMemory(lldb::pid_t pid,
(log->GetMask().Test(POSIX_LOG_MEMORY_DATA_SHORT) &&
size <= POSIX_LOG_MEMORY_SHORT_BYTES)))
log->Printf ("ProcessMonitor::%s() [%p]:0x%lx (0x%lx)", __FUNCTION__,
- (void*)vm_addr, *(unsigned long*)src, *(unsigned long*)buff);
+ (void*)vm_addr, *(const unsigned long*)src, *(const unsigned long*)buff);
}
vm_addr += word_size;
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Tue May 12 19:25:54 2015
@@ -772,48 +772,40 @@ GDBRemoteCommunication::StartDebugserver
llvm::SmallString<PATH_MAX> named_pipe_path;
Pipe port_pipe;
- bool listen = false;
- if (host_and_port[0])
+ if (host_and_port[0] && in_port == 0)
{
// Create a temporary file to get the stdout/stderr and redirect the
// output of the command into this file. We will later read this file
// if all goes well and fill the data into "command_output_ptr"
- if (in_port == 0)
+ // Binding to port zero, we need to figure out what port it ends up
+ // using using a named pipe...
+ error = port_pipe.CreateWithUniqueName("debugserver-named-pipe", false, named_pipe_path);
+ if (error.Success())
{
- // Binding to port zero, we need to figure out what port it ends up
- // using using a named pipe...
- error = port_pipe.CreateWithUniqueName("debugserver-named-pipe", false, named_pipe_path);
- if (error.Success())
- {
- debugserver_args.AppendArgument("--named-pipe");
- debugserver_args.AppendArgument(named_pipe_path.c_str());
- }
- else
+ debugserver_args.AppendArgument("--named-pipe");
+ debugserver_args.AppendArgument(named_pipe_path.c_str());
+ }
+ else
+ {
+ if (log)
+ log->Printf("GDBRemoteCommunication::%s() "
+ "named pipe creation failed: %s",
+ __FUNCTION__, error.AsCString());
+ // let's try an unnamed pipe
+ error = port_pipe.CreateNew(true);
+ if (error.Fail())
{
if (log)
log->Printf("GDBRemoteCommunication::%s() "
- "named pipe creation failed: %s",
+ "unnamed pipe creation failed: %s",
__FUNCTION__, error.AsCString());
- // let's try an unnamed pipe
- error = port_pipe.CreateNew(true);
- if (error.Fail())
- {
- if (log)
- log->Printf("GDBRemoteCommunication::%s() "
- "unnamed pipe creation failed: %s",
- __FUNCTION__, error.AsCString());
- return error;
- }
- int write_fd = port_pipe.GetWriteFileDescriptor();
- debugserver_args.AppendArgument("--pipe");
- debugserver_args.AppendArgument(std::to_string(write_fd).c_str());
- launch_info.AppendCloseFileAction(port_pipe.GetReadFileDescriptor());
+ return error;
}
- }
- else
- {
- listen = true;
+ int write_fd = port_pipe.GetWriteFileDescriptor();
+ debugserver_args.AppendArgument("--pipe");
+ debugserver_args.AppendArgument(std::to_string(write_fd).c_str());
+ launch_info.AppendCloseFileAction(port_pipe.GetReadFileDescriptor());
}
}
else
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Tue May 12 19:25:54 2015
@@ -677,15 +677,16 @@ GDBRemoteRegisterContext::WriteAllRegist
// This means buffer will be a little more than 2x larger than necessary but we resize
// it down once we've extracted all hex ascii chars from the packet.
DataBufferHeap buffer (G_packet_len, 0);
+
+ const uint32_t bytes_extracted = response.GetHexBytes (buffer.GetBytes(),
+ buffer.GetByteSize(),
+ '\xcc');
+
DataExtractor restore_data (buffer.GetBytes(),
buffer.GetByteSize(),
m_reg_data.GetByteOrder(),
m_reg_data.GetAddressByteSize());
-
- const uint32_t bytes_extracted = response.GetHexBytes ((void *)restore_data.GetDataStart(),
- restore_data.GetByteSize(),
- '\xcc');
-
+
if (bytes_extracted < restore_data.GetByteSize())
restore_data.SetData(restore_data.GetDataStart(), bytes_extracted, m_reg_data.GetByteOrder());
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue May 12 19:25:54 2015
@@ -4094,18 +4094,18 @@ ProcessGDBRemote::GetLoadedModuleList (G
if (!child->name)
continue;
- if (strcmp ((char*)child->name, "library") != 0)
+ if (strcmp ((const char*)child->name, "library") != 0)
continue;
GDBLoadedModuleInfoList::LoadedModuleInfo module;
for (xmlAttrPtr prop = child->properties; prop; prop=prop->next)
{
- if (strcmp ((char*)prop->name, "name") == 0)
+ if (strcmp ((const char*)prop->name, "name") == 0)
module.set_name (xmlExGetTextContent (prop));
// the address of the link_map struct.
- if (strcmp ((char*)prop->name, "lm") == 0)
+ if (strcmp ((const char*)prop->name, "lm") == 0)
{
std::string val = xmlExGetTextContent (prop);
if (val.length() > 2)
@@ -4116,7 +4116,7 @@ ProcessGDBRemote::GetLoadedModuleList (G
}
// the displacement as read from the field 'l_addr' of the link_map struct.
- if (strcmp ((char*)prop->name, "l_addr") == 0)
+ if (strcmp ((const char*)prop->name, "l_addr") == 0)
{
std::string val = xmlExGetTextContent (prop);
if (val.length() > 2)
@@ -4127,7 +4127,7 @@ ProcessGDBRemote::GetLoadedModuleList (G
}
// the memory address of the libraries PT_DYAMIC section.
- if (strcmp ((char*)prop->name, "l_ld") == 0)
+ if (strcmp ((const char*)prop->name, "l_ld") == 0)
{
std::string val = xmlExGetTextContent (prop);
if (val.length() > 2)
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=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Tue May 12 19:25:54 2015
@@ -191,7 +191,7 @@ DWARFFormValue::ExtractValue(const DWARF
// Set the string value to also be the data for inlined cstr form values only
// so we can tell the difference between DW_FORM_string and DW_FORM_strp form
// values;
- m_value.data = (uint8_t*)m_value.value.cstr; break;
+ m_value.data = (const uint8_t*)m_value.value.cstr; break;
case DW_FORM_exprloc:
case DW_FORM_block: m_value.value.uval = data.GetULEB128(offset_ptr); is_block = true; break;
case DW_FORM_block1: m_value.value.uval = data.GetU8(offset_ptr); is_block = true; break;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp Tue May 12 19:25:54 2015
@@ -69,7 +69,7 @@ NameToDIE::Dump (Stream *s)
for (uint32_t i=0; i<size; ++i)
{
const char *cstr = m_map.GetCStringAtIndex(i);
- s->Printf("%p: {0x%8.8x} \"%s\"\n", (void *)cstr, m_map.GetValueAtIndexUnchecked(i), cstr);
+ s->Printf("%p: {0x%8.8x} \"%s\"\n", (const void *)cstr, m_map.GetValueAtIndexUnchecked(i), cstr);
}
}
Modified: lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompactUnwindInfo.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompactUnwindInfo.cpp (original)
+++ lldb/trunk/source/Symbol/CompactUnwindInfo.cpp Tue May 12 19:25:54 2015
@@ -101,7 +101,7 @@ namespace lldb_private {
UNWIND_X86_64_REG_R15 = 5,
UNWIND_X86_64_REG_RBP = 6,
};
-};
+}
#ifndef UNWIND_SECOND_LEVEL_REGULAR
Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Tue May 12 19:25:54 2015
@@ -804,7 +804,7 @@ DWARFCallFrameInfo::FDEToUnwindPlan (dw_
// the DWARF expression.
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 = (uint8_t *)m_cfi_data.GetData(&offset, block_len);
+ const uint8_t *block_data = (const uint8_t *)m_cfi_data.GetData(&offset, block_len);
reg_location.SetAtDWARFExpression(block_data, block_len);
row->SetRegisterInfo (reg_num, reg_location);
@@ -858,7 +858,7 @@ DWARFCallFrameInfo::FDEToUnwindPlan (dw_
// evaluation stack prior to execution of the DWARF expression.
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 = (uint8_t*)m_cfi_data.GetData(&offset, block_len);
+ const uint8_t* block_data = (const uint8_t*)m_cfi_data.GetData(&offset, block_len);
//#if defined(__i386__) || defined(__x86_64__)
// // The EH frame info for EIP and RIP contains code that looks for traps to
// // be a specific type and increments the PC.
Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Tue May 12 19:25:54 2015
@@ -210,8 +210,8 @@ Symtab::DumpSymbolHeader (Stream *s)
static int
CompareSymbolID (const void *key, const void *p)
{
- const user_id_t match_uid = *(user_id_t*) key;
- const user_id_t symbol_uid = ((Symbol *)p)->GetID();
+ const user_id_t match_uid = *(const user_id_t*) key;
+ const user_id_t symbol_uid = ((const Symbol *)p)->GetID();
if (match_uid < symbol_uid)
return -1;
if (match_uid > symbol_uid)
@@ -227,7 +227,7 @@ Symtab::FindSymbolByID (lldb::user_id_t
Symbol *symbol = (Symbol*)::bsearch (&symbol_uid,
&m_symbols[0],
m_symbols.size(),
- (uint8_t *)&m_symbols[1] - (uint8_t *)&m_symbols[0],
+ sizeof(m_symbols[0]),
CompareSymbolID);
return symbol;
}
Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=237218&r1=237217&r2=237218&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Tue May 12 19:25:54 2015
@@ -867,7 +867,6 @@ PrepareCommandsForSourcing (const char *
{
enum PIPES { READ, WRITE }; // Constants 0 and 1 for READ and WRITE
- bool success = true;
::FILE *commands_file = NULL;
fds[0] = -1;
fds[1] = -1;
@@ -885,7 +884,6 @@ PrepareCommandsForSourcing (const char *
fprintf(stderr, "error: write(%i, %p, %" PRIu64 ") failed (errno = %i) "
"when trying to open LLDB commands pipe\n",
fds[WRITE], commands_data, static_cast<uint64_t>(commands_size), errno);
- success = false;
}
else if (static_cast<size_t>(nrwr) == commands_size)
{
@@ -911,14 +909,12 @@ PrepareCommandsForSourcing (const char *
"error: fdopen(%i, \"r\") failed (errno = %i) when "
"trying to open LLDB commands pipe\n",
fds[READ], errno);
- success = false;
}
}
}
else
{
fprintf(stderr, "error: can't create pipe file descriptors for LLDB commands\n");
- success = false;
}
return commands_file;
More information about the lldb-commits
mailing list