diff options
author | Vince Harron <vince@nethacker.com> | 2015-05-13 00:25:54 +0000 |
---|---|---|
committer | Vince Harron <vince@nethacker.com> | 2015-05-13 00:25:54 +0000 |
commit | d7e6a4f2f07464acfe4fe98b4e4038c67c7b2975 (patch) | |
tree | 329d2a720739a7140401e3842b751aa7f0651c93 /lldb/source/Plugins/Process | |
parent | 9bbc3653c5ccb170167b2ab3c4ec098be83a3d04 (diff) | |
download | bcm5719-llvm-d7e6a4f2f07464acfe4fe98b4e4038c67c7b2975.tar.gz bcm5719-llvm-d7e6a4f2f07464acfe4fe98b4e4038c67c7b2975.zip |
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
llvm-svn: 237218
Diffstat (limited to 'lldb/source/Plugins/Process')
6 files changed, 39 insertions, 46 deletions
diff --git a/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp index cb987ac6dac..303f1e2b442 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp @@ -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 diff --git a/lldb/source/Plugins/Process/Linux/ProcessLinux.h b/lldb/source/Plugins/Process/Linux/ProcessLinux.h index 1d8232d3bee..0abc023babd 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessLinux.h +++ b/lldb/source/Plugins/Process/Linux/ProcessLinux.h @@ -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; diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp index b8f2a3f0d8b..c08c46e6c7e 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp @@ -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; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 89d98760a60..fbd2047b352 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -772,48 +772,40 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *hostname, 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 diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 74b0d04859e..f5f134e80d6 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -677,15 +677,16 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data // 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()); diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 6eb4fbd2078..814b1ad1191 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -4094,18 +4094,18 @@ ProcessGDBRemote::GetLoadedModuleList (GDBLoadedModuleInfoList & list) 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 (GDBLoadedModuleInfoList & list) } // 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 (GDBLoadedModuleInfoList & list) } // 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) |