diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-04-04 04:06:10 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-04-04 04:06:10 +0000 |
commit | 324a1036194f95385b26c941bc82cc6dadf50ac7 (patch) | |
tree | 06bb7d9660aafa1ff4e69cfa813b5c122038e09f | |
parent | f3aefca7c1bcdd3a6445b7ae04a9f69af567a7e7 (diff) | |
download | bcm5719-llvm-324a1036194f95385b26c941bc82cc6dadf50ac7.tar.gz bcm5719-llvm-324a1036194f95385b26c941bc82cc6dadf50ac7.zip |
sweep up -Wformat warnings from gcc
This is a purely mechanical change explicitly casting any parameters for printf
style conversion. This cleans up the warnings emitted by gcc 4.8 on Linux.
llvm-svn: 205607
93 files changed, 2998 insertions, 2733 deletions
diff --git a/lldb/include/lldb/Host/DynamicLibrary.h b/lldb/include/lldb/Host/DynamicLibrary.h index 1fcc7d1883c..6f08273c844 100644 --- a/lldb/include/lldb/Host/DynamicLibrary.h +++ b/lldb/include/lldb/Host/DynamicLibrary.h @@ -21,31 +21,31 @@ public: DynamicLibrary (const FileSpec& spec, uint32_t options = Host::eDynamicLibraryOpenOptionLazy | Host::eDynamicLibraryOpenOptionLocal | Host::eDynamicLibraryOpenOptionLimitGetSymbol); - + ~DynamicLibrary (); - + template <typename T = void*> T GetSymbol (const char* name) { Error err; if (!m_handle) - return (T)NULL; + return static_cast<T>(NULL); void* symbol = Host::DynamicLibraryGetSymbol (m_handle, name, err); if (!symbol) - return (T)NULL; - return (T)symbol; + return static_cast<T>(NULL); + return *reinterpret_cast<T*>(&symbol); } - + bool IsValid (); - + private: lldb_private::FileSpec m_filespec; void* m_handle; - + DISALLOW_COPY_AND_ASSIGN (DynamicLibrary); }; - + } // namespace lldb_private #endif // liblldb_DynamicLibrary_h_ diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp index 799c9090763..6aec0722169 100644 --- a/lldb/source/API/SBAddress.cpp +++ b/lldb/source/API/SBAddress.cpp @@ -127,13 +127,15 @@ SBAddress::GetLoadAddress (const SBTarget &target) const addr = m_opaque_ap->GetLoadAddress (target_sp.get()); } } - + if (log) { if (addr == LLDB_INVALID_ADDRESS) - log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => LLDB_INVALID_ADDRESS", target_sp.get()); + log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => LLDB_INVALID_ADDRESS", + static_cast<void*>(target_sp.get())); else - log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => 0x%" PRIx64, target_sp.get(), addr); + log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => 0x%" PRIx64, + static_cast<void*>(target_sp.get()), addr); } return addr; diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 2c9cd12f18e..eb379ab12ce 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -124,9 +124,11 @@ SBBreakpoint::GetID () const if (log) { if (break_id == LLDB_INVALID_BREAK_ID) - log->Printf ("SBBreakpoint(%p)::GetID () => LLDB_INVALID_BREAK_ID", m_opaque_sp.get()); + log->Printf ("SBBreakpoint(%p)::GetID () => LLDB_INVALID_BREAK_ID", + static_cast<void*>(m_opaque_sp.get())); else - log->Printf ("SBBreakpoint(%p)::GetID () => %u", m_opaque_sp.get(), break_id); + log->Printf ("SBBreakpoint(%p)::GetID () => %u", + static_cast<void*>(m_opaque_sp.get()), break_id); } return break_id; @@ -225,7 +227,8 @@ SBBreakpoint::SetEnabled (bool enable) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)", m_opaque_sp.get(), enable); + log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)", + static_cast<void*>(m_opaque_sp.get()), enable); if (m_opaque_sp) { @@ -252,7 +255,8 @@ SBBreakpoint::SetOneShot (bool one_shot) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::SetOneShot (one_shot=%i)", m_opaque_sp.get(), one_shot); + log->Printf ("SBBreakpoint(%p)::SetOneShot (one_shot=%i)", + static_cast<void*>(m_opaque_sp.get()), one_shot); if (m_opaque_sp) { @@ -291,8 +295,9 @@ SBBreakpoint::SetIgnoreCount (uint32_t count) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)", m_opaque_sp.get(), count); - + log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)", + static_cast<void*>(m_opaque_sp.get()), count); + if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); @@ -333,7 +338,8 @@ SBBreakpoint::GetHitCount () const Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count); + log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u", + static_cast<void*>(m_opaque_sp.get()), count); return count; } @@ -350,7 +356,8 @@ SBBreakpoint::GetIgnoreCount () const Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u", m_opaque_sp.get(), count); + log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u", + static_cast<void*>(m_opaque_sp.get()), count); return count; } @@ -365,7 +372,8 @@ SBBreakpoint::SetThreadID (tid_t tid) } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4" PRIx64 ")", m_opaque_sp.get(), tid); + log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4" PRIx64 ")", + static_cast<void*>(m_opaque_sp.get()), tid); } @@ -381,7 +389,8 @@ SBBreakpoint::GetThreadID () Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4" PRIx64, m_opaque_sp.get(), tid); + log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4" PRIx64, + static_cast<void*>(m_opaque_sp.get()), tid); return tid; } @@ -390,7 +399,8 @@ SBBreakpoint::SetThreadIndex (uint32_t index) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)", m_opaque_sp.get(), index); + log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)", + static_cast<void*>(m_opaque_sp.get()), index); if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); @@ -411,18 +421,19 @@ SBBreakpoint::GetThreadIndex() const } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u", m_opaque_sp.get(), thread_idx); + log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u", + static_cast<void*>(m_opaque_sp.get()), thread_idx); return thread_idx; } - void SBBreakpoint::SetThreadName (const char *thread_name) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)", m_opaque_sp.get(), thread_name); + log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)", + static_cast<void*>(m_opaque_sp.get()), thread_name); if (m_opaque_sp) { @@ -444,7 +455,8 @@ SBBreakpoint::GetThreadName () const } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s", m_opaque_sp.get(), name); + log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s", + static_cast<void*>(m_opaque_sp.get()), name); return name; } @@ -454,7 +466,8 @@ SBBreakpoint::SetQueueName (const char *queue_name) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)", m_opaque_sp.get(), queue_name); + log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)", + static_cast<void*>(m_opaque_sp.get()), queue_name); if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); @@ -475,7 +488,8 @@ SBBreakpoint::GetQueueName () const } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s", m_opaque_sp.get(), name); + log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s", + static_cast<void*>(m_opaque_sp.get()), name); return name; } @@ -491,7 +505,9 @@ SBBreakpoint::GetNumResolvedLocations() const } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %" PRIu64, m_opaque_sp.get(), (uint64_t)num_resolved); + log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %" PRIu64, + static_cast<void*>(m_opaque_sp.get()), + static_cast<uint64_t>(num_resolved)); return num_resolved; } @@ -506,7 +522,9 @@ SBBreakpoint::GetNumLocations() const } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %" PRIu64, m_opaque_sp.get(), (uint64_t)num_locs); + log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %" PRIu64, + static_cast<void*>(m_opaque_sp.get()), + static_cast<uint64_t>(num_locs)); return num_locs; } @@ -570,9 +588,14 @@ void SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (log) - log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)", m_opaque_sp.get(), callback, baton); + { + void *pointer = &callback; + log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)", + static_cast<void*>(m_opaque_sp.get()), + *static_cast<void**>(&pointer), static_cast<void*>(baton)); + } if (m_opaque_sp) { @@ -586,9 +609,11 @@ void SBBreakpoint::SetScriptCallbackFunction (const char *callback_function_name) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (log) - log->Printf ("SBBreakpoint(%p)::SetScriptCallbackFunction (callback=%s)", m_opaque_sp.get(), callback_function_name); + log->Printf ("SBBreakpoint(%p)::SetScriptCallbackFunction (callback=%s)", + static_cast<void*>(m_opaque_sp.get()), + callback_function_name); if (m_opaque_sp) { @@ -603,9 +628,10 @@ SBError SBBreakpoint::SetScriptCallbackBody (const char *callback_body_text) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (log) - log->Printf ("SBBreakpoint(%p)::SetScriptCallbackBody: callback body:\n%s)", m_opaque_sp.get(), callback_body_text); + log->Printf ("SBBreakpoint(%p)::SetScriptCallbackBody: callback body:\n%s)", + static_cast<void*>(m_opaque_sp.get()), callback_body_text); SBError sb_error; if (m_opaque_sp) @@ -618,7 +644,7 @@ SBBreakpoint::SetScriptCallbackBody (const char *callback_body_text) } else sb_error.SetErrorString("invalid breakpoint"); - + return sb_error; } diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp index b2b94484f9c..4390e9ad737 100644 --- a/lldb/source/API/SBBreakpointLocation.cpp +++ b/lldb/source/API/SBBreakpointLocation.cpp @@ -46,7 +46,9 @@ SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &br SBStream sstr; GetDescription (sstr, lldb::eDescriptionLevelBrief); log->Printf ("SBBreakpointLocation::SBBreakpointLocaiton (const lldb::BreakpointLocationsSP &break_loc_sp" - "=%p) => this.sp = %p (%s)", break_loc_sp.get(), m_opaque_sp.get(), sstr.GetData()); + "=%p) => this.sp = %p (%s)", + static_cast<void*>(break_loc_sp.get()), + static_cast<void*>(m_opaque_sp.get()), sstr.GetData()); } } @@ -166,9 +168,11 @@ void SBBreakpointLocation::SetScriptCallbackFunction (const char *callback_function_name) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (log) - log->Printf ("SBBreakpointLocation(%p)::SetScriptCallbackFunction (callback=%s)", m_opaque_sp.get(), callback_function_name); + log->Printf ("SBBreakpointLocation(%p)::SetScriptCallbackFunction (callback=%s)", + static_cast<void*>(m_opaque_sp.get()), + callback_function_name); if (m_opaque_sp) { @@ -176,7 +180,6 @@ SBBreakpointLocation::SetScriptCallbackFunction (const char *callback_function_n BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions(); m_opaque_sp->GetBreakpoint().GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallbackFunction (bp_options, callback_function_name); - } } @@ -184,10 +187,11 @@ SBError SBBreakpointLocation::SetScriptCallbackBody (const char *callback_body_text) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (log) - log->Printf ("SBBreakpoint(%p)::SetScriptCallbackBody: callback body:\n%s)", m_opaque_sp.get(), callback_body_text); - + log->Printf ("SBBreakpoint(%p)::SetScriptCallbackBody: callback body:\n%s)", + static_cast<void*>(m_opaque_sp.get()), callback_body_text); + SBError sb_error; if (m_opaque_sp) { @@ -199,7 +203,7 @@ SBBreakpointLocation::SetScriptCallbackBody (const char *callback_body_text) } else sb_error.SetErrorString("invalid breakpoint"); - + return sb_error; } @@ -356,8 +360,9 @@ SBBreakpointLocation::GetBreakpoint () { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBBreakpointLocation(%p)::GetBreakpoint () => SBBreakpoint(%p) %s", - m_opaque_sp.get(), sb_bp.get(), sstr.GetData()); + log->Printf ("SBBreakpointLocation(%p)::GetBreakpoint () => SBBreakpoint(%p) %s", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(sb_bp.get()), sstr.GetData()); } return sb_bp; } diff --git a/lldb/source/API/SBBroadcaster.cpp b/lldb/source/API/SBBroadcaster.cpp index 7168305ac80..73eac5183f8 100644 --- a/lldb/source/API/SBBroadcaster.cpp +++ b/lldb/source/API/SBBroadcaster.cpp @@ -33,7 +33,7 @@ SBBroadcaster::SBBroadcaster (const char *name) : if (log) log->Printf ("SBBroadcaster::SBBroadcaster (name=\"%s\") => SBBroadcaster(%p)", - name, m_opaque_ptr); + name, static_cast<void*>(m_opaque_ptr)); } SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) : @@ -43,8 +43,9 @@ SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE)); if (log) - log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) => SBBroadcaster(%p)", - broadcaster, owns, m_opaque_ptr); + log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) => SBBroadcaster(%p)", + static_cast<void*>(broadcaster), owns, + static_cast<void*>(m_opaque_ptr)); } SBBroadcaster::SBBroadcaster (const SBBroadcaster &rhs) : @@ -75,7 +76,8 @@ SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)", m_opaque_ptr, event_type, unique); + log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)", + static_cast<void*>(m_opaque_ptr), event_type, unique); if (m_opaque_ptr == NULL) return; @@ -92,7 +94,9 @@ SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)", m_opaque_ptr, event.get(), unique); + log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)", + static_cast<void*>(m_opaque_ptr), + static_cast<void*>(event.get()), unique); if (m_opaque_ptr == NULL) return; @@ -109,7 +113,9 @@ SBBroadcaster::AddInitialEventsToListener (const SBListener &listener, uint32_t { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)", m_opaque_ptr, listener.get(), requested_events); + log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)", + static_cast<void*>(m_opaque_ptr), + static_cast<void*>(listener.get()), requested_events); if (m_opaque_ptr) m_opaque_ptr->AddInitialEventsToListener (listener.get(), requested_events); } diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index 419c1570170..388dff2a8aa 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -65,7 +65,9 @@ SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) : if (log) log->Printf ("SBCommandInterpreter::SBCommandInterpreter (interpreter=%p)" - " => SBCommandInterpreter(%p)", interpreter, m_opaque_ptr); + " => SBCommandInterpreter(%p)", + static_cast<void*>(interpreter), + static_cast<void*>(m_opaque_ptr)); } SBCommandInterpreter::SBCommandInterpreter(const SBCommandInterpreter &rhs) : @@ -129,8 +131,9 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p), add_to_history=%i)", - m_opaque_ptr, command_line, result.get(), add_to_history); + log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p), add_to_history=%i)", + static_cast<void*>(m_opaque_ptr), command_line, + static_cast<void*>(result.get()), add_to_history); result.Clear(); if (command_line && m_opaque_ptr) @@ -150,7 +153,9 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb SBStream sstr; result.GetDescription (sstr); log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p): %s, add_to_history=%i) => %i", - m_opaque_ptr, command_line, result.get(), sstr.GetData(), add_to_history, result.GetStatus()); + static_cast<void*>(m_opaque_ptr), command_line, + static_cast<void*>(result.get()), sstr.GetData(), + add_to_history, result.GetStatus()); } return result.GetStatus(); @@ -166,24 +171,27 @@ SBCommandInterpreter::HandleCompletion (const char *current_line, { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); int num_completions = 0; - + // Sanity check the arguments that are passed in: // cursor & last_char have to be within the current_line. if (current_line == NULL || cursor == NULL || last_char == NULL) return 0; - + if (cursor < current_line || last_char < current_line) return 0; - + size_t current_line_size = strlen (current_line); if (cursor - current_line > static_cast<ptrdiff_t>(current_line_size) || last_char - current_line > static_cast<ptrdiff_t>(current_line_size)) return 0; - + if (log) log->Printf ("SBCommandInterpreter(%p)::HandleCompletion (current_line=\"%s\", cursor at: %" PRId64 ", last char at: %" PRId64 ", match_start_point: %d, max_return_elements: %d)", - m_opaque_ptr, current_line, (uint64_t) (cursor - current_line), (uint64_t) (last_char - current_line), match_start_point, max_return_elements); - + static_cast<void*>(m_opaque_ptr), current_line, + static_cast<uint64_t>(cursor - current_line), + static_cast<uint64_t>(last_char - current_line), + match_start_point, max_return_elements); + if (m_opaque_ptr) { lldb_private::StringList lldb_matches; @@ -194,8 +202,9 @@ SBCommandInterpreter::HandleCompletion (const char *current_line, matches.AppendList (temp_list); } if (log) - log->Printf ("SBCommandInterpreter(%p)::HandleCompletion - Found %d completions.", m_opaque_ptr, num_completions); - + log->Printf ("SBCommandInterpreter(%p)::HandleCompletion - Found %d completions.", + static_cast<void*>(m_opaque_ptr), num_completions); + return num_completions; } @@ -254,9 +263,9 @@ SBCommandInterpreter::GetProcess () if (log) log->Printf ("SBCommandInterpreter(%p)::GetProcess () => SBProcess(%p)", - m_opaque_ptr, process_sp.get()); + static_cast<void*>(m_opaque_ptr), + static_cast<void*>(process_sp.get())); - return sb_process; } @@ -267,12 +276,12 @@ SBCommandInterpreter::GetDebugger () if (m_opaque_ptr) sb_debugger.reset(m_opaque_ptr->GetDebugger().shared_from_this()); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (log) log->Printf ("SBCommandInterpreter(%p)::GetDebugger () => SBDebugger(%p)", - m_opaque_ptr, sb_debugger.get()); - - + static_cast<void*>(m_opaque_ptr), + static_cast<void*>(sb_debugger.get())); + return sb_debugger; } @@ -316,8 +325,8 @@ SBCommandInterpreter::SourceInitFileInHomeDirectory (SBCommandReturnObject &resu if (log) log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInHomeDirectory (&SBCommandReturnObject(%p))", - m_opaque_ptr, result.get()); - + static_cast<void*>(m_opaque_ptr), + static_cast<void*>(result.get())); } void @@ -341,7 +350,8 @@ SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnOb if (log) log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInCurrentWorkingDirectory (&SBCommandReturnObject(%p))", - m_opaque_ptr, result.get()); + static_cast<void*>(m_opaque_ptr), + static_cast<void*>(result.get())); } SBBroadcaster @@ -353,7 +363,7 @@ SBCommandInterpreter::GetBroadcaster () if (log) log->Printf ("SBCommandInterpreter(%p)::GetBroadcaster() => SBBroadcaster(%p)", - m_opaque_ptr, broadcaster.get()); + static_cast<void*>(m_opaque_ptr), static_cast<void*>(broadcaster.get())); return broadcaster; } diff --git a/lldb/source/API/SBCommandReturnObject.cpp b/lldb/source/API/SBCommandReturnObject.cpp index 83d65637d3f..1ae2df76c97 100644 --- a/lldb/source/API/SBCommandReturnObject.cpp +++ b/lldb/source/API/SBCommandReturnObject.cpp @@ -75,14 +75,16 @@ SBCommandReturnObject::GetOutput () if (m_opaque_ap.get()) { if (log) - log->Printf ("SBCommandReturnObject(%p)::GetOutput () => \"%s\"", m_opaque_ap.get(), + log->Printf ("SBCommandReturnObject(%p)::GetOutput () => \"%s\"", + static_cast<void*>(m_opaque_ap.get()), m_opaque_ap->GetOutputData()); return m_opaque_ap->GetOutputData(); } if (log) - log->Printf ("SBCommandReturnObject(%p)::GetOutput () => NULL", m_opaque_ap.get()); + log->Printf ("SBCommandReturnObject(%p)::GetOutput () => NULL", + static_cast<void*>(m_opaque_ap.get())); return NULL; } @@ -95,14 +97,16 @@ SBCommandReturnObject::GetError () if (m_opaque_ap.get()) { if (log) - log->Printf ("SBCommandReturnObject(%p)::GetError () => \"%s\"", m_opaque_ap.get(), + log->Printf ("SBCommandReturnObject(%p)::GetError () => \"%s\"", + static_cast<void*>(m_opaque_ap.get()), m_opaque_ap->GetErrorData()); return m_opaque_ap->GetErrorData(); } - + if (log) - log->Printf ("SBCommandReturnObject(%p)::GetError () => NULL", m_opaque_ap.get()); + log->Printf ("SBCommandReturnObject(%p)::GetError () => NULL", + static_cast<void*>(m_opaque_ap.get())); return NULL; } diff --git a/lldb/source/API/SBCommunication.cpp b/lldb/source/API/SBCommunication.cpp index 10feae5d4eb..a29f735d2f1 100644 --- a/lldb/source/API/SBCommunication.cpp +++ b/lldb/source/API/SBCommunication.cpp @@ -32,7 +32,8 @@ SBCommunication::SBCommunication(const char * broadcaster_name) : if (log) log->Printf ("SBCommunication::SBCommunication (broadcaster_name=\"%s\") => " - "SBCommunication(%p)", broadcaster_name, m_opaque); + "SBCommunication(%p)", broadcaster_name, + static_cast<void*>(m_opaque)); } SBCommunication::~SBCommunication() @@ -97,8 +98,9 @@ SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd) } if (log) - log->Printf ("SBCommunication(%p)::AdoptFileDescriptor (fd=%d, ownd_fd=%i) => %s", - m_opaque, fd, owns_fd, Communication::ConnectionStatusAsCString (status)); + log->Printf ("SBCommunication(%p)::AdoptFileDescriptor (fd=%d, ownd_fd=%i) => %s", + static_cast<void*>(m_opaque), fd, owns_fd, + Communication::ConnectionStatusAsCString (status)); return status; } @@ -114,7 +116,8 @@ SBCommunication::Disconnect () status = m_opaque->Disconnect (); if (log) - log->Printf ("SBCommunication(%p)::Disconnect () => %s", m_opaque, + log->Printf ("SBCommunication(%p)::Disconnect () => %s", + static_cast<void*>(m_opaque), Communication::ConnectionStatusAsCString (status)); return status; @@ -129,7 +132,8 @@ SBCommunication::IsConnected () const result = m_opaque->IsConnected (); if (log) - log->Printf ("SBCommunication(%p)::IsConnected () => %i", m_opaque, result); + log->Printf ("SBCommunication(%p)::IsConnected () => %i", + static_cast<void*>(m_opaque), result); return false; } @@ -140,10 +144,8 @@ SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, Connect Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%" PRIu64 ", timeout_usec=%u, &status)...", - m_opaque, - dst, - (uint64_t)dst_len, - timeout_usec); + static_cast<void*>(m_opaque), static_cast<void*>(dst), + static_cast<uint64_t>(dst_len), timeout_usec); size_t bytes_read = 0; if (m_opaque) bytes_read = m_opaque->Read (dst, dst_len, timeout_usec, status, NULL); @@ -152,12 +154,10 @@ SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, Connect if (log) log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%" PRIu64 ", timeout_usec=%u, &status=%s) => %" PRIu64, - m_opaque, - dst, - (uint64_t)dst_len, - timeout_usec, + static_cast<void*>(m_opaque), static_cast<void*>(dst), + static_cast<uint64_t>(dst_len), timeout_usec, Communication::ConnectionStatusAsCString (status), - (uint64_t)bytes_read); + static_cast<uint64_t>(bytes_read)); return bytes_read; } @@ -174,7 +174,10 @@ SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &statu Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%" PRIu64 ", &status=%s) => %" PRIu64, - m_opaque, src, (uint64_t)src_len, Communication::ConnectionStatusAsCString (status), (uint64_t)bytes_written); + static_cast<void*>(m_opaque), static_cast<const void*>(src), + static_cast<uint64_t>(src_len), + Communication::ConnectionStatusAsCString (status), + static_cast<uint64_t>(bytes_written)); return 0; } @@ -189,7 +192,8 @@ SBCommunication::ReadThreadStart () success = m_opaque->StartReadThread (); if (log) - log->Printf ("SBCommunication(%p)::ReadThreadStart () => %i", m_opaque, success); + log->Printf ("SBCommunication(%p)::ReadThreadStart () => %i", + static_cast<void*>(m_opaque), success); return success; } @@ -200,14 +204,16 @@ SBCommunication::ReadThreadStop () { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBCommunication(%p)::ReadThreadStop ()...", m_opaque); + log->Printf ("SBCommunication(%p)::ReadThreadStop ()...", + static_cast<void*>(m_opaque)); bool success = false; if (m_opaque) success = m_opaque->StopReadThread (); if (log) - log->Printf ("SBCommunication(%p)::ReadThreadStop () => %i", m_opaque, success); + log->Printf ("SBCommunication(%p)::ReadThreadStop () => %i", + static_cast<void*>(m_opaque), success); return success; } @@ -220,7 +226,8 @@ SBCommunication::ReadThreadIsRunning () result = m_opaque->ReadThreadIsRunning (); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBCommunication(%p)::ReadThreadIsRunning () => %i", m_opaque, result); + log->Printf ("SBCommunication(%p)::ReadThreadIsRunning () => %i", + static_cast<void*>(m_opaque), result); return result; } @@ -242,7 +249,9 @@ SBCommunication::SetReadThreadBytesReceivedCallback if (log) log->Printf ("SBCommunication(%p)::SetReadThreadBytesReceivedCallback (callback=%p, baton=%p) => %i", - m_opaque, callback, callback_baton, result); + static_cast<void*>(m_opaque), + reinterpret_cast<void*>(callback), + static_cast<void*>(callback_baton), result); return result; } @@ -256,7 +265,8 @@ SBCommunication::GetBroadcaster () if (log) log->Printf ("SBCommunication(%p)::GetBroadcaster () => SBBroadcaster (%p)", - m_opaque, broadcaster.get()); + static_cast<void*>(m_opaque), + static_cast<void*>(broadcaster.get())); return broadcaster; } diff --git a/lldb/source/API/SBCompileUnit.cpp b/lldb/source/API/SBCompileUnit.cpp index 9f7487746a8..03c25710a9e 100644 --- a/lldb/source/API/SBCompileUnit.cpp +++ b/lldb/source/API/SBCompileUnit.cpp @@ -87,13 +87,14 @@ SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const sb_line_entry.SetLineEntry(line_entry); } } - + if (log) { SBStream sstr; sb_line_entry.GetDescription (sstr); - log->Printf ("SBCompileUnit(%p)::GetLineEntryAtIndex (idx=%u) => SBLineEntry(%p): '%s'", - m_opaque_ptr, idx, sb_line_entry.get(), sstr.GetData()); + log->Printf ("SBCompileUnit(%p)::GetLineEntryAtIndex (idx=%u) => SBLineEntry(%p): '%s'", + static_cast<void*>(m_opaque_ptr), idx, + static_cast<void*>(sb_line_entry.get()), sstr.GetData()); } return sb_line_entry; @@ -120,7 +121,6 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec else file_spec = *m_opaque_ptr; - index = m_opaque_ptr->FindLineEntry (start_idx, line, inline_file_spec ? inline_file_spec->get() : NULL, @@ -133,13 +133,20 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec SBStream sstr; if (index == UINT32_MAX) { - log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => NOT FOUND", - m_opaque_ptr, start_idx, line, inline_file_spec ? inline_file_spec->get() : NULL); + log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => NOT FOUND", + static_cast<void*>(m_opaque_ptr), start_idx, line, + inline_file_spec + ? static_cast<const void*>(inline_file_spec->get()) + : NULL); } else { - log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => %u", - m_opaque_ptr, start_idx, line, inline_file_spec ? inline_file_spec->get() : NULL, index); + log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => %u", + static_cast<void*>(m_opaque_ptr), start_idx, line, + inline_file_spec + ? static_cast<const void*>(inline_file_spec->get()) + : NULL, + index); } } @@ -196,13 +203,15 @@ SBCompileUnit::GetSupportFileAtIndex (uint32_t idx) const FileSpec file_spec = support_files.GetFileSpecAtIndex(idx); sb_file_spec.SetFileSpec(file_spec); } - + if (log) { SBStream sstr; sb_file_spec.GetDescription (sstr); - log->Printf ("SBCompileUnit(%p)::GetGetFileSpecAtIndex (idx=%u) => SBFileSpec(%p): '%s'", - m_opaque_ptr, idx, sb_file_spec.get(), sstr.GetData()); + log->Printf ("SBCompileUnit(%p)::GetGetFileSpecAtIndex (idx=%u) => SBFileSpec(%p): '%s'", + static_cast<void*>(m_opaque_ptr), idx, + static_cast<const void*>(sb_file_spec.get()), + sstr.GetData()); } return sb_file_spec; diff --git a/lldb/source/API/SBData.cpp b/lldb/source/API/SBData.cpp index a284d02aaab..40bd71e90b7 100644 --- a/lldb/source/API/SBData.cpp +++ b/lldb/source/API/SBData.cpp @@ -167,8 +167,8 @@ SBData::GetFloat (lldb::SBError& error, lldb::offset_t offset) error.SetErrorString("unable to read data"); } if (log) - log->Printf ("SBData::GetFloat (error=%p,offset=%" PRIu64 ") => " - "(%f)", error.get(), offset, value); + log->Printf ("SBData::GetFloat (error=%p,offset=%" PRIu64 ") => (%f)", + static_cast<void*>(error.get()), offset, value); return value; } @@ -190,7 +190,7 @@ SBData::GetDouble (lldb::SBError& error, lldb::offset_t offset) } if (log) log->Printf ("SBData::GetDouble (error=%p,offset=%" PRIu64 ") => " - "(%f)", error.get(), offset, value); + "(%f)", static_cast<void*>(error.get()), offset, value); return value; } @@ -212,7 +212,7 @@ SBData::GetLongDouble (lldb::SBError& error, lldb::offset_t offset) } if (log) log->Printf ("SBData::GetLongDouble (error=%p,offset=%" PRIu64 ") => " - "(%Lf)", error.get(), offset, value); + "(%Lf)", static_cast<void*>(error.get()), offset, value); return value; } @@ -234,7 +234,8 @@ SBData::GetAddress (lldb::SBError& error, lldb::offset_t offset) } if (log) log->Printf ("SBData::GetAddress (error=%p,offset=%" PRIu64 ") => " - "(%p)", error.get(), offset, (void*)value); + "(%p)", static_cast<void*>(error.get()), offset, + reinterpret_cast<void*>(value)); return value; } @@ -256,7 +257,7 @@ SBData::GetUnsignedInt8 (lldb::SBError& error, lldb::offset_t offset) } if (log) log->Printf ("SBData::GetUnsignedInt8 (error=%p,offset=%" PRIu64 ") => " - "(%c)", error.get(), offset, value); + "(%c)", static_cast<void*>(error.get()), offset, value); return value; } @@ -278,7 +279,7 @@ SBData::GetUnsignedInt16 (lldb::SBError& error, lldb::offset_t offset) } if (log) log->Printf ("SBData::GetUnsignedInt16 (error=%p,offset=%" PRIu64 ") => " - "(%hd)", error.get(), offset, value); + "(%hd)", static_cast<void*>(error.get()), offset, value); return value; } @@ -300,7 +301,7 @@ SBData::GetUnsignedInt32 (lldb::SBError& error, lldb::offset_t offset) } if (log) log->Printf ("SBData::GetUnsignedInt32 (error=%p,offset=%" PRIu64 ") => " - "(%d)", error.get(), offset, value); + "(%d)", static_cast<void*>(error.get()), offset, value); return value; } @@ -322,7 +323,8 @@ SBData::GetUnsignedInt64 (lldb::SBError& error, lldb::offset_t offset) } if (log) log->Printf ("SBData::GetUnsignedInt64 (error=%p,offset=%" PRIu64 ") => " - "(%" PRId64 ")", error.get(), offset, value); + "(%" PRId64 ")", static_cast<void*>(error.get()), offset, + value); return value; } @@ -344,7 +346,7 @@ SBData::GetSignedInt8 (lldb::SBError& error, lldb::offset_t offset) } if (log) log->Printf ("SBData::GetSignedInt8 (error=%p,offset=%" PRIu64 ") => " - "(%c)", error.get(), offset, value); + "(%c)", static_cast<void*>(error.get()), offset, value); return value; } @@ -366,7 +368,7 @@ SBData::GetSignedInt16 (lldb::SBError& error, lldb::offset_t offset) } if (log) log->Printf ("SBData::GetSignedInt16 (error=%p,offset=%" PRIu64 ") => " - "(%hd)", error.get(), offset, value); + "(%hd)", static_cast<void*>(error.get()), offset, value); return value; } @@ -388,7 +390,7 @@ SBData::GetSignedInt32 (lldb::SBError& error, lldb::offset_t offset) } if (log) log->Printf ("SBData::GetSignedInt32 (error=%p,offset=%" PRIu64 ") => " - "(%d)", error.get(), offset, value); + "(%d)", static_cast<void*>(error.get()), offset, value); return value; } @@ -410,7 +412,8 @@ SBData::GetSignedInt64 (lldb::SBError& error, lldb::offset_t offset) } if (log) log->Printf ("SBData::GetSignedInt64 (error=%p,offset=%" PRIu64 ") => " - "(%" PRId64 ")", error.get(), offset, value); + "(%" PRId64 ")", static_cast<void*>(error.get()), offset, + value); return value; } @@ -431,8 +434,9 @@ SBData::GetString (lldb::SBError& error, lldb::offset_t offset) error.SetErrorString("unable to read data"); } if (log) - log->Printf ("SBData::GetString (error=%p,offset=%" PRIu64 ") => " - "(%p)", error.get(), offset, value); + log->Printf ("SBData::GetString (error=%p,offset=%" PRIu64 ") => (%p)", + static_cast<void*>(error.get()), offset, + static_cast<const void*>(value)); return value; } @@ -480,7 +484,9 @@ SBData::ReadRawData (lldb::SBError& error, } if (log) log->Printf("SBData::ReadRawData (error=%p,offset=%" PRIu64 ",buf=%p,size=%" PRIu64 ") => " - "(%p)", error.get(), offset, buf, (uint64_t)size, ok); + "(%p)", static_cast<void*>(error.get()), offset, + static_cast<void*>(buf), static_cast<uint64_t>(size), + static_cast<void*>(ok)); return ok ? size : 0; } @@ -498,7 +504,9 @@ SBData::SetData (lldb::SBError& error, m_opaque_sp->SetData(buf, size, endian); if (log) log->Printf("SBData::SetData (error=%p,buf=%p,size=%" PRIu64 ",endian=%d,addr_size=%c) => " - "(%p)", error.get(), buf, (uint64_t)size, endian, addr_size, m_opaque_sp.get()); + "(%p)", static_cast<void*>(error.get()), + static_cast<const void*>(buf), static_cast<uint64_t>(size), + endian, addr_size, static_cast<void*>(m_opaque_sp.get())); } bool @@ -509,8 +517,8 @@ SBData::Append (const SBData& rhs) if (m_opaque_sp.get() && rhs.m_opaque_sp.get()) value = m_opaque_sp.get()->Append(*rhs.m_opaque_sp); if (log) - log->Printf ("SBData::Append (rhs=%p) => " - "(%s)", rhs.get(), value ? "true" : "false"); + log->Printf ("SBData::Append (rhs=%p) => (%s)", + static_cast<void*>(rhs.get()), value ? "true" : "false"); return value; } @@ -614,28 +622,28 @@ bool SBData::SetDataFromCString (const char* data) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (!data) { if (log) - log->Printf ("SBData::SetDataFromCString (data=%p) => " - "false", data); + log->Printf ("SBData::SetDataFromCString (data=%p) => false", + static_cast<const void*>(data)); return false; } - + size_t data_len = strlen(data); - + lldb::DataBufferSP buffer_sp(new DataBufferHeap(data, data_len)); - + if (!m_opaque_sp.get()) m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize())); else m_opaque_sp->SetData(buffer_sp); - + if (log) - log->Printf ("SBData::SetDataFromCString (data=%p) => " - "true", data); - + log->Printf ("SBData::SetDataFromCString (data=%p) => true", + static_cast<const void*>(data)); + return true; } @@ -643,28 +651,30 @@ bool SBData::SetDataFromUInt64Array (uint64_t* array, size_t array_len) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (!array || array_len == 0) { if (log) log->Printf("SBData::SetDataFromUInt64Array (array=%p, array_len = %" PRIu64 ") => " - "false", array, (uint64_t)array_len); + "false", static_cast<void*>(array), + static_cast<uint64_t>(array_len)); return false; } size_t data_len = array_len * sizeof(uint64_t); - + lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len)); - + if (!m_opaque_sp.get()) m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize())); else m_opaque_sp->SetData(buffer_sp); - + if (log) log->Printf("SBData::SetDataFromUInt64Array (array=%p, array_len = %" PRIu64 ") => " - "true", array, (uint64_t)array_len); - + "true", static_cast<void*>(array), + static_cast<uint64_t>(array_len)); + return true; } @@ -672,28 +682,30 @@ bool SBData::SetDataFromUInt32Array (uint32_t* array, size_t array_len) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (!array || array_len == 0) { if (log) log->Printf("SBData::SetDataFromUInt32Array (array=%p, array_len = %" PRIu64 ") => " - "false", array, (uint64_t)array_len); + "false", static_cast<void*>(array), + static_cast<uint64_t>(array_len)); return false; } - + size_t data_len = array_len * sizeof(uint32_t); - + lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len)); - + if (!m_opaque_sp.get()) m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize())); else m_opaque_sp->SetData(buffer_sp); - + if (log) log->Printf("SBData::SetDataFromUInt32Array (array=%p, array_len = %" PRIu64 ") => " - "true", array, (uint64_t)array_len); - + "true", static_cast<void*>(array), + static_cast<uint64_t>(array_len)); + return true; } @@ -701,28 +713,30 @@ bool SBData::SetDataFromSInt64Array (int64_t* array, size_t array_len) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (!array || array_len == 0) { if (log) log->Printf("SBData::SetDataFromSInt64Array (array=%p, array_len = %" PRIu64 ") => " - "false", array, (uint64_t)array_len); + "false", static_cast<void*>(array), + static_cast<uint64_t>(array_len)); return false; } - + size_t data_len = array_len * sizeof(int64_t); - + lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len)); - + if (!m_opaque_sp.get()) m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize())); else m_opaque_sp->SetData(buffer_sp); - + if (log) log->Printf("SBData::SetDataFromSInt64Array (array=%p, array_len = %" PRIu64 ") => " - "true", array, (uint64_t)array_len); - + "true", static_cast<void*>(array), + static_cast<uint64_t>(array_len)); + return true; } @@ -730,28 +744,30 @@ bool SBData::SetDataFromSInt32Array (int32_t* array, size_t array_len) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (!array || array_len == 0) { if (log) log->Printf("SBData::SetDataFromSInt32Array (array=%p, array_len = %" PRIu64 ") => " - "false", array, (uint64_t)array_len); + "false", static_cast<void*>(array), + static_cast<uint64_t>(array_len)); return false; } - + size_t data_len = array_len * sizeof(int32_t); - + lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len)); - + if (!m_opaque_sp.get()) m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize())); else m_opaque_sp->SetData(buffer_sp); - + if (log) log->Printf("SBData::SetDataFromSInt32Array (array=%p, array_len = %" PRIu64 ") => " - "true", array, (uint64_t)array_len); - + "true", static_cast<void*>(array), + static_cast<uint64_t>(array_len)); + return true; } @@ -759,27 +775,29 @@ bool SBData::SetDataFromDoubleArray (double* array, size_t array_len) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (!array || array_len == 0) { if (log) log->Printf("SBData::SetDataFromDoubleArray (array=%p, array_len = %" PRIu64 ") => " - "false", array, (uint64_t)array_len); + "false", static_cast<void*>(array), + static_cast<uint64_t>(array_len)); return false; } - + size_t data_len = array_len * sizeof(double); - + lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len)); - + if (!m_opaque_sp.get()) m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize())); else m_opaque_sp->SetData(buffer_sp); - + if (log) log->Printf("SBData::SetDataFromDoubleArray (array=%p, array_len = %" PRIu64 ") => " - "true", array, (uint64_t)array_len); - + "true", static_cast<void*>(array), + static_cast<uint64_t>(array_len)); + return true; } diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 8d6887a6c28..7b5b6e38299 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -131,8 +131,9 @@ SBDebugger::Clear () Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBDebugger(%p)::Clear ()", m_opaque_sp.get()); - + log->Printf ("SBDebugger(%p)::Clear ()", + static_cast<void*>(m_opaque_sp.get())); + if (m_opaque_sp) m_opaque_sp->ClearIOHandlers (); @@ -164,7 +165,9 @@ SBDebugger::Create(bool source_init_files, lldb::LogOutputCallback callback, voi { SBStream sstr; debugger.GetDescription (sstr); - log->Printf ("SBDebugger::Create () => SBDebugger(%p): %s", debugger.m_opaque_sp.get(), sstr.GetData()); + log->Printf ("SBDebugger::Create () => SBDebugger(%p): %s", + static_cast<void*>(debugger.m_opaque_sp.get()), + sstr.GetData()); } SBCommandInterpreter interp = debugger.GetCommandInterpreter(); @@ -187,16 +190,18 @@ void SBDebugger::Destroy (SBDebugger &debugger) { Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (log) { SBStream sstr; debugger.GetDescription (sstr); - log->Printf ("SBDebugger::Destroy () => SBDebugger(%p): %s", debugger.m_opaque_sp.get(), sstr.GetData()); + log->Printf ("SBDebugger::Destroy () => SBDebugger(%p): %s", + static_cast<void*>(debugger.m_opaque_sp.get()), + sstr.GetData()); } - + Debugger::Destroy (debugger.m_opaque_sp); - + if (debugger.m_opaque_sp.get() != NULL) debugger.m_opaque_sp.reset(); } @@ -293,8 +298,9 @@ SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership) Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(), - fh, transfer_ownership); + log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership=%i)", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(fh), transfer_ownership); if (m_opaque_sp) m_opaque_sp->SetInputFileHandle (fh, transfer_ownership); @@ -307,8 +313,9 @@ SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership) if (log) - log->Printf ("SBDebugger(%p)::SetOutputFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(), - fh, transfer_ownership); + log->Printf ("SBDebugger(%p)::SetOutputFileHandle (fh=%p, transfer_ownership=%i)", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(fh), transfer_ownership); if (m_opaque_sp) m_opaque_sp->SetOutputFileHandle (fh, transfer_ownership); @@ -321,8 +328,9 @@ SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership) if (log) - log->Printf ("SBDebugger(%p)::SetErrorFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(), - fh, transfer_ownership); + log->Printf ("SBDebugger(%p)::SetErrorFileHandle (fh=%p, transfer_ownership=%i)", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(fh), transfer_ownership); if (m_opaque_sp) m_opaque_sp->SetErrorFileHandle (fh, transfer_ownership); @@ -389,8 +397,9 @@ SBDebugger::GetCommandInterpreter () sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter()); if (log) - log->Printf ("SBDebugger(%p)::GetCommandInterpreter () => SBCommandInterpreter(%p)", - m_opaque_sp.get(), sb_interpreter.get()); + log->Printf ("SBDebugger(%p)::GetCommandInterpreter () => SBCommandInterpreter(%p)", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(sb_interpreter.get())); return sb_interpreter; } @@ -443,8 +452,9 @@ SBDebugger::GetListener () sb_listener.reset(&m_opaque_sp->GetListener(), false); if (log) - log->Printf ("SBDebugger(%p)::GetListener () => SBListener(%p)", m_opaque_sp.get(), - sb_listener.get()); + log->Printf ("SBDebugger(%p)::GetListener () => SBListener(%p)", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(sb_listener.get())); return sb_listener; } @@ -601,14 +611,14 @@ SBDebugger::CreateTarget (const char *filename, sb_error.Clear(); OptionGroupPlatform platform_options (false); platform_options.SetPlatformName (platform_name); - + sb_error.ref() = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, filename, target_triple, add_dependent_modules, &platform_options, target_sp); - + if (sb_error.Success()) sb_target.SetSP (target_sp); } @@ -616,20 +626,14 @@ SBDebugger::CreateTarget (const char *filename, { sb_error.SetErrorString("invalid target"); } - + Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - { - log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, platform_name=%s, add_dependent_modules=%u, error=%s) => SBTarget(%p)", - m_opaque_sp.get(), - filename, - target_triple, - platform_name, - add_dependent_modules, - sb_error.GetCString(), - target_sp.get()); - } - + log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, platform_name=%s, add_dependent_modules=%u, error=%s) => SBTarget(%p)", + static_cast<void*>(m_opaque_sp.get()), filename, + target_triple, platform_name, add_dependent_modules, + sb_error.GetCString(), static_cast<void*>(target_sp.get())); + return sb_target; } @@ -650,13 +654,12 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename, target_sp)); sb_target.SetSP (target_sp); } - + Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - { - log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename=\"%s\", triple=%s) => SBTarget(%p)", - m_opaque_sp.get(), filename, target_triple, target_sp.get()); - } + log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename=\"%s\", triple=%s) => SBTarget(%p)", + static_cast<void*>(m_opaque_sp.get()), filename, + target_triple, static_cast<void*>(target_sp.get())); return sb_target; } @@ -688,10 +691,9 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *arch_ } if (log) - { - log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", arch=%s) => SBTarget(%p)", - m_opaque_sp.get(), filename, arch_cstr, target_sp.get()); - } + log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", arch=%s) => SBTarget(%p)", + static_cast<void*>(m_opaque_sp.get()), filename, arch_cstr, + static_cast<void*>(target_sp.get())); return sb_target; } @@ -723,10 +725,9 @@ SBDebugger::CreateTarget (const char *filename) } Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - { - log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)", - m_opaque_sp.get(), filename, target_sp.get()); - } + log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)", + static_cast<void*>(m_opaque_sp.get()), filename, + static_cast<void*>(target_sp.get())); return sb_target; } @@ -750,9 +751,9 @@ SBDebugger::DeleteTarget (lldb::SBTarget &target) Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - { - log->Printf ("SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i", m_opaque_sp.get(), target.m_opaque_sp.get(), result); - } + log->Printf ("SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(target.m_opaque_sp.get()), result); return result; } @@ -850,8 +851,9 @@ SBDebugger::GetSelectedTarget () { SBStream sstr; sb_target.GetDescription (sstr, eDescriptionLevelBrief); - log->Printf ("SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s", m_opaque_sp.get(), - target_sp.get(), sstr.GetData()); + log->Printf ("SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(target_sp.get()), sstr.GetData()); } return sb_target; @@ -871,8 +873,9 @@ SBDebugger::SetSelectedTarget (SBTarget &sb_target) { SBStream sstr; sb_target.GetDescription (sstr, eDescriptionLevelBrief); - log->Printf ("SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s", m_opaque_sp.get(), - target_sp.get(), sstr.GetData()); + log->Printf ("SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(target_sp.get()), sstr.GetData()); } } @@ -888,10 +891,10 @@ SBDebugger::GetSelectedPlatform() sb_platform.SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform()); } if (log) - { - log->Printf ("SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s", m_opaque_sp.get(), - sb_platform.GetSP().get(), sb_platform.GetName()); - } + log->Printf ("SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(sb_platform.GetSP().get()), + sb_platform.GetName()); return sb_platform; } @@ -899,17 +902,18 @@ void SBDebugger::SetSelectedPlatform(SBPlatform &sb_platform) { Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + DebuggerSP debugger_sp(m_opaque_sp); if (debugger_sp) { debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.GetSP()); } + if (log) - { - log->Printf ("SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)", m_opaque_sp.get(), - sb_platform.GetSP().get(), sb_platform.GetName()); - } + log->Printf ("SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(sb_platform.GetSP().get()), + sb_platform.GetName()); } void @@ -1077,9 +1081,10 @@ const char * SBDebugger::GetPrompt() const { Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + if (log) - log->Printf ("SBDebugger(%p)::GetPrompt () => \"%s\"", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::GetPrompt () => \"%s\"", + static_cast<void*>(m_opaque_sp.get()), (m_opaque_sp ? m_opaque_sp->GetPrompt() : "")); if (m_opaque_sp) diff --git a/lldb/source/API/SBDeclaration.cpp b/lldb/source/API/SBDeclaration.cpp index fc90156e75a..8aea675afeb 100644 --- a/lldb/source/API/SBDeclaration.cpp +++ b/lldb/source/API/SBDeclaration.cpp @@ -74,19 +74,21 @@ SBFileSpec SBDeclaration::GetFileSpec () const { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + SBFileSpec sb_file_spec; if (m_opaque_ap.get() && m_opaque_ap->GetFile()) sb_file_spec.SetFileSpec(m_opaque_ap->GetFile()); - + if (log) { SBStream sstr; sb_file_spec.GetDescription (sstr); - log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s", m_opaque_ap.get(), - sb_file_spec.get(), sstr.GetData()); + log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s", + static_cast<void*>(m_opaque_ap.get()), + static_cast<const void*>(sb_file_spec.get()), + sstr.GetData()); } - + return sb_file_spec; } @@ -94,14 +96,15 @@ uint32_t SBDeclaration::GetLine () const { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + uint32_t line = 0; if (m_opaque_ap.get()) line = m_opaque_ap->GetLine(); - + if (log) - log->Printf ("SBLineEntry(%p)::GetLine () => %u", m_opaque_ap.get(), line); - + log->Printf ("SBLineEntry(%p)::GetLine () => %u", + static_cast<void*>(m_opaque_ap.get()), line); + return line; } diff --git a/lldb/source/API/SBError.cpp b/lldb/source/API/SBError.cpp index bd6b54300f6..157997b2502 100644 --- a/lldb/source/API/SBError.cpp +++ b/lldb/source/API/SBError.cpp @@ -77,7 +77,8 @@ SBError::Fail () const ret_value = m_opaque_ap->Fail(); if (log) - log->Printf ("SBError(%p)::Fail () => %i", m_opaque_ap.get(), ret_value); + log->Printf ("SBError(%p)::Fail () => %i", + static_cast<void*>(m_opaque_ap.get()), ret_value); return ret_value; } @@ -91,7 +92,8 @@ SBError::Success () const ret_value = m_opaque_ap->Success(); if (log) - log->Printf ("SBError(%p)::Success () => %i", m_opaque_ap.get(), ret_value); + log->Printf ("SBError(%p)::Success () => %i", + static_cast<void*>(m_opaque_ap.get()), ret_value); return ret_value; } @@ -106,7 +108,8 @@ SBError::GetError () const err = m_opaque_ap->GetError(); if (log) - log->Printf ("SBError(%p)::GetError () => 0x%8.8x", m_opaque_ap.get(), err); + log->Printf ("SBError(%p)::GetError () => 0x%8.8x", + static_cast<void*>(m_opaque_ap.get()), err); return err; @@ -121,7 +124,8 @@ SBError::GetType () const err_type = m_opaque_ap->GetType(); if (log) - log->Printf ("SBError(%p)::GetType () => %i", m_opaque_ap.get(), err_type); + log->Printf ("SBError(%p)::GetType () => %i", + static_cast<void*>(m_opaque_ap.get()), err_type); return err_type; } diff --git a/lldb/source/API/SBEvent.cpp b/lldb/source/API/SBEvent.cpp index d5d4a84bc1f..57a699fd739 100644 --- a/lldb/source/API/SBEvent.cpp +++ b/lldb/source/API/SBEvent.cpp @@ -92,9 +92,11 @@ SBEvent::GetType () const { StreamString sstr; if (lldb_event && lldb_event->GetBroadcaster() && lldb_event->GetBroadcaster()->GetEventNames(sstr, event_type, true)) - log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x (%s)", get(), event_type, sstr.GetData()); + log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x (%s)", + static_cast<void*>(get()), event_type, sstr.GetData()); else - log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x", get(), event_type); + log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x", + static_cast<void*>(get()), event_type); } @@ -141,11 +143,10 @@ SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster) // For logging, this gets a little chatty so only enable this when verbose logging is on Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE)); if (log) - log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i", - get(), - broadcaster.get(), - broadcaster.GetName(), - success); + log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i", + static_cast<void*>(get()), + static_cast<void*>(broadcaster.get()), + broadcaster.GetName(), success); return success; } @@ -206,8 +207,8 @@ SBEvent::GetCStringFromEvent (const SBEvent &event) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBEvent(%p)::GetCStringFromEvent () => \"%s\"", - event.get(), + log->Printf ("SBEvent(%p)::GetCStringFromEvent () => \"%s\"", + static_cast<void*>(event.get()), reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get()))); return reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get())); diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp index 4fd2866c9b0..e5a3f6deb47 100644 --- a/lldb/source/API/SBFileSpec.cpp +++ b/lldb/source/API/SBFileSpec.cpp @@ -72,7 +72,9 @@ SBFileSpec::Exists () const bool result = m_opaque_ap->Exists(); if (log) - log->Printf ("SBFileSpec(%p)::Exists () => %s", m_opaque_ap.get(), (result ? "true" : "false")); + log->Printf ("SBFileSpec(%p)::Exists () => %s", + static_cast<void*>(m_opaque_ap.get()), + (result ? "true" : "false")); return result; } @@ -98,9 +100,11 @@ SBFileSpec::GetFilename() const if (log) { if (s) - log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"", m_opaque_ap.get(), s); + log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"", + static_cast<void*>(m_opaque_ap.get()), s); else - log->Printf ("SBFileSpec(%p)::GetFilename () => NULL", m_opaque_ap.get()); + log->Printf ("SBFileSpec(%p)::GetFilename () => NULL", + static_cast<void*>(m_opaque_ap.get())); } return s; @@ -114,9 +118,11 @@ SBFileSpec::GetDirectory() const if (log) { if (s) - log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"", m_opaque_ap.get(), s); + log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"", + static_cast<void*>(m_opaque_ap.get()), s); else - log->Printf ("SBFileSpec(%p)::GetDirectory () => NULL", m_opaque_ap.get()); + log->Printf ("SBFileSpec(%p)::GetDirectory () => NULL", + static_cast<void*>(m_opaque_ap.get())); } return s; } @@ -148,7 +154,8 @@ SBFileSpec::GetPath (char *dst_path, size_t dst_len) const if (log) log->Printf ("SBFileSpec(%p)::GetPath (dst_path=\"%.*s\", dst_len=%" PRIu64 ") => %u", - m_opaque_ap.get(), result, dst_path, (uint64_t)dst_len, result); + static_cast<void*>(m_opaque_ap.get()), result, dst_path, + static_cast<uint64_t>(dst_len), result); if (result == 0 && dst_path && dst_len > 0) *dst_path = '\0'; diff --git a/lldb/source/API/SBFileSpecList.cpp b/lldb/source/API/SBFileSpecList.cpp index 3ebf3cc80a2..a457a754f0d 100644 --- a/lldb/source/API/SBFileSpecList.cpp +++ b/lldb/source/API/SBFileSpecList.cpp @@ -38,7 +38,8 @@ SBFileSpecList::SBFileSpecList (const SBFileSpecList &rhs) : if (log) { log->Printf ("SBFileSpecList::SBFileSpecList (const SBFileSpecList rhs.ap=%p) => SBFileSpecList(%p)", - rhs.m_opaque_ap.get(), m_opaque_ap.get()); + static_cast<void*>(rhs.m_opaque_ap.get()), + static_cast<void*>(m_opaque_ap.get())); } } diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index 44fc654c44b..8448bd2f975 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -63,9 +63,9 @@ SBFrame::SBFrame (const StackFrameSP &lldb_object_sp) : { SBStream sstr; GetDescription (sstr); - log->Printf ("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s", - lldb_object_sp.get(), lldb_object_sp.get(), sstr.GetData()); - + log->Printf ("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s", + static_cast<void*>(lldb_object_sp.get()), + static_cast<void*>(lldb_object_sp.get()), sstr.GetData()); } } @@ -141,8 +141,9 @@ SBFrame::GetSymbolContext (uint32_t resolve_scope) const } if (log) - log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)", - frame, resolve_scope, sb_sym_ctx.get()); + log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)", + static_cast<void*>(frame), resolve_scope, + static_cast<void*>(sb_sym_ctx.get())); return sb_sym_ctx; } @@ -184,8 +185,9 @@ SBFrame::GetModule () const } if (log) - log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)", - frame, module_sp.get()); + log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)", + static_cast<void*>(frame), + static_cast<void*>(module_sp.get())); return sb_module; } @@ -224,8 +226,9 @@ SBFrame::GetCompileUnit () const } } if (log) - log->Printf ("SBFrame(%p)::GetCompileUnit () => SBCompileUnit(%p)", - frame, sb_comp_unit.get()); + log->Printf ("SBFrame(%p)::GetCompileUnit () => SBCompileUnit(%p)", + static_cast<void*>(frame), + static_cast<void*>(sb_comp_unit.get())); return sb_comp_unit; } @@ -264,8 +267,9 @@ SBFrame::GetFunction () const } } if (log) - log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)", - frame, sb_function.get()); + log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)", + static_cast<void*>(frame), + static_cast<void*>(sb_function.get())); return sb_function; } @@ -304,8 +308,9 @@ SBFrame::GetSymbol () const } } if (log) - log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)", - frame, sb_symbol.get()); + log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)", + static_cast<void*>(frame), + static_cast<void*>(sb_symbol.get())); return sb_symbol; } @@ -339,12 +344,14 @@ SBFrame::GetBlock () const else { if (log) - log->Printf ("SBFrame(%p)::GetBlock () => error: process is running", frame); + log->Printf ("SBFrame(%p)::GetBlock () => error: process is running", + static_cast<void*>(frame)); } } if (log) - log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)", - frame, sb_block.GetPtr()); + log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)", + static_cast<void*>(frame), + static_cast<void*>(sb_block.GetPtr())); return sb_block; } @@ -382,8 +389,9 @@ SBFrame::GetFrameBlock () const } } if (log) - log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)", - frame, sb_block.GetPtr()); + log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)", + static_cast<void*>(frame), + static_cast<void*>(sb_block.GetPtr())); return sb_block; } @@ -421,8 +429,9 @@ SBFrame::GetLineEntry () const } } if (log) - log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)", - frame, sb_line_entry.get()); + log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)", + static_cast<void*>(frame), + static_cast<void*>(sb_line_entry.get())); return sb_line_entry; } @@ -430,16 +439,16 @@ uint32_t SBFrame::GetFrameID () const { uint32_t frame_idx = UINT32_MAX; - + ExecutionContext exe_ctx(m_opaque_sp.get()); StackFrame *frame = exe_ctx.GetFramePtr(); if (frame) frame_idx = frame->GetFrameIndex (); - + Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBFrame(%p)::GetFrameID () => %u", - frame, frame_idx); + log->Printf ("SBFrame(%p)::GetFrameID () => %u", + static_cast<void*>(frame), frame_idx); return frame_idx; } @@ -478,7 +487,8 @@ SBFrame::GetPC () const } if (log) - log->Printf ("SBFrame(%p)::GetPC () => 0x%" PRIx64, frame, addr); + log->Printf ("SBFrame(%p)::GetPC () => 0x%" PRIx64, + static_cast<void*>(frame), addr); return addr; } @@ -519,7 +529,7 @@ SBFrame::SetPC (addr_t new_pc) if (log) log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%" PRIx64 ") => %i", - frame, new_pc, ret_val); + static_cast<void*>(frame), new_pc, ret_val); return ret_val; } @@ -558,7 +568,8 @@ SBFrame::GetSP () const } } if (log) - log->Printf ("SBFrame(%p)::GetSP () => 0x%" PRIx64, frame, addr); + log->Printf ("SBFrame(%p)::GetSP () => 0x%" PRIx64, + static_cast<void*>(frame), addr); return addr; } @@ -599,7 +610,8 @@ SBFrame::GetFP () const } if (log) - log->Printf ("SBFrame(%p)::GetFP () => 0x%" PRIx64, frame, addr); + log->Printf ("SBFrame(%p)::GetFP () => 0x%" PRIx64, + static_cast<void*>(frame), addr); return addr; } @@ -638,7 +650,9 @@ SBFrame::GetPCAddress () const } } if (log) - log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", frame, sb_addr.get()); + log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", + static_cast<void*>(frame), + static_cast<void*>(sb_addr.get())); return sb_addr; } @@ -727,7 +741,6 @@ SBFrame::FindVariable (const char *name) } return value; } - SBValue SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic) @@ -742,7 +755,7 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic) log->Printf ("SBFrame::FindVariable called with empty name"); return sb_value; } - + ValueObjectSP value_sp; Mutex::Locker api_locker; ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); @@ -766,7 +779,7 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic) const bool can_create = true; const bool get_parent_variables = true; const bool stop_if_block_is_inlined_function = true; - + if (sc.block->AppendVariables (can_create, get_parent_variables, stop_if_block_is_inlined_function, @@ -794,10 +807,11 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic) log->Printf ("SBFrame::FindVariable () => error: process is running"); } } - + if (log) - log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)", - frame, name, value_sp.get()); + log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)", + static_cast<void*>(frame), name, + static_cast<void*>(value_sp.get())); return sb_value; } @@ -822,14 +836,14 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy { Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBValue sb_value; - + if (name == NULL || name[0] == '\0') { if (log) log->Printf ("SBFrame::FindValue called with empty name."); return sb_value; } - + ValueObjectSP value_sp; Mutex::Locker api_locker; ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); @@ -846,7 +860,7 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy if (frame) { VariableList variable_list; - + switch (value_type) { case eValueTypeVariableGlobal: // global variable @@ -854,7 +868,6 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy case eValueTypeVariableArgument: // function argument variables case eValueTypeVariableLocal: // function local variables { - SymbolContext sc (frame->GetSymbolContext (eSymbolContextBlock)); const bool can_create = true; @@ -957,12 +970,12 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy log->Printf ("SBFrame::FindValue () => error: process is running"); } } - + if (log) - log->Printf ("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) => SBValue(%p)", - frame, name, value_type, value_sp.get()); + log->Printf ("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) => SBValue(%p)", + static_cast<void*>(frame), name, value_type, + static_cast<void*>(value_sp.get())); - return sb_value; } @@ -999,10 +1012,9 @@ SBFrame::GetThread () const { SBStream sstr; sb_thread.GetDescription (sstr); - log->Printf ("SBFrame(%p)::GetThread () => SBThread(%p): %s", - exe_ctx.GetFramePtr(), - thread_sp.get(), - sstr.GetData()); + log->Printf ("SBFrame(%p)::GetThread () => SBThread(%p): %s", + static_cast<void*>(exe_ctx.GetFramePtr()), + static_cast<void*>(thread_sp.get()), sstr.GetData()); } return sb_thread; @@ -1039,11 +1051,12 @@ SBFrame::Disassemble () const { if (log) log->Printf ("SBFrame::Disassemble () => error: process is running"); - } + } } if (log) - log->Printf ("SBFrame(%p)::Disassemble () => %s", frame, disassembly); + log->Printf ("SBFrame(%p)::Disassemble () => %s", + static_cast<void*>(frame), disassembly); return disassembly; } @@ -1084,12 +1097,9 @@ SBFrame::GetVariables (bool arguments, Target *target = exe_ctx.GetTargetPtr(); if (log) - log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)", - arguments, - locals, - statics, - in_scope_only); - + log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)", + arguments, locals, statics, in_scope_only); + Process *process = exe_ctx.GetProcessPtr(); if (target && process) { @@ -1156,13 +1166,13 @@ SBFrame::GetVariables (bool arguments, { if (log) log->Printf ("SBFrame::GetVariables () => error: process is running"); - } + } } if (log) - { - log->Printf ("SBFrame(%p)::GetVariables (...) => SBValueList(%p)", frame, value_list.opaque_ptr()); - } + log->Printf ("SBFrame(%p)::GetVariables (...) => SBValueList(%p)", + static_cast<void*>(frame), + static_cast<void*>(value_list.opaque_ptr())); return value_list; } @@ -1207,11 +1217,13 @@ SBFrame::GetRegisters () { if (log) log->Printf ("SBFrame::GetRegisters () => error: process is running"); - } + } } if (log) - log->Printf ("SBFrame(%p)::GetRegisters () => SBValueList(%p)", frame, value_list.opaque_ptr()); + log->Printf ("SBFrame(%p)::GetRegisters () => SBValueList(%p)", + static_cast<void*>(frame), + static_cast<void*>(value_list.opaque_ptr())); return value_list; } @@ -1265,11 +1277,13 @@ SBFrame::FindRegister (const char *name) { if (log) log->Printf ("SBFrame::FindRegister () => error: process is running"); - } + } } if (log) - log->Printf ("SBFrame(%p)::FindRegister () => SBValue(%p)", frame, value_sp.get()); + log->Printf ("SBFrame(%p)::FindRegister () => SBValue(%p)", + static_cast<void*>(frame), + static_cast<void*>(value_sp.get())); return result; } @@ -1355,19 +1369,19 @@ lldb::SBValue SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &options) { Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + Log *expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); ExecutionResults exe_results = eExecutionSetupError; SBValue expr_result; - + if (expr == NULL || expr[0] == '\0') { if (log) log->Printf ("SBFrame::EvaluateExpression called with an empty expression"); return expr_result; } - + ValueObjectSP expr_value_sp; Mutex::Locker api_locker; @@ -1379,7 +1393,7 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option StackFrame *frame = NULL; Target *target = exe_ctx.GetTargetPtr(); Process *process = exe_ctx.GetProcessPtr(); - + if (target && process) { Process::StopLocker stop_locker; @@ -1395,7 +1409,7 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option Host::SetCrashDescriptionWithFormat ("SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = %u) %s", expr, options.GetFetchDynamicValue(), frame_description.GetString().c_str()); } - + exe_results = target->EvaluateExpression (expr, frame, expr_value_sp, @@ -1415,21 +1429,18 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option { if (log) log->Printf ("SBFrame::EvaluateExpression () => error: process is running"); - } + } } #ifndef LLDB_DISABLE_PYTHON if (expr_log) - expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is %s, summary %s **", - expr_result.GetValue(), - expr_result.GetSummary()); - + expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is %s, summary %s **", + expr_result.GetValue(), expr_result.GetSummary()); + if (log) - log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)", - frame, - expr, - expr_value_sp.get(), - exe_results); + log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)", + static_cast<void*>(frame), expr, + static_cast<void*>(expr_value_sp.get()), exe_results); #endif return expr_result; diff --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp index bb7ea2e9f20..3d185da17f2 100644 --- a/lldb/source/API/SBFunction.cpp +++ b/lldb/source/API/SBFunction.cpp @@ -66,9 +66,11 @@ SBFunction::GetName() const if (log) { if (cstr) - log->Printf ("SBFunction(%p)::GetName () => \"%s\"", m_opaque_ptr, cstr); + log->Printf ("SBFunction(%p)::GetName () => \"%s\"", + static_cast<void*>(m_opaque_ptr), cstr); else - log->Printf ("SBFunction(%p)::GetName () => NULL", m_opaque_ptr); + log->Printf ("SBFunction(%p)::GetName () => NULL", + static_cast<void*>(m_opaque_ptr)); } return cstr; } @@ -83,9 +85,11 @@ SBFunction::GetMangledName () const if (log) { if (cstr) - log->Printf ("SBFunction(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, cstr); + log->Printf ("SBFunction(%p)::GetMangledName () => \"%s\"", + static_cast<void*>(m_opaque_ptr), cstr); else - log->Printf ("SBFunction(%p)::GetMangledName () => NULL", m_opaque_ptr); + log->Printf ("SBFunction(%p)::GetMangledName () => NULL", + static_cast<void*>(m_opaque_ptr)); } return cstr; } diff --git a/lldb/source/API/SBHostOS.cpp b/lldb/source/API/SBHostOS.cpp index 5f9ba625db1..06fe5fb68fb 100644 --- a/lldb/source/API/SBHostOS.cpp +++ b/lldb/source/API/SBHostOS.cpp @@ -50,8 +50,10 @@ SBHostOS::ThreadCreate Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", name, - thread_function, thread_arg, error_ptr); + log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", + name, reinterpret_cast<void*>(thread_function), + static_cast<void*>(thread_arg), + static_cast<void*>(error_ptr)); // FIXME: You should log the return value? diff --git a/lldb/source/API/SBLineEntry.cpp b/lldb/source/API/SBLineEntry.cpp index 0864a2e006c..833eea3e35c 100644 --- a/lldb/source/API/SBLineEntry.cpp +++ b/lldb/source/API/SBLineEntry.cpp @@ -66,7 +66,6 @@ SBLineEntry::~SBLineEntry () SBAddress SBLineEntry::GetStartAddress () const { - SBAddress sb_address; if (m_opaque_ap.get()) sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress()); @@ -78,8 +77,9 @@ SBLineEntry::GetStartAddress () const const Address *addr = sb_address.get(); if (addr) addr->Dump (&sstr, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4); - log->Printf ("SBLineEntry(%p)::GetStartAddress () => SBAddress (%p): %s", - m_opaque_ap.get(), sb_address.get(), sstr.GetData()); + log->Printf ("SBLineEntry(%p)::GetStartAddress () => SBAddress (%p): %s", + static_cast<void*>(m_opaque_ap.get()), + static_cast<void*>(sb_address.get()), sstr.GetData()); } return sb_address; @@ -101,8 +101,9 @@ SBLineEntry::GetEndAddress () const const Address *addr = sb_address.get(); if (addr) addr->Dump (&sstr, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4); - log->Printf ("SBLineEntry(%p)::GetEndAddress () => SBAddress (%p): %s", - m_opaque_ap.get(), sb_address.get(), sstr.GetData()); + log->Printf ("SBLineEntry(%p)::GetEndAddress () => SBAddress (%p): %s", + static_cast<void*>(m_opaque_ap.get()), + static_cast<void*>(sb_address.get()), sstr.GetData()); } return sb_address; } @@ -127,8 +128,10 @@ SBLineEntry::GetFileSpec () const { SBStream sstr; sb_file_spec.GetDescription (sstr); - log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s", m_opaque_ap.get(), - sb_file_spec.get(), sstr.GetData()); + log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s", + static_cast<void*>(m_opaque_ap.get()), + static_cast<const void*>(sb_file_spec.get()), + sstr.GetData()); } return sb_file_spec; @@ -144,7 +147,8 @@ SBLineEntry::GetLine () const line = m_opaque_ap->line; if (log) - log->Printf ("SBLineEntry(%p)::GetLine () => %u", m_opaque_ap.get(), line); + log->Printf ("SBLineEntry(%p)::GetLine () => %u", + static_cast<void*>(m_opaque_ap.get()), line); return line; } diff --git a/lldb/source/API/SBListener.cpp b/lldb/source/API/SBListener.cpp index 2e67b4c24e8..bad9ba82bc9 100644 --- a/lldb/source/API/SBListener.cpp +++ b/lldb/source/API/SBListener.cpp @@ -42,7 +42,7 @@ SBListener::SBListener (const char *name) : if (log) log->Printf ("SBListener::SBListener (name=\"%s\") => SBListener(%p)", - name, m_opaque_ptr); + name, static_cast<void*>(m_opaque_ptr)); } @@ -110,7 +110,7 @@ SBListener::StartListeningForEventClass (SBDebugger &debugger, else return 0; } - + bool SBListener::StopListeningForEventClass (SBDebugger &debugger, const char *broadcaster_class, @@ -127,7 +127,7 @@ SBListener::StopListeningForEventClass (SBDebugger &debugger, else return false; } - + uint32_t SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask) { @@ -136,23 +136,23 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t { acquired_event_mask = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask); } - + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { StreamString sstr_requested; StreamString sstr_acquired; - + Broadcaster *lldb_broadcaster = broadcaster.get(); if (lldb_broadcaster) { const bool got_requested_names = lldb_broadcaster->GetEventNames (sstr_requested, event_mask, false); const bool got_acquired_names = lldb_broadcaster->GetEventNames (sstr_acquired, acquired_event_mask, false); log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p): %s, event_mask=0x%8.8x%s%s%s) => 0x%8.8x%s%s%s", - m_opaque_ptr, - lldb_broadcaster, - lldb_broadcaster->GetBroadcasterName().GetCString(), - event_mask, + static_cast<void*>(m_opaque_ptr), + static_cast<void*>(lldb_broadcaster), + lldb_broadcaster->GetBroadcasterName().GetCString(), + event_mask, got_requested_names ? " (" : "", sstr_requested.GetData(), got_requested_names ? ")" : "", @@ -163,12 +163,10 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t } else { - log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => 0x%8.8x", - m_opaque_ptr, - lldb_broadcaster, - event_mask, + log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => 0x%8.8x", + static_cast<void*>(m_opaque_ptr), + static_cast<void*>(lldb_broadcaster), event_mask, acquired_event_mask); - } } @@ -194,12 +192,14 @@ SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event) if (timeout_secs == UINT32_MAX) { log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=INFINITE, SBEvent(%p))...", - m_opaque_ptr, event.get()); + static_cast<void*>(m_opaque_ptr), + static_cast<void*>(event.get())); } else { log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=%d, SBEvent(%p))...", - m_opaque_ptr, timeout_secs, event.get()); + static_cast<void*>(m_opaque_ptr), timeout_secs, + static_cast<void*>(event.get())); } } bool success = false; @@ -226,12 +226,14 @@ SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event) if (timeout_secs == UINT32_MAX) { log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=INFINITE, SBEvent(%p)) => %i", - m_opaque_ptr, event.get(), success); + static_cast<void*>(m_opaque_ptr), + static_cast<void*>(event.get()), success); } else { log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=%d, SBEvent(%p)) => %i", - m_opaque_ptr, timeout_secs, event.get(), success); + static_cast<void*>(m_opaque_ptr), timeout_secs, + static_cast<void*>(event.get()), success); } } if (!success) diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index c8543d4de29..b1e39ff9e75 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -110,10 +110,9 @@ SBModule::GetFileSpec () const file_spec.SetFileSpec(module_sp->GetFileSpec()); if (log) - { - log->Printf ("SBModule(%p)::GetFileSpec () => SBFileSpec(%p)", - module_sp.get(), file_spec.get()); - } + log->Printf ("SBModule(%p)::GetFileSpec () => SBFileSpec(%p)", + static_cast<void*>(module_sp.get()), + static_cast<const void*>(file_spec.get())); return file_spec; } @@ -122,20 +121,18 @@ lldb::SBFileSpec SBModule::GetPlatformFileSpec () const { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + SBFileSpec file_spec; ModuleSP module_sp (GetSP ()); if (module_sp) file_spec.SetFileSpec(module_sp->GetPlatformFileSpec()); - + if (log) - { - log->Printf ("SBModule(%p)::GetPlatformFileSpec () => SBFileSpec(%p)", - module_sp.get(), file_spec.get()); - } - + log->Printf ("SBModule(%p)::GetPlatformFileSpec () => SBFileSpec(%p)", + static_cast<void*>(module_sp.get()), + static_cast<const void*>(file_spec.get())); + return file_spec; - } bool @@ -143,22 +140,19 @@ SBModule::SetPlatformFileSpec (const lldb::SBFileSpec &platform_file) { bool result = false; Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + ModuleSP module_sp (GetSP ()); if (module_sp) { module_sp->SetPlatformFileSpec(*platform_file); result = true; } - + if (log) - { - log->Printf ("SBModule(%p)::SetPlatformFileSpec (SBFileSpec(%p (%s)) => %i", - module_sp.get(), - platform_file.get(), - platform_file->GetPath().c_str(), - result); - } + log->Printf ("SBModule(%p)::SetPlatformFileSpec (SBFileSpec(%p (%s)) => %i", + static_cast<void*>(module_sp.get()), + static_cast<const void*>(platform_file.get()), + platform_file->GetPath().c_str(), result); return result; } @@ -201,10 +195,12 @@ SBModule::GetUUIDBytes () const { StreamString s; module_sp->GetUUID().Dump (&s); - log->Printf ("SBModule(%p)::GetUUIDBytes () => %s", module_sp.get(), s.GetData()); + log->Printf ("SBModule(%p)::GetUUIDBytes () => %s", + static_cast<void*>(module_sp.get()), s.GetData()); } else - log->Printf ("SBModule(%p)::GetUUIDBytes () => NULL", module_sp.get()); + log->Printf ("SBModule(%p)::GetUUIDBytes () => NULL", + static_cast<void*>(module_sp.get())); } return uuid_bytes; } @@ -234,10 +230,12 @@ SBModule::GetUUIDString () const { StreamString s; module_sp->GetUUID().Dump (&s); - log->Printf ("SBModule(%p)::GetUUIDString () => %s", module_sp.get(), s.GetData()); + log->Printf ("SBModule(%p)::GetUUIDString () => %s", + static_cast<void*>(module_sp.get()), s.GetData()); } else - log->Printf ("SBModule(%p)::GetUUIDString () => NULL", module_sp.get()); + log->Printf ("SBModule(%p)::GetUUIDString () => NULL", + static_cast<void*>(module_sp.get())); } return uuid_c_string; } diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index 52de0cd4fe3..bb5b989df6c 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -148,20 +148,17 @@ SBProcess::RemoteLaunch (char const **argv, lldb::SBError& error) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - if (log) { + if (log) log->Printf ("SBProcess(%p)::RemoteLaunch (argv=%p, envp=%p, stdin=%s, stdout=%s, stderr=%s, working-dir=%s, launch_flags=0x%x, stop_at_entry=%i, &error (%p))...", - m_opaque_wp.lock().get(), - argv, - envp, - stdin_path ? stdin_path : "NULL", - stdout_path ? stdout_path : "NULL", - stderr_path ? stderr_path : "NULL", + static_cast<void*>(m_opaque_wp.lock().get()), + static_cast<void*>(argv), static_cast<void*>(envp), + stdin_path ? stdin_path : "NULL", + stdout_path ? stdout_path : "NULL", + stderr_path ? stderr_path : "NULL", working_directory ? working_directory : "NULL", - launch_flags, - stop_at_entry, - error.get()); - } - + launch_flags, stop_at_entry, + static_cast<void*>(error.get())); + ProcessSP process_sp(GetSP()); if (process_sp) { @@ -170,7 +167,7 @@ SBProcess::RemoteLaunch (char const **argv, { if (stop_at_entry) launch_flags |= eLaunchFlagStopAtEntry; - ProcessLaunchInfo launch_info (stdin_path, + ProcessLaunchInfo launch_info (stdin_path, stdout_path, stderr_path, working_directory, @@ -193,13 +190,15 @@ SBProcess::RemoteLaunch (char const **argv, { error.SetErrorString ("unable to attach pid"); } - + if (log) { SBStream sstr; error.GetDescription (sstr); - log->Printf ("SBProcess(%p)::RemoteLaunch (...) => SBError (%p): %s", process_sp.get(), error.get(), sstr.GetData()); + log->Printf ("SBProcess(%p)::RemoteLaunch (...) => SBError (%p): %s", + static_cast<void*>(process_sp.get()), + static_cast<void*>(error.get()), sstr.GetData()); } - + return error.Success(); } @@ -214,7 +213,7 @@ SBProcess::RemoteAttachToProcessWithID (lldb::pid_t pid, lldb::SBError& error) { ProcessAttachInfo attach_info; attach_info.SetProcessID (pid); - error.SetError (process_sp->Attach (attach_info)); + error.SetError (process_sp->Attach (attach_info)); } else { @@ -230,7 +229,9 @@ SBProcess::RemoteAttachToProcessWithID (lldb::pid_t pid, lldb::SBError& error) if (log) { SBStream sstr; error.GetDescription (sstr); - log->Printf ("SBProcess(%p)::RemoteAttachToProcessWithID (%" PRIu64 ") => SBError (%p): %s", process_sp.get(), pid, error.get(), sstr.GetData()); + log->Printf ("SBProcess(%p)::RemoteAttachToProcessWithID (%" PRIu64 ") => SBError (%p): %s", + static_cast<void*>(process_sp.get()), pid, + static_cast<void*>(error.get()), sstr.GetData()); } return error.Success(); @@ -247,14 +248,15 @@ SBProcess::GetNumThreads () if (process_sp) { Process::StopLocker stop_locker; - + const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock()); Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex()); num_threads = process_sp->GetThreadList().GetSize(can_update); } if (log) - log->Printf ("SBProcess(%p)::GetNumThreads () => %d", process_sp.get(), num_threads); + log->Printf ("SBProcess(%p)::GetNumThreads () => %d", + static_cast<void*>(process_sp.get()), num_threads); return num_threads; } @@ -275,9 +277,9 @@ SBProcess::GetSelectedThread () const } if (log) - { - log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", process_sp.get(), thread_sp.get()); - } + log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", + static_cast<void*>(process_sp.get()), + static_cast<void*>(thread_sp.get())); return sb_thread; } @@ -286,7 +288,7 @@ SBThread SBProcess::CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + SBThread sb_thread; ThreadSP thread_sp; ProcessSP process_sp(GetSP()); @@ -296,10 +298,12 @@ SBProcess::CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context) thread_sp = process_sp->CreateOSPluginThread(tid, context); sb_thread.SetThread (thread_sp); } - + if (log) - log->Printf ("SBProcess(%p)::CreateOSPluginThread (tid=0x%" PRIx64 ", context=0x%" PRIx64 ") => SBThread(%p)", process_sp.get(), tid, context, thread_sp.get()); - + log->Printf ("SBProcess(%p)::CreateOSPluginThread (tid=0x%" PRIx64 ", context=0x%" PRIx64 ") => SBThread(%p)", + static_cast<void*>(process_sp.get()), tid, context, + static_cast<void*>(thread_sp.get())); + return sb_thread; } @@ -316,9 +320,11 @@ SBProcess::GetTarget() const target_sp = process_sp->GetTarget().shared_from_this(); sb_target.SetSP (target_sp); } - + if (log) - log->Printf ("SBProcess(%p)::GetTarget () => SBTarget(%p)", process_sp.get(), target_sp.get()); + log->Printf ("SBProcess(%p)::GetTarget () => SBTarget(%p)", + static_cast<void*>(process_sp.get()), + static_cast<void*>(target_sp.get())); return sb_target; } @@ -336,13 +342,12 @@ SBProcess::PutSTDIN (const char *src, size_t src_len) Error error; ret_val = process_sp->PutSTDIN (src, src_len, error); } - + if (log) log->Printf("SBProcess(%p)::PutSTDIN (src=\"%s\", src_len=%" PRIu64 ") => %" PRIu64, - process_sp.get(), - src, - (uint64_t) src_len, - (uint64_t) ret_val); + static_cast<void*>(process_sp.get()), src, + static_cast<uint64_t>(src_len), + static_cast<uint64_t>(ret_val)); return ret_val; } @@ -357,15 +362,14 @@ SBProcess::GetSTDOUT (char *dst, size_t dst_len) const Error error; bytes_read = process_sp->GetSTDOUT (dst, dst_len, error); } - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBProcess(%p)::GetSTDOUT (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64, - process_sp.get(), - (int) bytes_read, - dst, - (uint64_t)dst_len, - (uint64_t)bytes_read); + static_cast<void*>(process_sp.get()), + static_cast<int>(bytes_read), dst, + static_cast<uint64_t>(dst_len), + static_cast<uint64_t>(bytes_read)); return bytes_read; } @@ -384,11 +388,10 @@ SBProcess::GetSTDERR (char *dst, size_t dst_len) const Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBProcess(%p)::GetSTDERR (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64, - process_sp.get(), - (int) bytes_read, - dst, - (uint64_t)dst_len, - (uint64_t)bytes_read); + static_cast<void*>(process_sp.get()), + static_cast<int>(bytes_read), dst, + static_cast<uint64_t>(dst_len), + static_cast<uint64_t>(bytes_read)); return bytes_read; } @@ -403,16 +406,15 @@ SBProcess::GetAsyncProfileData(char *dst, size_t dst_len) const Error error; bytes_read = process_sp->GetAsyncProfileData (dst, dst_len, error); } - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBProcess(%p)::GetProfileData (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64, - process_sp.get(), - (int) bytes_read, - dst, - (uint64_t)dst_len, - (uint64_t)bytes_read); - + static_cast<void*>(process_sp.get()), + static_cast<int>(bytes_read), dst, + static_cast<uint64_t>(dst_len), + static_cast<uint64_t>(bytes_read)); + return bytes_read; } @@ -483,7 +485,8 @@ SBProcess::SetSelectedThreadByID (lldb::tid_t tid) if (log) log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%4.4" PRIx64 ") => %s", - process_sp.get(), tid, (ret_val ? "true" : "false")); + static_cast<void*>(process_sp.get()), tid, + (ret_val ? "true" : "false")); return ret_val; } @@ -502,8 +505,9 @@ SBProcess::SetSelectedThreadByIndexID (uint32_t index_id) } if (log) - log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%x) => %s", - process_sp.get(), index_id, (ret_val ? "true" : "false")); + log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%x) => %s", + static_cast<void*>(process_sp.get()), index_id, + (ret_val ? "true" : "false")); return ret_val; } @@ -526,10 +530,10 @@ SBProcess::GetThreadAtIndex (size_t index) } if (log) - { log->Printf ("SBProcess(%p)::GetThreadAtIndex (index=%d) => SBThread(%p)", - process_sp.get(), (uint32_t) index, thread_sp.get()); - } + static_cast<void*>(process_sp.get()), + static_cast<uint32_t>(index), + static_cast<void*>(thread_sp.get())); return sb_thread; } @@ -544,13 +548,14 @@ SBProcess::GetNumQueues () if (process_sp) { Process::StopLocker stop_locker; - + Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex()); num_queues = process_sp->GetQueueList().GetSize(); } if (log) - log->Printf ("SBProcess(%p)::GetNumQueues () => %d", process_sp.get(), num_queues); + log->Printf ("SBProcess(%p)::GetNumQueues () => %d", + static_cast<void*>(process_sp.get()), num_queues); return num_queues; } @@ -572,10 +577,10 @@ SBProcess::GetQueueAtIndex (size_t index) } if (log) - { log->Printf ("SBProcess(%p)::GetQueueAtIndex (index=%d) => SBQueue(%p)", - process_sp.get(), (uint32_t) index, queue_sp.get()); - } + static_cast<void*>(process_sp.get()), + static_cast<uint32_t>(index), + static_cast<void*>(queue_sp.get())); return sb_queue; } @@ -610,8 +615,8 @@ SBProcess::GetState () Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::GetState () => %s", - process_sp.get(), + log->Printf ("SBProcess(%p)::GetState () => %s", + static_cast<void*>(process_sp.get()), lldb_private::StateAsCString (ret_val)); return ret_val; @@ -630,8 +635,9 @@ SBProcess::GetExitStatus () } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::GetExitStatus () => %i (0x%8.8x)", - process_sp.get(), exit_status, exit_status); + log->Printf ("SBProcess(%p)::GetExitStatus () => %i (0x%8.8x)", + static_cast<void*>(process_sp.get()), exit_status, + exit_status); return exit_status; } @@ -648,8 +654,8 @@ SBProcess::GetExitDescription () } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::GetExitDescription () => %s", - process_sp.get(), exit_desc); + log->Printf ("SBProcess(%p)::GetExitDescription () => %s", + static_cast<void*>(process_sp.get()), exit_desc); return exit_desc; } @@ -663,7 +669,8 @@ SBProcess::GetProcessID () Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::GetProcessID () => %" PRIu64, process_sp.get(), ret_val); + log->Printf ("SBProcess(%p)::GetProcessID () => %" PRIu64, + static_cast<void*>(process_sp.get()), ret_val); return ret_val; } @@ -677,7 +684,8 @@ SBProcess::GetUniqueID() ret_val = process_sp->GetUniqueID(); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::GetUniqueID () => %" PRIu32, process_sp.get(), ret_val); + log->Printf ("SBProcess(%p)::GetUniqueID () => %" PRIu32, + static_cast<void*>(process_sp.get()), ret_val); return ret_val; } @@ -688,10 +696,11 @@ SBProcess::GetByteOrder () const ProcessSP process_sp(GetSP()); if (process_sp) byteOrder = process_sp->GetTarget().GetArchitecture().GetByteOrder(); - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::GetByteOrder () => %d", process_sp.get(), byteOrder); + log->Printf ("SBProcess(%p)::GetByteOrder () => %d", + static_cast<void*>(process_sp.get()), byteOrder); return byteOrder; } @@ -706,7 +715,8 @@ SBProcess::GetAddressByteSize () const Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d", process_sp.get(), size); + log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d", + static_cast<void*>(process_sp.get()), size); return size; } @@ -715,24 +725,26 @@ SBError SBProcess::Continue () { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + SBError sb_error; ProcessSP process_sp(GetSP()); if (log) - log->Printf ("SBProcess(%p)::Continue ()...", process_sp.get()); + log->Printf ("SBProcess(%p)::Continue ()...", + static_cast<void*>(process_sp.get())); if (process_sp) { Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex()); - + Error error (process_sp->Resume()); if (error.Success()) { if (process_sp->GetTarget().GetDebugger().GetAsyncExecution () == false) { if (log) - log->Printf ("SBProcess(%p)::Continue () waiting for process to stop...", process_sp.get()); + log->Printf ("SBProcess(%p)::Continue () waiting for process to stop...", + static_cast<void*>(process_sp.get())); process_sp->WaitForProcessToStop (NULL); } } @@ -745,7 +757,9 @@ SBProcess::Continue () { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess(%p)::Continue () => SBError (%p): %s", process_sp.get(), sb_error.get(), sstr.GetData()); + log->Printf ("SBProcess(%p)::Continue () => SBError (%p): %s", + static_cast<void*>(process_sp.get()), + static_cast<void*>(sb_error.get()), sstr.GetData()); } return sb_error; @@ -770,10 +784,9 @@ SBProcess::Destroy () { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess(%p)::Destroy () => SBError (%p): %s", - process_sp.get(), - sb_error.get(), - sstr.GetData()); + log->Printf ("SBProcess(%p)::Destroy () => SBError (%p): %s", + static_cast<void*>(process_sp.get()), + static_cast<void*>(sb_error.get()), sstr.GetData()); } return sb_error; @@ -792,16 +805,15 @@ SBProcess::Stop () } else sb_error.SetErrorString ("SBProcess is invalid"); - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess(%p)::Stop () => SBError (%p): %s", - process_sp.get(), - sb_error.get(), - sstr.GetData()); + log->Printf ("SBProcess(%p)::Stop () => SBError (%p): %s", + static_cast<void*>(process_sp.get()), + static_cast<void*>(sb_error.get()), sstr.GetData()); } return sb_error; @@ -825,10 +837,9 @@ SBProcess::Kill () { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess(%p)::Kill () => SBError (%p): %s", - process_sp.get(), - sb_error.get(), - sstr.GetData()); + log->Printf ("SBProcess(%p)::Kill () => SBError (%p): %s", + static_cast<void*>(process_sp.get()), + static_cast<void*>(sb_error.get()), sstr.GetData()); } return sb_error; @@ -869,17 +880,15 @@ SBProcess::Signal (int signo) sb_error.SetError (process_sp->Signal (signo)); } else - sb_error.SetErrorString ("SBProcess is invalid"); + sb_error.SetErrorString ("SBProcess is invalid"); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess(%p)::Signal (signo=%i) => SBError (%p): %s", - process_sp.get(), - signo, - sb_error.get(), - sstr.GetData()); + log->Printf ("SBProcess(%p)::Signal (signo=%i) => SBError (%p): %s", + static_cast<void*>(process_sp.get()), signo, + static_cast<void*>(sb_error.get()), sstr.GetData()); } return sb_error; } @@ -911,12 +920,9 @@ SBProcess::GetThreadByID (tid_t tid) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - { log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4" PRIx64 ") => SBThread (%p)", - process_sp.get(), - tid, - thread_sp.get()); - } + static_cast<void*>(process_sp.get()), tid, + static_cast<void*>(thread_sp.get())); return sb_thread; } @@ -938,12 +944,9 @@ SBProcess::GetThreadByIndexID (uint32_t index_id) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - { - log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%x) => SBThread (%p)", - process_sp.get(), - index_id, - thread_sp.get()); - } + log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%x) => SBThread (%p)", + static_cast<void*>(process_sp.get()), index_id, + static_cast<void*>(thread_sp.get())); return sb_thread; } @@ -954,9 +957,10 @@ SBProcess::GetStateFromEvent (const SBEvent &event) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get()); - + if (log) - log->Printf ("SBProcess::GetStateFromEvent (event.sp=%p) => %s", event.get(), + log->Printf ("SBProcess::GetStateFromEvent (event.sp=%p) => %s", + static_cast<void*>(event.get()), lldb_private::StateAsCString (ret_val)); return ret_val; @@ -1003,8 +1007,9 @@ SBProcess::GetBroadcaster () const SBBroadcaster broadcaster(process_sp.get(), false); if (log) - log->Printf ("SBProcess(%p)::GetBroadcaster () => SBBroadcaster (%p)", process_sp.get(), - broadcaster.get()); + log->Printf ("SBProcess(%p)::GetBroadcaster () => SBBroadcaster (%p)", + static_cast<void*>(process_sp.get()), + static_cast<void*>(broadcaster.get())); return broadcaster; } @@ -1025,15 +1030,11 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error ProcessSP process_sp(GetSP()); if (log) - { log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%" PRIx64 ", dst=%p, dst_len=%" PRIu64 ", SBError (%p))...", - process_sp.get(), - addr, - dst, - (uint64_t)dst_len, - sb_error.get()); - } - + static_cast<void*>(process_sp.get()), addr, + static_cast<void*>(dst), static_cast<uint64_t>(dst_len), + static_cast<void*>(sb_error.get())); + if (process_sp) { Process::StopLocker stop_locker; @@ -1045,7 +1046,8 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error else { if (log) - log->Printf ("SBProcess(%p)::ReadMemory() => error: process is running", process_sp.get()); + log->Printf ("SBProcess(%p)::ReadMemory() => error: process is running", + static_cast<void*>(process_sp.get())); sb_error.SetErrorString("process is running"); } } @@ -1059,13 +1061,10 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error SBStream sstr; sb_error.GetDescription (sstr); log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%" PRIx64 ", dst=%p, dst_len=%" PRIu64 ", SBError (%p): %s) => %" PRIu64, - process_sp.get(), - addr, - dst, - (uint64_t)dst_len, - sb_error.get(), - sstr.GetData(), - (uint64_t)bytes_read); + static_cast<void*>(process_sp.get()), addr, + static_cast<void*>(dst), static_cast<uint64_t>(dst_len), + static_cast<void*>(sb_error.get()), sstr.GetData(), + static_cast<uint64_t>(bytes_read)); } return bytes_read; @@ -1088,7 +1087,8 @@ SBProcess::ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBE { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::ReadCStringFromMemory() => error: process is running", process_sp.get()); + log->Printf ("SBProcess(%p)::ReadCStringFromMemory() => error: process is running", + static_cast<void*>(process_sp.get())); sb_error.SetErrorString("process is running"); } } @@ -1116,7 +1116,8 @@ SBProcess::ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBErro { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::ReadUnsignedFromMemory() => error: process is running", process_sp.get()); + log->Printf ("SBProcess(%p)::ReadUnsignedFromMemory() => error: process is running", + static_cast<void*>(process_sp.get())); sb_error.SetErrorString("process is running"); } } @@ -1144,7 +1145,8 @@ SBProcess::ReadPointerFromMemory (addr_t addr, lldb::SBError &sb_error) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::ReadPointerFromMemory() => error: process is running", process_sp.get()); + log->Printf ("SBProcess(%p)::ReadPointerFromMemory() => error: process is running", + static_cast<void*>(process_sp.get())); sb_error.SetErrorString("process is running"); } } @@ -1165,14 +1167,11 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s ProcessSP process_sp(GetSP()); if (log) - { log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%" PRIx64 ", src=%p, src_len=%" PRIu64 ", SBError (%p))...", - process_sp.get(), - addr, - src, - (uint64_t)src_len, - sb_error.get()); - } + static_cast<void*>(process_sp.get()), addr, + static_cast<const void*>(src), + static_cast<uint64_t>(src_len), + static_cast<void*>(sb_error.get())); if (process_sp) { @@ -1185,7 +1184,8 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s else { if (log) - log->Printf ("SBProcess(%p)::WriteMemory() => error: process is running", process_sp.get()); + log->Printf ("SBProcess(%p)::WriteMemory() => error: process is running", + static_cast<void*>(process_sp.get())); sb_error.SetErrorString("process is running"); } } @@ -1195,13 +1195,11 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s SBStream sstr; sb_error.GetDescription (sstr); log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%" PRIx64 ", src=%p, src_len=%" PRIu64 ", SBError (%p): %s) => %" PRIu64, - process_sp.get(), - addr, - src, - (uint64_t)src_len, - sb_error.get(), - sstr.GetData(), - (uint64_t)bytes_written); + static_cast<void*>(process_sp.get()), addr, + static_cast<const void*>(src), + static_cast<uint64_t>(src_len), + static_cast<void*>(sb_error.get()), sstr.GetData(), + static_cast<uint64_t>(bytes_written)); } return bytes_written; @@ -1248,7 +1246,7 @@ SBProcess::GetNumSupportedHardwareWatchpoints (lldb::SBError &sb_error) const sb_error.SetError(process_sp->GetWatchpointSupportInfo (num)); if (log) log->Printf ("SBProcess(%p)::GetNumSupportedHardwareWatchpoints () => %u", - process_sp.get(), num); + static_cast<void*>(process_sp.get()), num); } else { @@ -1273,13 +1271,14 @@ SBProcess::LoadImage (lldb::SBFileSpec &sb_image_spec, lldb::SBError &sb_error) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::LoadImage() => error: process is running", process_sp.get()); + log->Printf ("SBProcess(%p)::LoadImage() => error: process is running", + static_cast<void*>(process_sp.get())); sb_error.SetErrorString("process is running"); } } return LLDB_INVALID_IMAGE_TOKEN; } - + lldb::SBError SBProcess::UnloadImage (uint32_t image_token) { @@ -1297,7 +1296,8 @@ SBProcess::UnloadImage (uint32_t image_token) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::UnloadImage() => error: process is running", process_sp.get()); + log->Printf ("SBProcess(%p)::UnloadImage() => error: process is running", + static_cast<void*>(process_sp.get())); sb_error.SetErrorString("process is running"); } } @@ -1323,7 +1323,8 @@ SBProcess::SendEventData (const char *event_data) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBProcess(%p)::SendEventData() => error: process is running", process_sp.get()); + log->Printf ("SBProcess(%p)::SendEventData() => error: process is running", + static_cast<void*>(process_sp.get())); sb_error.SetErrorString("process is running"); } } @@ -1360,7 +1361,8 @@ SBProcess::GetExtendedBacktraceTypeAtIndex (uint32_t idx) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf("SBProcess(%p)::GetExtendedBacktraceTypeAtIndex() => error: requested extended backtrace name out of bounds", process_sp.get()); + log->Printf("SBProcess(%p)::GetExtendedBacktraceTypeAtIndex() => error: requested extended backtrace name out of bounds", + static_cast<void*>(process_sp.get())); } } return NULL; diff --git a/lldb/source/API/SBQueue.cpp b/lldb/source/API/SBQueue.cpp index 96876ac8d4e..31867b0dedf 100644 --- a/lldb/source/API/SBQueue.cpp +++ b/lldb/source/API/SBQueue.cpp @@ -98,7 +98,8 @@ namespace lldb_private } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBQueue(%p)::GetQueueID () => 0x%" PRIx64, this, result); + log->Printf ("SBQueue(%p)::GetQueueID () => 0x%" PRIx64, + static_cast<const void*>(this), result); return result; } @@ -113,10 +114,11 @@ namespace lldb_private } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBQueueImpl(%p)::GetIndexID () => %d", this, result); + log->Printf ("SBQueueImpl(%p)::GetIndexID () => %d", + static_cast<const void*>(this), result); return result; } - + const char * GetName () const { @@ -126,14 +128,16 @@ namespace lldb_private { name = queue_sp->GetName(); } - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBQueueImpl(%p)::GetName () => %s", this, name ? name : "NULL"); - + log->Printf ("SBQueueImpl(%p)::GetName () => %s", + static_cast<const void*>(this), + name ? name : "NULL"); + return name; } - + void FetchThreads () { @@ -160,7 +164,7 @@ namespace lldb_private } } } - + void FetchItems () { @@ -187,12 +191,12 @@ namespace lldb_private } } } - + uint32_t GetNumThreads () { uint32_t result = 0; - + FetchThreads(); if (m_thread_list_fetched) { @@ -200,12 +204,12 @@ namespace lldb_private } return result; } - + lldb::SBThread GetThreadAtIndex (uint32_t idx) { FetchThreads(); - + SBThread sb_thread; QueueSP queue_sp = m_queue_wp.lock(); if (queue_sp && idx < m_threads.size()) @@ -261,7 +265,7 @@ namespace lldb_private result = queue_sp->GetNumRunningWorkItems(); return result; } - + lldb::SBProcess GetProcess () { diff --git a/lldb/source/API/SBQueueItem.cpp b/lldb/source/API/SBQueueItem.cpp index 10d036ab880..6a1aa7bec61 100644 --- a/lldb/source/API/SBQueueItem.cpp +++ b/lldb/source/API/SBQueueItem.cpp @@ -49,7 +49,9 @@ SBQueueItem::IsValid() const bool is_valid = m_queue_item_sp.get() != NULL; Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf("SBQueueItem(%p)::IsValid() == %s", m_queue_item_sp.get(), is_valid ? "true" : "false"); + log->Printf("SBQueueItem(%p)::IsValid() == %s", + static_cast<void*>(m_queue_item_sp.get()), + is_valid ? "true" : "false"); return is_valid; } @@ -59,7 +61,8 @@ SBQueueItem::Clear () { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf("SBQueueItem(%p)::Clear()", m_queue_item_sp.get()); + log->Printf("SBQueueItem(%p)::Clear()", + static_cast<void*>(m_queue_item_sp.get())); m_queue_item_sp.reset(); } @@ -81,7 +84,9 @@ SBQueueItem::GetKind () const result = m_queue_item_sp->GetKind (); } if (log) - log->Printf("SBQueueItem(%p)::GetKind() == %d", m_queue_item_sp.get(), (int) result); + log->Printf("SBQueueItem(%p)::GetKind() == %d", + static_cast<void*>(m_queue_item_sp.get()), + static_cast<int>(result)); return result; } @@ -110,7 +115,8 @@ SBQueueItem::GetAddress () const if (addr) addr->Dump (&sstr, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4); log->Printf ("SBQueueItem(%p)::GetAddress() == SBAddress(%p): %s", - m_queue_item_sp.get(), result.get(), sstr.GetData()); + static_cast<void*>(m_queue_item_sp.get()), + static_cast<void*>(result.get()), sstr.GetData()); } return result; } @@ -149,7 +155,11 @@ SBQueueItem::GetExtendedBacktraceThread (const char *type) const char *queue_name = thread_sp->GetQueueName(); if (queue_name == NULL) queue_name = ""; - log->Printf ("SBQueueItem(%p)::GetExtendedBacktraceThread() = new extended Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'", m_queue_item_sp.get(), thread_sp.get(), (uint64_t) thread_sp->GetQueueID(), queue_name); + log->Printf ("SBQueueItem(%p)::GetExtendedBacktraceThread() = new extended Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'", + static_cast<void*>(m_queue_item_sp.get()), + static_cast<void*>(thread_sp.get()), + static_cast<uint64_t>(thread_sp->GetQueueID()), + queue_name); } } } diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp index ef3d0764c96..12a3b317d50 100644 --- a/lldb/source/API/SBSymbol.cpp +++ b/lldb/source/API/SBSymbol.cpp @@ -67,7 +67,8 @@ SBSymbol::GetName() const Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBSymbol(%p)::GetName () => \"%s\"", m_opaque_ptr, name ? name : ""); + log->Printf ("SBSymbol(%p)::GetName () => \"%s\"", + static_cast<void*>(m_opaque_ptr), name ? name : ""); return name; } @@ -79,7 +80,8 @@ SBSymbol::GetMangledName () const name = m_opaque_ptr->GetMangled().GetMangledName().AsCString(); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBSymbol(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, name ? name : ""); + log->Printf ("SBSymbol(%p)::GetMangledName () => \"%s\"", + static_cast<void*>(m_opaque_ptr), name ? name : ""); return name; } diff --git a/lldb/source/API/SBSymbolContext.cpp b/lldb/source/API/SBSymbolContext.cpp index 479b0f75bfe..481fa1a1d1a 100644 --- a/lldb/source/API/SBSymbolContext.cpp +++ b/lldb/source/API/SBSymbolContext.cpp @@ -101,8 +101,9 @@ SBSymbolContext::GetModule () { SBStream sstr; sb_module.GetDescription (sstr); - log->Printf ("SBSymbolContext(%p)::GetModule () => SBModule(%p): %s", - m_opaque_ap.get(), module_sp.get(), sstr.GetData()); + log->Printf ("SBSymbolContext(%p)::GetModule () => SBModule(%p): %s", + static_cast<void*>(m_opaque_ap.get()), + static_cast<void*>(module_sp.get()), sstr.GetData()); } return sb_module; @@ -120,15 +121,16 @@ SBSymbolContext::GetFunction () Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); Function *function = NULL; - + if (m_opaque_ap.get()) function = m_opaque_ap->function; SBFunction sb_function (function); if (log) - log->Printf ("SBSymbolContext(%p)::GetFunction () => SBFunction(%p)", - m_opaque_ap.get(), function); + log->Printf ("SBSymbolContext(%p)::GetFunction () => SBFunction(%p)", + static_cast<void*>(m_opaque_ap.get()), + static_cast<void*>(function)); return sb_function; } @@ -150,8 +152,9 @@ SBSymbolContext::GetLineEntry () if (log) { - log->Printf ("SBSymbolContext(%p)::GetLineEntry () => SBLineEntry(%p)", - m_opaque_ap.get(), sb_line_entry.get()); + log->Printf ("SBSymbolContext(%p)::GetLineEntry () => SBLineEntry(%p)", + static_cast<void*>(m_opaque_ap.get()), + static_cast<void*>(sb_line_entry.get())); } return sb_line_entry; @@ -163,19 +166,18 @@ SBSymbolContext::GetSymbol () Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); Symbol *symbol = NULL; - + if (m_opaque_ap.get()) symbol = m_opaque_ap->symbol; SBSymbol sb_symbol (symbol); if (log) - { - log->Printf ("SBSymbolContext(%p)::GetSymbol () => SBSymbol(%p)", - m_opaque_ap.get(), symbol); - } + log->Printf ("SBSymbolContext(%p)::GetSymbol () => SBSymbol(%p)", + static_cast<void*>(m_opaque_ap.get()), + static_cast<void*>(symbol)); - return sb_symbol; + return sb_symbol; } void diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 9f006f51312..817f1bc371f 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -552,10 +552,9 @@ SBTarget::GetProcess () Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - { - log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)", - target_sp.get(), process_sp.get()); - } + log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)", + static_cast<void*>(target_sp.get()), + static_cast<void*>(process_sp.get())); return sb_process; } @@ -652,19 +651,15 @@ SBTarget::Launch TargetSP target_sp(GetSP()); if (log) - { log->Printf ("SBTarget(%p)::Launch (argv=%p, envp=%p, stdin=%s, stdout=%s, stderr=%s, working-dir=%s, launch_flags=0x%x, stop_at_entry=%i, &error (%p))...", - target_sp.get(), - argv, - envp, - stdin_path ? stdin_path : "NULL", - stdout_path ? stdout_path : "NULL", - stderr_path ? stderr_path : "NULL", + static_cast<void*>(target_sp.get()), + static_cast<void*>(argv), static_cast<void*>(envp), + stdin_path ? stdin_path : "NULL", + stdout_path ? stdout_path : "NULL", + stderr_path ? stderr_path : "NULL", working_directory ? working_directory : "NULL", - launch_flags, - stop_at_entry, - error.get()); - } + launch_flags, stop_at_entry, + static_cast<void*>(error.get())); if (target_sp) { @@ -678,17 +673,17 @@ SBTarget::Launch if (process_sp) { state = process_sp->GetState(); - + if (process_sp->IsAlive() && state != eStateConnected) - { + { if (state == eStateAttaching) error.SetErrorString ("process attach is in progress"); else error.SetErrorString ("a process is already being debugged"); return sb_process; - } + } } - + if (state == eStateConnected) { // If we are already connected, then we have already specified the @@ -705,7 +700,7 @@ SBTarget::Launch launch_flags |= eLaunchFlagDisableSTDIO; ProcessLaunchInfo launch_info (stdin_path, stdout_path, stderr_path, working_directory, launch_flags); - + Module *exe_module = target_sp->GetExecutableModulePointer(); if (exe_module) launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true); @@ -728,10 +723,9 @@ SBTarget::Launch log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - { - log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)", - target_sp.get(), sb_process.GetSP().get()); - } + log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)", + static_cast<void*>(target_sp.get()), + static_cast<void*>(sb_process.GetSP().get())); return sb_process; } @@ -740,15 +734,14 @@ SBProcess SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + SBProcess sb_process; TargetSP target_sp(GetSP()); - + if (log) - { - log->Printf ("SBTarget(%p)::Launch (launch_info, error)...", target_sp.get()); - } - + log->Printf ("SBTarget(%p)::Launch (launch_info, error)...", + static_cast<void*>(target_sp.get())); + if (target_sp) { Mutex::Locker api_locker (target_sp->GetAPIMutex()); @@ -758,15 +751,15 @@ SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error) if (process_sp) { state = process_sp->GetState(); - + if (process_sp->IsAlive() && state != eStateConnected) - { + { if (state == eStateAttaching) error.SetErrorString ("process attach is in progress"); else error.SetErrorString ("a process is already being debugged"); return sb_process; - } + } } } @@ -779,7 +772,7 @@ SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error) const ArchSpec &arch_spec = target_sp->GetArchitecture(); if (arch_spec.IsValid()) launch_info.GetArchitecture () = arch_spec; - + error.SetError (target_sp->Launch (target_sp->GetDebugger().GetListener(), launch_info)); sb_process.SetSP(target_sp->GetProcessSP()); } @@ -787,14 +780,13 @@ SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error) { error.SetErrorString ("SBTarget is invalid"); } - + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - { log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)", - target_sp.get(), sb_process.GetSP().get()); - } - + static_cast<void*>(target_sp.get()), + static_cast<void*>(sb_process.GetSP().get())); + return sb_process; } @@ -802,41 +794,39 @@ lldb::SBProcess SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + SBProcess sb_process; ProcessSP process_sp; TargetSP target_sp(GetSP()); - + if (log) - { - log->Printf ("SBTarget(%p)::Attach (sb_attach_info, error)...", target_sp.get()); - } - + log->Printf ("SBTarget(%p)::Attach (sb_attach_info, error)...", + static_cast<void*>(target_sp.get())); + if (target_sp) { Mutex::Locker api_locker (target_sp->GetAPIMutex()); - + StateType state = eStateInvalid; process_sp = target_sp->GetProcessSP(); if (process_sp) { state = process_sp->GetState(); - + if (process_sp->IsAlive() && state != eStateConnected) - { + { if (state == eStateAttaching) error.SetErrorString ("process attach is in progress"); else error.SetErrorString ("a process is already being debugged"); if (log) - { log->Printf ("SBTarget(%p)::Attach (...) => error %s", - target_sp.get(), error.GetCString()); - } + static_cast<void*>(target_sp.get()), + error.GetCString()); return sb_process; - } + } } - + if (state != eStateConnected) process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), NULL, NULL); @@ -861,7 +851,7 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error) if (log) { log->Printf ("SBTarget(%p)::Attach (...) => error %s", - target_sp.get(), error.GetCString()); + static_cast<void*>(target_sp.get()), error.GetCString()); } return sb_process; } @@ -886,13 +876,12 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error) { error.SetErrorString ("SBTarget is invalid"); } - + if (log) - { log->Printf ("SBTarget(%p)::Attach (...) => SBProcess(%p)", - target_sp.get(), process_sp.get()); - } - + static_cast<void*>(target_sp.get()), + static_cast<void*>(process_sp.get())); + return sb_process; } @@ -924,10 +913,9 @@ SBTarget::AttachToProcessWithID TargetSP target_sp(GetSP()); if (log) - { - log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%" PRId64 ", error)...", target_sp.get(), pid); - } - + log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%" PRId64 ", error)...", + static_cast<void*>(target_sp.get()), pid); + if (target_sp) { Mutex::Locker api_locker (target_sp->GetAPIMutex()); @@ -937,15 +925,15 @@ SBTarget::AttachToProcessWithID if (process_sp) { state = process_sp->GetState(); - + if (process_sp->IsAlive() && state != eStateConnected) - { + { if (state == eStateAttaching) error.SetErrorString ("process attach is in progress"); else error.SetErrorString ("a process is already being debugged"); return sb_process; - } + } } if (state == eStateConnected) @@ -969,10 +957,10 @@ SBTarget::AttachToProcessWithID if (process_sp) { sb_process.SetSP (process_sp); - + ProcessAttachInfo attach_info; attach_info.SetProcessID (pid); - + PlatformSP platform_sp = target_sp->GetPlatform(); ProcessInstanceInfo instance_info; if (platform_sp->GetProcessInfo(pid, instance_info)) @@ -997,12 +985,11 @@ SBTarget::AttachToProcessWithID { error.SetErrorString ("SBTarget is invalid"); } - + if (log) - { log->Printf ("SBTarget(%p)::AttachToProcessWithID (...) => SBProcess(%p)", - target_sp.get(), process_sp.get()); - } + static_cast<void*>(target_sp.get()), + static_cast<void*>(process_sp.get())); return sb_process; } @@ -1016,16 +1003,16 @@ SBTarget::AttachToProcessWithName ) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + SBProcess sb_process; ProcessSP process_sp; TargetSP target_sp(GetSP()); - + if (log) - { - log->Printf ("SBTarget(%p)::AttachToProcessWithName (listener, name=%s, wait_for=%s, error)...", target_sp.get(), name, wait_for ? "true" : "false"); - } - + log->Printf ("SBTarget(%p)::AttachToProcessWithName (listener, name=%s, wait_for=%s, error)...", + static_cast<void*>(target_sp.get()), name, + wait_for ? "true" : "false"); + if (name && target_sp) { Mutex::Locker api_locker (target_sp->GetAPIMutex()); @@ -1035,17 +1022,17 @@ SBTarget::AttachToProcessWithName if (process_sp) { state = process_sp->GetState(); - + if (process_sp->IsAlive() && state != eStateConnected) - { + { if (state == eStateAttaching) error.SetErrorString ("process attach is in progress"); else error.SetErrorString ("a process is already being debugged"); return sb_process; - } + } } - + if (state == eStateConnected) { // If we are already connected, then we have already specified the @@ -1089,12 +1076,11 @@ SBTarget::AttachToProcessWithName { error.SetErrorString ("SBTarget is invalid"); } - + if (log) - { log->Printf ("SBTarget(%p)::AttachToPorcessWithName (...) => SBProcess(%p)", - target_sp.get(), process_sp.get()); - } + static_cast<void*>(target_sp.get()), + static_cast<void*>(process_sp.get())); return sb_process; } @@ -1112,12 +1098,11 @@ SBTarget::ConnectRemote SBProcess sb_process; ProcessSP process_sp; TargetSP target_sp(GetSP()); - + if (log) - { - log->Printf ("SBTarget(%p)::ConnectRemote (listener, url=%s, plugin_name=%s, error)...", target_sp.get(), url, plugin_name); - } - + log->Printf ("SBTarget(%p)::ConnectRemote (listener, url=%s, plugin_name=%s, error)...", + static_cast<void*>(target_sp.get()), url, plugin_name); + if (target_sp) { Mutex::Locker api_locker (target_sp->GetAPIMutex()); @@ -1125,8 +1110,7 @@ SBTarget::ConnectRemote process_sp = target_sp->CreateProcess (listener.ref(), plugin_name, NULL); else process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), plugin_name, NULL); - - + if (process_sp) { sb_process.SetSP (process_sp); @@ -1141,12 +1125,11 @@ SBTarget::ConnectRemote { error.SetErrorString ("SBTarget is invalid"); } - + if (log) - { log->Printf ("SBTarget(%p)::ConnectRemote (...) => SBProcess(%p)", - target_sp.get(), process_sp.get()); - } + static_cast<void*>(target_sp.get()), + static_cast<void*>(process_sp.get())); return sb_process; } @@ -1166,8 +1149,9 @@ SBTarget::GetExecutable () Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { - log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)", - target_sp.get(), exe_file_spec.get()); + log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)", + static_cast<void*>(target_sp.get()), + static_cast<const void*>(exe_file_spec.get())); } return exe_file_spec; @@ -1269,7 +1253,7 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, if (target_sp && line != 0) { Mutex::Locker api_locker (target_sp->GetAPIMutex()); - + const LazyBool check_inlines = eLazyBoolCalculate; const LazyBool skip_prologue = eLazyBoolCalculate; const bool internal = false; @@ -1283,12 +1267,9 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, sb_bp.GetDescription (sstr); char path[PATH_MAX]; sb_file_spec->GetPath (path, sizeof(path)); - log->Printf ("SBTarget(%p)::BreakpointCreateByLocation ( %s:%u ) => SBBreakpoint(%p): %s", - target_sp.get(), - path, - line, - sb_bp.get(), - sstr.GetData()); + log->Printf ("SBTarget(%p)::BreakpointCreateByLocation ( %s:%u ) => SBBreakpoint(%p): %s", + static_cast<void*>(target_sp.get()), path, line, + static_cast<void*>(sb_bp.get()), sstr.GetData()); } return sb_bp; @@ -1305,7 +1286,7 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, if (target_sp.get()) { Mutex::Locker api_locker (target_sp->GetAPIMutex()); - + const bool internal = false; const bool hardware = false; const LazyBool skip_prologue = eLazyBoolCalculate; @@ -1320,12 +1301,11 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, *sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, skip_prologue, internal, hardware); } } - + if (log) - { - log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", module=\"%s\") => SBBreakpoint(%p)", - target_sp.get(), symbol_name, module_name, sb_bp.get()); - } + log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", module=\"%s\") => SBBreakpoint(%p)", + static_cast<void*>(target_sp.get()), symbol_name, + module_name, static_cast<void*>(sb_bp.get())); return sb_bp; } @@ -1363,12 +1343,11 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, internal, hardware); } - + if (log) - { - log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", name_type: %d) => SBBreakpoint(%p)", - target_sp.get(), symbol_name, name_type_mask, sb_bp.get()); - } + log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", name_type: %d) => SBBreakpoint(%p)", + static_cast<void*>(target_sp.get()), symbol_name, + name_type_mask, static_cast<void*>(sb_bp.get())); return sb_bp; } @@ -1399,10 +1378,11 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[], internal, hardware); } - + if (log) { - log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbols={", target_sp.get()); + log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbols={", + static_cast<void*>(target_sp.get())); for (uint32_t i = 0 ; i < num_names; i++) { char sep; @@ -1414,9 +1394,9 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[], log->Printf ("\"%s\"%c ", symbol_names[i], sep); else log->Printf ("\"<NULL>\"%c ", sep); - } - log->Printf ("name_type: %d) => SBBreakpoint(%p)", name_type_mask, sb_bp.get()); + log->Printf ("name_type: %d) => SBBreakpoint(%p)", name_type_mask, + static_cast<void*>(sb_bp.get())); } return sb_bp; @@ -1437,12 +1417,12 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const bool internal = false; const bool hardware = false; const LazyBool skip_prologue = eLazyBoolCalculate; - + if (module_name && module_name[0]) { FileSpecList module_spec_list; module_spec_list.Append (FileSpec (module_name, false)); - + *sb_bp = target_sp->CreateFuncRegexBreakpoint (&module_spec_list, NULL, regexp, skip_prologue, internal, hardware); } else @@ -1452,10 +1432,9 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, } if (log) - { - log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)", - target_sp.get(), symbol_name_regex, module_name, sb_bp.get()); - } + log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)", + static_cast<void*>(target_sp.get()), symbol_name_regex, + module_name, static_cast<void*>(sb_bp.get())); return sb_bp; } @@ -1476,15 +1455,14 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const bool internal = false; const bool hardware = false; const LazyBool skip_prologue = eLazyBoolCalculate; - + *sb_bp = target_sp->CreateFuncRegexBreakpoint (module_list.get(), comp_unit_list.get(), regexp, skip_prologue, internal, hardware); } if (log) - { - log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\") => SBBreakpoint(%p)", - target_sp.get(), symbol_name_regex, sb_bp.get()); - } + log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\") => SBBreakpoint(%p)", + static_cast<void*>(target_sp.get()), symbol_name_regex, + static_cast<void*>(sb_bp.get())); return sb_bp; } @@ -1502,11 +1480,12 @@ SBTarget::BreakpointCreateByAddress (addr_t address) const bool hardware = false; *sb_bp = target_sp->CreateBreakpoint (address, false, hardware); } - + if (log) - { - log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (address=%" PRIu64 ") => SBBreakpoint(%p)", target_sp.get(), (uint64_t) address, sb_bp.get()); - } + log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (address=%" PRIu64 ") => SBBreakpoint(%p)", + static_cast<void*>(target_sp.get()), + static_cast<uint64_t>(address), + static_cast<void*>(sb_bp.get())); return sb_bp; } @@ -1527,12 +1506,12 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex, FileSpecList source_file_spec_list; const bool hardware = false; source_file_spec_list.Append (source_file.ref()); - + if (module_name && module_name[0]) { FileSpecList module_spec_list; module_spec_list.Append (FileSpec (module_name, false)); - + *sb_bp = target_sp->CreateSourceRegexBreakpoint (&module_spec_list, &source_file_spec_list, regexp, false, hardware); } else @@ -1545,8 +1524,9 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex, { char path[PATH_MAX]; source_file->GetPath (path, sizeof(path)); - log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\", file=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)", - target_sp.get(), source_regex, path, module_name, sb_bp.get()); + log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\", file=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)", + static_cast<void*>(target_sp.get()), source_regex, path, + module_name, static_cast<void*>(sb_bp.get())); } return sb_bp; @@ -1570,10 +1550,9 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex, } if (log) - { - log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\") => SBBreakpoint(%p)", - target_sp.get(), source_regex, sb_bp.get()); - } + log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\") => SBBreakpoint(%p)", + static_cast<void*>(target_sp.get()), source_regex, + static_cast<void*>(sb_bp.get())); return sb_bp; } @@ -1595,14 +1574,11 @@ SBTarget::BreakpointCreateForException (lldb::LanguageType language, } if (log) - { - log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (Language: %s, catch: %s throw: %s) => SBBreakpoint(%p)", - target_sp.get(), + log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (Language: %s, catch: %s throw: %s) => SBBreakpoint(%p)", + static_cast<void*>(target_sp.get()), LanguageRuntime::GetNameForLanguageType(language), - catch_bp ? "on" : "off", - throw_bp ? "on" : "off", - sb_bp.get()); - } + catch_bp ? "on" : "off", throw_bp ? "on" : "off", + static_cast<void*>(sb_bp.get())); return sb_bp; } @@ -1646,9 +1622,9 @@ SBTarget::BreakpointDelete (break_id_t bp_id) } if (log) - { - log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", target_sp.get(), (uint32_t) bp_id, result); - } + log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", + static_cast<void*>(target_sp.get()), + static_cast<uint32_t>(bp_id), result); return result; } @@ -1667,10 +1643,10 @@ SBTarget::FindBreakpointByID (break_id_t bp_id) } if (log) - { - log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p)", - target_sp.get(), (uint32_t) bp_id, sb_breakpoint.get()); - } + log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p)", + static_cast<void*>(target_sp.get()), + static_cast<uint32_t>(bp_id), + static_cast<void*>(sb_breakpoint.get())); return sb_breakpoint; } @@ -1755,9 +1731,9 @@ SBTarget::DeleteWatchpoint (watch_id_t wp_id) } if (log) - { - log->Printf ("SBTarget(%p)::WatchpointDelete (wp_id=%d) => %i", target_sp.get(), (uint32_t) wp_id, result); - } + log->Printf ("SBTarget(%p)::WatchpointDelete (wp_id=%d) => %i", + static_cast<void*>(target_sp.get()), + static_cast<uint32_t>(wp_id), result); return result; } @@ -1780,10 +1756,10 @@ SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id) } if (log) - { - log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)", - target_sp.get(), (uint32_t) wp_id, watchpoint_sp.get()); - } + log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)", + static_cast<void*>(target_sp.get()), + static_cast<uint32_t>(wp_id), + static_cast<void*>(watchpoint_sp.get())); return sb_watchpoint; } @@ -1792,7 +1768,7 @@ lldb::SBWatchpoint SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, SBError &error) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + SBWatchpoint sb_watchpoint; lldb::WatchpointSP watchpoint_sp; TargetSP target_sp(GetSP()); @@ -1809,7 +1785,7 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, S error.SetErrorString("Can't create a watchpoint that is neither read nor write."); return sb_watchpoint; } - + // Target::CreateWatchpoint() is thread safe. Error cw_error; // This API doesn't take in a type, so we can't figure out what it is. @@ -1818,13 +1794,13 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, S error.SetError(cw_error); sb_watchpoint.SetSP (watchpoint_sp); } - + if (log) - { log->Printf ("SBTarget(%p)::WatchAddress (addr=0x%" PRIx64 ", 0x%u) => SBWatchpoint(%p)", - target_sp.get(), addr, (uint32_t) size, watchpoint_sp.get()); - } - + static_cast<void*>(target_sp.get()), addr, + static_cast<uint32_t>(size), + static_cast<void*>(watchpoint_sp.get())); + return sb_watchpoint; } @@ -1871,7 +1847,7 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type) if (pointer_ast_type) { lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t))); - + ExecutionContext exe_ctx (ExecutionContextRef(ExecutionContext(m_opaque_sp.get(),false))); ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), pointer_ast_type, @@ -1879,7 +1855,7 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type) buffer, exe_ctx.GetByteOrder(), exe_ctx.GetAddressByteSize())); - + if (ptr_result_valobj_sp) { ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress); @@ -1895,9 +1871,12 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type) if (log) { if (new_value_sp) - log->Printf ("SBTarget(%p)::CreateValueFromAddress => \"%s\"", m_opaque_sp.get(), new_value_sp->GetName().AsCString()); + log->Printf ("SBTarget(%p)::CreateValueFromAddress => \"%s\"", + static_cast<void*>(m_opaque_sp.get()), + new_value_sp->GetName().AsCString()); else - log->Printf ("SBTarget(%p)::CreateValueFromAddress => NULL", m_opaque_sp.get()); + log->Printf ("SBTarget(%p)::CreateValueFromAddress => NULL", + static_cast<void*>(m_opaque_sp.get())); } return sb_value; } @@ -1992,7 +1971,8 @@ SBTarget::GetNumModules () const } if (log) - log->Printf ("SBTarget(%p)::GetNumModules () => %d", target_sp.get(), num); + log->Printf ("SBTarget(%p)::GetNumModules () => %d", + static_cast<void*>(target_sp.get()), num); return num; } @@ -2003,7 +1983,8 @@ SBTarget::Clear () Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBTarget(%p)::Clear ()", m_opaque_sp.get()); + log->Printf ("SBTarget(%p)::Clear ()", + static_cast<void*>(m_opaque_sp.get())); m_opaque_sp.reset(); } @@ -2074,10 +2055,9 @@ SBTarget::GetModuleAtIndex (uint32_t idx) } if (log) - { - log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p)", - target_sp.get(), idx, module_sp.get()); - } + log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p)", + static_cast<void*>(target_sp.get()), idx, + static_cast<void*>(module_sp.get())); return sb_module; } @@ -2099,10 +2079,11 @@ SBTarget::GetBroadcaster () const TargetSP target_sp(GetSP()); SBBroadcaster broadcaster(target_sp.get(), false); - + if (log) - log->Printf ("SBTarget(%p)::GetBroadcaster () => SBBroadcaster(%p)", - target_sp.get(), broadcaster.get()); + log->Printf ("SBTarget(%p)::GetBroadcaster () => SBBroadcaster(%p)", + static_cast<void*>(target_sp.get()), + static_cast<void*>(broadcaster.get())); return broadcaster; } @@ -2642,16 +2623,16 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio log->Printf ("SBTarget::EvaluateExpression called with an empty expression"); return expr_result; } - + Mutex::Locker api_locker (target_sp->GetAPIMutex()); ExecutionContext exe_ctx (m_opaque_sp.get()); - + if (log) log->Printf ("SBTarget()::EvaluateExpression (expr=\"%s\")...", expr); - + frame = exe_ctx.GetFramePtr(); Target *target = exe_ctx.GetTargetPtr(); - + if (target) { #ifdef LLDB_CONFIGURATION_DEBUG @@ -2680,17 +2661,14 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio #ifndef LLDB_DISABLE_PYTHON if (expr_log) expr_log->Printf("** [SBTarget::EvaluateExpression] Expression result is %s, summary %s **", - expr_result.GetValue(), - expr_result.GetSummary()); - + expr_result.GetValue(), expr_result.GetSummary()); + if (log) log->Printf ("SBTarget(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)", - frame, - expr, - expr_value_sp.get(), - exe_results); + static_cast<void*>(frame), expr, + static_cast<void*>(expr_value_sp.get()), exe_results); #endif - + return expr_result; } diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index fe672d10719..d9d4f149966 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -120,12 +120,14 @@ SBThread::GetStopReason() else { if (log) - log->Printf ("SBThread(%p)::GetStopReason() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetStopReason() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } if (log) - log->Printf ("SBThread(%p)::GetStopReason () => %s", exe_ctx.GetThreadPtr(), + log->Printf ("SBThread(%p)::GetStopReason () => %s", + static_cast<void*>(exe_ctx.GetThreadPtr()), Thread::StopReasonAsCString (reason)); return reason; @@ -183,7 +185,8 @@ SBThread::GetStopReasonDataCount () { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBThread(%p)::GetStopReasonDataCount() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetStopReasonDataCount() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } return 0; @@ -257,7 +260,8 @@ SBThread::GetStopReasonDataAtIndex (uint32_t idx) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBThread(%p)::GetStopReasonDataAtIndex() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetStopReasonDataAtIndex() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } return 0; @@ -284,8 +288,9 @@ SBThread::GetStopDescription (char *dst, size_t dst_len) if (stop_desc) { if (log) - log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"", - exe_ctx.GetThreadPtr(), stop_desc); + log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"", + static_cast<void*>(exe_ctx.GetThreadPtr()), + stop_desc); if (dst) return ::snprintf (dst, dst_len, "%s", stop_desc); else @@ -362,19 +367,20 @@ SBThread::GetStopDescription (char *dst, size_t dst_len) default: break; } - + if (stop_desc && stop_desc[0]) { if (log) - log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'", - exe_ctx.GetThreadPtr(), stop_desc); + log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'", + static_cast<void*>(exe_ctx.GetThreadPtr()), + stop_desc); if (dst) return ::snprintf (dst, dst_len, "%s", stop_desc) + 1; // Include the NULL byte if (stop_desc_len == 0) stop_desc_len = ::strlen (stop_desc) + 1; // Include the NULL byte - + return stop_desc_len; } } @@ -384,7 +390,8 @@ SBThread::GetStopDescription (char *dst, size_t dst_len) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBThread(%p)::GetStopDescription() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetStopDescription() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } if (dst) @@ -414,16 +421,18 @@ SBThread::GetStopReturnValue () else { if (log) - log->Printf ("SBThread(%p)::GetStopReturnValue() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetStopReturnValue() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } - + if (log) - log->Printf ("SBThread(%p)::GetStopReturnValue () => %s", exe_ctx.GetThreadPtr(), - return_valobj_sp.get() - ? return_valobj_sp->GetValueAsCString() - : "<no return value>"); - + log->Printf ("SBThread(%p)::GetStopReturnValue () => %s", + static_cast<void*>(exe_ctx.GetThreadPtr()), + return_valobj_sp.get() + ? return_valobj_sp->GetValueAsCString() + : "<no return value>"); + return SBValue (return_valobj_sp); } @@ -469,12 +478,15 @@ SBThread::GetName () const else { if (log) - log->Printf ("SBThread(%p)::GetName() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetName() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } - + if (log) - log->Printf ("SBThread(%p)::GetName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL"); + log->Printf ("SBThread(%p)::GetName () => %s", + static_cast<void*>(exe_ctx.GetThreadPtr()), + name ? name : "NULL"); return name; } @@ -497,12 +509,15 @@ SBThread::GetQueueName () const else { if (log) - log->Printf ("SBThread(%p)::GetQueueName() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetQueueName() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } - + if (log) - log->Printf ("SBThread(%p)::GetQueueName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL"); + log->Printf ("SBThread(%p)::GetQueueName () => %s", + static_cast<void*>(exe_ctx.GetThreadPtr()), + name ? name : "NULL"); return name; } @@ -525,12 +540,14 @@ SBThread::GetQueueID () const else { if (log) - log->Printf ("SBThread(%p)::GetQueueID() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetQueueID() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } - + if (log) - log->Printf ("SBThread(%p)::GetQueueID () => 0x%" PRIx64, exe_ctx.GetThreadPtr(), id); + log->Printf ("SBThread(%p)::GetQueueID () => 0x%" PRIx64, + static_cast<void*>(exe_ctx.GetThreadPtr()), id); return id; } @@ -587,9 +604,10 @@ SBThread::StepOver (lldb::RunMode stop_other_threads) if (log) - log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", exe_ctx.GetThreadPtr(), + log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", + static_cast<void*>(exe_ctx.GetThreadPtr()), Thread::RunModeAsCString (stop_other_threads)); - + if (exe_ctx.HasThreadScope()) { Thread *thread = exe_ctx.GetThreadPtr(); @@ -612,8 +630,8 @@ SBThread::StepOver (lldb::RunMode stop_other_threads) else { new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction (true, - abort_other_plans, - stop_other_threads); + abort_other_plans, + stop_other_threads); } } @@ -638,10 +656,10 @@ SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads) if (log) log->Printf ("SBThread(%p)::StepInto (target_name='%s', stop_other_threads='%s')", - exe_ctx.GetThreadPtr(), + static_cast<void*>(exe_ctx.GetThreadPtr()), target_name? target_name: "<NULL>", Thread::RunModeAsCString (stop_other_threads)); - + if (exe_ctx.HasThreadScope()) { bool abort_other_plans = false; @@ -666,10 +684,10 @@ SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads) else { new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction (false, - abort_other_plans, - stop_other_threads); + abort_other_plans, + stop_other_threads); } - + // This returns an error, we should use it! ResumeNewPlan (exe_ctx, new_plan_sp.get()); } @@ -685,8 +703,9 @@ SBThread::StepOut () if (log) - log->Printf ("SBThread(%p)::StepOut ()", exe_ctx.GetThreadPtr()); - + log->Printf ("SBThread(%p)::StepOut ()", + static_cast<void*>(exe_ctx.GetThreadPtr())); + if (exe_ctx.HasThreadScope()) { bool abort_other_plans = false; @@ -696,14 +715,14 @@ SBThread::StepOut () const LazyBool avoid_no_debug = eLazyBoolCalculate; ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut (abort_other_plans, - NULL, - false, - stop_other_threads, - eVoteYes, - eVoteNoOpinion, - 0, - avoid_no_debug)); - + NULL, + false, + stop_other_threads, + eVoteYes, + eVoteNoOpinion, + 0, + avoid_no_debug)); + // This returns an error, we should use it! ResumeNewPlan (exe_ctx, new_plan_sp.get()); } @@ -722,7 +741,10 @@ SBThread::StepOutOfFrame (lldb::SBFrame &sb_frame) { SBStream frame_desc_strm; sb_frame.GetDescription (frame_desc_strm); - log->Printf ("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)", exe_ctx.GetThreadPtr(), frame_sp.get(), frame_desc_strm.GetData()); + log->Printf ("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)", + static_cast<void*>(exe_ctx.GetThreadPtr()), + static_cast<void*>(frame_sp.get()), + frame_desc_strm.GetData()); } if (exe_ctx.HasThreadScope()) @@ -732,13 +754,13 @@ SBThread::StepOutOfFrame (lldb::SBFrame &sb_frame) Thread *thread = exe_ctx.GetThreadPtr(); ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut (abort_other_plans, - NULL, - false, - stop_other_threads, - eVoteYes, + NULL, + false, + stop_other_threads, + eVoteYes, eVoteNoOpinion, frame_sp->GetFrameIndex())); - + // This returns an error, we should use it! ResumeNewPlan (exe_ctx, new_plan_sp.get()); } @@ -755,13 +777,14 @@ SBThread::StepInstruction (bool step_over) if (log) - log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", exe_ctx.GetThreadPtr(), step_over); - + log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", + static_cast<void*>(exe_ctx.GetThreadPtr()), step_over); + if (exe_ctx.HasThreadScope()) { Thread *thread = exe_ctx.GetThreadPtr(); ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepSingleInstruction (step_over, true, true)); - + // This returns an error, we should use it! ResumeNewPlan (exe_ctx, new_plan_sp.get()); } @@ -777,8 +800,9 @@ SBThread::RunToAddress (lldb::addr_t addr) if (log) - log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")", exe_ctx.GetThreadPtr(), addr); - + log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")", + static_cast<void*>(exe_ctx.GetThreadPtr()), addr); + if (exe_ctx.HasThreadScope()) { bool abort_other_plans = false; @@ -789,7 +813,7 @@ SBThread::RunToAddress (lldb::addr_t addr) Thread *thread = exe_ctx.GetThreadPtr(); ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads)); - + // This returns an error, we should use it! ResumeNewPlan (exe_ctx, new_plan_sp.get()); } @@ -803,7 +827,7 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame, SBError sb_error; Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); char path[PATH_MAX]; - + Mutex::Locker api_locker; ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); @@ -814,11 +838,10 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame, SBStream frame_desc_strm; sb_frame.GetDescription (frame_desc_strm); sb_file_spec->GetPath (path, sizeof(path)); - log->Printf ("SBThread(%p)::StepOverUntil (frame = SBFrame(%p): %s, file+line = %s:%u)", - exe_ctx.GetThreadPtr(), - frame_sp.get(), - frame_desc_strm.GetData(), - path, line); + log->Printf ("SBThread(%p)::StepOverUntil (frame = SBFrame(%p): %s, file+line = %s:%u)", + static_cast<void*>(exe_ctx.GetThreadPtr()), + static_cast<void*>(frame_sp.get()), + frame_desc_strm.GetData(), path, line); } if (exe_ctx.HasThreadScope()) @@ -831,14 +854,14 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame, sb_error.SetErrorString("invalid line argument"); return sb_error; } - + if (!frame_sp) { frame_sp = thread->GetSelectedFrame (); if (!frame_sp) frame_sp = thread->GetStackFrameAtIndex (0); } - + SymbolContext frame_sc; if (!frame_sp) { @@ -851,13 +874,13 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame, eSymbolContextFunction | eSymbolContextLineEntry | eSymbolContextSymbol ); - + if (frame_sc.comp_unit == NULL) { sb_error.SetErrorStringWithFormat("frame %u doesn't have debug information", frame_sp->GetFrameIndex()); return sb_error; } - + FileSpec step_file_spec; if (sb_file_spec.IsValid()) { @@ -874,15 +897,15 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame, return sb_error; } } - + // Grab the current function, then we will make sure the "until" address is // within the function. We discard addresses that are out of the current // function, and then if there are no addresses remaining, give an appropriate // error message. - + bool all_in_function = true; AddressRange fun_range = frame_sc.function->GetAddressRange(); - + std::vector<addr_t> step_over_until_addrs; const bool abort_other_plans = false; const bool stop_other_threads = false; @@ -914,7 +937,7 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame, } } } - + if (step_over_until_addrs.empty()) { if (all_in_function) @@ -953,7 +976,9 @@ SBThread::JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line) ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); if (log) - log->Printf ("SBThread(%p)::JumpToLine (file+line = %s:%u)", exe_ctx.GetThreadPtr(), file_spec->GetPath().c_str(), line); + log->Printf ("SBThread(%p)::JumpToLine (file+line = %s:%u)", + static_cast<void*>(exe_ctx.GetThreadPtr()), + file_spec->GetPath().c_str(), line); if (!exe_ctx.HasThreadScope()) { @@ -972,7 +997,7 @@ SBError SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value) { SBError sb_error; - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); Mutex::Locker api_locker; @@ -980,14 +1005,16 @@ SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value) if (log) - log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)", exe_ctx.GetThreadPtr(), frame.GetFrameID()); - + log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)", + static_cast<void*>(exe_ctx.GetThreadPtr()), + frame.GetFrameID()); + if (exe_ctx.HasThreadScope()) { Thread *thread = exe_ctx.GetThreadPtr(); sb_error.SetError (thread->ReturnFromFrame(frame.GetFrameSP(), return_value.GetSP())); } - + return sb_error; } @@ -1009,11 +1036,13 @@ SBThread::Suspend() else { if (log) - log->Printf ("SBThread(%p)::Suspend() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::Suspend() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } if (log) - log->Printf ("SBThread(%p)::Suspend() => %i", exe_ctx.GetThreadPtr(), result); + log->Printf ("SBThread(%p)::Suspend() => %i", + static_cast<void*>(exe_ctx.GetThreadPtr()), result); return result; } @@ -1035,11 +1064,13 @@ SBThread::Resume () else { if (log) - log->Printf ("SBThread(%p)::Resume() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::Resume() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } if (log) - log->Printf ("SBThread(%p)::Resume() => %i", exe_ctx.GetThreadPtr(), result); + log->Printf ("SBThread(%p)::Resume() => %i", + static_cast<void*>(exe_ctx.GetThreadPtr()), result); return result; } @@ -1077,8 +1108,10 @@ SBThread::GetProcess () { SBStream frame_desc_strm; sb_process.GetDescription (frame_desc_strm); - log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s", exe_ctx.GetThreadPtr(), - sb_process.GetSP().get(), frame_desc_strm.GetData()); + log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s", + static_cast<void*>(exe_ctx.GetThreadPtr()), + static_cast<void*>(sb_process.GetSP().get()), + frame_desc_strm.GetData()); } return sb_process; @@ -1103,12 +1136,14 @@ SBThread::GetNumFrames () else { if (log) - log->Printf ("SBThread(%p)::GetNumFrames() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetNumFrames() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } if (log) - log->Printf ("SBThread(%p)::GetNumFrames () => %u", exe_ctx.GetThreadPtr(), num_frames); + log->Printf ("SBThread(%p)::GetNumFrames () => %u", + static_cast<void*>(exe_ctx.GetThreadPtr()), num_frames); return num_frames; } @@ -1134,7 +1169,8 @@ SBThread::GetFrameAtIndex (uint32_t idx) else { if (log) - log->Printf ("SBThread(%p)::GetFrameAtIndex() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetFrameAtIndex() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } @@ -1142,8 +1178,10 @@ SBThread::GetFrameAtIndex (uint32_t idx) { SBStream frame_desc_strm; sb_frame.GetDescription (frame_desc_strm); - log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s", - exe_ctx.GetThreadPtr(), idx, frame_sp.get(), frame_desc_strm.GetData()); + log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s", + static_cast<void*>(exe_ctx.GetThreadPtr()), idx, + static_cast<void*>(frame_sp.get()), + frame_desc_strm.GetData()); } return sb_frame; @@ -1170,7 +1208,8 @@ SBThread::GetSelectedFrame () else { if (log) - log->Printf ("SBThread(%p)::GetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetSelectedFrame() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } @@ -1178,8 +1217,10 @@ SBThread::GetSelectedFrame () { SBStream frame_desc_strm; sb_frame.GetDescription (frame_desc_strm); - log->Printf ("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s", - exe_ctx.GetThreadPtr(), frame_sp.get(), frame_desc_strm.GetData()); + log->Printf ("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s", + static_cast<void*>(exe_ctx.GetThreadPtr()), + static_cast<void*>(frame_sp.get()), + frame_desc_strm.GetData()); } return sb_frame; @@ -1211,7 +1252,8 @@ SBThread::SetSelectedFrame (uint32_t idx) else { if (log) - log->Printf ("SBThread(%p)::SetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::SetSelectedFrame() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } @@ -1219,8 +1261,10 @@ SBThread::SetSelectedFrame (uint32_t idx) { SBStream frame_desc_strm; sb_frame.GetDescription (frame_desc_strm); - log->Printf ("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s", - exe_ctx.GetThreadPtr(), idx, frame_sp.get(), frame_desc_strm.GetData()); + log->Printf ("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s", + static_cast<void*>(exe_ctx.GetThreadPtr()), idx, + static_cast<void*>(frame_sp.get()), + frame_desc_strm.GetData()); } return sb_frame; } @@ -1323,7 +1367,11 @@ SBThread::GetExtendedBacktraceThread (const char *type) const char *queue_name = new_thread_sp->GetQueueName(); if (queue_name == NULL) queue_name = ""; - log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => new extended Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'", exe_ctx.GetThreadPtr(), new_thread_sp.get(), new_thread_sp->GetQueueID(), queue_name); + log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => new extended Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'", + static_cast<void*>(exe_ctx.GetThreadPtr()), + static_cast<void*>(new_thread_sp.get()), + new_thread_sp->GetQueueID(), + queue_name); } } } @@ -1333,14 +1381,14 @@ SBThread::GetExtendedBacktraceThread (const char *type) else { if (log) - log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => error: process is running", exe_ctx.GetThreadPtr()); + log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => error: process is running", + static_cast<void*>(exe_ctx.GetThreadPtr())); } } if (log && sb_origin_thread.IsValid() == false) - { - log->Printf("SBThread(%p)::GetExtendedBacktraceThread() is not returning a Valid thread", exe_ctx.GetThreadPtr()); - } + log->Printf("SBThread(%p)::GetExtendedBacktraceThread() is not returning a Valid thread", + static_cast<void*>(exe_ctx.GetThreadPtr())); return sb_origin_thread; } diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index c379508ab05..f171d239913 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -58,7 +58,7 @@ public: ValueImpl () { } - + ValueImpl (lldb::ValueObjectSP in_valobj_sp, lldb::DynamicValueType use_dynamic, bool use_synthetic, @@ -71,7 +71,7 @@ public: if (!m_name.IsEmpty() && m_valobj_sp) m_valobj_sp->SetName(m_name); } - + ValueImpl (const ValueImpl& rhs) : m_valobj_sp(rhs.m_valobj_sp), m_use_dynamic(rhs.m_use_dynamic), @@ -79,7 +79,7 @@ public: m_name (rhs.m_name) { } - + ValueImpl & operator = (const ValueImpl &rhs) { @@ -92,7 +92,7 @@ public: } return *this; } - + bool IsValid () { @@ -115,13 +115,13 @@ public: return false; } } - + lldb::ValueObjectSP GetRootSP () { return m_valobj_sp; } - + lldb::ValueObjectSP GetSP (Process::StopLocker &stop_locker, Mutex::Locker &api_locker, Error &error) { @@ -131,26 +131,27 @@ public: error.SetErrorString("invalid value object"); return m_valobj_sp; } - + lldb::ValueObjectSP value_sp = m_valobj_sp; - + Target *target = value_sp->GetTargetSP().get(); if (target) api_locker.Lock(target->GetAPIMutex()); else return ValueObjectSP(); - + ProcessSP process_sp(value_sp->GetProcessSP()); if (process_sp && !stop_locker.TryLock (&process_sp->GetRunLock())) { // We don't allow people to play around with ValueObject if the process is running. // If you want to look at values, pause the process, then look. if (log) - log->Printf ("SBValue(%p)::GetSP() => error: process is running", value_sp.get()); + log->Printf ("SBValue(%p)::GetSP() => error: process is running", + static_cast<void*>(value_sp.get())); error.SetErrorString ("process must be stopped."); return ValueObjectSP(); } - + if (value_sp->GetDynamicValue(m_use_dynamic)) value_sp = value_sp->GetDynamicValue(m_use_dynamic); if (value_sp->GetSyntheticValue(m_use_synthetic)) @@ -159,34 +160,34 @@ public: error.SetErrorString("invalid value object"); if (!m_name.IsEmpty()) value_sp->SetName(m_name); - + return value_sp; } - + void SetUseDynamic (lldb::DynamicValueType use_dynamic) { m_use_dynamic = use_dynamic; } - + void SetUseSynthetic (bool use_synthetic) { m_use_synthetic = use_synthetic; } - + lldb::DynamicValueType GetUseDynamic () { return m_use_dynamic; } - + bool GetUseSynthetic () { return m_use_synthetic; } - + // All the derived values that we would make from the m_valobj_sp will share // the ExecutionContext with m_valobj_sp, so we don't need to do the calculations // in GetSP to return the Target, Process, Thread or Frame. It is convenient to @@ -199,7 +200,7 @@ public: else return TargetSP(); } - + ProcessSP GetProcessSP () { @@ -208,7 +209,7 @@ public: else return ProcessSP(); } - + ThreadSP GetThreadSP () { @@ -217,7 +218,7 @@ public: else return ThreadSP(); } - + StackFrameSP GetFrameSP () { @@ -226,7 +227,7 @@ public: else return StackFrameSP(); } - + private: lldb::ValueObjectSP m_valobj_sp; lldb::DynamicValueType m_use_dynamic; @@ -337,16 +338,18 @@ SBValue::GetName() lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) name = value_sp->GetName().GetCString(); - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (name) - log->Printf ("SBValue(%p)::GetName () => \"%s\"", value_sp.get(), name); + log->Printf ("SBValue(%p)::GetName () => \"%s\"", + static_cast<void*>(value_sp.get()), name); else - log->Printf ("SBValue(%p)::GetName () => NULL", value_sp.get()); + log->Printf ("SBValue(%p)::GetName () => NULL", + static_cast<void*>(value_sp.get())); } - + return name; } @@ -361,15 +364,17 @@ SBValue::GetTypeName () { name = value_sp->GetQualifiedTypeName().GetCString(); } - + if (log) { if (name) - log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"", value_sp.get(), name); + log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"", + static_cast<void*>(value_sp.get()), name); else - log->Printf ("SBValue(%p)::GetTypeName () => NULL", value_sp.get()); + log->Printf ("SBValue(%p)::GetTypeName () => NULL", + static_cast<void*>(value_sp.get())); } - + return name; } @@ -378,17 +383,19 @@ SBValue::GetByteSize () { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); size_t result = 0; - + ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { result = value_sp->GetByteSize(); } - + if (log) - log->Printf ("SBValue(%p)::GetByteSize () => %" PRIu64, value_sp.get(), (uint64_t)result); - + log->Printf ("SBValue(%p)::GetByteSize () => %" PRIu64, + static_cast<void*>(value_sp.get()), + static_cast<uint64_t>(result)); + return result; } @@ -396,18 +403,19 @@ bool SBValue::IsInScope () { bool result = false; - + ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { result = value_sp->IsInScope (); } - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBValue(%p)::IsInScope () => %i", value_sp.get(), result); - + log->Printf ("SBValue(%p)::IsInScope () => %i", + static_cast<void*>(value_sp.get()), result); + return result; } @@ -415,7 +423,7 @@ const char * SBValue::GetValue () { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + const char *cstr = NULL; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); @@ -426,11 +434,13 @@ SBValue::GetValue () if (log) { if (cstr) - log->Printf ("SBValue(%p)::GetValue() => \"%s\"", value_sp.get(), cstr); + log->Printf ("SBValue(%p)::GetValue() => \"%s\"", + static_cast<void*>(value_sp.get()), cstr); else - log->Printf ("SBValue(%p)::GetValue() => NULL", value_sp.get()); + log->Printf ("SBValue(%p)::GetValue() => NULL", + static_cast<void*>(value_sp.get())); } - + return cstr; } @@ -442,20 +452,44 @@ SBValue::GetValueType () lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) result = value_sp->GetValueType(); - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { switch (result) { - case eValueTypeInvalid: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid", value_sp.get()); break; - case eValueTypeVariableGlobal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal", value_sp.get()); break; - case eValueTypeVariableStatic: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic", value_sp.get()); break; - case eValueTypeVariableArgument:log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument", value_sp.get()); break; - case eValueTypeVariableLocal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal", value_sp.get()); break; - case eValueTypeRegister: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister", value_sp.get()); break; - case eValueTypeRegisterSet: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet", value_sp.get()); break; - case eValueTypeConstResult: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult", value_sp.get()); break; + case eValueTypeInvalid: + log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid", + static_cast<void*>(value_sp.get())); + break; + case eValueTypeVariableGlobal: + log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal", + static_cast<void*>(value_sp.get())); + break; + case eValueTypeVariableStatic: + log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic", + static_cast<void*>(value_sp.get())); + break; + case eValueTypeVariableArgument: + log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument", + static_cast<void*>(value_sp.get())); + break; + case eValueTypeVariableLocal: + log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal", + static_cast<void*>(value_sp.get())); + break; + case eValueTypeRegister: + log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister", + static_cast<void*>(value_sp.get())); + break; + case eValueTypeRegisterSet: + log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet", + static_cast<void*>(value_sp.get())); + break; + case eValueTypeConstResult: + log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult", + static_cast<void*>(value_sp.get())); + break; } } return result; @@ -475,9 +509,11 @@ SBValue::GetObjectDescription () if (log) { if (cstr) - log->Printf ("SBValue(%p)::GetObjectDescription() => \"%s\"", value_sp.get(), cstr); + log->Printf ("SBValue(%p)::GetObjectDescription() => \"%s\"", + static_cast<void*>(value_sp.get()), cstr); else - log->Printf ("SBValue(%p)::GetObjectDescription() => NULL", value_sp.get()); + log->Printf ("SBValue(%p)::GetObjectDescription() => NULL", + static_cast<void*>(value_sp.get())); } return cstr; } @@ -498,9 +534,12 @@ SBValue::GetType() if (log) { if (type_sp) - log->Printf ("SBValue(%p)::GetType => SBType(%p)", value_sp.get(), type_sp.get()); + log->Printf ("SBValue(%p)::GetType => SBType(%p)", + static_cast<void*>(value_sp.get()), + static_cast<void*>(type_sp.get())); else - log->Printf ("SBValue(%p)::GetType => NULL", value_sp.get()); + log->Printf ("SBValue(%p)::GetType => NULL", + static_cast<void*>(value_sp.get())); } return sb_type; } @@ -517,8 +556,9 @@ SBValue::GetValueDidChange () result = value_sp->GetValueDidChange (); } if (log) - log->Printf ("SBValue(%p)::GetValueDidChange() => %i", value_sp.get(), result); - + log->Printf ("SBValue(%p)::GetValueDidChange() => %i", + static_cast<void*>(value_sp.get()), result); + return result; } @@ -537,9 +577,11 @@ SBValue::GetSummary () if (log) { if (cstr) - log->Printf ("SBValue(%p)::GetSummary() => \"%s\"", value_sp.get(), cstr); + log->Printf ("SBValue(%p)::GetSummary() => \"%s\"", + static_cast<void*>(value_sp.get()), cstr); else - log->Printf ("SBValue(%p)::GetSummary() => NULL", value_sp.get()); + log->Printf ("SBValue(%p)::GetSummary() => NULL", + static_cast<void*>(value_sp.get())); } return cstr; } @@ -559,9 +601,11 @@ SBValue::GetLocation () if (log) { if (cstr) - log->Printf ("SBValue(%p)::GetLocation() => \"%s\"", value_sp.get(), cstr); + log->Printf ("SBValue(%p)::GetLocation() => \"%s\"", + static_cast<void*>(value_sp.get()), cstr); else - log->Printf ("SBValue(%p)::GetLocation() => NULL", value_sp.get()); + log->Printf ("SBValue(%p)::GetLocation() => NULL", + static_cast<void*>(value_sp.get())); } return cstr; } @@ -587,10 +631,11 @@ SBValue::SetValueFromCString (const char *value_str, lldb::SBError& error) } else error.SetErrorStringWithFormat ("Could not get value: %s", locker.GetError().AsCString()); - + if (log) - log->Printf ("SBValue(%p)::SetValueFromCString(\"%s\") => %i", value_sp.get(), value_str, success); - + log->Printf ("SBValue(%p)::SetValueFromCString(\"%s\") => %i", + static_cast<void*>(value_sp.get()), value_str, success); + return success; } @@ -698,11 +743,11 @@ SBValue::CreateChildAtOffset (const char *name, uint32_t offset, SBType type) { if (new_value_sp) log->Printf ("SBValue(%p)::CreateChildAtOffset => \"%s\"", - value_sp.get(), + static_cast<void*>(value_sp.get()), new_value_sp->GetName().AsCString()); else log->Printf ("SBValue(%p)::CreateChildAtOffset => NULL", - value_sp.get()); + static_cast<void*>(value_sp.get())); } return sb_value; } @@ -757,15 +802,11 @@ SBValue::CreateValueFromExpression (const char *name, const char *expression, SB { if (new_value_sp) log->Printf ("SBValue(%p)::CreateValueFromExpression(name=\"%s\", expression=\"%s\") => SBValue (%p)", - value_sp.get(), - name, - expression, - new_value_sp.get()); + static_cast<void*>(value_sp.get()), name, expression, + static_cast<void*>(new_value_sp.get())); else log->Printf ("SBValue(%p)::CreateValueFromExpression(name=\"%s\", expression=\"%s\") => NULL", - value_sp.get(), - name, - expression); + static_cast<void*>(value_sp.get()), name, expression); } return sb_value; } @@ -784,7 +825,7 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s if (pointer_ast_type) { lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t))); - + ExecutionContext exe_ctx (value_sp->GetExecutionContextRef()); ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), pointer_ast_type, @@ -792,7 +833,7 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s buffer, exe_ctx.GetByteOrder(), exe_ctx.GetAddressByteSize())); - + if (ptr_result_valobj_sp) { ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress); @@ -808,9 +849,12 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s if (log) { if (new_value_sp) - log->Printf ("SBValue(%p)::CreateValueFromAddress => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString()); + log->Printf ("SBValue(%p)::CreateValueFromAddress => \"%s\"", + static_cast<void*>(value_sp.get()), + new_value_sp->GetName().AsCString()); else - log->Printf ("SBValue(%p)::CreateValueFromAddress => NULL", value_sp.get()); + log->Printf ("SBValue(%p)::CreateValueFromAddress => NULL", + static_cast<void*>(value_sp.get())); } return sb_value; } @@ -825,7 +869,7 @@ SBValue::CreateValueFromData (const char* name, SBData data, SBType type) if (value_sp) { ExecutionContext exe_ctx (value_sp->GetExecutionContextRef()); - + new_value_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), type.m_opaque_sp->GetClangASTType(false), ConstString(name), @@ -838,9 +882,12 @@ SBValue::CreateValueFromData (const char* name, SBData data, SBType type) if (log) { if (new_value_sp) - log->Printf ("SBValue(%p)::CreateValueFromData => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString()); + log->Printf ("SBValue(%p)::CreateValueFromData => \"%s\"", + static_cast<void*>(value_sp.get()), + new_value_sp->GetName().AsCString()); else - log->Printf ("SBValue(%p)::CreateValueFromData => NULL", value_sp.get()); + log->Printf ("SBValue(%p)::CreateValueFromData => NULL", + static_cast<void*>(value_sp.get())); } return sb_value; } @@ -865,7 +912,7 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool { lldb::ValueObjectSP child_sp; Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) @@ -884,12 +931,14 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool } } } - + SBValue sb_value; sb_value.SetSP (child_sp, use_dynamic, GetPreferSyntheticValue()); if (log) - log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", value_sp.get(), idx, value_sp.get()); - + log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", + static_cast<void*>(value_sp.get()), idx, + static_cast<void*>(value_sp.get())); + return sb_value; } @@ -907,9 +956,11 @@ SBValue::GetIndexOfChildWithName (const char *name) if (log) { if (idx == UINT32_MAX) - log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND", value_sp.get(), name); + log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND", + static_cast<void*>(value_sp.get()), name); else - log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u", value_sp.get(), name, idx); + log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u", + static_cast<void*>(value_sp.get()), name, idx); } return idx; } @@ -921,7 +972,7 @@ SBValue::GetChildMemberWithName (const char *name) TargetSP target_sp; if (m_opaque_sp) target_sp = m_opaque_sp->GetTargetSP(); - + if (target_sp) use_dynamic_value = target_sp->GetPreferDynamicValue(); return GetChildMemberWithName (name, use_dynamic_value); @@ -932,22 +983,24 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy { lldb::ValueObjectSP child_sp; const ConstString str_name (name); - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - + ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { child_sp = value_sp->GetChildMemberWithName (str_name, true); } - + SBValue sb_value; sb_value.SetSP(child_sp, use_dynamic_value, GetPreferSyntheticValue()); - + if (log) - log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", value_sp.get(), name, value_sp.get()); - + log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", + static_cast<void*>(value_sp.get()), name, + static_cast<void*>(value_sp.get())); + return sb_value; } @@ -1049,13 +1102,15 @@ SBValue::GetValueForExpressionPath(const char* expr_path) // using default values for all the fancy options, just do it if you can child_sp = value_sp->GetValueForExpressionPath(expr_path); } - + SBValue sb_value; sb_value.SetSP(child_sp,GetPreferDynamicValue(),GetPreferSyntheticValue()); - + if (log) - log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)", value_sp.get(), expr_path, value_sp.get()); - + log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)", + static_cast<void*>(value_sp.get()), expr_path, + static_cast<void*>(value_sp.get())); + return sb_value; } @@ -1134,9 +1189,10 @@ SBValue::MightHaveChildren () lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) has_children = value_sp->MightHaveChildren(); - + if (log) - log->Printf ("SBValue(%p)::MightHaveChildren() => %i", value_sp.get(), has_children); + log->Printf ("SBValue(%p)::MightHaveChildren() => %i", + static_cast<void*>(value_sp.get()), has_children); return has_children; } @@ -1144,16 +1200,17 @@ uint32_t SBValue::GetNumChildren () { uint32_t num_children = 0; - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) num_children = value_sp->GetNumChildren(); - + if (log) - log->Printf ("SBValue(%p)::GetNumChildren () => %u", value_sp.get(), num_children); - + log->Printf ("SBValue(%p)::GetNumChildren () => %u", + static_cast<void*>(value_sp.get()), num_children); + return num_children; } @@ -1171,8 +1228,10 @@ SBValue::Dereference () } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", value_sp.get(), value_sp.get()); - + log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", + static_cast<void*>(value_sp.get()), + static_cast<void*>(value_sp.get())); + return sb_value; } @@ -1180,17 +1239,17 @@ bool SBValue::TypeIsPointerType () { bool is_ptr_type = false; - + ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) is_ptr_type = value_sp->IsPointerType(); - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", value_sp.get(), is_ptr_type); - - + log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", + static_cast<void*>(value_sp.get()), is_ptr_type); + return is_ptr_type; } @@ -1218,9 +1277,12 @@ SBValue::GetTarget() if (log) { if (target_sp.get() == NULL) - log->Printf ("SBValue(%p)::GetTarget () => NULL", m_opaque_sp.get()); + log->Printf ("SBValue(%p)::GetTarget () => NULL", + static_cast<void*>(m_opaque_sp.get())); else - log->Printf ("SBValue(%p)::GetTarget () => %p", m_opaque_sp.get(), target_sp.get()); + log->Printf ("SBValue(%p)::GetTarget () => %p", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(target_sp.get())); } return sb_target; } @@ -1239,9 +1301,12 @@ SBValue::GetProcess() if (log) { if (process_sp.get() == NULL) - log->Printf ("SBValue(%p)::GetProcess () => NULL", m_opaque_sp.get()); + log->Printf ("SBValue(%p)::GetProcess () => NULL", + static_cast<void*>(m_opaque_sp.get())); else - log->Printf ("SBValue(%p)::GetProcess () => %p", m_opaque_sp.get(), process_sp.get()); + log->Printf ("SBValue(%p)::GetProcess () => %p", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(process_sp.get())); } return sb_process; } @@ -1260,9 +1325,12 @@ SBValue::GetThread() if (log) { if (thread_sp.get() == NULL) - log->Printf ("SBValue(%p)::GetThread () => NULL", m_opaque_sp.get()); + log->Printf ("SBValue(%p)::GetThread () => NULL", + static_cast<void*>(m_opaque_sp.get())); else - log->Printf ("SBValue(%p)::GetThread () => %p", m_opaque_sp.get(), thread_sp.get()); + log->Printf ("SBValue(%p)::GetThread () => %p", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(thread_sp.get())); } return sb_thread; } @@ -1281,9 +1349,12 @@ SBValue::GetFrame() if (log) { if (frame_sp.get() == NULL) - log->Printf ("SBValue(%p)::GetFrame () => NULL", m_opaque_sp.get()); + log->Printf ("SBValue(%p)::GetFrame () => NULL", + static_cast<void*>(m_opaque_sp.get())); else - log->Printf ("SBValue(%p)::GetFrame () => %p", m_opaque_sp.get(), frame_sp.get()); + log->Printf ("SBValue(%p)::GetFrame () => %p", + static_cast<void*>(m_opaque_sp.get()), + static_cast<void*>(frame_sp.get())); } return sb_frame; } @@ -1450,8 +1521,10 @@ SBValue::AddressOf() } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBValue(%p)::AddressOf () => SBValue(%p)", value_sp.get(), value_sp.get()); - + log->Printf ("SBValue(%p)::AddressOf () => SBValue(%p)", + static_cast<void*>(value_sp.get()), + static_cast<void*>(value_sp.get())); + return sb_value; } @@ -1487,8 +1560,9 @@ SBValue::GetLoadAddress() } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBValue(%p)::GetLoadAddress () => (%" PRIu64 ")", value_sp.get(), value); - + log->Printf ("SBValue(%p)::GetLoadAddress () => (%" PRIu64 ")", + static_cast<void*>(value_sp.get()), value); + return value; } @@ -1524,8 +1598,11 @@ SBValue::GetAddress() } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBValue(%p)::GetAddress () => (%s,%" PRIu64 ")", value_sp.get(), - (addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"), + log->Printf ("SBValue(%p)::GetAddress () => (%s,%" PRIu64 ")", + static_cast<void*>(value_sp.get()), + (addr.GetSection() + ? addr.GetSection()->GetName().GetCString() + : "NULL"), addr.GetOffset()); return SBAddress(new Address(addr)); } @@ -1551,11 +1628,9 @@ SBValue::GetPointeeData (uint32_t item_idx, } if (log) log->Printf ("SBValue(%p)::GetPointeeData (%d, %d) => SBData(%p)", - value_sp.get(), - item_idx, - item_count, - sb_data.get()); - + static_cast<void*>(value_sp.get()), item_idx, item_count, + static_cast<void*>(sb_data.get())); + return sb_data; } @@ -1576,9 +1651,9 @@ SBValue::GetData () } if (log) log->Printf ("SBValue(%p)::GetData () => SBData(%p)", - value_sp.get(), - sb_data.get()); - + static_cast<void*>(value_sp.get()), + static_cast<void*>(sb_data.get())); + return sb_data; } @@ -1589,25 +1664,26 @@ SBValue::SetData (lldb::SBData &data, SBError &error) ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); bool ret = true; - + if (value_sp) { DataExtractor *data_extractor = data.get(); - + if (!data_extractor) { if (log) - log->Printf ("SBValue(%p)::SetData() => error: no data to set", value_sp.get()); - + log->Printf ("SBValue(%p)::SetData() => error: no data to set", + static_cast<void*>(value_sp.get())); + error.SetErrorString("No data to set"); ret = false; } else { Error set_error; - + value_sp->SetData(*data_extractor, set_error); - + if (!set_error.Success()) { error.SetErrorStringWithFormat("Couldn't set data: %s", set_error.AsCString()); @@ -1620,12 +1696,11 @@ SBValue::SetData (lldb::SBData &data, SBError &error) error.SetErrorStringWithFormat ("Couldn't set data: could not get SBValue: %s", locker.GetError().AsCString()); ret = false; } - + if (log) log->Printf ("SBValue(%p)::SetData (%p) => %s", - value_sp.get(), - data.get(), - ret ? "true" : "false"); + static_cast<void*>(value_sp.get()), + static_cast<void*>(data.get()), ret ? "true" : "false"); return ret; } @@ -1648,7 +1723,7 @@ lldb::SBWatchpoint SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error) { SBWatchpoint sb_watchpoint; - + // If the SBValue is not valid, there's no point in even trying to watch it. ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); @@ -1658,29 +1733,29 @@ SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error) // Read and Write cannot both be false. if (!read && !write) return sb_watchpoint; - + // If the value is not in scope, don't try and watch and invalid value if (!IsInScope()) return sb_watchpoint; - + addr_t addr = GetLoadAddress(); if (addr == LLDB_INVALID_ADDRESS) return sb_watchpoint; size_t byte_size = GetByteSize(); if (byte_size == 0) return sb_watchpoint; - + uint32_t watch_type = 0; if (read) watch_type |= LLDB_WATCH_TYPE_READ; if (write) watch_type |= LLDB_WATCH_TYPE_WRITE; - + Error rc; ClangASTType type (value_sp->GetClangType()); WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc); error.SetError(rc); - + if (watchpoint_sp) { sb_watchpoint.SetSP (watchpoint_sp); @@ -1701,18 +1776,21 @@ SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBValue(%p)::Watch() => error getting SBValue: %s", value_sp.get(), locker.GetError().AsCString()); - + log->Printf ("SBValue(%p)::Watch() => error getting SBValue: %s", + static_cast<void*>(value_sp.get()), + locker.GetError().AsCString()); + error.SetErrorStringWithFormat("could not get SBValue: %s", locker.GetError().AsCString()); } else { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBValue(%p)::Watch() => error getting SBValue: no target", value_sp.get()); + log->Printf ("SBValue(%p)::Watch() => error getting SBValue: no target", + static_cast<void*>(value_sp.get())); error.SetErrorString("could not set watchpoint, a target is required"); } - + return sb_watchpoint; } diff --git a/lldb/source/API/SBValueList.cpp b/lldb/source/API/SBValueList.cpp index 46866eb3742..5069ed3f562 100644 --- a/lldb/source/API/SBValueList.cpp +++ b/lldb/source/API/SBValueList.cpp @@ -99,8 +99,8 @@ SBValueList::SBValueList (const SBValueList &rhs) : if (log) { log->Printf ("SBValueList::SBValueList (rhs.ap=%p) => this.ap = %p", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), - m_opaque_ap.get()); + static_cast<void*>(rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), + static_cast<void*>(m_opaque_ap.get())); } } @@ -114,9 +114,9 @@ SBValueList::SBValueList (const ValueListImpl *lldb_object_ptr) : if (log) { - log->Printf ("SBValueList::SBValueList (lldb_object_ptr=%p) => this.ap = %p", - lldb_object_ptr, - m_opaque_ap.get()); + log->Printf ("SBValueList::SBValueList (lldb_object_ptr=%p) => this.ap = %p", + static_cast<const void*>(lldb_object_ptr), + static_cast<void*>(m_opaque_ap.get())); } } @@ -218,7 +218,8 @@ SBValueList::GetValueAtIndex (uint32_t idx) const SBStream sstr; sb_value.GetDescription (sstr); log->Printf ("SBValueList::GetValueAtIndex (this.ap=%p, idx=%d) => SBValue (this.sp = %p, '%s')", - m_opaque_ap.get(), idx, sb_value.GetSP().get(), sstr.GetData()); + static_cast<void*>(m_opaque_ap.get()), idx, + static_cast<void*>(sb_value.GetSP().get()), sstr.GetData()); } return sb_value; @@ -237,7 +238,8 @@ SBValueList::GetSize () const size = m_opaque_ap->GetSize(); if (log) - log->Printf ("SBValueList::GetSize (this.ap=%p) => %d", m_opaque_ap.get(), size); + log->Printf ("SBValueList::GetSize (this.ap=%p) => %d", + static_cast<void*>(m_opaque_ap.get()), size); return size; } diff --git a/lldb/source/API/SBWatchpoint.cpp b/lldb/source/API/SBWatchpoint.cpp index 194695c31d5..1a1a970aaa8 100644 --- a/lldb/source/API/SBWatchpoint.cpp +++ b/lldb/source/API/SBWatchpoint.cpp @@ -42,7 +42,9 @@ SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp) : SBStream sstr; GetDescription (sstr, lldb::eDescriptionLevelBrief); log->Printf ("SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp" - "=%p) => this.sp = %p (%s)", wp_sp.get(), m_opaque_sp.get(), sstr.GetData()); + "=%p) => this.sp = %p (%s)", + static_cast<void*>(wp_sp.get()), + static_cast<void*>(m_opaque_sp.get()), sstr.GetData()); } } @@ -77,9 +79,11 @@ SBWatchpoint::GetID () if (log) { if (watch_id == LLDB_INVALID_WATCH_ID) - log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID", watchpoint_sp.get()); + log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID", + static_cast<void*>(watchpoint_sp.get())); else - log->Printf ("SBWatchpoint(%p)::GetID () => %u", watchpoint_sp.get(), watch_id); + log->Printf ("SBWatchpoint(%p)::GetID () => %u", + static_cast<void*>(watchpoint_sp.get()), watch_id); } return watch_id; @@ -185,7 +189,8 @@ SBWatchpoint::GetHitCount () Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u", watchpoint_sp.get(), count); + log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u", + static_cast<void*>(watchpoint_sp.get()), count); return count; } diff --git a/lldb/source/Breakpoint/BreakpointID.cpp b/lldb/source/Breakpoint/BreakpointID.cpp index 9a59e29d007..9963ed68303 100644 --- a/lldb/source/Breakpoint/BreakpointID.cpp +++ b/lldb/source/Breakpoint/BreakpointID.cpp @@ -71,7 +71,7 @@ void BreakpointID::GetDescription (Stream *s, lldb::DescriptionLevel level) { if (level == eDescriptionLevelVerbose) - s->Printf("%p BreakpointID:", this); + s->Printf("%p BreakpointID:", static_cast<void*>(this)); if (m_break_id == LLDB_INVALID_BREAK_ID) s->PutCString ("<invalid>"); diff --git a/lldb/source/Breakpoint/BreakpointList.cpp b/lldb/source/Breakpoint/BreakpointList.cpp index 147ad36b040..65073776154 100644 --- a/lldb/source/Breakpoint/BreakpointList.cpp +++ b/lldb/source/Breakpoint/BreakpointList.cpp @@ -167,7 +167,7 @@ void BreakpointList::Dump (Stream *s) const { Mutex::Locker locker(m_mutex); - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<const void*>(this)); s->Indent(); s->Printf("BreakpointList with %u Breakpoints:\n", (uint32_t)m_breakpoints.size()); s->IndentMore(); diff --git a/lldb/source/Breakpoint/BreakpointLocationList.cpp b/lldb/source/Breakpoint/BreakpointLocationList.cpp index 917c776e75d..ae7f863ad09 100644 --- a/lldb/source/Breakpoint/BreakpointLocationList.cpp +++ b/lldb/source/Breakpoint/BreakpointLocationList.cpp @@ -152,7 +152,7 @@ BreakpointLocationList::FindByAddress (const Address &addr) const void BreakpointLocationList::Dump (Stream *s) const { - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<const void*>(this)); //s->Indent(); Mutex::Locker locker (m_mutex); s->Printf("BreakpointLocationList with %" PRIu64 " BreakpointLocations:\n", (uint64_t)m_locations.size()); diff --git a/lldb/source/Breakpoint/BreakpointSiteList.cpp b/lldb/source/Breakpoint/BreakpointSiteList.cpp index 68c4af18ec5..1eaadb62a38 100644 --- a/lldb/source/Breakpoint/BreakpointSiteList.cpp +++ b/lldb/source/Breakpoint/BreakpointSiteList.cpp @@ -186,7 +186,7 @@ BreakpointSiteList::BreakpointSiteContainsBreakpoint (lldb::break_id_t bp_site_i void BreakpointSiteList::Dump (Stream *s) const { - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<const void*>(this)); //s->Indent(); s->Printf("BreakpointSiteList with %u BreakpointSites:\n", (uint32_t)m_bp_site_list.size()); s->IndentMore(); diff --git a/lldb/source/Breakpoint/WatchpointList.cpp b/lldb/source/Breakpoint/WatchpointList.cpp index 6d62dffd22c..472bae06b44 100644 --- a/lldb/source/Breakpoint/WatchpointList.cpp +++ b/lldb/source/Breakpoint/WatchpointList.cpp @@ -55,7 +55,7 @@ void WatchpointList::DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const { Mutex::Locker locker (m_mutex); - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<const void*>(this)); //s->Indent(); s->Printf("WatchpointList with %" PRIu64 " Watchpoints:\n", (uint64_t)m_watchpoints.size()); diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index fa19bf3968c..de4877257e0 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -63,18 +63,18 @@ static void DumpTargetInfo (uint32_t target_idx, Target *target, const char *prefix_cstr, bool show_stopped_process_status, Stream &strm) { const ArchSpec &target_arch = target->GetArchitecture(); - + Module *exe_module = target->GetExecutableModulePointer(); char exe_path[PATH_MAX]; bool exe_valid = false; if (exe_module) exe_valid = exe_module->GetFileSpec().GetPath (exe_path, sizeof(exe_path)); - + if (!exe_valid) ::strcpy (exe_path, "<none>"); - + strm.Printf ("%starget #%u: %s", prefix_cstr ? prefix_cstr : "", target_idx, exe_path); - + uint32_t properties = 0; if (target_arch.IsValid()) { @@ -84,7 +84,7 @@ DumpTargetInfo (uint32_t target_idx, Target *target, const char *prefix_cstr, bo PlatformSP platform_sp (target->GetPlatform()); if (platform_sp) strm.Printf ("%splatform=%s", properties++ > 0 ? ", " : " ( ", platform_sp->GetName().GetCString()); - + ProcessSP process_sp (target->GetProcessSP()); bool show_process_status = false; if (process_sp) @@ -123,7 +123,7 @@ DumpTargetList (TargetList &target_list, bool show_stopped_process_status, Strea { const uint32_t num_targets = target_list.GetNumTargets(); if (num_targets) - { + { TargetSP selected_target_sp (target_list.GetSelectedTarget()); strm.PutCString ("Current targets:\n"); for (uint32_t i=0; i<num_targets; ++i) @@ -167,17 +167,17 @@ public: { CommandArgumentEntry arg; CommandArgumentData file_arg; - + // Define the first (and only) variant of this arg. file_arg.arg_type = eArgTypeFilename; file_arg.arg_repetition = eArgRepeatPlain; - + // There is only one variant this argument could be; put it into the argument entry. arg.push_back (file_arg); - + // Push the data for the first argument into the m_arguments vector. m_arguments.push_back (arg); - + m_option_group.Append (&m_arch_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); m_option_group.Append (&m_platform_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); m_option_group.Append (&m_core_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); @@ -210,7 +210,7 @@ public: { std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); - + CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, CommandCompletions::eDiskFileCompletion, completion_str.c_str(), @@ -248,12 +248,12 @@ protected: const char *file_path = command.GetArgumentAtIndex(0); Timer scoped_timer(__PRETTY_FUNCTION__, "(lldb) target create '%s'", file_path); FileSpec file_spec; - + if (file_path) file_spec.SetFile (file_path, true); - + bool must_set_platform_path = false; - + Debugger &debugger = m_interpreter.GetDebugger(); PlatformSP platform_sp(debugger.GetPlatformList().GetSelectedPlatform ()); @@ -334,7 +334,7 @@ protected: } } } - + debugger.GetTargetList().SetSelectedTarget(target_sp.get()); if (must_set_platform_path) { @@ -352,7 +352,7 @@ protected: FileSpec core_file_dir; core_file_dir.GetDirectory() = core_file.GetDirectory(); target_sp->GetExecutableSearchPaths ().Append (core_file_dir); - + ProcessSP process_sp (target_sp->CreateProcess (m_interpreter.GetDebugger().GetListener(), NULL, &core_file)); if (process_sp) @@ -360,7 +360,7 @@ protected: // Seems wierd that we Launch a core file, but that is // what we do! error = process_sp->LoadCore(); - + if (error.Fail()) { result.AppendError(error.AsCString("can't find plug-in for core file")); @@ -403,7 +403,6 @@ protected: result.SetStatus (eReturnStatusFailed); } return result.Succeeded(); - } private: @@ -434,12 +433,12 @@ public: 0) { } - + virtual ~CommandObjectTargetList () { } - + protected: virtual bool DoExecute (Args& args, CommandReturnObject &result) @@ -447,7 +446,7 @@ protected: if (args.GetArgumentCount() == 0) { Stream &strm = result.GetOutputStream(); - + bool show_stopped_process_status = false; if (DumpTargetList (m_interpreter.GetDebugger().GetTargetList(), show_stopped_process_status, strm) == 0) { @@ -482,12 +481,12 @@ public: 0) { } - + virtual ~CommandObjectTargetSelect () { } - + protected: virtual bool DoExecute (Args& args, CommandReturnObject &result) @@ -562,12 +561,12 @@ public: m_option_group.Append (&m_cleanup_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); m_option_group.Finalize(); } - + virtual ~CommandObjectTargetDelete () { } - + Options * GetOptions () { @@ -600,7 +599,7 @@ protected: if (success) { if (target_idx < num_targets) - { + { target_sp = target_list.GetTargetAtIndex (target_idx); if (target_sp) { @@ -626,7 +625,6 @@ protected: success = false; } } - } else { @@ -661,10 +659,10 @@ protected: result.GetOutputStream().Printf("%u targets deleted.\n", (uint32_t)num_targets_to_delete); result.SetStatus(eReturnStatusSuccessFinishResult); } - + return result.Succeeded(); } - + OptionGroupOptions m_option_group; OptionGroupBoolean m_cleanup_option; }; @@ -701,17 +699,17 @@ public: { CommandArgumentEntry arg; CommandArgumentData var_name_arg; - + // Define the first (and only) variant of this arg. var_name_arg.arg_type = eArgTypeVarName; var_name_arg.arg_repetition = eArgRepeatPlus; - + // There is only one variant this argument could be; put it into the argument entry. arg.push_back (var_name_arg); - + // Push the data for the first argument into the m_arguments vector. m_arguments.push_back (arg); - + m_option_group.Append (&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); m_option_group.Append (&m_option_variable, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); m_option_group.Append (&m_option_format, OptionGroupFormat::OPTION_GROUP_FORMAT | OptionGroupFormat::OPTION_GROUP_GDB_FMT, LLDB_OPT_SET_1); @@ -719,7 +717,7 @@ public: m_option_group.Append (&m_option_shared_libraries, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); m_option_group.Finalize(); } - + virtual ~CommandObjectTargetVariable () { @@ -729,33 +727,33 @@ public: DumpValueObject (Stream &s, VariableSP &var_sp, ValueObjectSP &valobj_sp, const char *root_name) { DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions()); - + switch (var_sp->GetScope()) { case eValueTypeVariableGlobal: if (m_option_variable.show_scope) s.PutCString("GLOBAL: "); break; - + case eValueTypeVariableStatic: if (m_option_variable.show_scope) s.PutCString("STATIC: "); break; - + case eValueTypeVariableArgument: if (m_option_variable.show_scope) s.PutCString(" ARG: "); break; - + case eValueTypeVariableLocal: if (m_option_variable.show_scope) s.PutCString(" LOCAL: "); break; - + default: break; } - + if (m_option_variable.show_decl) { bool show_fullpaths = false; @@ -763,17 +761,16 @@ public: if (var_sp->DumpDeclaration(&s, show_fullpaths, show_module)) s.PutCString (": "); } - + const Format format = m_option_format.GetFormat(); if (format != eFormatDefault) options.SetFormat(format); options.SetRootValueObjectName(root_name); - + valobj_sp->Dump(s,options); } - - + static size_t GetVariableCallback (void *baton, const char *name, VariableList &variable_list) @@ -788,17 +785,14 @@ public: } return 0; } - - Options * GetOptions () { return &m_option_group; } - + protected: - void DumpGlobalVariableList(const ExecutionContext &exe_ctx, const SymbolContext &sc, const VariableList &variable_list, Stream &s) { @@ -824,14 +818,14 @@ protected: s.Printf ("Global variables for %s\n", sc.comp_unit->GetPath().c_str()); } - + for (uint32_t i=0; i<count; ++i) { VariableSP var_sp (variable_list.GetVariableAtIndex(i)); if (var_sp) { ValueObjectSP valobj_sp (ValueObjectVariable::Create (exe_ctx.GetBestExecutionContextScope(), var_sp)); - + if (valobj_sp) DumpValueObject (s, var_sp, valobj_sp, var_sp->GetName().GetCString()); } @@ -845,7 +839,7 @@ protected: Target *target = m_exe_ctx.GetTargetPtr(); const size_t argc = args.GetArgumentCount(); Stream &s = result.GetOutputStream(); - + if (argc > 0) { @@ -882,7 +876,7 @@ protected: valobj_list)); matches = variable_list.GetSize(); } - + if (matches == 0) { result.GetErrorStream().Printf ("error: can't find global variable '%s'\n", arg); @@ -899,7 +893,7 @@ protected: ValueObjectSP valobj_sp (valobj_list.GetValueObjectAtIndex(global_idx)); if (!valobj_sp) valobj_sp = ValueObjectVariable::Create (m_exe_ctx.GetBestExecutionContextScope(), var_sp); - + if (valobj_sp) DumpValueObject (s, var_sp, valobj_sp, use_var_name ? var_sp->GetName().GetCString() : arg); } @@ -946,7 +940,7 @@ protected: comp_unit->GetPath().c_str()); else result.AppendErrorWithFormat ("no debug information for frame %u\n", frame->GetFrameIndex()); - } + } else result.AppendError ("'target variable' takes one or more global variable names as arguments\n"); result.SetStatus (eReturnStatusFailed); @@ -963,7 +957,7 @@ protected: { const FileSpec module_file(shlibs.GetFileSpecAtIndex(shlib_idx)); ModuleSpec module_spec (module_file); - + ModuleSP module_sp (target->GetImages().FindFirstModule(module_spec)); if (module_sp) { @@ -993,7 +987,7 @@ protected: for (size_t cu_idx=0; cu_idx<num_compile_units; ++cu_idx) target->GetImages().FindCompileUnits(compile_units.GetFileSpecAtIndex(cu_idx), append, sc_list); } - + const uint32_t num_scs = sc_list.GetSize(); if (num_scs > 0) { @@ -1029,10 +1023,10 @@ protected: m_cmd_name.c_str()); m_interpreter.TruncationWarningGiven(); } - + return result.Succeeded(); } - + OptionGroupOptions m_option_group; OptionGroupVariable m_option_variable; OptionGroupFormat m_option_format; @@ -1058,15 +1052,15 @@ public: CommandArgumentEntry arg; CommandArgumentData old_prefix_arg; CommandArgumentData new_prefix_arg; - + // Define the first variant of this arg pair. old_prefix_arg.arg_type = eArgTypeOldPathPrefix; old_prefix_arg.arg_repetition = eArgRepeatPairPlus; - + // Define the first variant of this arg pair. new_prefix_arg.arg_type = eArgTypeNewPathPrefix; new_prefix_arg.arg_repetition = eArgRepeatPairPlus; - + // There are two required arguments that must always occur together, i.e. an argument "pair". Because they // must always occur together, they are treated as two variants of one argument rather than two independent // arguments. Push them both into the first argument position for m_arguments... @@ -1101,7 +1095,7 @@ protected: { const char *from = command.GetArgumentAtIndex(i); const char *to = command.GetArgumentAtIndex(i+1); - + if (from[0] && to[0]) { bool last_pair = ((argc - i) == 2); @@ -1186,7 +1180,7 @@ public: CommandArgumentData index_arg; CommandArgumentData old_prefix_arg; CommandArgumentData new_prefix_arg; - + // Define the first and only variant of this arg. index_arg.arg_type = eArgTypeIndex; index_arg.arg_repetition = eArgRepeatPlain; @@ -1197,11 +1191,11 @@ public: // Define the first variant of this arg pair. old_prefix_arg.arg_type = eArgTypeOldPathPrefix; old_prefix_arg.arg_repetition = eArgRepeatPairPlus; - + // Define the first variant of this arg pair. new_prefix_arg.arg_type = eArgTypeNewPathPrefix; new_prefix_arg.arg_repetition = eArgRepeatPairPlus; - + // There are two required arguments that must always occur together, i.e. an argument "pair". Because they // must always occur together, they are treated as two variants of one argument rather than two independent // arguments. Push them both into the same argument position for m_arguments... @@ -1249,7 +1243,7 @@ protected: { const char *from = command.GetArgumentAtIndex(i); const char *to = command.GetArgumentAtIndex(i+1); - + if (from[0] && to[0]) { bool last_pair = ((argc - i) == 2); @@ -1348,14 +1342,14 @@ public: { CommandArgumentEntry arg; CommandArgumentData path_arg; - + // Define the first (and only) variant of this arg. path_arg.arg_type = eArgTypeDirectoryName; path_arg.arg_repetition = eArgRepeatPlain; - + // There is only one variant this argument could be; put it into the argument entry. arg.push_back (path_arg); - + // Push the data for the first argument into the m_arguments vector. m_arguments.push_back (arg); } @@ -1442,7 +1436,7 @@ DumpCompileUnitLineTable (CommandInterpreter &interpreter, false, eSymbolContextCompUnit, sc_list); - + for (uint32_t i=0; i<num_matches; ++i) { SymbolContext sc; @@ -1450,7 +1444,7 @@ DumpCompileUnitLineTable (CommandInterpreter &interpreter, { if (i > 0) strm << "\n\n"; - + strm << "Line table for " << *static_cast<FileSpec*> (sc.comp_unit) << " in `" << module->GetFileSpec().GetFilename() << "\n"; LineTable *line_table = sc.comp_unit->GetLineTable(); @@ -1619,7 +1613,7 @@ LookupAddressInModule (CommandInterpreter &interpreter, if (!module->ResolveFileAddress (addr, so_addr)) return false; } - + ExecutionContextScope *exe_scope = interpreter.GetExecutionContext().GetBestExecutionContextScope(); DumpAddress (exe_scope, so_addr, verbose, strm); // strm.IndentMore(); @@ -1642,7 +1636,7 @@ LookupAddressInModule (CommandInterpreter &interpreter, // strm.IndentLess(); return true; } - + return false; } @@ -1652,7 +1646,7 @@ LookupSymbolInModule (CommandInterpreter &interpreter, Stream &strm, Module *mod if (module) { SymbolContext sc; - + SymbolVendor *sym_vendor = module->GetSymbolVendor (); if (sym_vendor) { @@ -1674,8 +1668,7 @@ LookupSymbolInModule (CommandInterpreter &interpreter, Stream &strm, Module *mod { num_matches = symtab->AppendSymbolIndexesWithName (symbol_name, match_indexes); } - - + if (num_matches > 0) { strm.Indent (); @@ -1712,19 +1705,19 @@ DumpSymbolContextList (ExecutionContextScope *exe_scope, Stream &strm, SymbolCon strm.IndentMore (); uint32_t i; const uint32_t num_matches = sc_list.GetSize(); - + for (i=0; i<num_matches; ++i) { SymbolContext sc; if (sc_list.GetContextAtIndex(i, sc)) { AddressRange range; - + sc.GetAddressRange(eSymbolContextEverything, 0, true, range); - + DumpAddress (exe_scope, range.GetBaseAddress(), verbose, strm); } } @@ -1766,7 +1759,7 @@ LookupFunctionInModule (CommandInterpreter &interpreter, append, sc_list); } - + if (num_matches) { strm.Indent (); @@ -1797,7 +1790,7 @@ LookupTypeInModule (CommandInterpreter &interpreter, ConstString name(name_cstr); num_matches = module->FindTypes(sc, name, name_is_fully_qualified, max_num_matches, type_list); - + if (num_matches) { strm.Indent (); @@ -1842,22 +1835,22 @@ LookupTypeHere (CommandInterpreter &interpreter, { if (!sym_ctx.module_sp) return 0; - + TypeList type_list; const uint32_t max_num_matches = UINT32_MAX; size_t num_matches = 1; bool name_is_fully_qualified = false; - + ConstString name(name_cstr); num_matches = sym_ctx.module_sp->FindTypes(sym_ctx, name, name_is_fully_qualified, max_num_matches, type_list); - + if (num_matches) { strm.Indent (); strm.PutCString("Best match found in "); DumpFullpath (strm, &sym_ctx.module_sp->GetFileSpec(), 0); strm.PutCString(":\n"); - + TypeSP type_sp (type_list.GetTypeAtIndex(0)); if (type_sp) { @@ -1912,7 +1905,6 @@ LookupFileAndLineInModule (CommandInterpreter &interpreter, } } return 0; - } @@ -1925,7 +1917,7 @@ FindModulesByName (Target *target, // Dump specified images (by basename or fullpath) FileSpec module_file_spec(module_name, false); ModuleSpec module_spec (module_file_spec); - + const size_t initial_size = module_list.GetSize (); if (check_global_list) @@ -1937,7 +1929,7 @@ FindModulesByName (Target *target, for (size_t image_idx = 0; image_idx<num_modules; ++image_idx) { Module *module = Module::GetAllocatedModuleAtIndex(image_idx); - + if (module) { if (module->MatchesModuleSpec (module_spec)) @@ -1953,7 +1945,7 @@ FindModulesByName (Target *target, if (target) { const size_t num_matches = target->GetImages().FindModules (module_spec, module_list); - + // Not found in our module list for our target, check the main // shared module list in case it is a extra file used somewhere // else @@ -1968,7 +1960,7 @@ FindModulesByName (Target *target, ModuleList::FindSharedModules (module_spec,module_list); } } - + return module_list.GetSize () - initial_size; } @@ -1982,7 +1974,6 @@ FindModulesByName (Target *target, class CommandObjectTargetModulesModuleAutoComplete : public CommandObjectParsed { public: - CommandObjectTargetModulesModuleAutoComplete (CommandInterpreter &interpreter, const char *name, const char *help, @@ -1991,23 +1982,23 @@ public: { CommandArgumentEntry arg; CommandArgumentData file_arg; - + // Define the first (and only) variant of this arg. file_arg.arg_type = eArgTypeFilename; file_arg.arg_repetition = eArgRepeatStar; - + // There is only one variant this argument could be; put it into the argument entry. arg.push_back (file_arg); - + // Push the data for the first argument into the m_arguments vector. m_arguments.push_back (arg); } - + virtual ~CommandObjectTargetModulesModuleAutoComplete () { } - + virtual int HandleArgumentCompletion (Args &input, int &cursor_index, @@ -2021,7 +2012,7 @@ public: // Arguments are the standard module completer. std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); - + CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, CommandCompletions::eModuleCompletion, completion_str.c_str(), @@ -2044,7 +2035,6 @@ public: class CommandObjectTargetModulesSourceFileAutoComplete : public CommandObjectParsed { public: - CommandObjectTargetModulesSourceFileAutoComplete (CommandInterpreter &interpreter, const char *name, const char *help, @@ -2054,23 +2044,23 @@ public: { CommandArgumentEntry arg; CommandArgumentData source_file_arg; - + // Define the first (and only) variant of this arg. source_file_arg.arg_type = eArgTypeSourceFile; source_file_arg.arg_repetition = eArgRepeatPlus; - + // There is only one variant this argument could be; put it into the argument entry. arg.push_back (source_file_arg); - + // Push the data for the first argument into the m_arguments vector. m_arguments.push_back (arg); } - + virtual ~CommandObjectTargetModulesSourceFileAutoComplete () { } - + virtual int HandleArgumentCompletion (Args &input, int &cursor_index, @@ -2084,7 +2074,7 @@ public: // Arguments are the standard source file completer. std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); - + CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, CommandCompletions::eSourceFileCompletion, completion_str.c_str(), @@ -2112,39 +2102,38 @@ public: m_options (interpreter) { } - + virtual ~CommandObjectTargetModulesDumpSymtab () { } - + virtual Options * GetOptions () { return &m_options; } - + class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options(interpreter), m_sort_order (eSortOrderNone) { } - + virtual ~CommandOptions () { } - + virtual Error SetOptionValue (uint32_t option_idx, const char *option_arg) { Error error; const int short_option = m_getopt_table[option_idx].val; - + switch (short_option) { case 's': @@ -2153,33 +2142,33 @@ public: eSortOrderNone, error); break; - + default: error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; - + } return error; } - + void OptionParsingStarting () { m_sort_order = eSortOrderNone; } - + const OptionDefinition* GetDefinitions () { return g_option_table; } - + // Options table: Required for subclasses of Options. static OptionDefinition g_option_table[]; - + SortOrder m_sort_order; }; - + protected: virtual bool DoExecute (Args& command, @@ -2195,11 +2184,11 @@ protected: else { uint32_t num_dumped = 0; - + uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize(); result.GetOutputStream().SetAddressByteSize(addr_byte_size); result.GetErrorStream().SetAddressByteSize(addr_byte_size); - + if (command.GetArgumentCount() == 0) { // Dump all sections for all modules images @@ -2258,7 +2247,7 @@ protected: result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr); } } - + if (num_dumped > 0) result.SetStatus (eReturnStatusSuccessFinishResult); else @@ -2269,8 +2258,7 @@ protected: } return result.Succeeded(); } - - + CommandOptions m_options; }; @@ -2308,12 +2296,12 @@ public: NULL) { } - + virtual ~CommandObjectTargetModulesDumpSections () { } - + protected: virtual bool DoExecute (Args& command, @@ -2329,11 +2317,11 @@ protected: else { uint32_t num_dumped = 0; - + uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize(); result.GetOutputStream().SetAddressByteSize(addr_byte_size); result.GetErrorStream().SetAddressByteSize(addr_byte_size); - + if (command.GetArgumentCount() == 0) { // Dump all sections for all modules images @@ -2383,7 +2371,7 @@ protected: } } } - + if (num_dumped > 0) result.SetStatus (eReturnStatusSuccessFinishResult); else @@ -2414,12 +2402,12 @@ public: NULL) { } - + virtual ~CommandObjectTargetModulesDumpSymfile () { } - + protected: virtual bool DoExecute (Args& command, @@ -2435,11 +2423,11 @@ protected: else { uint32_t num_dumped = 0; - + uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize(); result.GetOutputStream().SetAddressByteSize(addr_byte_size); result.GetErrorStream().SetAddressByteSize(addr_byte_size); - + if (command.GetArgumentCount() == 0) { // Dump all sections for all modules images @@ -2486,7 +2474,7 @@ protected: result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr); } } - + if (num_dumped > 0) result.SetStatus (eReturnStatusSuccessFinishResult); else @@ -2517,12 +2505,12 @@ public: eFlagRequiresTarget) { } - + virtual ~CommandObjectTargetModulesDumpLineTable () { } - + protected: virtual bool DoExecute (Args& command, @@ -2530,11 +2518,11 @@ protected: { Target *target = m_exe_ctx.GetTargetPtr(); uint32_t total_num_dumped = 0; - + uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize(); result.GetOutputStream().SetAddressByteSize(addr_byte_size); result.GetErrorStream().SetAddressByteSize(addr_byte_size); - + if (command.GetArgumentCount() == 0) { result.AppendErrorWithFormat ("\nSyntax: %s\n", m_cmd_syntax.c_str()); @@ -2547,7 +2535,7 @@ protected: for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx) { FileSpec file_spec(arg_cstr, false); - + const ModuleList &target_modules = target->GetImages(); Mutex::Locker modules_locker(target_modules.GetMutex()); const size_t num_modules = target_modules.GetSize(); @@ -2570,7 +2558,7 @@ protected: } } } - + if (total_num_dumped > 0) result.SetStatus (eReturnStatusSuccessFinishResult); else @@ -2592,7 +2580,6 @@ protected: class CommandObjectTargetModulesDump : public CommandObjectMultiword { public: - //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ @@ -2607,7 +2594,7 @@ public: LoadSubCommand ("symfile", CommandObjectSP (new CommandObjectTargetModulesDumpSymfile (interpreter))); LoadSubCommand ("line-table", CommandObjectSP (new CommandObjectTargetModulesDumpLineTable (interpreter))); } - + virtual ~CommandObjectTargetModulesDump() { @@ -2629,18 +2616,18 @@ public: m_option_group.Append (&m_symbol_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); m_option_group.Finalize(); } - + virtual ~CommandObjectTargetModulesAdd () { } - + virtual Options * GetOptions () { return &m_option_group; } - + virtual int HandleArgumentCompletion (Args &input, int &cursor_index, @@ -2653,7 +2640,7 @@ public: { std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); - + CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, CommandCompletions::eDiskFileCompletion, completion_str.c_str(), @@ -2666,11 +2653,9 @@ public: } protected: - OptionGroupOptions m_option_group; OptionGroupUUID m_uuid_option_group; OptionGroupFile m_symbol_file; - virtual bool DoExecute (Args& args, @@ -2686,7 +2671,7 @@ protected: else { bool flush = false; - + const size_t argc = args.GetArgumentCount(); if (argc == 0) { @@ -2803,7 +2788,7 @@ protected: } } } - + if (flush) { ProcessSP process = target->GetProcessSP(); @@ -2811,7 +2796,7 @@ protected: process->Flush(); } } - + return result.Succeeded(); } @@ -2834,18 +2819,18 @@ public: m_option_group.Append (&m_slide_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); m_option_group.Finalize(); } - + virtual ~CommandObjectTargetModulesLoad () { } - + virtual Options * GetOptions () { return &m_option_group; } - + protected: virtual bool DoExecute (Args& args, @@ -2868,7 +2853,7 @@ protected: search_using_module_spec = true; module_spec.GetFileSpec() = m_file_option.GetOptionValue().GetCurrentValue(); } - + if (m_uuid_option_group.GetOptionValue().OptionWasSet()) { search_using_module_spec = true; @@ -2877,7 +2862,6 @@ protected: if (search_using_module_spec) { - ModuleList matching_modules; const size_t num_matches = target->GetImages().FindModules (module_spec, matching_modules); @@ -2970,7 +2954,7 @@ protected: } } } - + if (changed) { target->ModulesDidLoad (matching_modules); @@ -3009,7 +2993,7 @@ protected: else { std::string uuid_str; - + if (module_spec.GetFileSpec()) module_spec.GetFileSpec().GetPath (path, sizeof(path)); else @@ -3049,8 +3033,8 @@ protected: } } return result.Succeeded(); - } - + } + OptionGroupOptions m_option_group; OptionGroupUUID m_uuid_option_group; OptionGroupFile m_file_option; @@ -3063,11 +3047,9 @@ protected: class CommandObjectTargetModulesList : public CommandObjectParsed { public: - class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options(interpreter), m_format_array(), @@ -3075,12 +3057,12 @@ public: m_module_addr (LLDB_INVALID_ADDRESS) { } - + virtual ~CommandOptions () { } - + virtual Error SetOptionValue (uint32_t option_idx, const char *option_arg) { @@ -3105,7 +3087,7 @@ public: } return error; } - + void OptionParsingStarting () { @@ -3113,24 +3095,24 @@ public: m_use_global_module_list = false; m_module_addr = LLDB_INVALID_ADDRESS; } - + const OptionDefinition* GetDefinitions () { return g_option_table; } - + // Options table: Required for subclasses of Options. - + static OptionDefinition g_option_table[]; - + // Instance variables to hold the values for command options. typedef std::vector< std::pair<char, uint32_t> > FormatWidthCollection; FormatWidthCollection m_format_array; bool m_use_global_module_list; lldb::addr_t m_module_addr; }; - + CommandObjectTargetModulesList (CommandInterpreter &interpreter) : CommandObjectParsed (interpreter, "target modules list", @@ -3139,19 +3121,19 @@ public: m_options (interpreter) { } - + virtual ~CommandObjectTargetModulesList () { } - + virtual Options * GetOptions () { return &m_options; } - + protected: virtual bool DoExecute (Args& command, @@ -3179,7 +3161,7 @@ protected: } // Dump all sections for all modules images Stream &strm = result.GetOutputStream(); - + if (m_options.m_module_addr != LLDB_INVALID_ADDRESS) { if (target) @@ -3212,7 +3194,7 @@ protected: } return result.Succeeded(); } - + size_t num_modules = 0; Mutex::Locker locker; // This locker will be locked on the mutex in module_list_ptr if it is non-NULL. // Otherwise it will lock the AllocationModuleCollectionMutex when accessing @@ -3248,10 +3230,10 @@ protected: } } } - + module_list_ptr = &module_list; } - + if (module_list_ptr != NULL) { locker.Lock(module_list_ptr->GetMutex()); @@ -3259,7 +3241,7 @@ protected: } if (num_modules > 0) - { + { for (uint32_t image_idx = 0; image_idx<num_modules; ++image_idx) { ModuleSP module_sp; @@ -3274,7 +3256,7 @@ protected: module = Module::GetAllocatedModuleAtIndex(image_idx); module_sp = module->shared_from_this(); } - + const size_t indent = strm.Printf("[%3u] ", image_idx); PrintModule (target, module, indent, strm); @@ -3313,7 +3295,7 @@ protected: strm.PutCString("Null module"); return; } - + bool dump_object_name = false; if (m_options.m_format_array.empty()) { @@ -3336,25 +3318,25 @@ protected: case 'A': DumpModuleArchitecture (strm, module, false, width); break; - + case 't': DumpModuleArchitecture (strm, module, true, width); break; - + case 'f': DumpFullpath (strm, &module->GetFileSpec(), width); dump_object_name = true; break; - + case 'd': DumpDirectory (strm, &module->GetFileSpec(), width); break; - + case 'b': DumpBasename (strm, &module->GetFileSpec(), width); dump_object_name = true; break; - + case 'h': case 'o': // Image header address @@ -3442,23 +3424,23 @@ protected: strm.Printf("%.*s", width, "<NONE>"); } break; - + case 'm': module->GetModificationTime().Dump(&strm, width); break; case 'p': - strm.Printf("%p", module); + strm.Printf("%p", static_cast<void*>(module)); break; case 'u': DumpModuleUUID(strm, module); break; - + default: break; } - + } if (dump_object_name) { @@ -3468,7 +3450,7 @@ protected: } strm.EOL(); } - + CommandOptions m_options; }; @@ -3589,7 +3571,7 @@ public: std::string m_str; // Holds name lookup lldb::addr_t m_addr; // Holds the address to lookup }; - + CommandObjectTargetModulesShowUnwind (CommandInterpreter &interpreter) : CommandObjectParsed (interpreter, "target modules show-unwind", @@ -3602,12 +3584,12 @@ public: m_options (interpreter) { } - + virtual ~CommandObjectTargetModulesShowUnwind () { } - + virtual Options * GetOptions () @@ -3650,7 +3632,7 @@ protected: } SymbolContextList sc_list; - + if (m_options.m_type == eLookupTypeFunctionOrSymbol) { ConstString function_name (m_options.m_str.c_str()); @@ -3771,7 +3753,6 @@ CommandObjectTargetModulesShowUnwind::CommandOptions::g_option_table[] = class CommandObjectTargetModulesLookup : public CommandObjectParsed { public: - enum { eLookupTypeInvalid = -1, @@ -3783,29 +3764,28 @@ public: eLookupTypeType, kNumLookupTypes }; - + class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options(interpreter) { OptionParsingStarting(); } - + virtual ~CommandOptions () { } - + virtual Error SetOptionValue (uint32_t option_idx, const char *option_arg) { Error error; - + const int short_option = m_getopt_table[option_idx].val; - + switch (short_option) { case 'a': @@ -3815,27 +3795,27 @@ public: m_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error); } break; - + case 'o': m_offset = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS); if (m_offset == LLDB_INVALID_ADDRESS) error.SetErrorStringWithFormat ("invalid offset string '%s'", option_arg); break; - + case 's': m_str = option_arg; m_type = eLookupTypeSymbol; break; - + case 'f': m_file.SetFile (option_arg, false); m_type = eLookupTypeFileLine; break; - + case 'i': m_include_inlines = false; break; - + case 'l': m_line_number = Args::StringToUInt32(option_arg, UINT32_MAX); if (m_line_number == UINT32_MAX) @@ -3844,12 +3824,12 @@ public: error.SetErrorString ("zero is an invalid line number"); m_type = eLookupTypeFileLine; break; - + case 'F': m_str = option_arg; m_type = eLookupTypeFunction; break; - + case 'n': m_str = option_arg; m_type = eLookupTypeFunctionOrSymbol; @@ -3859,23 +3839,23 @@ public: m_str = option_arg; m_type = eLookupTypeType; break; - + case 'v': m_verbose = 1; break; - + case 'A': m_print_all = true; break; - + case 'r': m_use_regex = true; break; } - + return error; } - + void OptionParsingStarting () { @@ -3890,15 +3870,15 @@ public: m_verbose = false; m_print_all = false; } - + const OptionDefinition* GetDefinitions () { return g_option_table; } - + // Options table: Required for subclasses of Options. - + static OptionDefinition g_option_table[]; int m_type; // Should be a eLookupTypeXXX enum after parsing options std::string m_str; // Holds name lookup @@ -3910,9 +3890,8 @@ public: bool m_include_inlines;// Check for inline entries when looking up by file/line. bool m_verbose; // Enable verbose lookup info bool m_print_all; // Print all matches, even in cases where there's a best match. - }; - + CommandObjectTargetModulesLookup (CommandInterpreter &interpreter) : CommandObjectParsed (interpreter, "target modules lookup", @@ -3923,29 +3902,29 @@ public: { CommandArgumentEntry arg; CommandArgumentData file_arg; - + // Define the first (and only) variant of this arg. file_arg.arg_type = eArgTypeFilename; file_arg.arg_repetition = eArgRepeatStar; - + // There is only one variant this argument could be; put it into the argument entry. arg.push_back (file_arg); - + // Push the data for the first argument into the m_arguments vector. m_arguments.push_back (arg); } - + virtual ~CommandObjectTargetModulesLookup () { } - + virtual Options * GetOptions () { return &m_options; } - + bool LookupHere (CommandInterpreter &interpreter, CommandReturnObject &result, bool &syntax_error) { @@ -3961,17 +3940,17 @@ public: case eLookupTypeType: break; } - + StackFrameSP frame = m_exe_ctx.GetFrameSP(); - + if (!frame) return false; - + const SymbolContext &sym_ctx(frame->GetSymbolContext(eSymbolContextModule)); - + if (!sym_ctx.module_sp) return false; - + switch (m_options.m_type) { default: @@ -3991,10 +3970,10 @@ public: } break; } - + return true; } - + bool LookupInModule (CommandInterpreter &interpreter, Module *module, CommandReturnObject &result, bool &syntax_error) { @@ -4016,7 +3995,7 @@ public: } } break; - + case eLookupTypeSymbol: if (!m_options.m_str.empty()) { @@ -4032,11 +4011,10 @@ public: } } break; - + case eLookupTypeFileLine: if (m_options.m_file) { - if (LookupFileAndLineInModule (m_interpreter, result.GetOutputStream(), module, @@ -4069,8 +4047,7 @@ public: } } break; - - + case eLookupTypeType: if (!m_options.m_str.empty()) { @@ -4085,17 +4062,17 @@ public: } } break; - + default: m_options.GenerateOptionUsage (result.GetErrorStream(), this); syntax_error = true; break; } - + result.SetStatus (eReturnStatusFailed); return false; } - + protected: virtual bool DoExecute (Args& command, @@ -4117,11 +4094,11 @@ protected: result.GetOutputStream().SetAddressByteSize(addr_byte_size); result.GetErrorStream().SetAddressByteSize(addr_byte_size); // Dump all sections for all modules images - + if (command.GetArgumentCount() == 0) { ModuleSP current_module; - + // Where it is possible to look in the current symbol context // first, try that. If this search was successful and --all // was not passed, don't print anything else. @@ -4135,9 +4112,9 @@ protected: return result.Succeeded(); } } - + // Dump all sections for all other modules - + const ModuleList &target_modules = target->GetImages(); Mutex::Locker modules_locker(target_modules.GetMutex()); const size_t num_modules = target_modules.GetSize(); @@ -4146,7 +4123,7 @@ protected: for (i = 0; i<num_modules && syntax_error == false; ++i) { Module *module_pointer = target_modules.GetModulePointerAtIndexUnlocked(i); - + if (module_pointer != current_module.get() && LookupInModule (m_interpreter, target_modules.GetModulePointerAtIndexUnlocked(i), result, syntax_error)) { @@ -4189,7 +4166,7 @@ protected: result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr); } } - + if (num_successful_lookups > 0) result.SetStatus (eReturnStatusSuccessFinishResult); else @@ -4197,7 +4174,7 @@ protected: } return result.Succeeded(); } - + CommandOptions m_options; }; @@ -4232,7 +4209,6 @@ CommandObjectTargetModulesLookup::CommandOptions::g_option_table[] = class CommandObjectTargetModulesImageSearchPaths : public CommandObjectMultiword { public: - CommandObjectTargetModulesImageSearchPaths (CommandInterpreter &interpreter) : CommandObjectMultiword (interpreter, "target modules search-paths", @@ -4245,7 +4221,7 @@ public: LoadSubCommand ("list", CommandObjectSP (new CommandObjectTargetModulesSearchPathsList (interpreter))); LoadSubCommand ("query", CommandObjectSP (new CommandObjectTargetModulesSearchPathsQuery (interpreter))); } - + ~CommandObjectTargetModulesImageSearchPaths() { } @@ -4284,7 +4260,7 @@ public: ~CommandObjectTargetModules() { } - + private: //------------------------------------------------------------------ // For CommandObjectTargetModules only @@ -4312,12 +4288,12 @@ public: m_option_group.Append (&m_current_frame_option, LLDB_OPT_SET_2, LLDB_OPT_SET_2); m_option_group.Finalize(); } - + virtual ~CommandObjectTargetSymbolsAdd () { } - + virtual int HandleArgumentCompletion (Args &input, int &cursor_index, @@ -4330,7 +4306,7 @@ public: { std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); - + CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, CommandCompletions::eDiskFileCompletion, completion_str.c_str(), @@ -4341,16 +4317,14 @@ public: matches); return matches.GetSize(); } - + virtual Options * GetOptions () { return &m_option_group; } - protected: - bool AddModuleSymbols (Target *target, ModuleSpec &module_spec, @@ -4362,7 +4336,7 @@ protected: { char symfile_path[PATH_MAX]; symbol_fspec.GetPath (symfile_path, sizeof(symfile_path)); - + if (!module_spec.GetUUID().IsValid()) { if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec()) @@ -4373,7 +4347,7 @@ protected: // current target, so we need to find that module in the // target ModuleList matching_module_list; - + size_t num_matches = 0; // First extract all module specs from the symbol file lldb_private::ModuleSpecList symfile_module_specs; @@ -4394,7 +4368,7 @@ protected: num_matches = target->GetImages().FindModules (symfile_uuid_module_spec, matching_module_list); } } - + if (num_matches == 0) { // No matches yet, iterate through the module specs to find a UUID value that @@ -4410,7 +4384,7 @@ protected: ModuleSpec symfile_uuid_module_spec; symfile_uuid_module_spec.GetUUID() = symfile_module_spec.GetUUID(); num_matches = target->GetImages().FindModules (symfile_uuid_module_spec, matching_module_list); - } + } } } } @@ -4419,23 +4393,22 @@ protected: // Just try to match up the file by basename if we have no matches at this point if (num_matches == 0) num_matches = target->GetImages().FindModules (module_spec, matching_module_list); - + while (num_matches == 0) { ConstString filename_no_extension(module_spec.GetFileSpec().GetFileNameStrippingExtension()); // Empty string returned, lets bail if (!filename_no_extension) break; - + // Check if there was no extension to strip and the basename is the same if (filename_no_extension == module_spec.GetFileSpec().GetFilename()) break; - + // Replace basename with one less extension module_spec.GetFileSpec().GetFilename() = filename_no_extension; - + num_matches = target->GetImages().FindModules (module_spec, matching_module_list); - } if (num_matches > 1) @@ -4445,21 +4418,21 @@ protected: else if (num_matches == 1) { ModuleSP module_sp (matching_module_list.GetModuleAtIndex(0)); - + // The module has not yet created its symbol vendor, we can just // give the existing target module the symfile path to use for // when it decides to create it! module_sp->SetSymbolFileFileSpec (symbol_fspec); - + SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor(true, &result.GetErrorStream()); if (symbol_vendor) { SymbolFile *symbol_file = symbol_vendor->GetSymbolFile(); - + if (symbol_file) { ObjectFile *object_file = symbol_file->GetObjectFile(); - + if (object_file && object_file->GetFileSpec() == symbol_fspec) { // Provide feedback that the symfile has been successfully added. @@ -4467,13 +4440,13 @@ protected: result.AppendMessageWithFormat("symbol file '%s' has been added to '%s'\n", symfile_path, module_fs.GetPath().c_str()); - + // Let clients know something changed in the module // if it is currently loaded ModuleList module_list; module_list.Append (module_sp); target->SymbolsDidLoad (module_list); - + // Make sure we load any scripting resources that may be embedded // in the debug info files in case the platform supports that. Error error; @@ -4679,7 +4652,7 @@ protected: if (platform_sp->ResolveSymbolFile(*target, module_spec, symfile_spec).Success()) module_spec.GetSymbolFileSpec() = symfile_spec; } - + ArchSpec arch; bool symfile_exists = module_spec.GetSymbolFileSpec().Exists(); @@ -4715,13 +4688,11 @@ protected: } return result.Succeeded(); } - + OptionGroupOptions m_option_group; OptionGroupUUID m_uuid_option_group; OptionGroupFile m_file_option; OptionGroupBoolean m_current_frame_option; - - }; @@ -4744,13 +4715,13 @@ public: "target symbols <sub-command> ...") { LoadSubCommand ("add", CommandObjectSP (new CommandObjectTargetSymbolsAdd (interpreter))); - + } virtual ~CommandObjectTargetSymbols() { } - + private: //------------------------------------------------------------------ // For CommandObjectTargetModules only @@ -4785,9 +4756,9 @@ public: m_one_liner() { } - + ~CommandOptions () {} - + const OptionDefinition* GetDefinitions () { @@ -4807,7 +4778,7 @@ public: m_class_name = option_arg; m_sym_ctx_specified = true; break; - + case 'e': m_line_end = Args::StringToUInt32 (option_arg, UINT_MAX, 0, &success); if (!success) @@ -4817,7 +4788,7 @@ public: } m_sym_ctx_specified = true; break; - + case 'l': m_line_start = Args::StringToUInt32 (option_arg, 0, 0, &success); if (!success) @@ -4827,17 +4798,17 @@ public: } m_sym_ctx_specified = true; break; - + case 'i': m_no_inlines = true; break; - + case 'n': m_function_name = option_arg; m_func_name_type_mask |= eFunctionNameTypeAuto; m_sym_ctx_specified = true; break; - + case 'f': m_file_name = option_arg; m_sym_ctx_specified = true; @@ -4895,7 +4866,7 @@ public: m_thread_index = UINT32_MAX; m_thread_name.clear(); m_queue_name.clear(); - + m_no_inlines = false; m_sym_ctx_specified = false; m_thread_specified = false; @@ -4904,9 +4875,9 @@ public: m_one_liner.clear(); } - + static OptionDefinition g_option_table[]; - + std::string m_class_name; std::string m_function_name; uint32_t m_line_start; @@ -4947,7 +4918,6 @@ public: } protected: - virtual void IOHandlerActivated (IOHandler &io_handler) { @@ -4958,8 +4928,7 @@ protected: output_sp->Flush(); } } - - + virtual void IOHandlerInputComplete (IOHandler &io_handler, std::string &line) { @@ -4991,12 +4960,12 @@ protected: } io_handler.SetIsDone(true); } - + bool DoExecute (Args& command, CommandReturnObject &result) { m_stop_hook_sp.reset(); - + Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target) { @@ -5007,63 +4976,63 @@ protected: if (m_options.m_sym_ctx_specified) { specifier_ap.reset(new SymbolContextSpecifier(m_interpreter.GetDebugger().GetSelectedTarget())); - + if (!m_options.m_module_name.empty()) { specifier_ap->AddSpecification (m_options.m_module_name.c_str(), SymbolContextSpecifier::eModuleSpecified); } - + if (!m_options.m_class_name.empty()) { specifier_ap->AddSpecification (m_options.m_class_name.c_str(), SymbolContextSpecifier::eClassOrNamespaceSpecified); } - + if (!m_options.m_file_name.empty()) { specifier_ap->AddSpecification (m_options.m_file_name.c_str(), SymbolContextSpecifier::eFileSpecified); } - + if (m_options.m_line_start != 0) { specifier_ap->AddLineSpecification (m_options.m_line_start, SymbolContextSpecifier::eLineStartSpecified); } - + if (m_options.m_line_end != UINT_MAX) { specifier_ap->AddLineSpecification (m_options.m_line_end, SymbolContextSpecifier::eLineEndSpecified); } - + if (!m_options.m_function_name.empty()) { specifier_ap->AddSpecification (m_options.m_function_name.c_str(), SymbolContextSpecifier::eFunctionSpecified); } } - + if (specifier_ap.get()) new_hook_sp->SetSpecifier (specifier_ap.release()); // Next see if any of the thread options have been entered: - + if (m_options.m_thread_specified) { ThreadSpec *thread_spec = new ThreadSpec(); - + if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID) { thread_spec->SetTID (m_options.m_thread_id); } - + if (m_options.m_thread_index != UINT32_MAX) thread_spec->SetIndex (m_options.m_thread_index); - + if (!m_options.m_thread_name.empty()) thread_spec->SetName (m_options.m_thread_name.c_str()); - + if (!m_options.m_queue_name.empty()) thread_spec->SetQueueName (m_options.m_queue_name.c_str()); - + new_hook_sp->SetThreadSpecifier (thread_spec); - + } if (m_options.m_use_one_liner) { @@ -5087,7 +5056,7 @@ protected: result.AppendError ("invalid target\n"); result.SetStatus (eReturnStatusFailed); } - + return result.Succeeded(); } private: @@ -5194,7 +5163,7 @@ protected: result.AppendError ("invalid target\n"); result.SetStatus (eReturnStatusFailed); } - + return result.Succeeded(); } }; @@ -5231,7 +5200,7 @@ protected: // FIXME: see if we can use the breakpoint id style parser? size_t num_args = command.GetArgumentCount(); bool success; - + if (num_args == 0) { target->SetAllStopHooksActiveState (m_enable); @@ -5302,7 +5271,7 @@ protected: result.SetStatus (eReturnStatusFailed); return result.Succeeded(); } - + size_t num_hooks = target->GetNumStopHooks (); if (num_hooks == 0) { @@ -5372,7 +5341,7 @@ CommandObjectMultiwordTarget::CommandObjectMultiwordTarget (CommandInterpreter & "A set of commands for operating on debugger targets.", "target <subcommand> [<subcommand-options>]") { - + LoadSubCommand ("create", CommandObjectSP (new CommandObjectTargetCreate (interpreter))); LoadSubCommand ("delete", CommandObjectSP (new CommandObjectTargetDelete (interpreter))); LoadSubCommand ("list", CommandObjectSP (new CommandObjectTargetList (interpreter))); diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index 5ac2bcce70f..fa9197d12b7 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -427,7 +427,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum break; case DumpStyleSectionPointerOffset: - s->Printf("(Section *)%p + ", section_sp.get()); + s->Printf("(Section *)%p + ", static_cast<void*>(section_sp.get())); s->Address(m_offset, addr_size); break; diff --git a/lldb/source/Core/AddressRange.cpp b/lldb/source/Core/AddressRange.cpp index 835a01d82aa..3505d56b43e 100644 --- a/lldb/source/Core/AddressRange.cpp +++ b/lldb/source/Core/AddressRange.cpp @@ -196,7 +196,10 @@ AddressRange::Dump(Stream *s, Target *target, Address::DumpStyle style, Address: void AddressRange::DumpDebug (Stream *s) const { - s->Printf("%p: AddressRange section = %p, offset = 0x%16.16" PRIx64 ", byte_size = 0x%16.16" PRIx64 "\n", this, m_base_addr.GetSection().get(), m_base_addr.GetOffset(), GetByteSize()); + s->Printf("%p: AddressRange section = %p, offset = 0x%16.16" PRIx64 ", byte_size = 0x%16.16" PRIx64 "\n", + static_cast<const void*>(this), + static_cast<void*>(m_base_addr.GetSection().get()), + m_base_addr.GetOffset(), GetByteSize()); } // //bool diff --git a/lldb/source/Core/Broadcaster.cpp b/lldb/source/Core/Broadcaster.cpp index 88f39961832..dc37516c29c 100644 --- a/lldb/source/Core/Broadcaster.cpp +++ b/lldb/source/Core/Broadcaster.cpp @@ -31,15 +31,16 @@ Broadcaster::Broadcaster (BroadcasterManager *manager, const char *name) : { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Broadcaster::Broadcaster(\"%s\")", this, m_broadcaster_name.AsCString()); - + log->Printf ("%p Broadcaster::Broadcaster(\"%s\")", + static_cast<void*>(this), m_broadcaster_name.AsCString()); } Broadcaster::~Broadcaster() { Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Broadcaster::~Broadcaster(\"%s\")", this, m_broadcaster_name.AsCString()); + log->Printf ("%p Broadcaster::~Broadcaster(\"%s\")", + static_cast<void*>(this), m_broadcaster_name.AsCString()); Clear(); } @@ -226,7 +227,7 @@ Broadcaster::PrivateBroadcastEvent (EventSP &event_sp, bool unique) const uint32_t event_type = event_sp->GetType(); Mutex::Locker event_types_locker(m_listeners_mutex); - + Listener *hijacking_listener = NULL; if (!m_hijacking_listeners.empty()) { @@ -242,11 +243,9 @@ Broadcaster::PrivateBroadcastEvent (EventSP &event_sp, bool unique) StreamString event_description; event_sp->Dump (&event_description); log->Printf ("%p Broadcaster(\"%s\")::BroadcastEvent (event_sp = {%s}, unique =%i) hijack = %p", - this, - m_broadcaster_name.AsCString(""), - event_description.GetData(), - unique, - hijacking_listener); + static_cast<void*>(this), m_broadcaster_name.AsCString(""), + event_description.GetData(), unique, + static_cast<void*>(hijacking_listener)); } if (hijacking_listener) @@ -293,16 +292,12 @@ bool Broadcaster::HijackBroadcaster (Listener *listener, uint32_t event_mask) { Mutex::Locker event_types_locker(m_listeners_mutex); - + Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EVENTS)); if (log) - { log->Printf ("%p Broadcaster(\"%s\")::HijackBroadcaster (listener(\"%s\")=%p)", - this, - m_broadcaster_name.AsCString(""), - listener->m_name.c_str(), - listener); - } + static_cast<void*>(this), m_broadcaster_name.AsCString(""), + listener->m_name.c_str(), static_cast<void*>(listener)); m_hijacking_listeners.push_back(listener); m_hijacking_masks.push_back(event_mask); return true; @@ -320,10 +315,9 @@ Broadcaster::RestoreBroadcaster () { Listener *listener = m_hijacking_listeners.back(); log->Printf ("%p Broadcaster(\"%s\")::RestoreBroadcaster (about to pop listener(\"%s\")=%p)", - this, + static_cast<void*>(this), m_broadcaster_name.AsCString(""), - listener->m_name.c_str(), - listener); + listener->m_name.c_str(), static_cast<void*>(listener)); } m_hijacking_listeners.pop_back(); } diff --git a/lldb/source/Core/ConnectionFileDescriptor.cpp b/lldb/source/Core/ConnectionFileDescriptor.cpp index cba540e882b..fc1e9f2b535 100644 --- a/lldb/source/Core/ConnectionFileDescriptor.cpp +++ b/lldb/source/Core/ConnectionFileDescriptor.cpp @@ -106,7 +106,8 @@ ConnectionFileDescriptor::ConnectionFileDescriptor () : { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p ConnectionFileDescriptor::ConnectionFileDescriptor ()", this); + log->Printf ("%p ConnectionFileDescriptor::ConnectionFileDescriptor ()", + static_cast<void*>(this)); } ConnectionFileDescriptor::ConnectionFileDescriptor (int fd, bool owns_fd) : @@ -125,7 +126,8 @@ ConnectionFileDescriptor::ConnectionFileDescriptor (int fd, bool owns_fd) : { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = %i, owns_fd = %i)", this, fd, owns_fd); + log->Printf ("%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = %i, owns_fd = %i)", + static_cast<void*>(this), fd, owns_fd); OpenCommandPipe (); } @@ -134,7 +136,8 @@ ConnectionFileDescriptor::~ConnectionFileDescriptor () { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p ConnectionFileDescriptor::~ConnectionFileDescriptor ()", this); + log->Printf ("%p ConnectionFileDescriptor::~ConnectionFileDescriptor ()", + static_cast<void*>(this)); Disconnect (NULL); CloseCommandPipe (); } @@ -143,7 +146,7 @@ void ConnectionFileDescriptor::OpenCommandPipe () { CloseCommandPipe(); - + Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); // Make the command file descriptor here: int filedes[2]; @@ -156,8 +159,7 @@ ConnectionFileDescriptor::OpenCommandPipe () { if (log) log->Printf ("%p ConnectionFileDescriptor::OpenCommandPipe () - could not make pipe: %s", - this, - strerror(errno)); + static_cast<void*>(this), strerror(errno)); } else { @@ -165,8 +167,7 @@ ConnectionFileDescriptor::OpenCommandPipe () m_pipe_write = filedes[1]; if (log) log->Printf ("%p ConnectionFileDescriptor::OpenCommandPipe() - success readfd=%d writefd=%d", - this, - m_pipe_read, + static_cast<void*>(this), m_pipe_read, m_pipe_write); } } @@ -177,7 +178,7 @@ ConnectionFileDescriptor::CloseCommandPipe () Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) log->Printf ("%p ConnectionFileDescriptor::CloseCommandPipe()", - this); + static_cast<void*>(this)); if (m_pipe_read != -1) { @@ -188,7 +189,7 @@ ConnectionFileDescriptor::CloseCommandPipe () #endif m_pipe_read = -1; } - + if (m_pipe_write != -1) { #ifdef _MSC_VER @@ -212,10 +213,11 @@ ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr) Mutex::Locker locker (m_mutex); Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) - log->Printf ("%p ConnectionFileDescriptor::Connect (url = '%s')", this, s); + log->Printf ("%p ConnectionFileDescriptor::Connect (url = '%s')", + static_cast<void*>(this), s); OpenCommandPipe(); - + if (s && s[0]) { if (strstr(s, "listen://") == s) @@ -252,7 +254,7 @@ ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr) s += strlen ("fd://"); bool success = false; m_fd_send = m_fd_recv = Args::StringToSInt32 (s, -1, 0, &success); - + if (success) { // We have what looks to be a valid file descriptor, but we @@ -293,7 +295,7 @@ ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr) return eConnectionStatusSuccess; } } - + if (error_ptr) error_ptr->SetErrorStringWithFormat ("invalid file descriptor: \"fd://%s\"", s); m_fd_send = m_fd_recv = -1; @@ -364,7 +366,8 @@ ConnectionFileDescriptor::Disconnect (Error *error_ptr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) - log->Printf ("%p ConnectionFileDescriptor::Disconnect ()", this); + log->Printf ("%p ConnectionFileDescriptor::Disconnect ()", + static_cast<void*>(this)); // Reset the port predicate when disconnecting and don't broadcast m_port_predicate.SetValue(0, eBroadcastNever); @@ -374,20 +377,21 @@ ConnectionFileDescriptor::Disconnect (Error *error_ptr) if (m_fd_send < 0 && m_fd_recv < 0) { if (log) - log->Printf ("%p ConnectionFileDescriptor::Disconnect(): Nothing to disconnect", this); + log->Printf ("%p ConnectionFileDescriptor::Disconnect(): Nothing to disconnect", + static_cast<void*>(this)); return eConnectionStatusSuccess; } - + // Try to get the ConnectionFileDescriptor's mutex. If we fail, that is quite likely // because somebody is doing a blocking read on our file descriptor. If that's the case, // then send the "q" char to the command file channel so the read will wake up and the connection // will then know to shut down. - + m_shutting_down = true; - + Mutex::Locker locker; bool got_lock= locker.TryLock (m_mutex); - + if (!got_lock) { if (m_pipe_write != -1 ) @@ -395,10 +399,12 @@ ConnectionFileDescriptor::Disconnect (Error *error_ptr) int result; result = write (m_pipe_write, "q", 1); if (log) - log->Printf ("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the lock, sent 'q' to %d, result = %d.", this, m_pipe_write, result); + log->Printf ("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the lock, sent 'q' to %d, result = %d.", + static_cast<void*>(this), m_pipe_write, result); } else if (log) - log->Printf ("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the lock, but no command pipe is available.", this); + log->Printf ("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the lock, but no command pipe is available.", + static_cast<void*>(this)); locker.Lock (m_mutex); } @@ -423,15 +429,14 @@ ConnectionFileDescriptor::Disconnect (Error *error_ptr) } // Now set all our descriptors to invalid values. - + m_fd_send = m_fd_recv = -1; if (status != eConnectionStatusSuccess) { - return status; } - + m_shutting_down = false; return eConnectionStatusSuccess; } @@ -446,7 +451,8 @@ ConnectionFileDescriptor::Read (void *dst, Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %" PRIu64 ")...", - this, m_fd_recv, dst, (uint64_t)dst_len); + static_cast<void*>(this), m_fd_recv, + static_cast<void*>(dst), static_cast<uint64_t>(dst_len)); Mutex::Locker locker; bool got_lock = locker.TryLock (m_mutex); @@ -454,16 +460,16 @@ ConnectionFileDescriptor::Read (void *dst, { if (log) log->Printf ("%p ConnectionFileDescriptor::Read () failed to get the connection lock.", - this); + static_cast<void*>(this)); if (error_ptr) error_ptr->SetErrorString ("failed to get the connection lock for read."); - + status = eConnectionStatusTimedOut; return 0; } else if (m_shutting_down) return eConnectionStatusError; - + ssize_t bytes_read = 0; status = BytesAvailable (timeout_usec, error_ptr); @@ -509,12 +515,9 @@ ConnectionFileDescriptor::Read (void *dst, if (log) log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %" PRIu64 ") => %" PRIi64 ", error = %s", - this, - m_fd_recv, - dst, - (uint64_t)dst_len, - (int64_t)bytes_read, - error.AsCString()); + static_cast<void*>(this), m_fd_recv, + static_cast<void*>(dst), static_cast<uint64_t>(dst_len), + static_cast<int64_t>(bytes_read), error.AsCString()); if (error_ptr) *error_ptr = error; @@ -562,7 +565,8 @@ ConnectionFileDescriptor::Read (void *dst, default: if (log) - log->Printf("%p ConnectionFileDescriptor::Read (), unexpected error: %s", this, strerror(error_value)); + log->Printf("%p ConnectionFileDescriptor::Read (), unexpected error: %s", + static_cast<void*>(this), strerror(error_value)); status = eConnectionStatusError; break; // Break to close.... @@ -578,7 +582,9 @@ ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStat { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) - log->Printf ("%p ConnectionFileDescriptor::Write (src = %p, src_len = %" PRIu64 ")", this, src, (uint64_t)src_len); + log->Printf ("%p ConnectionFileDescriptor::Write (src = %p, src_len = %" PRIu64 ")", + static_cast<void*>(this), static_cast<const void*>(src), + static_cast<uint64_t>(src_len)); if (!IsConnected ()) { @@ -609,7 +615,7 @@ ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStat bytes_sent = ::send (m_fd_send, (char*)src, src_len, 0); } while (bytes_sent < 0 && errno == EINTR); break; - + case eFDTypeSocketUDP: // Unconnected UDP socket requiring sendto/recvfrom assert (m_udp_send_sockaddr->GetFamily() != 0); do @@ -635,31 +641,28 @@ ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStat { case eFDTypeFile: // Other FD requireing read/write log->Printf ("%p ConnectionFileDescriptor::Write() ::write (fd = %i, src = %p, src_len = %" PRIu64 ") => %" PRIi64 " (error = %s)", - this, - m_fd_send, - src, - (uint64_t)src_len, - (int64_t)bytes_sent, + static_cast<void*>(this), m_fd_send, + static_cast<const void*>(src), + static_cast<uint64_t>(src_len), + static_cast<int64_t>(bytes_sent), error.AsCString()); break; - + case eFDTypeSocket: // Socket requiring send/recv log->Printf ("%p ConnectionFileDescriptor::Write() ::send (socket = %i, src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", - this, - m_fd_send, - src, - (uint64_t)src_len, - (int64_t)bytes_sent, + static_cast<void*>(this), m_fd_send, + static_cast<const void*>(src), + static_cast<uint64_t>(src_len), + static_cast<int64_t>(bytes_sent), error.AsCString()); break; - + case eFDTypeSocketUDP: // Unconnected UDP socket requiring sendto/recvfrom log->Printf ("%p ConnectionFileDescriptor::Write() ::sendto (socket = %i, src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", - this, - m_fd_send, - src, - (uint64_t)src_len, - (int64_t)bytes_sent, + static_cast<void*>(this), m_fd_send, + static_cast<const void*>(src), + static_cast<uint64_t>(src_len), + static_cast<int64_t>(bytes_sent), error.AsCString()); break; } @@ -714,10 +717,11 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt { // Don't need to take the mutex here separately since we are only called from Read. If we // ever get used more generally we will need to lock here as well. - + Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) - log->Printf("%p ConnectionFileDescriptor::BytesAvailable (timeout_usec = %u)", this, timeout_usec); + log->Printf("%p ConnectionFileDescriptor::BytesAvailable (timeout_usec = %u)", + static_cast<void*>(this), timeout_usec); struct timeval *tv_ptr; struct timeval tv; if (timeout_usec == UINT32_MAX) @@ -733,17 +737,17 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt tv.tv_usec = time_value.microseconds(); tv_ptr = &tv; } - + // Make a copy of the file descriptors to make sure we don't // have another thread change these values out from under us // and cause problems in the loop below where like in FS_SET() const int data_fd = m_fd_recv; const int pipe_fd = m_pipe_read; - + if (data_fd >= 0) { const bool have_pipe_fd = pipe_fd >= 0; - + while (data_fd == m_fd_recv) { const int nfds = std::max<int>(data_fd, pipe_fd) + 1; @@ -757,49 +761,55 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt FD_SET (data_fd, read_fds.data()); if (have_pipe_fd) FD_SET (pipe_fd, read_fds.data()); - + Error error; - + if (log) { if (have_pipe_fd) log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i, %i}, NULL, NULL, timeout=%p)...", - this, nfds, data_fd, pipe_fd, tv_ptr); + static_cast<void*>(this), nfds, data_fd, pipe_fd, + static_cast<void*>(tv_ptr)); else log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i}, NULL, NULL, timeout=%p)...", - this, nfds, data_fd, tv_ptr); + static_cast<void*>(this), nfds, data_fd, + static_cast<void*>(tv_ptr)); } - + const int num_set_fds = ::select (nfds, read_fds.data(), NULL, NULL, tv_ptr); if (num_set_fds < 0) error.SetErrorToErrno(); else error.Clear(); - + if (log) { if (have_pipe_fd) log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i, %i}, NULL, NULL, timeout=%p) => %d, error = %s", - this, nfds, data_fd, pipe_fd, tv_ptr, num_set_fds, error.AsCString()); + static_cast<void*>(this), nfds, data_fd, + pipe_fd, static_cast<void*>(tv_ptr), num_set_fds, + error.AsCString()); else log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i}, NULL, NULL, timeout=%p) => %d, error = %s", - this, nfds, data_fd, tv_ptr, num_set_fds, error.AsCString()); + static_cast<void*>(this), nfds, data_fd, + static_cast<void*>(tv_ptr), num_set_fds, + error.AsCString()); } - + if (error_ptr) *error_ptr = error; - + if (error.Fail()) { switch (error.GetError()) { case EBADF: // One of the descriptor sets specified an invalid descriptor. return eConnectionStatusLostConnection; - + case EINVAL: // The specified time limit is invalid. One of its components is negative or too large. default: // Other unknown error return eConnectionStatusError; - + case EAGAIN: // The kernel was (perhaps temporarily) unable to // allocate the requested number of file descriptors, // or we have non-blocking IO @@ -824,23 +834,24 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt // We got a command to exit. Read the data from that pipe: char buffer[16]; ssize_t bytes_read; - + do { bytes_read = ::read (pipe_fd, buffer, sizeof(buffer)); } while (bytes_read < 0 && errno == EINTR); assert (bytes_read == 1 && buffer[0] == 'q'); - + if (log) log->Printf("%p ConnectionFileDescriptor::BytesAvailable() got data: %*s from the command channel.", - this, (int) bytes_read, buffer); - + static_cast<void*>(this), + static_cast<int>(bytes_read), buffer); + return eConnectionStatusEndOfFile; } } } } - + if (error_ptr) error_ptr->SetErrorString("not connected"); return eConnectionStatusLostConnection; @@ -865,10 +876,11 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt { // Don't need to take the mutex here separately since we are only called from Read. If we // ever get used more generally we will need to lock here as well. - + Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) - log->Printf("%p ConnectionFileDescriptor::BytesAvailable (timeout_usec = %u)", this, timeout_usec); + log->Printf("%p ConnectionFileDescriptor::BytesAvailable (timeout_usec = %u)", + static_cast<void*>(this), timeout_usec); struct timeval *tv_ptr; struct timeval tv; if (timeout_usec == UINT32_MAX) @@ -884,7 +896,7 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt tv.tv_usec = time_value.microseconds(); tv_ptr = &tv; } - + // Make a copy of the file descriptors to make sure we don't // have another thread change these values out from under us // and cause problems in the loop below where like in FS_SET() @@ -899,9 +911,9 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt #ifndef _MSC_VER assert (data_fd < FD_SETSIZE); #endif - + const bool have_pipe_fd = pipe_fd >= 0; - + if (have_pipe_fd) { assert (pipe_fd < FD_SETSIZE); @@ -918,47 +930,53 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt const int nfds = std::max<int>(data_fd, pipe_fd) + 1; Error error; - + if (log) { if (have_pipe_fd) log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i, %i}, NULL, NULL, timeout=%p)...", - this, nfds, data_fd, pipe_fd, tv_ptr); + static_cast<void*>(this), nfds, data_fd, pipe_fd, + static_cast<void*>(tv_ptr)); else log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i}, NULL, NULL, timeout=%p)...", - this, nfds, data_fd, tv_ptr); + static_cast<void*>(this), nfds, data_fd, + static_cast<void*>(tv_ptr)); } - + const int num_set_fds = ::select (nfds, &read_fds, NULL, NULL, tv_ptr); if (num_set_fds < 0) error.SetErrorToErrno(); else error.Clear(); - + if (log) { if (have_pipe_fd) log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i, %i}, NULL, NULL, timeout=%p) => %d, error = %s", - this, nfds, data_fd, pipe_fd, tv_ptr, num_set_fds, error.AsCString()); + static_cast<void*>(this), nfds, data_fd, pipe_fd, + static_cast<void*>(tv_ptr), num_set_fds, + error.AsCString()); else log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i}, NULL, NULL, timeout=%p) => %d, error = %s", - this, nfds, data_fd, tv_ptr, num_set_fds, error.AsCString()); + static_cast<void*>(this), nfds, data_fd, + static_cast<void*>(tv_ptr), num_set_fds, + error.AsCString()); } if (error_ptr) *error_ptr = error; - + if (error.Fail()) { switch (error.GetError()) { case EBADF: // One of the descriptor sets specified an invalid descriptor. return eConnectionStatusLostConnection; - + case EINVAL: // The specified time limit is invalid. One of its components is negative or too large. default: // Other unknown error return eConnectionStatusError; - + case EAGAIN: // The kernel was (perhaps temporarily) unable to // allocate the requested number of file descriptors, // or we have non-blocking IO @@ -981,23 +999,24 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt // We got a command to exit. Read the data from that pipe: char buffer[16]; ssize_t bytes_read; - + do { bytes_read = ::read (pipe_fd, buffer, sizeof(buffer)); } while (bytes_read < 0 && errno == EINTR); assert (bytes_read == 1 && buffer[0] == 'q'); - + if (log) log->Printf("%p ConnectionFileDescriptor::BytesAvailable() got data: %*s from the command channel.", - this, (int) bytes_read, buffer); - + static_cast<void*>(this), + static_cast<int>(bytes_read), buffer); + return eConnectionStatusEndOfFile; } } } } - + if (error_ptr) error_ptr->SetErrorString("not connected"); return eConnectionStatusLostConnection; @@ -1136,11 +1155,12 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt bytes_read = ::read (pipe_fd, buffer, sizeof(buffer)); } while (bytes_read < 0 && errno == EINTR); assert (bytes_read == 1 && buffer[0] == 'q'); - + if (log) log->Printf("%p ConnectionFileDescriptor::BytesAvailable() got data: %*s from the command channel.", - this, (int) bytes_read, buffer); - + static_cast<void*>(this), + static_cast<int>(bytes_read), buffer); + return eConnectionStatusEndOfFile; } } @@ -1169,7 +1189,8 @@ ConnectionFileDescriptor::Close (int& fd, FDType type, Error *error_ptr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) - log->Printf ("%p ConnectionFileDescriptor::Close (fd = %i)", this,fd); + log->Printf ("%p ConnectionFileDescriptor::Close (fd = %i)", + static_cast<void*>(this), fd); #if _WIN32 if (type != eFDTypeFile) success = closesocket(fd) == 0; @@ -1291,7 +1312,8 @@ ConnectionFileDescriptor::SocketListen (const char *host_and_port, Error *error_ { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) - log->Printf ("%p ConnectionFileDescriptor::SocketListen (%s)", this, host_and_port); + log->Printf ("%p ConnectionFileDescriptor::SocketListen (%s)", + static_cast<void*>(this), host_and_port); Disconnect (NULL); m_fd_send_type = m_fd_recv_type = eFDTypeSocket; @@ -1447,7 +1469,8 @@ ConnectionFileDescriptor::ConnectTCP (const char *host_and_port, Error *error_pt { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) - log->Printf ("%p ConnectionFileDescriptor::ConnectTCP (host/port = %s)", this, host_and_port); + log->Printf ("%p ConnectionFileDescriptor::ConnectTCP (host/port = %s)", + static_cast<void*>(this), host_and_port); Disconnect (NULL); m_fd_send_type = m_fd_recv_type = eFDTypeSocket; @@ -1521,11 +1544,12 @@ ConnectionFileDescriptor::ConnectUDP (const char *host_and_port, Error *error_pt { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) - log->Printf ("%p ConnectionFileDescriptor::ConnectUDP (host/port = %s)", this, host_and_port); + log->Printf ("%p ConnectionFileDescriptor::ConnectUDP (host/port = %s)", + static_cast<void*>(this), host_and_port); Disconnect (NULL); m_fd_send_type = m_fd_recv_type = eFDTypeSocketUDP; - + std::string host_str; std::string port_str; int32_t port = INT32_MIN; @@ -1561,10 +1585,10 @@ ConnectionFileDescriptor::ConnectUDP (const char *host_and_port, Error *error_pt // At this point we have setup the recieve port, now we need to // setup the UDP send socket - + struct addrinfo hints; struct addrinfo *service_info_list = NULL; - + ::memset (&hints, 0, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_DGRAM; @@ -1580,7 +1604,7 @@ ConnectionFileDescriptor::ConnectUDP (const char *host_and_port, Error *error_pt Disconnect (NULL); return eConnectionStatusError; } - + for (struct addrinfo *service_info_ptr = service_info_list; service_info_ptr != NULL; service_info_ptr = service_info_ptr->ai_next) @@ -1588,7 +1612,7 @@ ConnectionFileDescriptor::ConnectUDP (const char *host_and_port, Error *error_pt m_fd_send = ::socket (service_info_ptr->ai_family, service_info_ptr->ai_socktype, service_info_ptr->ai_protocol); - + if (m_fd_send != -1) { *m_udp_send_sockaddr = service_info_ptr; @@ -1597,7 +1621,7 @@ ConnectionFileDescriptor::ConnectUDP (const char *host_and_port, Error *error_pt else continue; } - + :: freeaddrinfo (service_info_list); if (m_fd_send == -1) diff --git a/lldb/source/Core/ConstString.cpp b/lldb/source/Core/ConstString.cpp index ce6e51108db..5657b483a49 100644 --- a/lldb/source/Core/ConstString.cpp +++ b/lldb/source/Core/ConstString.cpp @@ -294,7 +294,10 @@ ConstString::DumpDebug(Stream *s) const size_t cstr_len = GetLength(); // Only print the parens if we have a non-NULL string const char *parens = cstr ? "\"" : ""; - s->Printf("%*p: ConstString, string = %s%s%s, length = %" PRIu64, (int)sizeof(void*) * 2, this, parens, cstr, parens, (uint64_t)cstr_len); + s->Printf("%*p: ConstString, string = %s%s%s, length = %" PRIu64, + static_cast<int>(sizeof(void*) * 2), + static_cast<const void*>(this), parens, cstr, parens, + static_cast<uint64_t>(cstr_len)); } void diff --git a/lldb/source/Core/Event.cpp b/lldb/source/Core/Event.cpp index 2d4899dd6dc..bf5ff222a12 100644 --- a/lldb/source/Core/Event.cpp +++ b/lldb/source/Core/Event.cpp @@ -57,20 +57,19 @@ Event::Dump (Stream *s) const StreamString event_name; if (m_broadcaster->GetEventNames (event_name, m_type, false)) s->Printf("%p Event: broadcaster = %p (%s), type = 0x%8.8x (%s), data = ", - this, - m_broadcaster, + static_cast<const void*>(this), + static_cast<void*>(m_broadcaster), m_broadcaster->GetBroadcasterName().GetCString(), - m_type, - event_name.GetString().c_str()); + m_type, event_name.GetString().c_str()); else s->Printf("%p Event: broadcaster = %p (%s), type = 0x%8.8x, data = ", - this, - m_broadcaster, - m_broadcaster->GetBroadcasterName().GetCString(), - m_type); + static_cast<const void*>(this), + static_cast<void*>(m_broadcaster), + m_broadcaster->GetBroadcasterName().GetCString(), m_type); } else - s->Printf("%p Event: broadcaster = NULL, type = 0x%8.8x, data = ", this, m_type); + s->Printf("%p Event: broadcaster = NULL, type = 0x%8.8x, data = ", + static_cast<const void*>(this), m_type); if (m_data_ap.get() == NULL) s->Printf ("<NULL>"); diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp index 738780de0bb..f9e03d10c5c 100644 --- a/lldb/source/Core/IOHandler.cpp +++ b/lldb/source/Core/IOHandler.cpp @@ -4536,31 +4536,30 @@ public: m_max_y (0) { } - - + virtual ~SourceFileWindowDelegate() { } - + void Update (const SymbolContext &sc) { m_sc = sc; } - + uint32_t NumVisibleLines () const { return m_max_y - m_min_y; } - + virtual const char * WindowDelegateGetHelpText () { return "Source/Disassembly window keyboard shortcuts:"; } - + virtual KeyHelp * WindowDelegateGetKeyHelp () { @@ -4587,7 +4586,7 @@ public: }; return g_source_view_key_help; } - + virtual bool WindowDelegateDraw (Window &window, bool force) { @@ -4605,20 +4604,18 @@ public: update_location = true; } } - + m_min_x = 1; m_min_y = 2; m_max_x = window.GetMaxX()-1; m_max_y = window.GetMaxY()-1; - + const uint32_t num_visible_lines = NumVisibleLines(); StackFrameSP frame_sp; bool set_selected_line_to_pc = false; - if (update_location) { - const bool process_alive = process ? process->IsAlive() : false; bool thread_changed = false; if (process_alive) @@ -4665,9 +4662,9 @@ public: frame_changed = m_frame_idx != UINT32_MAX; m_frame_idx = UINT32_MAX; } - + const bool context_changed = thread_changed || frame_changed || stop_id_changed; - + if (process_alive) { if (m_sc.line_entry.IsValid()) @@ -4707,7 +4704,7 @@ public: int m_line_width = 1; for (size_t n = num_lines; n >= 10; n = n / 10) ++m_line_width; - + snprintf (m_line_format, sizeof(m_line_format), " %%%iu ", m_line_width); if (num_lines < num_visible_lines || m_selected_line < num_visible_lines) m_first_visible_line = 0; @@ -4720,7 +4717,7 @@ public: { m_file_sp.reset(); } - + if (!m_file_sp || m_file_sp->GetNumLines() == 0) { // Show disassembly @@ -4775,8 +4772,7 @@ public: m_pc_line = UINT32_MAX; } } - - + const int window_width = window.GetWidth(); window.Erase(); window.DrawTitleBox ("Sources"); @@ -4822,8 +4818,7 @@ public: } } } - - + const attr_t selected_highlight_attr = A_REVERSE; const attr_t pc_highlight_attr = COLOR_PAIR(1); @@ -4844,13 +4839,13 @@ public: highlight_attr = pc_highlight_attr; else if (line_is_selected) highlight_attr = selected_highlight_attr; - + if (bp_lines.find(curr_line+1) != bp_lines.end()) bp_attr = COLOR_PAIR(2); if (bp_attr) window.AttributeOn(bp_attr); - + window.Printf (m_line_format, curr_line + 1); if (bp_attr) @@ -4862,7 +4857,7 @@ public: window.PutChar(ACS_DIAMOND); else window.PutChar(' '); - + if (highlight_attr) window.AttributeOn(highlight_attr); const uint32_t line_len = m_file_sp->GetLineLength(curr_line + 1, false); @@ -4930,16 +4925,15 @@ public: } } } - - + const attr_t selected_highlight_attr = A_REVERSE; const attr_t pc_highlight_attr = COLOR_PAIR(1); - + StreamString strm; InstructionList &insts = m_disassembly_sp->GetInstructionList(); Address pc_address; - + if (frame_sp) pc_address = frame_sp->GetFrameCodeAddress(); const uint32_t pc_idx = pc_address.IsValid() ? insts.GetIndexOfInstructionAtAddress (pc_address) : UINT32_MAX; @@ -4965,7 +4959,7 @@ public: Instruction *inst = insts.GetInstructionAtIndex(inst_idx).get(); if (!inst) break; - + const int line_y = m_min_y+i; window.MoveCursor(1, line_y); const bool is_pc_line = frame_sp && inst_idx == pc_idx; @@ -4978,28 +4972,29 @@ public: highlight_attr = pc_highlight_attr; else if (line_is_selected) highlight_attr = selected_highlight_attr; - + if (bp_file_addrs.find(inst->GetAddress().GetFileAddress()) != bp_file_addrs.end()) bp_attr = COLOR_PAIR(2); - + if (bp_attr) window.AttributeOn(bp_attr); - - window.Printf (" 0x%16.16llx ", inst->GetAddress().GetLoadAddress(target)); - + + window.Printf (" 0x%16.16llx ", + static_cast<unsigned long long>(inst->GetAddress().GetLoadAddress(target))); + if (bp_attr) window.AttributeOff(bp_attr); - + window.PutChar(ACS_VLINE); // Mark the line with the PC with a diamond if (is_pc_line) window.PutChar(ACS_DIAMOND); else window.PutChar(' '); - + if (highlight_attr) window.AttributeOn(highlight_attr); - + const char *mnemonic = inst->GetMnemonic(&exe_ctx); const char *operands = inst->GetOperands(&exe_ctx); const char *comment = inst->GetComment(&exe_ctx); @@ -5010,7 +5005,7 @@ public: operands = NULL; if (comment && comment[0] == '\0') comment = NULL; - + strm.Clear(); if (mnemonic && operands && comment) @@ -5019,10 +5014,10 @@ public: strm.Printf ("%-8s %s", mnemonic, operands); else if (mnemonic) strm.Printf ("%s", mnemonic); - + int right_pad = 1; window.PutCStringTruncated(strm.GetString().c_str(), right_pad); - + if (is_pc_line && frame_sp && frame_sp->GetConcreteFrameIndex() == 0) { StopInfoSP stop_info_sp; @@ -5053,7 +5048,7 @@ public: window.DeferredRefresh(); return true; // Drawing handled } - + size_t GetNumLines () { @@ -5062,7 +5057,7 @@ public: num_lines = GetNumDisassemblyLines(); return num_lines; } - + size_t GetNumSourceLines () const { @@ -5095,7 +5090,7 @@ public: m_first_visible_line = 0; m_selected_line = m_first_visible_line; return eKeyHandled; - + case '.': case KEY_NPAGE: // Page down key @@ -5109,7 +5104,7 @@ public: m_selected_line = m_first_visible_line; } return eKeyHandled; - + case KEY_UP: if (m_selected_line > 0) { @@ -5127,7 +5122,7 @@ public: m_first_visible_line++; } return eKeyHandled; - + case '\r': case '\n': case KEY_ENTER: @@ -5221,7 +5216,7 @@ public: exe_ctx.GetProcessRef().Resume(); } return eKeyHandled; - + case 'o': // 'o' == step out { @@ -5254,7 +5249,7 @@ public: } } return eKeyHandled; - + case 'h': window.CreateHelpSubwindow (); return eKeyHandled; @@ -5264,7 +5259,7 @@ public: } return eKeyNotHandled; } - + protected: typedef std::set<uint32_t> BreakpointLines; typedef std::set<lldb::addr_t> BreakpointAddrs; diff --git a/lldb/source/Core/Listener.cpp b/lldb/source/Core/Listener.cpp index aca2b374092..8f843589b09 100644 --- a/lldb/source/Core/Listener.cpp +++ b/lldb/source/Core/Listener.cpp @@ -34,21 +34,23 @@ Listener::Listener(const char *name) : { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Listener::Listener('%s')", this, m_name.c_str()); + log->Printf ("%p Listener::Listener('%s')", + static_cast<void*>(this), m_name.c_str()); } Listener::~Listener() { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); Mutex::Locker locker (m_broadcasters_mutex); - + size_t num_managers = m_broadcaster_managers.size(); - + for (size_t i = 0; i < num_managers; i++) m_broadcaster_managers[i]->RemoveListener(*this); - + if (log) - log->Printf ("%p Listener::~Listener('%s')", this, m_name.c_str()); + log->Printf ("%p Listener::~Listener('%s')", + static_cast<void*>(this), m_name.c_str()); Clear(); } @@ -87,11 +89,9 @@ Listener::StartListeningForEvents (Broadcaster* broadcaster, uint32_t event_mask Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS)); if (log) log->Printf ("%p Listener::StartListeningForEvents (broadcaster = %p, mask = 0x%8.8x) acquired_mask = 0x%8.8x for %s", - this, - broadcaster, - event_mask, - acquired_mask, - m_name.c_str()); + static_cast<void*>(this), + static_cast<void*>(broadcaster), event_mask, + acquired_mask, m_name.c_str()); return acquired_mask; @@ -115,8 +115,14 @@ Listener::StartListeningForEvents (Broadcaster* broadcaster, uint32_t event_mask Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS)); if (log) + { + void **pointer = reinterpret_cast<void**>(&callback); log->Printf ("%p Listener::StartListeningForEvents (broadcaster = %p, mask = 0x%8.8x, callback = %p, user_data = %p) acquired_mask = 0x%8.8x for %s", - this, broadcaster, event_mask, callback, callback_user_data, acquired_mask, m_name.c_str()); + static_cast<void*>(this), + static_cast<void*>(broadcaster), event_mask, *pointer, + static_cast<void*>(callback_user_data), acquired_mask, + m_name.c_str()); + } return acquired_mask; } @@ -185,7 +191,9 @@ Listener::AddEvent (EventSP &event_sp) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS)); if (log) - log->Printf ("%p Listener('%s')::AddEvent (event_sp = {%p})", this, m_name.c_str(), event_sp.get()); + log->Printf ("%p Listener('%s')::AddEvent (event_sp = {%p})", + static_cast<void*>(this), m_name.c_str(), + static_cast<void*>(event_sp.get())); // Scope for "locker" { @@ -292,17 +300,14 @@ Listener::FindNextEventInternal if (pos != m_events.end()) { event_sp = *pos; - + if (log) log->Printf ("%p '%s' Listener::FindNextEventInternal(broadcaster=%p, broadcaster_names=%p[%u], event_type_mask=0x%8.8x, remove=%i) event %p", - this, - GetName(), - broadcaster, - broadcaster_names, - num_broadcaster_names, - event_type_mask, - remove, - event_sp.get()); + static_cast<void*>(this), GetName(), + static_cast<void*>(broadcaster), + static_cast<const void*>(broadcaster_names), + num_broadcaster_names, event_type_mask, remove, + static_cast<void*>(event_sp.get())); if (remove) { @@ -311,16 +316,16 @@ Listener::FindNextEventInternal if (m_events.empty()) m_cond_wait.SetValue (false, eBroadcastNever); } - + // Unlock the event queue here. We've removed this event and are about to return // it so it should be okay to get the next event off the queue here - and it might // be useful to do that in the "DoOnRemoval". lock.Unlock(); - + // Don't call DoOnRemoval if you aren't removing the event... if (remove) event_sp->DoOnRemoval(); - + return true; } @@ -404,10 +409,9 @@ Listener::WaitForEventsInternal bool timed_out = false; if (log) - { log->Printf ("%p Listener::WaitForEventsInternal (timeout = { %p }) for %s", - this, timeout, m_name.c_str()); - } + static_cast<void*>(this), static_cast<const void*>(timeout), + m_name.c_str()); while (1) { @@ -421,7 +425,7 @@ Listener::WaitForEventsInternal // added that might meet our current filter // But first poll for any new event that might satisfy our condition, and if so consume it, // otherwise wait. - + Mutex::Locker event_locker(m_events_mutex); const bool remove = false; if (FindNextEventInternal (broadcaster, broadcaster_names, num_broadcaster_names, event_type_mask, event_sp, remove)) @@ -437,14 +441,16 @@ Listener::WaitForEventsInternal { log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS); if (log) - log->Printf ("%p Listener::WaitForEventsInternal() timed out for %s", this, m_name.c_str()); + log->Printf ("%p Listener::WaitForEventsInternal() timed out for %s", + static_cast<void*>(this), m_name.c_str()); break; } else { log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS); if (log) - log->Printf ("%p Listener::WaitForEventsInternal() unknown error for %s", this, m_name.c_str()); + log->Printf ("%p Listener::WaitForEventsInternal() unknown error for %s", + static_cast<void*>(this), m_name.c_str()); break; } } diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp index 55bd3cbb8e9..60cd80fa2ee 100644 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -5242,7 +5242,8 @@ Mangled::Dump (Stream *s) const void Mangled::DumpDebug (Stream *s) const { - s->Printf("%*p: Mangled mangled = ", (int)sizeof(void*) * 2, this); + s->Printf("%*p: Mangled mangled = ", static_cast<int>(sizeof(void*) * 2), + static_cast<const void*>(this)); m_mangled.DumpDebug(s); s->Printf(", demangled = "); m_demangled.DumpDebug(s); diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index a6ffbd2b76a..4cf10e9d51f 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -161,23 +161,23 @@ Module::Module (const ModuleSpec &module_spec) : Mutex::Locker locker (GetAllocationModuleCollectionMutex()); GetModuleCollection().push_back(this); } - + Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES)); if (log) log->Printf ("%p Module::Module((%s) '%s%s%s%s')", - this, + static_cast<void*>(this), module_spec.GetArchitecture().GetArchitectureName(), module_spec.GetFileSpec().GetPath().c_str(), module_spec.GetObjectName().IsEmpty() ? "" : "(", module_spec.GetObjectName().IsEmpty() ? "" : module_spec.GetObjectName().AsCString(""), module_spec.GetObjectName().IsEmpty() ? "" : ")"); - + // First extract all module specifications from the file using the local // file path. If there are no specifications, then don't fill anything in ModuleSpecList modules_specs; if (ObjectFile::GetModuleSpecifications(module_spec.GetFileSpec(), 0, 0, modules_specs) == 0) return; - + // Now make sure that one of the module specifications matches what we just // extract. We might have a module specification that specifies a file "/usr/lib/dyld" // with UUID XXX, but we might have a local version of "/usr/lib/dyld" that has @@ -239,15 +239,14 @@ Module::Module(const FileSpec& file_spec, if (object_name) m_object_name = *object_name; - + if (object_mod_time_ptr) m_object_mod_time = *object_mod_time_ptr; Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES)); if (log) log->Printf ("%p Module::Module((%s) '%s%s%s%s')", - this, - m_arch.GetArchitectureName(), + static_cast<void*>(this), m_arch.GetArchitectureName(), m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(", m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""), @@ -300,7 +299,7 @@ Module::~Module() Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES)); if (log) log->Printf ("%p Module::~Module((%s) '%s%s%s%s')", - this, + static_cast<void*>(this), m_arch.GetArchitectureName(), m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(", @@ -473,14 +472,16 @@ Module::CalculateSymbolContextModule () void Module::DumpSymbolContext(Stream *s) { - s->Printf(", Module{%p}", this); + s->Printf(", Module{%p}", static_cast<void*>(this)); } size_t Module::GetNumCompileUnits() { Mutex::Locker locker (m_mutex); - Timer scoped_timer(__PRETTY_FUNCTION__, "Module::GetNumCompileUnits (module = %p)", this); + Timer scoped_timer(__PRETTY_FUNCTION__, + "Module::GetNumCompileUnits (module = %p)", + static_cast<void*>(this)); SymbolVendor *symbols = GetSymbolVendor (); if (symbols) return symbols->GetNumCompileUnits(); diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 3fad62d9a30..45cad1bb26f 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -931,7 +931,7 @@ ModuleList::GetSharedModule for (size_t module_idx = 0; module_idx < num_matching_modules; ++module_idx) { module_sp = matching_module_list.GetModuleAtIndex(module_idx); - + // Make sure the file for the module hasn't been modified if (module_sp->FileHasChanged()) { @@ -940,7 +940,8 @@ ModuleList::GetSharedModule Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_MODULES)); if (log) - log->Printf("module changed: %p, removing from global module list", module_sp.get()); + log->Printf("module changed: %p, removing from global module list", + static_cast<void*>(module_sp.get())); shared_module_list.Remove (module_sp); module_sp.reset(); @@ -975,7 +976,7 @@ ModuleList::GetSharedModule { if (did_create_ptr) *did_create_ptr = true; - + shared_module_list.ReplaceEquivalent(module_sp); return error; } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 1145eaa3d43..90d30d2593d 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -237,13 +237,12 @@ ValueObject::UpdateFormatsIfNeeded() Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES)); if (log) log->Printf("[%s %p] checking for FormatManager revisions. ValueObject rev: %d - Global rev: %d", - GetName().GetCString(), - this, - m_last_format_mgr_revision, - DataVisualization::GetCurrentRevision()); - + GetName().GetCString(), static_cast<void*>(this), + m_last_format_mgr_revision, + DataVisualization::GetCurrentRevision()); + bool any_change = false; - + if ( (m_last_format_mgr_revision != DataVisualization::GetCurrentRevision())) { SetValueFormat(DataVisualization::GetFormat (*this, eNoDynamicValues)); @@ -253,12 +252,11 @@ ValueObject::UpdateFormatsIfNeeded() #endif m_last_format_mgr_revision = DataVisualization::GetCurrentRevision(); - + any_change = true; } - + return any_change; - } void diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index 47e781e7115..a9f2606212c 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -175,7 +175,7 @@ ValueObjectDynamicValue::UpdateValue () m_error = m_parent->GetError(); return false; } - + // Setting our type_sp to NULL will route everything back through our // parent which is equivalent to not using dynamic values. if (m_use_dynamic == lldb::eNoDynamicValues) @@ -183,7 +183,7 @@ ValueObjectDynamicValue::UpdateValue () m_dynamic_type_info.Clear(); return true; } - + ExecutionContext exe_ctx (GetExecutionContextRef()); Target *target = exe_ctx.GetTargetPtr(); if (target) @@ -191,16 +191,16 @@ ValueObjectDynamicValue::UpdateValue () m_data.SetByteOrder(target->GetArchitecture().GetByteOrder()); m_data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize()); } - + // First make sure our Type and/or Address haven't changed: Process *process = exe_ctx.GetProcessPtr(); if (!process) return false; - + TypeAndOrName class_type_or_name; Address dynamic_address; bool found_dynamic_type = false; - + lldb::LanguageType known_type = m_parent->GetObjectRuntimeLanguage(); if (known_type != lldb::eLanguageTypeUnknown && known_type != lldb::eLanguageTypeC) { @@ -213,7 +213,7 @@ ValueObjectDynamicValue::UpdateValue () LanguageRuntime *cpp_runtime = process->GetLanguageRuntime (lldb::eLanguageTypeC_plus_plus); if (cpp_runtime) found_dynamic_type = cpp_runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address); - + if (!found_dynamic_type) { LanguageRuntime *objc_runtime = process->GetLanguageRuntime (lldb::eLanguageTypeObjC); @@ -221,10 +221,10 @@ ValueObjectDynamicValue::UpdateValue () found_dynamic_type = objc_runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address); } } - + // Getting the dynamic value may have run the program a bit, and so marked us as needing updating, but we really // don't... - + m_update_point.SetUpdated(); if (found_dynamic_type) @@ -251,7 +251,7 @@ ValueObjectDynamicValue::UpdateValue () { m_type_impl.Clear(); } - + // If we don't have a dynamic type, then make ourselves just a echo of our parent. // Or we could return false, and make ourselves an echo of our parent? if (!found_dynamic_type) @@ -264,13 +264,13 @@ ValueObjectDynamicValue::UpdateValue () m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get()); return m_error.Success(); } - + Value old_value(m_value); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES)); - + bool has_changed_type = false; - + if (!m_dynamic_type_info) { m_dynamic_type_info = class_type_or_name; @@ -283,37 +283,35 @@ ValueObjectDynamicValue::UpdateValue () SetValueDidChange (true); has_changed_type = true; } - + if (has_changed_type) ClearDynamicTypeInformation (); - + if (!m_address.IsValid() || m_address != dynamic_address) { if (m_address.IsValid()) SetValueDidChange (true); - + // We've moved, so we should be fine... m_address = dynamic_address; lldb::TargetSP target_sp (GetTargetSP()); lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get()); m_value.GetScalar() = load_address; } - + m_dynamic_type_info = FixupTypeAndOrName(m_dynamic_type_info, *m_parent); - + //m_value.SetContext (Value::eContextTypeClangType, corrected_type); m_value.SetClangType (m_dynamic_type_info.GetClangASTType()); - + // Our address is the location of the dynamic type stored in memory. It isn't a load address, // because we aren't pointing to the LOCATION that stores the pointer to us, we're pointing to us... m_value.SetValueType(Value::eValueTypeScalar); if (has_changed_type && log) - log->Printf("[%s %p] has a new dynamic type %s", - GetName().GetCString(), - this, - GetTypeName().GetCString()); - + log->Printf("[%s %p] has a new dynamic type %s", GetName().GetCString(), + static_cast<void*>(this), GetTypeName().GetCString()); + if (m_address.IsValid() && m_dynamic_type_info) { // The variable value is in the Scalar value inside the m_value. @@ -333,7 +331,7 @@ ValueObjectDynamicValue::UpdateValue () return true; } } - + // We get here if we've failed above... SetValueIsValid (false); return false; diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index e077017f281..2f026b50a28 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -594,7 +594,9 @@ FormatManager::GetFormat (ValueObject& valobj, if (valobj_type) { if (log) - log->Printf("[FormatManager::GetFormat] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>")); + log->Printf("[FormatManager::GetFormat] Caching %p for type %s", + static_cast<void*>(retval.get()), + valobj_type.AsCString("<invalid>")); m_format_cache.SetFormat(valobj_type,retval); } if (log && log->GetDebug()) @@ -643,7 +645,9 @@ FormatManager::GetSummaryFormat (ValueObject& valobj, if (valobj_type) { if (log) - log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>")); + log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s", + static_cast<void*>(retval.get()), + valobj_type.AsCString("<invalid>")); m_format_cache.SetSummary(valobj_type,retval); } if (log && log->GetDebug()) @@ -693,7 +697,9 @@ FormatManager::GetSyntheticChildren (ValueObject& valobj, if (valobj_type) { if (log) - log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>")); + log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s", + static_cast<void*>(retval.get()), + valobj_type.AsCString("<invalid>")); m_format_cache.SetSynthetic(valobj_type,retval); } if (log && log->GetDebug()) diff --git a/lldb/source/DataFormatters/TypeSummary.cpp b/lldb/source/DataFormatters/TypeSummary.cpp index 4c75b4b87d0..628c385b92d 100644 --- a/lldb/source/DataFormatters/TypeSummary.cpp +++ b/lldb/source/DataFormatters/TypeSummary.cpp @@ -129,7 +129,8 @@ std::string CXXFunctionSummaryFormat::GetDescription () { StreamString sstr; - sstr.Printf ("`%s (%p) `%s%s%s%s%s%s%s", m_description.c_str(),m_impl, + sstr.Printf ("`%s (%p) `%s%s%s%s%s%s%s", m_description.c_str(), + static_cast<void*>(&m_impl), Cascades() ? "" : " (not cascading)", !DoesPrintChildren() ? "" : " (show children)", !DoesPrintValue() ? " (hide value)" : "", diff --git a/lldb/source/DataFormatters/TypeSynthetic.cpp b/lldb/source/DataFormatters/TypeSynthetic.cpp index 972be486b78..29f0c627675 100644 --- a/lldb/source/DataFormatters/TypeSynthetic.cpp +++ b/lldb/source/DataFormatters/TypeSynthetic.cpp @@ -57,9 +57,9 @@ CXXSyntheticChildren::GetDescription() Cascades() ? "" : " (not cascading)", SkipsPointers() ? " (skip pointers)" : "", SkipsReferences() ? " (skip references)" : "", - m_create_callback, + reinterpret_cast<void*>(m_create_callback), m_description.c_str()); - + return sstr.GetString(); } diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp index 4c25114202c..1d7e4d52062 100644 --- a/lldb/source/Expression/ClangASTSource.cpp +++ b/lldb/source/Expression/ClangASTSource.cpp @@ -168,50 +168,48 @@ ClangASTSource::FindExternalVisibleDeclsByName void ClangASTSource::CompleteType (TagDecl *tag_decl) -{ +{ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + static unsigned int invocation_id = 0; unsigned int current_id = invocation_id++; - + if (log) { - log->Printf(" CompleteTagDecl[%u] on (ASTContext*)%p Completing (TagDecl*)%p named %s", - current_id, - m_ast_context, - tag_decl, + log->Printf(" CompleteTagDecl[%u] on (ASTContext*)%p Completing (TagDecl*)%p named %s", + current_id, static_cast<void*>(m_ast_context), + static_cast<void*>(tag_decl), tag_decl->getName().str().c_str()); - + log->Printf(" CTD[%u] Before:", current_id); ASTDumper dumper((Decl*)tag_decl); dumper.ToLog(log, " [CTD] "); } - + if (!m_ast_importer->CompleteTagDecl (tag_decl)) { // We couldn't complete the type. Maybe there's a definition // somewhere else that can be completed. - + if (log) log->Printf(" CTD[%u] Type could not be completed in the module in which it was first found.", current_id); - + bool found = false; DeclContext *decl_ctx = tag_decl->getDeclContext(); - + if (const NamespaceDecl *namespace_context = dyn_cast<NamespaceDecl>(decl_ctx)) { ClangASTImporter::NamespaceMapSP namespace_map = m_ast_importer->GetNamespaceMap(namespace_context); - + if (log && log->GetVerbose()) - log->Printf(" CTD[%u] Inspecting namespace map %p (%d entries)", - current_id, - namespace_map.get(), - (int)namespace_map->size()); - + log->Printf(" CTD[%u] Inspecting namespace map %p (%d entries)", + current_id, static_cast<void*>(namespace_map.get()), + static_cast<int>(namespace_map->size())); + if (!namespace_map) return; - + for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(), e = namespace_map->end(); i != e && !found; ++i) @@ -221,35 +219,35 @@ ClangASTSource::CompleteType (TagDecl *tag_decl) current_id, i->second.GetNamespaceDecl()->getNameAsString().c_str(), i->first->GetFileSpec().GetFilename().GetCString()); - + TypeList types; - + SymbolContext null_sc; ConstString name(tag_decl->getName().str().c_str()); - + i->first->FindTypesInNamespace(null_sc, name, &i->second, UINT32_MAX, types); - + for (uint32_t ti = 0, te = types.GetSize(); ti != te && !found; ++ti) { lldb::TypeSP type = types.GetTypeAtIndex(ti); - + if (!type) continue; - + ClangASTType clang_type (type->GetClangFullType()); - + if (!clang_type) continue; - + const TagType *tag_type = clang_type.GetQualType()->getAs<TagType>(); - + if (!tag_type) continue; - + TagDecl *candidate_tag_decl = const_cast<TagDecl*>(tag_type->getDecl()); - + if (m_ast_importer->CompleteTagDeclWithOrigin (tag_decl, candidate_tag_decl)) found = true; } @@ -258,43 +256,43 @@ ClangASTSource::CompleteType (TagDecl *tag_decl) else { TypeList types; - + SymbolContext null_sc; ConstString name(tag_decl->getName().str().c_str()); ClangNamespaceDecl namespace_decl; - + const ModuleList &module_list = m_target->GetImages(); bool exact_match = false; module_list.FindTypes (null_sc, name, exact_match, UINT32_MAX, types); - + for (uint32_t ti = 0, te = types.GetSize(); ti != te && !found; ++ti) { lldb::TypeSP type = types.GetTypeAtIndex(ti); - + if (!type) continue; - + ClangASTType clang_type (type->GetClangFullType()); - + if (!clang_type) continue; - + const TagType *tag_type = clang_type.GetQualType()->getAs<TagType>(); - + if (!tag_type) continue; - + TagDecl *candidate_tag_decl = const_cast<TagDecl*>(tag_type->getDecl()); - + if (m_ast_importer->CompleteTagDeclWithOrigin (tag_decl, candidate_tag_decl)) found = true; } } } - + if (log) { log->Printf(" [CTD] After:"); @@ -305,39 +303,41 @@ ClangASTSource::CompleteType (TagDecl *tag_decl) void ClangASTSource::CompleteType (clang::ObjCInterfaceDecl *interface_decl) -{ +{ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + if (log) { - log->Printf(" [CompleteObjCInterfaceDecl] on (ASTContext*)%p Completing an ObjCInterfaceDecl named %s", m_ast_context, interface_decl->getName().str().c_str()); + log->Printf(" [CompleteObjCInterfaceDecl] on (ASTContext*)%p Completing an ObjCInterfaceDecl named %s", + static_cast<void*>(m_ast_context), + interface_decl->getName().str().c_str()); log->Printf(" [COID] Before:"); ASTDumper dumper((Decl*)interface_decl); dumper.ToLog(log, " [COID] "); } - + Decl *original_decl = NULL; ASTContext *original_ctx = NULL; - + if (m_ast_importer->ResolveDeclOrigin(interface_decl, &original_decl, &original_ctx)) { if (ObjCInterfaceDecl *original_iface_decl = dyn_cast<ObjCInterfaceDecl>(original_decl)) { ObjCInterfaceDecl *complete_iface_decl = GetCompleteObjCInterface(original_iface_decl); - + if (complete_iface_decl && (complete_iface_decl != original_iface_decl)) { m_ast_importer->SetDeclOrigin(interface_decl, original_iface_decl); } } } - + m_ast_importer->CompleteObjCInterfaceDecl (interface_decl); - + if (interface_decl->getSuperClass() && interface_decl->getSuperClass() != interface_decl) CompleteType(interface_decl->getSuperClass()); - + if (log) { log->Printf(" [COID] After:"); @@ -391,83 +391,82 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context, ClangASTMetrics::RegisterLexicalQuery(); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + const Decl *context_decl = dyn_cast<Decl>(decl_context); - + if (!context_decl) return ELR_Failure; - + static unsigned int invocation_id = 0; unsigned int current_id = invocation_id++; - + if (log) { if (const NamedDecl *context_named_decl = dyn_cast<NamedDecl>(context_decl)) log->Printf("FindExternalLexicalDecls[%u] on (ASTContext*)%p in '%s' (%sDecl*)%p with %s predicate", - current_id, - m_ast_context, + current_id, static_cast<void*>(m_ast_context), context_named_decl->getNameAsString().c_str(), context_decl->getDeclKindName(), - context_decl, + static_cast<const void*>(context_decl), (predicate ? "non-null" : "null")); else if(context_decl) log->Printf("FindExternalLexicalDecls[%u] on (ASTContext*)%p in (%sDecl*)%p with %s predicate", - current_id, - m_ast_context, - context_decl->getDeclKindName(), - context_decl, + current_id, static_cast<void*>(m_ast_context), + context_decl->getDeclKindName(), + static_cast<const void*>(context_decl), (predicate ? "non-null" : "null")); else log->Printf("FindExternalLexicalDecls[%u] on (ASTContext*)%p in a NULL context with %s predicate", - current_id, - m_ast_context, + current_id, static_cast<const void*>(m_ast_context), (predicate ? "non-null" : "null")); } - + Decl *original_decl = NULL; ASTContext *original_ctx = NULL; - + if (!m_ast_importer->ResolveDeclOrigin(context_decl, &original_decl, &original_ctx)) return ELR_Failure; - + if (log) - { - log->Printf(" FELD[%u] Original decl (ASTContext*)%p (Decl*)%p:", current_id, original_ctx, original_decl); + { + log->Printf(" FELD[%u] Original decl (ASTContext*)%p (Decl*)%p:", + current_id, static_cast<void*>(original_ctx), + static_cast<void*>(original_decl)); ASTDumper(original_decl).ToLog(log, " "); } - + if (ObjCInterfaceDecl *original_iface_decl = dyn_cast<ObjCInterfaceDecl>(original_decl)) { ObjCInterfaceDecl *complete_iface_decl = GetCompleteObjCInterface(original_iface_decl); - + if (complete_iface_decl && (complete_iface_decl != original_iface_decl)) { original_decl = complete_iface_decl; original_ctx = &complete_iface_decl->getASTContext(); - + m_ast_importer->SetDeclOrigin(context_decl, original_iface_decl); } } - + if (TagDecl *original_tag_decl = dyn_cast<TagDecl>(original_decl)) { ExternalASTSource *external_source = original_ctx->getExternalSource(); - + if (external_source) external_source->CompleteType (original_tag_decl); } - + const DeclContext *original_decl_context = dyn_cast<DeclContext>(original_decl); - + if (!original_decl_context) return ELR_Failure; - + for (TagDecl::decl_iterator iter = original_decl_context->decls_begin(); iter != original_decl_context->decls_end(); ++iter) { Decl *decl = *iter; - + if (!predicate || predicate(decl->getKind())) { if (log) @@ -478,35 +477,35 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context, else log->Printf(" FELD[%d] Adding lexical %sDecl %s", current_id, decl->getDeclKindName(), ast_dumper.GetCString()); } - + Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, original_ctx, decl); - + if (!copied_decl) continue; - + if (FieldDecl *copied_field = dyn_cast<FieldDecl>(copied_decl)) { QualType copied_field_type = copied_field->getType(); - + m_ast_importer->RequireCompleteType(copied_field_type); } - + decls.push_back(copied_decl); - + DeclContext *decl_context_non_const = const_cast<DeclContext *>(decl_context); - + if (copied_decl->getDeclContext() != decl_context) { if (copied_decl->getDeclContext()->containsDecl(copied_decl)) copied_decl->getDeclContext()->removeDecl(copied_decl); copied_decl->setDeclContext(decl_context_non_const); } - + if (!decl_context_non_const->containsDecl(copied_decl)) decl_context_non_const->addDeclInternal(copied_decl); } } - + return ELR_AlreadyLoaded; } @@ -514,41 +513,48 @@ void ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context) { assert (m_ast_context); - + ClangASTMetrics::RegisterVisibleQuery(); - + const ConstString name(context.m_decl_name.getAsString().c_str()); - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + static unsigned int invocation_id = 0; unsigned int current_id = invocation_id++; - + if (log) { if (!context.m_decl_context) - log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on (ASTContext*)%p for '%s' in a NULL DeclContext", current_id, m_ast_context, name.GetCString()); + log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on (ASTContext*)%p for '%s' in a NULL DeclContext", + current_id, static_cast<void*>(m_ast_context), + name.GetCString()); else if (const NamedDecl *context_named_decl = dyn_cast<NamedDecl>(context.m_decl_context)) - log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on (ASTContext*)%p for '%s' in '%s'", current_id, m_ast_context, name.GetCString(), context_named_decl->getNameAsString().c_str()); + log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on (ASTContext*)%p for '%s' in '%s'", + current_id, static_cast<void*>(m_ast_context), + name.GetCString(), + context_named_decl->getNameAsString().c_str()); else - log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on (ASTContext*)%p for '%s' in a '%s'", current_id, m_ast_context, name.GetCString(), context.m_decl_context->getDeclKindName()); + log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on (ASTContext*)%p for '%s' in a '%s'", + current_id, static_cast<void*>(m_ast_context), + name.GetCString(), + context.m_decl_context->getDeclKindName()); } - + context.m_namespace_map.reset(new ClangASTImporter::NamespaceMap); - + if (const NamespaceDecl *namespace_context = dyn_cast<NamespaceDecl>(context.m_decl_context)) { ClangASTImporter::NamespaceMapSP namespace_map = m_ast_importer->GetNamespaceMap(namespace_context); - + if (log && log->GetVerbose()) - log->Printf(" CAS::FEVD[%u] Inspecting namespace map %p (%d entries)", - current_id, - namespace_map.get(), - (int)namespace_map->size()); - + log->Printf(" CAS::FEVD[%u] Inspecting namespace map %p (%d entries)", + current_id, static_cast<void*>(namespace_map.get()), + static_cast<int>(namespace_map->size())); + if (!namespace_map) return; - + for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(), e = namespace_map->end(); i != e; ++i) @@ -558,7 +564,7 @@ ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context) current_id, i->second.GetNamespaceDecl()->getNameAsString().c_str(), i->first->GetFileSpec().GetFilename().GetCString()); - + FindExternalVisibleDecls(context, i->first, i->second, @@ -577,26 +583,26 @@ ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context) else { ClangNamespaceDecl namespace_decl; - + if (log) log->Printf(" CAS::FEVD[%u] Searching the root namespace", current_id); - + FindExternalVisibleDecls(context, lldb::ModuleSP(), namespace_decl, current_id); } - + if (!context.m_namespace_map->empty()) { if (log && log->GetVerbose()) - log->Printf(" CAS::FEVD[%u] Registering namespace map %p (%d entries)", + log->Printf(" CAS::FEVD[%u] Registering namespace map %p (%d entries)", current_id, - context.m_namespace_map.get(), - (int)context.m_namespace_map->size()); - + static_cast<void*>(context.m_namespace_map.get()), + static_cast<int>(context.m_namespace_map->size())); + NamespaceDecl *clang_namespace_decl = AddNamespace(context, context.m_namespace_map); - + if (clang_namespace_decl) clang_namespace_decl->setHasExternalVisibleStorage(); } @@ -933,30 +939,30 @@ void ClangASTSource::FindObjCMethodDecls (NameSearchContext &context) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + static unsigned int invocation_id = 0; unsigned int current_id = invocation_id++; - + const DeclarationName &decl_name(context.m_decl_name); const DeclContext *decl_ctx(context.m_decl_context); - + const ObjCInterfaceDecl *interface_decl = dyn_cast<ObjCInterfaceDecl>(decl_ctx); - + if (!interface_decl) return; - + do { Decl *original_decl = NULL; ASTContext *original_ctx = NULL; - + m_ast_importer->ResolveDeclOrigin(interface_decl, &original_decl, &original_ctx); - + if (!original_decl) break; - + ObjCInterfaceDecl *original_interface_decl = dyn_cast<ObjCInterfaceDecl>(original_decl); - + if (FindObjCMethodDeclsWithOrigin(current_id, context, original_interface_decl, @@ -965,9 +971,9 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context) "at origin")) return; // found it, no need to look any further } while (0); - + StreamString ss; - + if (decl_name.isObjCZeroArgSelector()) { ss.Printf("%s", decl_name.getAsString().c_str()); @@ -977,9 +983,9 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context) ss.Printf("%s", decl_name.getAsString().c_str()); } else - { + { clang::Selector sel = decl_name.getObjCSelector(); - + for (unsigned i = 0, e = sel.getNumArgs(); i != e; ++i) @@ -987,224 +993,222 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context) llvm::StringRef r = sel.getNameForSlot(i); ss.Printf("%s:", r.str().c_str()); } - } + } ss.Flush(); - + if (strstr(ss.GetData(), "$__lldb")) return; // we don't need any results - + ConstString selector_name(ss.GetData()); - + if (log) log->Printf("ClangASTSource::FindObjCMethodDecls[%d] on (ASTContext*)%p for selector [%s %s]", - current_id, - m_ast_context, + current_id, static_cast<void*>(m_ast_context), interface_decl->getNameAsString().c_str(), selector_name.AsCString()); SymbolContextList sc_list; - + const bool include_symbols = false; const bool include_inlines = false; const bool append = false; - + std::string interface_name = interface_decl->getNameAsString(); - + do { StreamString ms; ms.Printf("-[%s %s]", interface_name.c_str(), selector_name.AsCString()); ms.Flush(); ConstString instance_method_name(ms.GetData()); - + m_target->GetImages().FindFunctions(instance_method_name, lldb::eFunctionNameTypeFull, include_symbols, include_inlines, append, sc_list); - + if (sc_list.GetSize()) break; - + ms.Clear(); ms.Printf("+[%s %s]", interface_name.c_str(), selector_name.AsCString()); ms.Flush(); ConstString class_method_name(ms.GetData()); - + m_target->GetImages().FindFunctions(class_method_name, lldb::eFunctionNameTypeFull, include_symbols, include_inlines, append, sc_list); - + if (sc_list.GetSize()) break; - + // Fall back and check for methods in categories. If we find methods this way, we need to check that they're actually in // categories on the desired class. - + SymbolContextList candidate_sc_list; - + m_target->GetImages().FindFunctions(selector_name, lldb::eFunctionNameTypeSelector, include_symbols, include_inlines, append, candidate_sc_list); - + for (uint32_t ci = 0, ce = candidate_sc_list.GetSize(); ci != ce; ++ci) { SymbolContext candidate_sc; - + if (!candidate_sc_list.GetContextAtIndex(ci, candidate_sc)) continue; - + if (!candidate_sc.function) continue; - + const char *candidate_name = candidate_sc.function->GetName().AsCString(); - + const char *cursor = candidate_name; - + if (*cursor != '+' && *cursor != '-') continue; - + ++cursor; - + if (*cursor != '[') continue; - + ++cursor; - + size_t interface_len = interface_name.length(); - + if (strncmp(cursor, interface_name.c_str(), interface_len)) continue; - + cursor += interface_len; - + if (*cursor == ' ' || *cursor == '(') sc_list.Append(candidate_sc); } } while (0); - + if (sc_list.GetSize()) { // We found a good function symbol. Use that. - + for (uint32_t i = 0, e = sc_list.GetSize(); i != e; ++i) { SymbolContext sc; - + if (!sc_list.GetContextAtIndex(i, sc)) continue; - + if (!sc.function) continue; - + DeclContext *function_ctx = sc.function->GetClangDeclContext(); - + if (!function_ctx) continue; - + ObjCMethodDecl *method_decl = dyn_cast<ObjCMethodDecl>(function_ctx); - + if (!method_decl) continue; - + ObjCInterfaceDecl *found_interface_decl = method_decl->getClassInterface(); - + if (!found_interface_decl) continue; - + if (found_interface_decl->getName() == interface_decl->getName()) { Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, &method_decl->getASTContext(), method_decl); - + if (!copied_decl) continue; - + ObjCMethodDecl *copied_method_decl = dyn_cast<ObjCMethodDecl>(copied_decl); - + if (!copied_method_decl) continue; - + if (log) { ASTDumper dumper((Decl*)copied_method_decl); log->Printf(" CAS::FOMD[%d] found (in symbols) %s", current_id, dumper.GetCString()); } - + context.AddNamedDecl(copied_method_decl); } } - + return; } - + // Try the debug information. - + do { ObjCInterfaceDecl *complete_interface_decl = GetCompleteObjCInterface(const_cast<ObjCInterfaceDecl*>(interface_decl)); - + if (!complete_interface_decl) break; - + // We found the complete interface. The runtime never needs to be queried in this scenario. - + DeclFromUser<const ObjCInterfaceDecl> complete_iface_decl(complete_interface_decl); - + if (complete_interface_decl == interface_decl) break; // already checked this one - + if (log) log->Printf("CAS::FOPD[%d] trying origin (ObjCInterfaceDecl*)%p/(ASTContext*)%p...", - current_id, - complete_interface_decl, - &complete_iface_decl->getASTContext()); - + current_id, static_cast<void*>(complete_interface_decl), + static_cast<void*>(&complete_iface_decl->getASTContext())); + FindObjCMethodDeclsWithOrigin(current_id, context, complete_interface_decl, m_ast_context, m_ast_importer, "in debug info"); - + return; } while (0); - + do { // Check the runtime only if the debug information didn't have a complete interface. - + lldb::ProcessSP process(m_target->GetProcessSP()); - + if (!process) break; - + ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime()); - + if (!language_runtime) break; - + TypeVendor *type_vendor = language_runtime->GetTypeVendor(); - + if (!type_vendor) break; - + ConstString interface_name(interface_decl->getNameAsString().c_str()); bool append = false; uint32_t max_matches = 1; std::vector <ClangASTType> types; - + if (!type_vendor->FindTypes(interface_name, append, max_matches, types)) break; - + const clang::Type *runtime_clang_type = QualType::getFromOpaquePtr(types[0].GetOpaqueQualType()).getTypePtr(); - + const ObjCInterfaceType *runtime_interface_type = dyn_cast<ObjCInterfaceType>(runtime_clang_type); - + if (!runtime_interface_type) break; - + ObjCInterfaceDecl *runtime_interface_decl = runtime_interface_type->getDecl(); - + FindObjCMethodDeclsWithOrigin(current_id, context, runtime_interface_decl, @@ -1279,109 +1283,107 @@ ClangASTSource::FindObjCPropertyAndIvarDecls (NameSearchContext &context) static unsigned int invocation_id = 0; unsigned int current_id = invocation_id++; - + DeclFromParser<const ObjCInterfaceDecl> parser_iface_decl(cast<ObjCInterfaceDecl>(context.m_decl_context)); DeclFromUser<const ObjCInterfaceDecl> origin_iface_decl(parser_iface_decl.GetOrigin(m_ast_importer)); ConstString class_name(parser_iface_decl->getNameAsString().c_str()); - + if (log) log->Printf("ClangASTSource::FindObjCPropertyAndIvarDecls[%d] on (ASTContext*)%p for '%s.%s'", - current_id, - m_ast_context, + current_id, static_cast<void*>(m_ast_context), parser_iface_decl->getNameAsString().c_str(), context.m_decl_name.getAsString().c_str()); - + if (FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *m_ast_context, m_ast_importer, origin_iface_decl)) return; - + if (log) log->Printf("CAS::FOPD[%d] couldn't find the property on origin (ObjCInterfaceDecl*)%p/(ASTContext*)%p, searching elsewhere...", - current_id, - origin_iface_decl.decl, - &origin_iface_decl->getASTContext()); - + current_id, static_cast<const void*>(origin_iface_decl.decl), + static_cast<void*>(&origin_iface_decl->getASTContext())); + SymbolContext null_sc; TypeList type_list; - + do { ObjCInterfaceDecl *complete_interface_decl = GetCompleteObjCInterface(const_cast<ObjCInterfaceDecl*>(parser_iface_decl.decl)); - + if (!complete_interface_decl) break; - + // We found the complete interface. The runtime never needs to be queried in this scenario. - + DeclFromUser<const ObjCInterfaceDecl> complete_iface_decl(complete_interface_decl); - + if (complete_iface_decl.decl == origin_iface_decl.decl) break; // already checked this one - + if (log) log->Printf("CAS::FOPD[%d] trying origin (ObjCInterfaceDecl*)%p/(ASTContext*)%p...", current_id, - complete_iface_decl.decl, - &complete_iface_decl->getASTContext()); - + static_cast<const void*>(complete_iface_decl.decl), + static_cast<void*>(&complete_iface_decl->getASTContext())); + FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *m_ast_context, m_ast_importer, complete_iface_decl); - + return; } while(0); - + do { // Check the runtime only if the debug information didn't have a complete interface. - + lldb::ProcessSP process(m_target->GetProcessSP()); - + if (!process) return; - + ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime()); - + if (!language_runtime) return; - + TypeVendor *type_vendor = language_runtime->GetTypeVendor(); - + if (!type_vendor) break; - + bool append = false; uint32_t max_matches = 1; std::vector <ClangASTType> types; - + if (!type_vendor->FindTypes(class_name, append, max_matches, types)) break; - + const clang::Type *runtime_clang_type = QualType::getFromOpaquePtr(types[0].GetOpaqueQualType()).getTypePtr(); const ObjCInterfaceType *runtime_interface_type = dyn_cast<ObjCInterfaceType>(runtime_clang_type); - + if (!runtime_interface_type) break; - + DeclFromUser<const ObjCInterfaceDecl> runtime_iface_decl(runtime_interface_type->getDecl()); - + if (log) log->Printf("CAS::FOPD[%d] trying runtime (ObjCInterfaceDecl*)%p/(ASTContext*)%p...", current_id, - runtime_iface_decl.decl, - &runtime_iface_decl->getASTContext()); - + static_cast<const void*>(runtime_iface_decl.decl), + static_cast<void*>(&runtime_iface_decl->getASTContext())); + if (FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *m_ast_context, @@ -1469,55 +1471,51 @@ ClangASTSource::layoutRecordType(const RecordDecl *record, BaseOffsetMap &virtual_base_offsets) { ClangASTMetrics::RegisterRecordLayout(); - + static unsigned int invocation_id = 0; unsigned int current_id = invocation_id++; - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + if (log) - { log->Printf("LayoutRecordType[%u] on (ASTContext*)%p for (RecordDecl*)%p [name = '%s']", - current_id, - m_ast_context, - record, + current_id, static_cast<void*>(m_ast_context), + static_cast<const void*>(record), record->getNameAsString().c_str()); - } - - + DeclFromParser <const RecordDecl> parser_record(record); DeclFromUser <const RecordDecl> origin_record(parser_record.GetOrigin(m_ast_importer)); - + if (origin_record.IsInvalid()) return false; - + FieldOffsetMap origin_field_offsets; BaseOffsetMap origin_base_offsets; BaseOffsetMap origin_virtual_base_offsets; - + ClangASTContext::GetCompleteDecl(&origin_record->getASTContext(), const_cast<RecordDecl*>(origin_record.decl)); - + if (!origin_record.decl->getDefinition()) return false; - + const ASTRecordLayout &record_layout(origin_record->getASTContext().getASTRecordLayout(origin_record.decl)); - + int field_idx = 0, field_count = record_layout.getFieldCount(); - + for (RecordDecl::field_iterator fi = origin_record->field_begin(), fe = origin_record->field_end(); fi != fe; ++fi) { if (field_idx >= field_count) return false; // Layout didn't go well. Bail out. - + uint64_t field_offset = record_layout.getFieldOffset(field_idx); - + origin_field_offsets.insert(std::pair<const FieldDecl *, uint64_t>(*fi, field_offset)); - + field_idx++; } - + ASTContext &parser_ast_context(record->getASTContext()); DeclFromUser <const CXXRecordDecl> origin_cxx_record(DynCast<const CXXRecordDecl>(origin_record)); @@ -1533,14 +1531,15 @@ ClangASTSource::layoutRecordType(const RecordDecl *record, !ImportOffsetMap(base_offsets, origin_base_offsets, m_ast_importer, parser_ast_context) || !ImportOffsetMap(virtual_base_offsets, origin_virtual_base_offsets, m_ast_importer, parser_ast_context)) return false; - + size = record_layout.getSize().getQuantity() * m_ast_context->getCharWidth(); alignment = record_layout.getAlignment().getQuantity() * m_ast_context->getCharWidth(); - + if (log) { log->Printf("LRT[%u] returned:", current_id); - log->Printf("LRT[%u] Original = (RecordDecl*)%p", current_id, origin_record.decl); + log->Printf("LRT[%u] Original = (RecordDecl*)%p", current_id, + static_cast<const void*>(origin_record.decl)); log->Printf("LRT[%u] Size = %" PRId64, current_id, size); log->Printf("LRT[%u] Alignment = %" PRId64, current_id, alignment); log->Printf("LRT[%u] Fields:", current_id); @@ -1549,10 +1548,8 @@ ClangASTSource::layoutRecordType(const RecordDecl *record, ++fi) { log->Printf("LRT[%u] (FieldDecl*)%p, Name = '%s', Offset = %" PRId64 " bits", - current_id, - *fi, - fi->getNameAsString().c_str(), - field_offsets[*fi]); + current_id, static_cast<void*>(*fi), + fi->getNameAsString().c_str(), field_offsets[*fi]); } DeclFromParser <const CXXRecordDecl> parser_cxx_record = DynCast<const CXXRecordDecl>(parser_record); if (parser_cxx_record.IsValid()) @@ -1563,19 +1560,19 @@ ClangASTSource::layoutRecordType(const RecordDecl *record, ++bi) { bool is_virtual = bi->isVirtual(); - + QualType base_type = bi->getType(); const RecordType *base_record_type = base_type->getAs<RecordType>(); DeclFromParser <RecordDecl> base_record(base_record_type->getDecl()); DeclFromParser <CXXRecordDecl> base_cxx_record = DynCast<CXXRecordDecl>(base_record); - + log->Printf("LRT[%u] %s(CXXRecordDecl*)%p, Name = '%s', Offset = %" PRId64 " chars", - current_id, - (is_virtual ? "Virtual " : ""), - base_cxx_record.decl, + current_id, (is_virtual ? "Virtual " : ""), + static_cast<void*>(base_cxx_record.decl), base_cxx_record.decl->getNameAsString().c_str(), - (is_virtual ? virtual_base_offsets[base_cxx_record.decl].getQuantity() : - base_offsets[base_cxx_record.decl].getQuantity())); + (is_virtual + ? virtual_base_offsets[base_cxx_record.decl].getQuantity() + : base_offsets[base_cxx_record.decl].getQuantity())); } } else @@ -1583,7 +1580,7 @@ ClangASTSource::layoutRecordType(const RecordDecl *record, log->Printf("LRD[%u] Not a CXXRecord, so no bases", current_id); } } - + return true; } @@ -1594,25 +1591,22 @@ ClangASTSource::CompleteNamespaceMap (ClangASTImporter::NamespaceMapSP &namespac { static unsigned int invocation_id = 0; unsigned int current_id = invocation_id++; - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + if (log) { if (parent_map && parent_map->size()) log->Printf("CompleteNamespaceMap[%u] on (ASTContext*)%p Searching for namespace %s in namespace %s", - current_id, - m_ast_context, + current_id, static_cast<void*>(m_ast_context), name.GetCString(), parent_map->begin()->second.GetNamespaceDecl()->getDeclName().getAsString().c_str()); else log->Printf("CompleteNamespaceMap[%u] on (ASTContext*)%p Searching for namespace %s", - current_id, - m_ast_context, + current_id, static_cast<void*>(m_ast_context), name.GetCString()); } - - + if (parent_map) { for (ClangASTImporter::NamespaceMap::iterator i = parent_map->begin(), e = parent_map->end(); @@ -1620,24 +1614,24 @@ ClangASTSource::CompleteNamespaceMap (ClangASTImporter::NamespaceMapSP &namespac ++i) { ClangNamespaceDecl found_namespace_decl; - + lldb::ModuleSP module_sp = i->first; ClangNamespaceDecl module_parent_namespace_decl = i->second; - + SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor(); - + if (!symbol_vendor) continue; - + SymbolContext null_sc; - + found_namespace_decl = symbol_vendor->FindNamespace(null_sc, name, &module_parent_namespace_decl); - + if (!found_namespace_decl) continue; - + namespace_map->push_back(std::pair<lldb::ModuleSP, ClangNamespaceDecl>(module_sp, found_namespace_decl)); - + if (log) log->Printf(" CMN[%u] Found namespace %s in module %s", current_id, @@ -1649,32 +1643,32 @@ ClangASTSource::CompleteNamespaceMap (ClangASTImporter::NamespaceMapSP &namespac { const ModuleList &target_images = m_target->GetImages(); Mutex::Locker modules_locker(target_images.GetMutex()); - + ClangNamespaceDecl null_namespace_decl; - + for (size_t i = 0, e = target_images.GetSize(); i < e; ++i) { lldb::ModuleSP image = target_images.GetModuleAtIndexUnlocked(i); - + if (!image) continue; - + ClangNamespaceDecl found_namespace_decl; - + SymbolVendor *symbol_vendor = image->GetSymbolVendor(); - + if (!symbol_vendor) continue; - + SymbolContext null_sc; - + found_namespace_decl = symbol_vendor->FindNamespace(null_sc, name, &null_namespace_decl); - + if (!found_namespace_decl) continue; - + namespace_map->push_back(std::pair<lldb::ModuleSP, ClangNamespaceDecl>(image, found_namespace_decl)); - + if (log) log->Printf(" CMN[%u] Found namespace %s in module %s", current_id, diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 4a76871128b..821dae2e515 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -309,57 +309,56 @@ ClangExpressionDeclMap::AddValueToStruct { assert (m_struct_vars.get()); assert (m_parser_vars.get()); - + bool is_persistent_variable = false; - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + m_struct_vars->m_struct_laid_out = false; - + if (m_struct_members.GetVariable(decl, GetParserID())) return true; - + ClangExpressionVariableSP var_sp (m_found_entities.GetVariable(decl, GetParserID())); - + if (!var_sp) { var_sp = m_parser_vars->m_persistent_vars->GetVariable(decl, GetParserID()); is_persistent_variable = true; } - + if (!var_sp) return false; - + if (log) log->Printf("Adding value for (NamedDecl*)%p [%s - %s] to the structure", - decl, - name.GetCString(), + static_cast<const void*>(decl), name.GetCString(), var_sp->GetName().GetCString()); - + // We know entity->m_parser_vars is valid because we used a parser variable // to find it - + ClangExpressionVariable::ParserVars *parser_vars = var_sp->GetParserVars(GetParserID()); parser_vars->m_llvm_value = value; - + if (ClangExpressionVariable::JITVars *jit_vars = var_sp->GetJITVars(GetParserID())) { // We already laid this out; do not touch - + if (log) log->Printf("Already placed at 0x%llx", (unsigned long long)jit_vars->m_offset); } - + var_sp->EnableJITVars(GetParserID()); - + ClangExpressionVariable::JITVars *jit_vars = var_sp->GetJITVars(GetParserID()); jit_vars->m_alignment = alignment; jit_vars->m_size = size; - + m_struct_members.AddVariable(var_sp); - + if (m_parser_vars->m_materializer) { uint32_t offset = 0; @@ -379,16 +378,16 @@ ClangExpressionDeclMap::AddValueToStruct else if (parser_vars->m_lldb_var) offset = m_parser_vars->m_materializer->AddVariable(parser_vars->m_lldb_var, err); } - + if (!err.Success()) return false; - + if (log) log->Printf("Placed at 0x%llx", (unsigned long long)offset); - + jit_vars->m_offset = offset; // TODO DoStructLayout() should not change this. } - + return true; } @@ -866,23 +865,23 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context) { assert (m_ast_context); - + ClangASTMetrics::RegisterVisibleQuery(); - + const ConstString name(context.m_decl_name.getAsString().c_str()); - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + if (GetImportInProgress()) { if (log && log->GetVerbose()) log->Printf("Ignoring a query during an import"); return; } - + static unsigned int invocation_id = 0; unsigned int current_id = invocation_id++; - + if (log) { if (!context.m_decl_context) @@ -892,20 +891,19 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context) else log->Printf("ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for '%s' in a '%s'", current_id, name.GetCString(), context.m_decl_context->getDeclKindName()); } - + if (const NamespaceDecl *namespace_context = dyn_cast<NamespaceDecl>(context.m_decl_context)) { ClangASTImporter::NamespaceMapSP namespace_map = m_ast_importer->GetNamespaceMap(namespace_context); - + if (log && log->GetVerbose()) log->Printf(" CEDM::FEVD[%u] Inspecting (NamespaceMap*)%p (%d entries)", - current_id, - namespace_map.get(), + current_id, static_cast<void*>(namespace_map.get()), (int)namespace_map->size()); - + if (!namespace_map) return; - + for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(), e = namespace_map->end(); i != e; ++i) @@ -915,7 +913,7 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context) current_id, i->second.GetNamespaceDecl()->getNameAsString().c_str(), i->first->GetFileSpec().GetFilename().GetCString()); - + FindExternalVisibleDecls(context, i->first, i->second, @@ -925,16 +923,16 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context) else if (isa<TranslationUnitDecl>(context.m_decl_context)) { ClangNamespaceDecl namespace_decl; - + if (log) log->Printf(" CEDM::FEVD[%u] Searching the root namespace", current_id); - + FindExternalVisibleDecls(context, lldb::ModuleSP(), namespace_decl, current_id); } - + if (!context.m_found.variable) ClangASTSource::FindExternalVisibleDecls(context); } diff --git a/lldb/source/Expression/IRDynamicChecks.cpp b/lldb/source/Expression/IRDynamicChecks.cpp index a75a0fca9c6..4b56bf71166 100644 --- a/lldb/source/Expression/IRDynamicChecks.cpp +++ b/lldb/source/Expression/IRDynamicChecks.cpp @@ -427,12 +427,12 @@ public: m_objc_object_check_func(NULL) { } - + virtual ~ObjcObjectChecker () { } - + enum msgSend_type { eMsgSend = 0, @@ -441,25 +441,25 @@ public: eMsgSend_fpret, eMsgSend_stret }; - + std::map <llvm::Instruction *, msgSend_type> msgSend_types; private: bool InstrumentInstruction(llvm::Instruction *inst) { CallInst *call_inst = dyn_cast<CallInst>(inst); - + if (!call_inst) return false; // call_inst really shouldn't be NULL, because otherwise InspectInstruction wouldn't have registered it - + if (!m_objc_object_check_func) m_objc_object_check_func = BuildObjectCheckerFunc(m_checker_functions.m_objc_object_check->StartAddress()); - + // id objc_msgSend(id theReceiver, SEL theSelector, ...) - + llvm::Value *target_object; llvm::Value *selector; - + switch (msgSend_types[inst]) { case eMsgSend: @@ -475,119 +475,124 @@ private: case eMsgSendSuper_stret: return true; } - + // These objects should always be valid according to Sean Calannan assert (target_object); assert (selector); // Insert an instruction to cast the receiver id to int8_t* - + BitCastInst *bit_cast = new BitCastInst(target_object, GetI8PtrTy(), "", inst); - + // Insert an instruction to call the helper with the result - + llvm::Value *arg_array[2]; - + arg_array[0] = bit_cast; arg_array[1] = selector; - + ArrayRef<llvm::Value*> args(arg_array, 2); - + CallInst::Create(m_objc_object_check_func, args, "", inst); - + return true; } - + bool InspectInstruction(llvm::Instruction &i) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); CallInst *call_inst = dyn_cast<CallInst>(&i); - + if (call_inst) { // This metadata is set by IRForTarget::MaybeHandleCall(). - + MDNode *metadata = call_inst->getMetadata("lldb.call.realName"); - + if (!metadata) return true; - + if (metadata->getNumOperands() != 1) { if (log) - log->Printf("Function call metadata has %d operands for [%p] %s", metadata->getNumOperands(), call_inst, PrintValue(call_inst).c_str()); + log->Printf("Function call metadata has %d operands for [%p] %s", + metadata->getNumOperands(), + static_cast<void*>(call_inst), + PrintValue(call_inst).c_str()); return false; } - + MDString *real_name = dyn_cast<MDString>(metadata->getOperand(0)); - + if (!real_name) { if (log) - log->Printf("Function call metadata is not an MDString for [%p] %s", call_inst, PrintValue(call_inst).c_str()); + log->Printf("Function call metadata is not an MDString for [%p] %s", + static_cast<void*>(call_inst), + PrintValue(call_inst).c_str()); return false; } std::string name_str = real_name->getString(); const char* name_cstr = name_str.c_str(); - + if (log) log->Printf("Found call to %s: %s\n", name_cstr, PrintValue(call_inst).c_str()); - + if (name_str.find("objc_msgSend") == std::string::npos) return true; - + if (!strcmp(name_cstr, "objc_msgSend")) { RegisterInstruction(i); msgSend_types[&i] = eMsgSend; return true; } - + if (!strcmp(name_cstr, "objc_msgSend_stret")) { RegisterInstruction(i); msgSend_types[&i] = eMsgSend_stret; return true; } - + if (!strcmp(name_cstr, "objc_msgSend_fpret")) { RegisterInstruction(i); msgSend_types[&i] = eMsgSend_fpret; return true; } - + if (!strcmp(name_cstr, "objc_msgSendSuper")) { RegisterInstruction(i); msgSend_types[&i] = eMsgSendSuper; return true; } - + if (!strcmp(name_cstr, "objc_msgSendSuper_stret")) { RegisterInstruction(i); msgSend_types[&i] = eMsgSendSuper_stret; return true; } - + if (log) log->Printf("Function name '%s' contains 'objc_msgSend' but is not handled", name_str.c_str()); - + return true; } - + return true; } - + llvm::Value *m_objc_object_check_func; }; diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index d50802ac956..9934a3bb749 100644 --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -481,9 +481,10 @@ IRExecutionUnit::MemoryManager::allocateStub(const llvm::GlobalValue* F, if (log) { log->Printf("IRExecutionUnit::allocateStub (F=%p, StubSize=%u, Alignment=%u) = %p", - F, StubSize, Alignment, return_value); + static_cast<const void*>(F), StubSize, Alignment, + static_cast<void*>(return_value)); } - + return return_value; } diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index a1fa6538e04..6b8499aa73e 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -1743,23 +1743,23 @@ bool IRForTarget::ResolveExternals (Function &llvm_function) { lldb_private::Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + for (GlobalVariable &global_var : m_module->globals()) { std::string global_name = global_var.getName().str(); - + if (log) - log->Printf("Examining %s, DeclForGlobalValue returns %p", + log->Printf("Examining %s, DeclForGlobalValue returns %p", global_name.c_str(), - DeclForGlobal(&global_var)); - + static_cast<void*>(DeclForGlobal(&global_var))); + if (global_name.find("OBJC_IVAR") == 0) { if (!HandleSymbol(&global_var)) { if (m_error_stream) m_error_stream->Printf("Error [IRForTarget]: Couldn't find Objective-C indirect ivar symbol %s\n", global_name.c_str()); - + return false; } } @@ -1769,7 +1769,7 @@ IRForTarget::ResolveExternals (Function &llvm_function) { if (m_error_stream) m_error_stream->Printf("Error [IRForTarget]: Couldn't resolve the class for an Objective-C static method call\n"); - + return false; } } @@ -1779,7 +1779,7 @@ IRForTarget::ResolveExternals (Function &llvm_function) { if (m_error_stream) m_error_stream->Printf("Error [IRForTarget]: Couldn't resolve the class for an Objective-C static method call\n"); - + return false; } } @@ -1789,12 +1789,12 @@ IRForTarget::ResolveExternals (Function &llvm_function) { if (m_error_stream) m_error_stream->Printf("Internal error [IRForTarget]: Couldn't rewrite external variable %s\n", global_name.c_str()); - + return false; } } } - + return true; } diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index 70d862e3451..8072558a62c 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -1352,43 +1352,44 @@ Materializer::DematerializerSP Materializer::Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &error) { ExecutionContextScope *exe_scope = frame_sp.get(); - + if (!exe_scope) exe_scope = map.GetBestExecutionContextScope(); - + DematerializerSP dematerializer_sp = m_dematerializer_wp.lock(); - + if (dematerializer_sp) { error.SetErrorToGenericError(); error.SetErrorString("Couldn't materialize: already materialized"); } - + DematerializerSP ret(new Dematerializer(*this, frame_sp, map, process_address)); - + if (!exe_scope) { error.SetErrorToGenericError(); error.SetErrorString("Couldn't materialize: target doesn't exist"); } - + for (EntityUP &entity_up : m_entities) { entity_up->Materialize(frame_sp, map, process_address, error); - + if (!error.Success()) return DematerializerSP(); } - + if (Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)) { - log->Printf("Materializer::Materialize (frame_sp = %p, process_address = 0x%" PRIx64 ") materialized:", frame_sp.get(), process_address); + log->Printf("Materializer::Materialize (frame_sp = %p, process_address = 0x%" PRIx64 ") materialized:", + static_cast<void*>(frame_sp.get()), process_address); for (EntityUP &entity_up : m_entities) entity_up->DumpToLog(map, process_address, log); } - + m_dematerializer_wp = ret; - + return ret; } @@ -1400,15 +1401,15 @@ Materializer::Dematerializer::Dematerialize (Error &error, lldb::ClangExpression lldb::ThreadSP thread_sp = m_thread_wp.lock(); if (thread_sp) frame_sp = thread_sp->GetFrameWithStackID(m_stack_id); - + ExecutionContextScope *exe_scope = m_map->GetBestExecutionContextScope(); - + if (!IsValid()) { error.SetErrorToGenericError(); error.SetErrorString("Couldn't dematerialize: invalid dematerializer"); } - + if (!exe_scope) { error.SetErrorToGenericError(); @@ -1418,11 +1419,12 @@ Materializer::Dematerializer::Dematerialize (Error &error, lldb::ClangExpression { if (Log *log =lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)) { - log->Printf("Materializer::Dematerialize (frame_sp = %p, process_address = 0x%" PRIx64 ") about to dematerialize:", frame_sp.get(), m_process_address); + log->Printf("Materializer::Dematerialize (frame_sp = %p, process_address = 0x%" PRIx64 ") about to dematerialize:", + static_cast<void*>(frame_sp.get()), m_process_address); for (EntityUP &entity_up : m_materializer->m_entities) entity_up->DumpToLog(*m_map, m_process_address, log); } - + for (EntityUP &entity_up : m_materializer->m_entities) { if (entity_up.get() == m_materializer->m_result_entity) @@ -1433,12 +1435,12 @@ Materializer::Dematerializer::Dematerialize (Error &error, lldb::ClangExpression { entity_up->Dematerialize (frame_sp, *m_map, m_process_address, frame_top, frame_bottom, error); } - + if (!error.Success()) break; } } - + Wipe(); } diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index e9ea781e736..c5fa2378212 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -1891,12 +1891,10 @@ Host::LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_i if (error.Fail() || log) { error.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", - pid, - exe_path, - &file_actions, - &attr, - argv, - envp); + pid, exe_path, static_cast<void*>(&file_actions), + static_cast<void*>(&attr), + reinterpret_cast<const void*>(argv), + reinterpret_cast<const void*>(envp)); if (log) { for (int ii=0; argv[ii]; ++ii) @@ -1918,11 +1916,9 @@ Host::LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_i if (error.Fail() || log) { error.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = NULL, attr = %p, argv = %p, envp = %p )", - pid, - exe_path, - &attr, - argv, - envp); + pid, exe_path, static_cast<void*>(&attr), + reinterpret_cast<const void*>(argv), + reinterpret_cast<const void*>(envp)); if (log) { for (int ii=0; argv[ii]; ++ii) diff --git a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp index a7f6ce64d67..a964ebd9fb2 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp @@ -251,7 +251,7 @@ ABIMacOSX_arm64::PrepareTrivialCall (Thread &thread, (uint64_t)return_addr); for (size_t i = 0; i < args.size(); ++i) - s.Printf (", arg%d = 0x%" PRIx64, i + 1, args[i]); + s.Printf (", arg%d = 0x%" PRIx64, static_cast<int>(i + 1), args[i]); s.PutCString (")"); log->PutCString(s.GetString().c_str()); } @@ -268,7 +268,8 @@ ABIMacOSX_arm64::PrepareTrivialCall (Thread &thread, { const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i); if (log) - log->Printf("About to write arg%d (0x%" PRIx64 ") into %s", i + 1, args[i], reg_info->name); + log->Printf("About to write arg%d (0x%" PRIx64 ") into %s", + static_cast<int>(i + 1), args[i], reg_info->name); if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i])) return false; } diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp index a7bb68005c1..254dc75fc7d 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp @@ -29,7 +29,7 @@ public: m_type_vendor(type_vendor) { } - + bool FindExternalVisibleDeclsByName (const clang::DeclContext *decl_ctx, clang::DeclarationName name) @@ -43,34 +43,33 @@ public: { log->Printf("AppleObjCExternalASTSource::FindExternalVisibleDeclsByName[%u] on (ASTContext*)%p Looking for %s in (%sDecl*)%p", current_id, - &decl_ctx->getParentASTContext(), - name.getAsString().c_str(), - decl_ctx->getDeclKindName(), - decl_ctx); + static_cast<void*>(&decl_ctx->getParentASTContext()), + name.getAsString().c_str(), decl_ctx->getDeclKindName(), + static_cast<const void*>(decl_ctx)); } - + do { const clang::ObjCInterfaceDecl *interface_decl = llvm::dyn_cast<clang::ObjCInterfaceDecl>(decl_ctx); - + if (!interface_decl) break; - + clang::ObjCInterfaceDecl *non_const_interface_decl = const_cast<clang::ObjCInterfaceDecl*>(interface_decl); if (!m_type_vendor.FinishDecl(non_const_interface_decl)) break; - + clang::DeclContext::lookup_const_result result = non_const_interface_decl->lookup(name); - + return (result.size() != 0); } while(0); - + SetNoExternalVisibleDeclsForName(decl_ctx, name); return false; } - + clang::ExternalLoadResult FindExternalLexicalDecls (const clang::DeclContext *DC, bool (*isKindWeWant)(clang::Decl::Kind), @@ -78,7 +77,7 @@ public: { return clang::ELR_Success; } - + void CompleteType (clang::TagDecl *tag_decl) { @@ -86,20 +85,20 @@ public: unsigned int current_id = invocation_id++; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? - + if (log) { log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on (ASTContext*)%p Completing (TagDecl*)%p named %s", current_id, - &tag_decl->getASTContext(), - tag_decl, + static_cast<void*>(&tag_decl->getASTContext()), + static_cast<void*>(tag_decl), tag_decl->getName().str().c_str()); - + log->Printf(" AOEAS::CT[%u] Before:", current_id); ASTDumper dumper((clang::Decl*)tag_decl); dumper.ToLog(log, " [CT] "); } - + if (log) { log->Printf(" AOEAS::CT[%u] After:", current_id); @@ -108,30 +107,30 @@ public: } return; } - + void CompleteType (clang::ObjCInterfaceDecl *interface_decl) { static unsigned int invocation_id = 0; unsigned int current_id = invocation_id++; - + Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? - + if (log) { log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on (ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s", current_id, - &interface_decl->getASTContext(), - interface_decl, + static_cast<void*>(&interface_decl->getASTContext()), + static_cast<void*>(interface_decl), interface_decl->getName().str().c_str()); - + log->Printf(" AOEAS::CT[%u] Before:", current_id); ASTDumper dumper((clang::Decl*)interface_decl); dumper.ToLog(log, " [CT] "); } - + m_type_vendor.FinishDecl(interface_decl); - + if (log) { log->Printf(" [CT] After:"); @@ -140,7 +139,7 @@ public: } return; } - + bool layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, @@ -151,7 +150,7 @@ public: { return false; } - + void StartTranslationUnit (clang::ASTConsumer *Consumer) { clang::TranslationUnitDecl *translation_unit_decl = m_type_vendor.m_ast_ctx.getASTContext()->getTranslationUnitDecl(); diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index 105a87d2b01..051f409348f 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -335,7 +335,9 @@ ObjectContainerBSDArchive::CreateInstance Timer scoped_timer (__PRETTY_FUNCTION__, "ObjectContainerBSDArchive::CreateInstance (module = %s, file = %p, file_offset = 0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")", module_sp->GetFileSpec().GetPath().c_str(), - file, (uint64_t) file_offset, (uint64_t) length); + static_cast<const void*>(file), + static_cast<uint64_t>(file_offset), + static_cast<uint64_t>(length)); // Map the entire .a file to be sure that we don't lose any data if the file // gets updated by a new build while this .a file is being used for debugging @@ -457,7 +459,7 @@ ObjectContainerBSDArchive::ParseHeader () void ObjectContainerBSDArchive::Dump (Stream *s) const { - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<const void*>(this)); s->Indent(); const size_t num_archs = GetNumArchitectures(); const size_t num_objects = GetNumObjects(); diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp index 0b88ff299ea..7497b987eba 100644 --- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp +++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp @@ -164,7 +164,7 @@ ObjectContainerUniversalMachO::ParseHeader (lldb_private::DataExtractor &data, void ObjectContainerUniversalMachO::Dump (Stream *s) const { - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<const void*>(this)); s->Indent(); const size_t num_archs = GetNumArchitectures(); const size_t num_objects = GetNumObjects(); diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp index ec0f093e6ad..1ed77701770 100644 --- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp @@ -202,16 +202,16 @@ ObjectFileJIT::Dump (Stream *s) if (module_sp) { lldb_private::Mutex::Locker locker(module_sp->GetMutex()); - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<void*>(this)); s->Indent(); s->PutCString("ObjectFileJIT"); - + ArchSpec arch; if (GetArchitecture(arch)) *s << ", arch = " << arch.GetArchitectureName(); - + s->EOL(); - + SectionList *sections = GetSectionList(); if (sections) sections->Dump(s, NULL, true, UINT32_MAX); diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 72190742d0b..ed80c635c74 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1632,7 +1632,10 @@ struct TrieEntry void Dump () const { - printf ("0x%16.16llx 0x%16.16llx 0x%16.16llx \"%s\"", address, flags, other, name.GetCString()); + printf ("0x%16.16llx 0x%16.16llx 0x%16.16llx \"%s\"", + static_cast<unsigned long long>(address), + static_cast<unsigned long long>(flags), + static_cast<unsigned long long>(other), name.GetCString()); if (import_name) printf (" -> \"%s\"\n", import_name.GetCString()); else @@ -1649,17 +1652,18 @@ struct TrieEntryWithOffset { lldb::offset_t nodeOffset; TrieEntry entry; - + TrieEntryWithOffset (lldb::offset_t offset) : nodeOffset (offset), entry() { } - + void Dump (uint32_t idx) const { - printf ("[%3u] 0x%16.16llx: ", idx, nodeOffset); + printf ("[%3u] 0x%16.16llx: ", idx, + static_cast<unsigned long long>(nodeOffset)); entry.Dump(); } @@ -4081,7 +4085,7 @@ ObjectFileMachO::Dump (Stream *s) if (module_sp) { lldb_private::Mutex::Locker locker(module_sp->GetMutex()); - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<void*>(this)); s->Indent(); if (m_header.magic == MH_MAGIC_64 || m_header.magic == MH_CIGAM_64) s->PutCString("ObjectFileMachO64"); diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 91c3f50bc6a..ca70b96651a 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -790,19 +790,19 @@ ObjectFilePECOFF::Dump(Stream *s) if (module_sp) { lldb_private::Mutex::Locker locker(module_sp->GetMutex()); - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<void*>(this)); s->Indent(); s->PutCString("ObjectFilePECOFF"); - + ArchSpec header_arch; GetArchitecture (header_arch); - + *s << ", file = '" << m_file << "', arch = " << header_arch.GetArchitectureName() << "\n"; - + SectionList *sections = GetSectionList(); if (sections) sections->Dump(s, NULL, true, UINT32_MAX); - + if (m_symtab_ap.get()) m_symtab_ap->Dump(s, NULL, eSortOrderNone); diff --git a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp index 744d7ada9c8..35e82925f42 100644 --- a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp +++ b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp @@ -632,7 +632,8 @@ DynamicRegisterInfo::Dump () const { StreamFile s(stdout, false); const size_t num_regs = m_regs.size(); - s.Printf("%p: DynamicRegisterInfo contains %" PRIu64 " registers:\n", this, (uint64_t)num_regs); + s.Printf("%p: DynamicRegisterInfo contains %" PRIu64 " registers:\n", + static_cast<const void*>(this), static_cast<uint64_t>(num_regs)); for (size_t i=0; i<num_regs; ++i) { s.Printf("[%3" PRIu64 "] name = %-10s", (uint64_t)i, m_regs[i].name); @@ -671,9 +672,10 @@ DynamicRegisterInfo::Dump () const } s.EOL(); } - + const size_t num_sets = m_sets.size(); - s.Printf("%p: DynamicRegisterInfo contains %" PRIu64 " register sets:\n", this, (uint64_t)num_sets); + s.Printf("%p: DynamicRegisterInfo contains %" PRIu64 " register sets:\n", + static_cast<const void*>(this), static_cast<uint64_t>(num_sets)); for (size_t i=0; i<num_sets; ++i) { s.Printf("set[%" PRIu64 "] name = %s, regs = [", (uint64_t)i, m_sets[i].name); diff --git a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp index 6b8c7dfd5d3..11ad8152176 100644 --- a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp +++ b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp @@ -42,7 +42,8 @@ HistoryThread::HistoryThread (lldb_private::Process &process, m_unwinder_ap.reset (new HistoryUnwind (*this, pcs, stop_id, stop_id_is_valid)); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p HistoryThread::HistoryThread", this); + log->Printf ("%p HistoryThread::HistoryThread", + static_cast<void*>(this)); } // Destructor @@ -51,7 +52,8 @@ HistoryThread::~HistoryThread () { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p HistoryThread::~HistoryThread (tid=0x%" PRIx64 ")", this, GetID()); + log->Printf ("%p HistoryThread::~HistoryThread (tid=0x%" PRIx64 ")", + static_cast<void*>(this), GetID()); DestroyThread(); } diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 393def34975..a3cd6e9351e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1458,8 +1458,7 @@ ProcessGDBRemote::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) log->Printf( "ProcessGDBRemote::%s Making new thread: %p for thread ID: 0x%" PRIx64 ".\n", - __FUNCTION__, - thread_sp.get(), + __FUNCTION__, static_cast<void*>(thread_sp.get()), thread_sp->GetID()); } else @@ -1467,8 +1466,7 @@ ProcessGDBRemote::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) log->Printf( "ProcessGDBRemote::%s Found old thread: %p for thread ID: 0x%" PRIx64 ".\n", - __FUNCTION__, - thread_sp.get(), + __FUNCTION__, static_cast<void*>(thread_sp.get()), thread_sp->GetID()); } new_thread_list.AddThread(thread_sp); @@ -1563,9 +1561,9 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) log->Printf ("ProcessGDBRemote::%s Adding new thread: %p for thread ID: 0x%" PRIx64 ".\n", __FUNCTION__, - thread_sp.get(), + static_cast<void*>(thread_sp.get()), thread_sp->GetID()); - + m_thread_list_real.AddThread(thread_sp); } gdb_thread = static_cast<ThreadGDBRemote *> (thread_sp.get()); @@ -1588,7 +1586,6 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) if (tid != LLDB_INVALID_THREAD_ID) m_thread_ids.push_back (tid); value.erase(0, comma_pos + 1); - } tid = Args::StringToUInt64 (value.c_str(), LLDB_INVALID_THREAD_ID, 16); if (tid != LLDB_INVALID_THREAD_ID) @@ -1715,7 +1712,6 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) thread_sp->SetStopInfo (invalid_stop_info_sp); } } - } else if (reason.compare("trap") == 0) { @@ -1740,7 +1736,7 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) handled = true; } } - + if (!handled && signo && did_exec == false) { if (signo == SIGTRAP) @@ -1750,7 +1746,7 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) handled = true; addr_t pc = thread_sp->GetRegisterContext()->GetPC() + m_breakpoint_pc_offset; lldb::BreakpointSiteSP bp_site_sp = thread_sp->GetProcess()->GetBreakpointSiteList().FindByAddress(pc); - + if (bp_site_sp) { // If the breakpoint is for this thread, then we'll report the hit, but if it is for another thread, @@ -1782,7 +1778,7 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) if (!handled) thread_sp->SetStopInfo (StopInfo::CreateStopReasonWithSignal (*thread_sp, signo)); } - + if (!description.empty()) { lldb::StopInfoSP stop_info_sp (thread_sp->GetStopInfo ()); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp index be60321fb4e..60e5c6ed62f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp @@ -135,7 +135,7 @@ void DWARFDebugAranges::Sort (bool minimize) { Timer scoped_timer(__PRETTY_FUNCTION__, "%s this = %p", - __PRETTY_FUNCTION__, this); + __PRETTY_FUNCTION__, static_cast<void*>(this)); Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES)); size_t orig_arange_size = 0; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp index 06ac825e0d4..488e9820b6f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp @@ -66,11 +66,12 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data) { Timer scoped_timer (__PRETTY_FUNCTION__, "DWARFDebugPubnames::GeneratePubnames (data = %p)", - dwarf2Data); + static_cast<void*>(dwarf2Data)); Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES)); if (log) - log->Printf("DWARFDebugPubnames::GeneratePubnames (data = %p)", dwarf2Data); + log->Printf("DWARFDebugPubnames::GeneratePubnames (data = %p)", + static_cast<void*>(dwarf2Data)); m_sets.clear(); DWARFDebugInfo* debug_info = dwarf2Data->DebugInfo(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 28cbe82ebc8..03159ff6493 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -829,7 +829,8 @@ SymbolFileDWARF::DebugInfo() { if (m_info.get() == NULL) { - Timer scoped_timer(__PRETTY_FUNCTION__, "%s this = %p", __PRETTY_FUNCTION__, this); + Timer scoped_timer(__PRETTY_FUNCTION__, "%s this = %p", + __PRETTY_FUNCTION__, static_cast<void*>(this)); if (get_debug_info_data().GetByteSize() > 0) { m_info.reset(new DWARFDebugInfo()); @@ -879,7 +880,8 @@ SymbolFileDWARF::DebugRanges() { if (m_ranges.get() == NULL) { - Timer scoped_timer(__PRETTY_FUNCTION__, "%s this = %p", __PRETTY_FUNCTION__, this); + Timer scoped_timer(__PRETTY_FUNCTION__, "%s this = %p", + __PRETTY_FUNCTION__, static_cast<void*>(this)); if (get_debug_ranges_data().GetByteSize() > 0) { m_ranges.reset(new DWARFDebugRanges()); @@ -2380,7 +2382,6 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) // The type will get resolved when all of the calls to SymbolFileDWARF::ResolveClangOpaqueTypeDefinition // are done. m_forward_decl_clang_type_to_die.erase (clang_type_no_qualifiers.GetOpaqueQualType()); - // Disable external storage for this type so we don't get anymore // clang::ExternalASTSource queries for this type. @@ -2395,14 +2396,11 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) Log *log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION)); if (log) - { GetObjectFile()->GetModule()->LogMessageVerboseBacktrace (log, "0x%8.8" PRIx64 ": %s '%s' resolving forward declaration...", MakeUserID(die->GetOffset()), DW_TAG_value_to_name(tag), type->GetName().AsCString()); - - } assert (clang_type); DWARFDebugInfoEntry::Attributes attributes; @@ -2413,11 +2411,10 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) case DW_TAG_class_type: { LayoutInfo layout_info; - + { if (die->HasChildren()) { - LanguageType class_language = eLanguageTypeUnknown; if (clang_type.IsObjCObjectOrInterfaceType()) { @@ -2426,7 +2423,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) // the class is created. clang_type.StartTagDeclarationDefinition (); } - + int tag_decl_kind = -1; AccessType default_accessibility = eAccessNone; if (tag == DW_TAG_structure_type) @@ -2444,14 +2441,14 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) tag_decl_kind = clang::TTK_Class; default_accessibility = eAccessPrivate; } - + SymbolContext sc(GetCompUnitForDWARFCompUnit(dwarf_cu)); std::vector<clang::CXXBaseSpecifier *> base_classes; std::vector<int> member_accessibilities; bool is_a_class = false; // Parse members and base classes first DWARFDIECollection member_function_dies; - + DelayedPropertyList delayed_properties; ParseChildMembers (sc, dwarf_cu, @@ -2465,7 +2462,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) default_accessibility, is_a_class, layout_info); - + // Now parse any methods if there were any... size_t num_functions = member_function_dies.Size(); if (num_functions > 0) @@ -2475,13 +2472,12 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) ResolveType(dwarf_cu, member_function_dies.GetDIEPtrAtIndex(i)); } } - + if (class_language == eLanguageTypeObjC) { ConstString class_name (clang_type.GetTypeName()); if (class_name) { - DIEArray method_die_offsets; if (m_using_apple_tables) { @@ -2492,21 +2488,21 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) { if (!m_indexed) Index (); - + m_objc_class_selectors_index.Find (class_name, method_die_offsets); } - + if (!method_die_offsets.empty()) { DWARFDebugInfo* debug_info = DebugInfo(); - + DWARFCompileUnit* method_cu = NULL; const size_t num_matches = method_die_offsets.size(); for (size_t i=0; i<num_matches; ++i) { const dw_offset_t die_offset = method_die_offsets[i]; DWARFDebugInfoEntry *method_die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &method_cu); - + if (method_die) ResolveType (method_cu, method_die); else @@ -2519,14 +2515,14 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) } } } - + for (DelayedPropertyList::iterator pi = delayed_properties.begin(), pe = delayed_properties.end(); pi != pe; ++pi) pi->Finalize(); } } - + // If we have a DW_TAG_structure_type instead of a DW_TAG_class_type we // need to tell the clang type it is actually a class. if (class_language != eLanguageTypeObjC) @@ -2534,7 +2530,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) if (is_a_class && tag_decl_kind != clang::TTK_Class) clang_type.SetTagTypeKind (clang::TTK_Class); } - + // Since DW_TAG_structure_type gets used for both classes // and structures, we may need to set any DW_TAG_member // fields to have a "private" access if none was specified. @@ -2553,7 +2549,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) &member_accessibilities.front(), member_accessibilities.size()); } - + if (!base_classes.empty()) { // Make sure all base classes refer to complete types and not @@ -2589,7 +2585,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) } clang_type.SetBaseClassesForClassType (&base_classes.front(), base_classes.size()); - + // Clang will copy each CXXBaseSpecifier in "base_classes" // so we have to free them all. ClangASTType::DeleteBaseClassSpecifiers (&base_classes.front(), @@ -2597,10 +2593,10 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) } } } - + clang_type.BuildIndirectFields (); clang_type.CompleteTagDeclarationDefinition (); - + if (!layout_info.field_offsets.empty() || !layout_info.base_offsets.empty() || !layout_info.vbase_offsets.empty() ) @@ -2609,7 +2605,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) layout_info.bit_size = type->GetByteSize() * 8; if (layout_info.bit_size == 0) layout_info.bit_size = die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_byte_size, 0) * 8; - + clang::CXXRecordDecl *record_decl = clang_type.GetAsCXXRecordDecl(); if (record_decl) { @@ -2617,14 +2613,14 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) { GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) caching layout info for record_decl = %p, bit_size = %" PRIu64 ", alignment = %" PRIu64 ", field_offsets[%u], base_offsets[%u], vbase_offsets[%u])", - clang_type.GetOpaqueQualType(), - record_decl, + static_cast<void*>(clang_type.GetOpaqueQualType()), + static_cast<void*>(record_decl), layout_info.bit_size, layout_info.alignment, - (uint32_t)layout_info.field_offsets.size(), - (uint32_t)layout_info.base_offsets.size(), - (uint32_t)layout_info.vbase_offsets.size()); - + static_cast<uint32_t>(layout_info.field_offsets.size()), + static_cast<uint32_t>(layout_info.base_offsets.size()), + static_cast<uint32_t>(layout_info.vbase_offsets.size())); + uint32_t idx; { llvm::DenseMap <const clang::FieldDecl *, uint64_t>::const_iterator pos, end = layout_info.field_offsets.end(); @@ -2632,13 +2628,13 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) { GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) field[%u] = { bit_offset=%u, name='%s' }", - clang_type.GetOpaqueQualType(), + static_cast<void*>(clang_type.GetOpaqueQualType()), idx, - (uint32_t)pos->second, + static_cast<uint32_t>(pos->second), pos->first->getNameAsString().c_str()); } } - + { llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits>::const_iterator base_pos, base_end = layout_info.base_offsets.end(); for (idx = 0, base_pos = layout_info.base_offsets.begin(); base_pos != base_end; ++base_pos, ++idx) @@ -2657,9 +2653,9 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) { GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) vbase[%u] = { byte_offset=%u, name='%s' }", - clang_type.GetOpaqueQualType(), + static_cast<void*>(clang_type.GetOpaqueQualType()), idx, - (uint32_t)vbase_pos->second.getQuantity(), + static_cast<uint32_t>(vbase_pos->second.getQuantity()), vbase_pos->first->getNameAsString().c_str()); } } @@ -2755,9 +2751,8 @@ SymbolFileDWARF::ResolveSymbolContext (const Address& so_addr, uint32_t resolve_ { Timer scoped_timer(__PRETTY_FUNCTION__, "SymbolFileDWARF::ResolveSymbolContext (so_addr = { section = %p, offset = 0x%" PRIx64 " }, resolve_scope = 0x%8.8x)", - so_addr.GetSection().get(), - so_addr.GetOffset(), - resolve_scope); + static_cast<void*>(so_addr.GetSection().get()), + so_addr.GetOffset(), resolve_scope); uint32_t resolved = 0; if (resolve_scope & ( eSymbolContextCompUnit | eSymbolContextFunction | @@ -3134,18 +3129,15 @@ SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const lldb_privat Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); if (log) - { GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::FindGlobalVariables (name=\"%s\", namespace_decl=%p, append=%u, max_matches=%u, variables)", name.GetCString(), - namespace_decl, - append, - max_matches); - } - + static_cast<const void*>(namespace_decl), + append, max_matches); + if (!NamespaceDeclMatchesThisSymbolFile(namespace_decl)) return 0; - + DWARFDebugInfo* info = DebugInfo(); if (info == NULL) return 0; @@ -3159,7 +3151,7 @@ SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const lldb_privat const uint32_t original_size = variables.GetSize(); DIEArray die_offsets; - + if (m_using_apple_tables) { if (m_apple_names_ap.get()) @@ -3167,10 +3159,10 @@ SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const lldb_privat const char *name_cstr = name.GetCString(); const char *base_name_start; const char *base_name_end = NULL; - + if (!CPPLanguageRuntime::StripNamespacesFromVariableName(name_cstr, base_name_start, base_name_end)) base_name_start = name_cstr; - + m_apple_names_ap->FindByName (base_name_start, die_offsets); } } @@ -3182,14 +3174,14 @@ SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const lldb_privat m_global_index.Find (name, die_offsets); } - + const size_t num_die_matches = die_offsets.size(); if (num_die_matches) { SymbolContext sc; sc.module_sp = m_obj_file->GetModule(); assert (sc.module_sp); - + DWARFDebugInfo* debug_info = DebugInfo(); DWARFCompileUnit* dwarf_cu = NULL; const DWARFDebugInfoEntry* die = NULL; @@ -3209,11 +3201,11 @@ SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const lldb_privat case DW_TAG_try_block: case DW_TAG_catch_block: break; - + case DW_TAG_variable: { sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, UINT32_MAX); - + if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die)) continue; @@ -3242,10 +3234,9 @@ SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const lldb_privat { GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::FindGlobalVariables (name=\"%s\", namespace_decl=%p, append=%u, max_matches=%u, variables) => %u", - name.GetCString(), - namespace_decl, - append, - max_matches, + name.GetCString(), + static_cast<const void*>(namespace_decl), + append, max_matches, num_matches); } return num_matches; @@ -3255,13 +3246,12 @@ uint32_t SymbolFileDWARF::FindGlobalVariables(const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables) { Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); - + if (log) { GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::FindGlobalVariables (regex=\"%s\", append=%u, max_matches=%u, variables)", - regex.GetText(), - append, + regex.GetText(), append, max_matches); } @@ -3959,38 +3949,32 @@ SymbolFileDWARF::FindTypes (const SymbolContext& sc, return 0; Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); - + if (log) { if (namespace_decl) - { GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(%p) \"%s\", append=%u, max_matches=%u, type_list)", name.GetCString(), - namespace_decl->GetNamespaceDecl(), + static_cast<void*>(namespace_decl->GetNamespaceDecl()), namespace_decl->GetQualifiedName().c_str(), - append, - max_matches); - } + append, max_matches); else - { GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(NULL), append=%u, max_matches=%u, type_list)", - name.GetCString(), - append, + name.GetCString(), append, max_matches); - } } // If we aren't appending the results to this list, then clear the list if (!append) types.Clear(); - + if (!NamespaceDeclMatchesThisSymbolFile(namespace_decl)) return 0; DIEArray die_offsets; - + if (m_using_apple_tables) { if (m_apple_types_ap.get()) @@ -4003,10 +3987,10 @@ SymbolFileDWARF::FindTypes (const SymbolContext& sc, { if (!m_indexed) Index (); - + m_type_index.Find (name, die_offsets); } - + const size_t num_die_matches = die_offsets.size(); if (num_die_matches) @@ -4024,7 +4008,7 @@ SymbolFileDWARF::FindTypes (const SymbolContext& sc, { if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die)) continue; - + Type *matching_type = ResolveType (dwarf_cu, die); if (matching_type) { @@ -4052,10 +4036,9 @@ SymbolFileDWARF::FindTypes (const SymbolContext& sc, GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(%p) \"%s\", append=%u, max_matches=%u, type_list) => %u", name.GetCString(), - namespace_decl->GetNamespaceDecl(), + static_cast<void*>(namespace_decl->GetNamespaceDecl()), namespace_decl->GetQualifiedName().c_str(), - append, - max_matches, + append, max_matches, num_matches); } else @@ -4063,8 +4046,7 @@ SymbolFileDWARF::FindTypes (const SymbolContext& sc, GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(NULL), append=%u, max_matches=%u, type_list) => %u", name.GetCString(), - append, - max_matches, + append, max_matches, num_matches); } } @@ -4156,7 +4138,7 @@ SymbolFileDWARF::FindNamespace (const SymbolContext& sc, GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::FindNamespace (sc, name=\"%s\") => clang::NamespaceDecl(%p) \"%s\"", name.GetCString(), - namespace_decl.GetNamespaceDecl(), + static_cast<const void*>(namespace_decl.GetNamespaceDecl()), namespace_decl.GetQualifiedName().c_str()); } @@ -4618,20 +4600,20 @@ SymbolFileDWARF::ResolveNamespaceDIE (DWARFCompileUnit *dwarf_cu, const DWARFDeb { GetObjectFile()->GetModule()->LogMessage (log, "ASTContext => %p: 0x%8.8" PRIx64 ": DW_TAG_namespace with DW_AT_name(\"%s\") => clang::NamespaceDecl *%p (original = %p)", - GetClangASTContext().getASTContext(), + static_cast<void*>(GetClangASTContext().getASTContext()), MakeUserID(die->GetOffset()), namespace_name, - namespace_decl, - namespace_decl->getOriginalNamespace()); + static_cast<void*>(namespace_decl), + static_cast<void*>(namespace_decl->getOriginalNamespace())); } else { GetObjectFile()->GetModule()->LogMessage (log, "ASTContext => %p: 0x%8.8" PRIx64 ": DW_TAG_namespace (anonymous) => clang::NamespaceDecl *%p (original = %p)", - GetClangASTContext().getASTContext(), + static_cast<void*>(GetClangASTContext().getASTContext()), MakeUserID(die->GetOffset()), - namespace_decl, - namespace_decl->getOriginalNamespace()); + static_cast<void*>(namespace_decl), + static_cast<void*>(namespace_decl->getOriginalNamespace())); } } @@ -5456,7 +5438,7 @@ SymbolFileDWARF::CopyUniqueClassMethodTypes (SymbolFileDWARF *src_symfile, // Is everything kosher so we can go through the members at top speed? bool fast_path = true; - + if (src_size != dst_size) { if (src_size != 0 && dst_size != 0) @@ -5468,12 +5450,12 @@ SymbolFileDWARF::CopyUniqueClassMethodTypes (SymbolFileDWARF *src_symfile, src_size, dst_size); } - + fast_path = false; } uint32_t idx; - + if (fast_path) { for (idx = 0; idx < src_size; ++idx) @@ -5493,10 +5475,10 @@ SymbolFileDWARF::CopyUniqueClassMethodTypes (SymbolFileDWARF *src_symfile, DW_TAG_value_to_name(src_die->Tag())); fast_path = false; } - + const char *src_name = src_die->GetMangledName (src_symfile, src_cu); const char *dst_name = dst_die->GetMangledName (this, dst_cu); - + // Make sure the names match if (src_name == dst_name || (strcmp (src_name, dst_name) == 0)) continue; @@ -5509,7 +5491,7 @@ SymbolFileDWARF::CopyUniqueClassMethodTypes (SymbolFileDWARF *src_symfile, src_name, dst_die->GetOffset(), dst_name); - + fast_path = false; } } @@ -5523,25 +5505,31 @@ SymbolFileDWARF::CopyUniqueClassMethodTypes (SymbolFileDWARF *src_symfile, { src_die = src_name_to_die.GetValueAtIndexUnchecked (idx); dst_die = dst_name_to_die.GetValueAtIndexUnchecked (idx); - + clang::DeclContext *src_decl_ctx = src_symfile->m_die_to_decl_ctx[src_die]; if (src_decl_ctx) { if (log) - log->Printf ("uniquing decl context %p from 0x%8.8x for 0x%8.8x", src_decl_ctx, src_die->GetOffset(), dst_die->GetOffset()); + log->Printf ("uniquing decl context %p from 0x%8.8x for 0x%8.8x", + static_cast<void*>(src_decl_ctx), + src_die->GetOffset(), dst_die->GetOffset()); LinkDeclContextToDIE (src_decl_ctx, dst_die); } else { if (log) - log->Printf ("warning: tried to unique decl context from 0x%8.8x for 0x%8.8x, but none was found", src_die->GetOffset(), dst_die->GetOffset()); + log->Printf ("warning: tried to unique decl context from 0x%8.8x for 0x%8.8x, but none was found", + src_die->GetOffset(), dst_die->GetOffset()); } - + Type *src_child_type = m_die_to_type[src_die]; if (src_child_type) { if (log) - log->Printf ("uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x", src_child_type, src_child_type->GetID(), src_die->GetOffset(), dst_die->GetOffset()); + log->Printf ("uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x", + static_cast<void*>(src_child_type), + src_child_type->GetID(), + src_die->GetOffset(), dst_die->GetOffset()); m_die_to_type[dst_die] = src_child_type; } else @@ -5556,24 +5544,27 @@ SymbolFileDWARF::CopyUniqueClassMethodTypes (SymbolFileDWARF *src_symfile, // We must do this slowly. For each member of the destination, look // up a member in the source with the same name, check its tag, and // unique them if everything matches up. Report failures. - + if (!src_name_to_die.IsEmpty() && !dst_name_to_die.IsEmpty()) { src_name_to_die.Sort(); - + for (idx = 0; idx < dst_size; ++idx) { const char *dst_name = dst_name_to_die.GetCStringAtIndex(idx); dst_die = dst_name_to_die.GetValueAtIndexUnchecked(idx); src_die = src_name_to_die.Find(dst_name, NULL); - + if (src_die && (src_die->Tag() == dst_die->Tag())) { clang::DeclContext *src_decl_ctx = src_symfile->m_die_to_decl_ctx[src_die]; if (src_decl_ctx) { if (log) - log->Printf ("uniquing decl context %p from 0x%8.8x for 0x%8.8x", src_decl_ctx, src_die->GetOffset(), dst_die->GetOffset()); + log->Printf ("uniquing decl context %p from 0x%8.8x for 0x%8.8x", + static_cast<void*>(src_decl_ctx), + src_die->GetOffset(), + dst_die->GetOffset()); LinkDeclContextToDIE (src_decl_ctx, dst_die); } else @@ -5581,12 +5572,16 @@ SymbolFileDWARF::CopyUniqueClassMethodTypes (SymbolFileDWARF *src_symfile, if (log) log->Printf ("warning: tried to unique decl context from 0x%8.8x for 0x%8.8x, but none was found", src_die->GetOffset(), dst_die->GetOffset()); } - + Type *src_child_type = m_die_to_type[src_die]; if (src_child_type) { if (log) - log->Printf ("uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x", src_child_type, src_child_type->GetID(), src_die->GetOffset(), dst_die->GetOffset()); + log->Printf ("uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x", + static_cast<void*>(src_child_type), + src_child_type->GetID(), + src_die->GetOffset(), + dst_die->GetOffset()); m_die_to_type[dst_die] = src_child_type; } else @@ -5614,13 +5609,13 @@ SymbolFileDWARF::CopyUniqueClassMethodTypes (SymbolFileDWARF *src_symfile, if (src_size_artificial && dst_size_artificial) { dst_name_to_die_artificial.Sort(); - + for (idx = 0; idx < src_size_artificial; ++idx) { const char *src_name_artificial = src_name_to_die_artificial.GetCStringAtIndex(idx); src_die = src_name_to_die_artificial.GetValueAtIndexUnchecked (idx); dst_die = dst_name_to_die_artificial.Find(src_name_artificial, NULL); - + if (dst_die) { // Both classes have the artificial types, link them @@ -5628,7 +5623,9 @@ SymbolFileDWARF::CopyUniqueClassMethodTypes (SymbolFileDWARF *src_symfile, if (src_decl_ctx) { if (log) - log->Printf ("uniquing decl context %p from 0x%8.8x for 0x%8.8x", src_decl_ctx, src_die->GetOffset(), dst_die->GetOffset()); + log->Printf ("uniquing decl context %p from 0x%8.8x for 0x%8.8x", + static_cast<void*>(src_decl_ctx), + src_die->GetOffset(), dst_die->GetOffset()); LinkDeclContextToDIE (src_decl_ctx, dst_die); } else @@ -5636,12 +5633,15 @@ SymbolFileDWARF::CopyUniqueClassMethodTypes (SymbolFileDWARF *src_symfile, if (log) log->Printf ("warning: tried to unique decl context from 0x%8.8x for 0x%8.8x, but none was found", src_die->GetOffset(), dst_die->GetOffset()); } - + Type *src_child_type = m_die_to_type[src_die]; if (src_child_type) { if (log) - log->Printf ("uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x", src_child_type, src_child_type->GetID(), src_die->GetOffset(), dst_die->GetOffset()); + log->Printf ("uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x", + static_cast<void*>(src_child_type), + src_child_type->GetID(), + src_die->GetOffset(), dst_die->GetOffset()); m_die_to_type[dst_die] = src_child_type; } else @@ -5690,14 +5690,14 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, { const DWARFDebugInfoEntry *context_die; clang::DeclContext *context = GetClangDeclContextContainingDIE (dwarf_cu, die, &context_die); - + GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::ParseType (die = 0x%8.8x, decl_ctx = %p (die 0x%8.8x)) %s name = '%s')", - die->GetOffset(), - context, - context_die->GetOffset(), - DW_TAG_value_to_name(die->Tag()), - die->GetName(this, dwarf_cu)); - + die->GetOffset(), + static_cast<void*>(context), + context_die->GetOffset(), + DW_TAG_value_to_name(die->Tag()), + die->GetName(this, dwarf_cu)); + #if defined(LLDB_CONFIGURATION_DEBUG) or defined(LLDB_CONFIGURATION_RELEASE) scoped_die_logger.Push (dwarf_cu, die); g_die_stack.LogDIEs(log, this); @@ -5712,7 +5712,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, // GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDwarf::%s %s", __FUNCTION__, s.GetData()); // // } - + Type *type_ptr = m_die_to_type.lookup (die); TypeList* type_list = GetTypeList(); if (type_ptr == NULL) @@ -5770,7 +5770,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, case DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; case DW_AT_name: - + type_name_cstr = form_value.AsCString(&get_debug_str_data()); // Work around a bug in llvm-gcc where they give a name to a reference type which doesn't // include the "&"... @@ -5829,7 +5829,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, if (!clang_type && (encoding_data_type == Type::eEncodingIsPointerUID || encoding_data_type == Type::eEncodingIsTypedefUID) && sc.comp_unit != NULL) { bool translation_unit_is_objc = (sc.comp_unit->GetLanguage() == eLanguageTypeObjC || sc.comp_unit->GetLanguage() == eLanguageTypeObjC_plus_plus); - + if (translation_unit_is_objc) { if (type_name_cstr != NULL) @@ -5837,7 +5837,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, static ConstString g_objc_type_name_id("id"); static ConstString g_objc_type_name_Class("Class"); static ConstString g_objc_type_name_selector("SEL"); - + if (type_name_const_str == g_objc_type_name_id) { if (log) @@ -5879,11 +5879,11 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, else if (encoding_data_type == Type::eEncodingIsPointerUID && encoding_uid != LLDB_INVALID_UID) { // Clang sometimes erroneously emits id as objc_object*. In that case we fix up the type to "id". - + DWARFDebugInfoEntry* encoding_die = dwarf_cu->GetDIEPtr(encoding_uid); - + if (encoding_die && encoding_die->Tag() == DW_TAG_structure_type) - { + { if (const char *struct_name = encoding_die->GetAttributeValueAsString(this, dwarf_cu, DW_AT_name, NULL)) { if (!strcmp(struct_name, "objc_object")) @@ -5903,7 +5903,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, } } } - + type_sp.reset( new Type (MakeUserID(die->GetOffset()), this, type_name_const_str, @@ -5914,7 +5914,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, &decl, clang_type, resolve_state)); - + m_die_to_type[die] = type_sp.get(); // Type* encoding_type = GetUniquedTypeForDIEOffset(encoding_uid, type_sp, NULL, 0, 0, false); @@ -5996,7 +5996,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, case DW_AT_APPLE_objc_complete_type: is_complete_objc_class = form_value.Signed(); break; - + case DW_AT_allocated: case DW_AT_associated: case DW_AT_data_location: @@ -6035,7 +6035,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, return type_sp; } } - + DEBUG_PRINTF ("0x%8.8" PRIx64 ": %s (\"%s\")\n", MakeUserID(die->GetOffset()), DW_TAG_value_to_name(tag), type_name_cstr); int tag_decl_kind = -1; @@ -6055,7 +6055,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, tag_decl_kind = clang::TTK_Class; default_accessibility = eAccessPrivate; } - + if (byte_size_valid && byte_size == 0 && type_name_cstr && die->HasChildren() == false && sc.comp_unit->GetLanguage() == eLanguageTypeObjC) @@ -6093,20 +6093,20 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, // else... type_sp = m_debug_map_symfile->FindCompleteObjCDefinitionTypeForDIE (die, type_name_const_str, true); } - + if (type_sp) { if (log) { GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is an incomplete objc type, complete type is 0x%8.8" PRIx64, - this, + static_cast<void*>(this), die->GetOffset(), DW_TAG_value_to_name(tag), type_name_cstr, type_sp->GetID()); } - + // We found a real definition for this type elsewhere // so lets use it and cache the fact that we found // a complete type for this die @@ -6115,7 +6115,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, } } } - + if (is_forward_declaration) { @@ -6128,12 +6128,12 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, { GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a forward declaration, trying to find complete type", - this, + static_cast<void*>(this), die->GetOffset(), DW_TAG_value_to_name(tag), type_name_cstr); } - + DWARFDeclContext die_decl_ctx; die->GetDWARFDeclContext(this, dwarf_cu, die_decl_ctx); @@ -6154,7 +6154,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, { GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a forward declaration, complete type is 0x%8.8" PRIx64, - this, + static_cast<void*>(this), die->GetOffset(), DW_TAG_value_to_name(tag), type_name_cstr, @@ -6174,7 +6174,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, if (!clang_type) { const DWARFDebugInfoEntry *decl_ctx_die; - + clang::DeclContext *decl_ctx = GetClangDeclContextContainingDIE (dwarf_cu, die, &decl_ctx_die); if (accessibility == eAccessNone && decl_ctx) { @@ -6199,14 +6199,14 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, type_name_cstr, tag_decl_kind, template_param_infos); - + clang::ClassTemplateSpecializationDecl *class_specialization_decl = ast.CreateClassTemplateSpecializationDecl (decl_ctx, class_template_decl, tag_decl_kind, template_param_infos); clang_type = ast.CreateClassTemplateSpecializationType (class_specialization_decl); clang_type_was_created = true; - + GetClangASTContext().SetMetadata (class_template_decl, metadata); GetClangASTContext().SetMetadata (class_specialization_decl, metadata); } @@ -6238,7 +6238,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, &decl, clang_type, Type::eResolveStateForward)); - + type_sp->SetIsCompleteObjCClass(is_complete_objc_class); @@ -6253,7 +6253,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, unique_ast_entry.m_byte_size = byte_size; GetUniqueDWARFASTTypeMap().Insert (type_name_const_str, unique_ast_entry); - + if (is_forward_declaration && die->HasChildren()) { // Check to see if the DIE actually has a definition, some version of GCC will @@ -6294,18 +6294,18 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, // No children for this struct/union/class, lets finish it clang_type.StartTagDeclarationDefinition (); clang_type.CompleteTagDeclarationDefinition (); - + if (tag == DW_TAG_structure_type) // this only applies in C { clang::RecordDecl *record_decl = clang_type.GetAsRecordDecl(); - + if (record_decl) { LayoutInfo layout_info; - + layout_info.alignment = 0; layout_info.bit_size = 0; - + m_record_decl_to_layout_map.insert(std::make_pair(record_decl, layout_info)); } } @@ -6319,7 +6319,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, // we want to start the definition in case the class is needed as the // declaration context for a contained class or type without the need // to complete that type.. - + if (class_language != eLanguageTypeObjC && class_language != eLanguageTypeObjC_plus_plus) clang_type.StartTagDeclarationDefinition (); @@ -6334,7 +6334,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, clang_type.SetHasExternalStorage (true); } } - + } break; @@ -6397,12 +6397,12 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, if (enumerator_type) enumerator_clang_type = enumerator_type->GetClangFullType(); } - + if (!enumerator_clang_type) enumerator_clang_type = ast.GetBuiltinTypeForDWARFEncodingAndBitSize (NULL, DW_ATE_signed, byte_size * 8); - + clang_type = ast.CreateEnumerationType (type_name_cstr, GetClangDeclContextContainingDIE (dwarf_cu, die, NULL), decl, @@ -6414,7 +6414,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, } LinkDeclContextToDIE(clang_type.GetDeclContextForType(), die); - + type_sp.reset( new Type (MakeUserID(die->GetOffset()), this, type_name_const_str, @@ -6491,7 +6491,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, case DW_AT_virtuality: is_virtual = form_value.Boolean(); break; case DW_AT_explicit: is_explicit = form_value.Boolean(); break; case DW_AT_artificial: is_artificial = form_value.Boolean(); break; - + case DW_AT_external: if (form_value.Unsigned()) @@ -6554,12 +6554,12 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, object_pointer_name.assign(s.GetData()); } } - + DEBUG_PRINTF ("0x%8.8" PRIx64 ": %s (\"%s\")\n", MakeUserID(die->GetOffset()), DW_TAG_value_to_name(tag), type_name_cstr); ClangASTType return_clang_type; Type *func_type = NULL; - + if (type_die_offset != DW_INVALID_OFFSET) func_type = ResolveTypeUID(type_die_offset); @@ -6573,7 +6573,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, std::vector<clang::ParmVarDecl*> function_param_decls; // Parse the function children for the parameters - + const DWARFDebugInfoEntry *decl_ctx_die = NULL; clang::DeclContext *containing_decl_ctx = GetClangDeclContextContainingDIE (dwarf_cu, die, &decl_ctx_die); const clang::Decl::Kind containing_decl_kind = containing_decl_ctx->getDeclKind(); @@ -6608,9 +6608,9 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, function_param_types.size(), is_variadic, type_quals); - + bool ignore_containing_context = false; - + if (type_name_cstr) { bool type_handled = false; @@ -6677,7 +6677,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, SymbolFileDWARF *class_symfile = NULL; DWARFCompileUnitSP class_type_cu_sp; const DWARFDebugInfoEntry *class_type_die = NULL; - + SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile(); if (debug_map_symfile) { @@ -6692,7 +6692,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, if (class_type_die) { llvm::SmallVector<const DWARFDebugInfoEntry *, 0> failures; - + CopyUniqueClassMethodTypes (class_symfile, class_type, class_type_cu_sp.get(), @@ -6700,12 +6700,12 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, dwarf_cu, decl_ctx_die, failures); - + // FIXME do something with these failures that's smarter than // just dropping them on the ground. Unfortunately classes don't // like having stuff added to them after their definitions are // complete... - + type_ptr = m_die_to_type[die]; if (type_ptr && type_ptr != DIE_IS_BEING_PARSED) { @@ -6714,7 +6714,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, } } } - + if (specification_die_offset != DW_INVALID_OFFSET) { // We have a specification which we are going to base our function @@ -6773,7 +6773,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, // in the DWARF for C++ methods... Default to public for now... if (accessibility == eAccessNone) accessibility = eAccessPublic; - + if (!is_static && !die->HasChildren()) { // We have a C++ member function with no children (this pointer!) @@ -6792,7 +6792,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, m_obj_file->GetFileSpec().GetPath().c_str()); const bool is_attr_used = false; - + cxx_method_decl = class_opaque_type.AddMethodToCXXRecordType (type_name_cstr, clang_type, accessibility, @@ -6802,7 +6802,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, is_explicit, is_attr_used, is_artificial); - + type_handled = cxx_method_decl != NULL; if (type_handled) @@ -6811,17 +6811,17 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, Host::SetCrashDescription (NULL); - + ClangASTMetadata metadata; metadata.SetUserID(MakeUserID(die->GetOffset())); - + if (!object_pointer_name.empty()) { metadata.SetObjectPtrName(object_pointer_name.c_str()); if (log) log->Printf ("Setting object pointer name: %s on method object %p.\n", object_pointer_name.c_str(), - cxx_method_decl); + static_cast<void*>(cxx_method_decl)); } GetClangASTContext().SetMetadata (cxx_method_decl, metadata); } @@ -6841,7 +6841,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, // we need to modify the m_die_to_type so it doesn't think we are // trying to parse this DIE anymore... m_die_to_type[die] = NULL; - + // Now we get the full type to force our class type to complete itself // using the clang::ExternalASTSource protocol which will parse all // base classes and all methods (including the method for this DIE). @@ -6854,7 +6854,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, type_sp = type_ptr->shared_from_this(); break; } - + // FIXME This is fixing some even uglier behavior but we really need to // uniq the methods of each class as well as the class itself. // <rdar://problem/11240464> @@ -6865,7 +6865,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, } } } - + if (!type_handled) { // We just have a function that isn't part of a class @@ -6893,17 +6893,17 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, ast.SetFunctionParameters (function_decl, &function_param_decls.front(), function_param_decls.size()); - + ClangASTMetadata metadata; metadata.SetUserID(MakeUserID(die->GetOffset())); - + if (!object_pointer_name.empty()) { metadata.SetObjectPtrName(object_pointer_name.c_str()); if (log) log->Printf ("Setting object pointer name: %s on function object %p.", object_pointer_name.c_str(), - function_decl); + static_cast<void*>(function_decl)); } GetClangASTContext().SetMetadata (function_decl, metadata); } @@ -7022,7 +7022,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, dw_offset_t containing_type_die_offset = DW_INVALID_OFFSET; const size_t num_attributes = die->GetAttributes(this, dwarf_cu, NULL, attributes); - + if (num_attributes > 0) { uint32_t i; for (i=0; i<num_attributes; ++i) @@ -7040,10 +7040,10 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, } } } - + Type *pointee_type = ResolveTypeUID(type_die_offset); Type *class_type = ResolveTypeUID(containing_type_die_offset); - + ClangASTType pointee_clang_type = pointee_type->GetClangForwardType(); ClangASTType class_clang_type = class_type->GetClangLayoutType(); @@ -7062,7 +7062,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, clang_type, Type::eResolveStateForward)); } - + break; } default: @@ -8011,12 +8011,11 @@ SymbolFileDWARF::LayoutRecordType (const clang::RecordDecl *record_decl, if (log) GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::LayoutRecordType (record_decl = %p, bit_size = %" PRIu64 ", alignment = %" PRIu64 ", field_offsets[%u],base_offsets[%u], vbase_offsets[%u]) success = %i", - record_decl, - bit_size, - alignment, - (uint32_t)field_offsets.size(), - (uint32_t)base_offsets.size(), - (uint32_t)vbase_offsets.size(), + static_cast<const void*>(record_decl), + bit_size, alignment, + static_cast<uint32_t>(field_offsets.size()), + static_cast<uint32_t>(base_offsets.size()), + static_cast<uint32_t>(vbase_offsets.size()), success); return success; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 0cb2143711a..90ecc1f55fb 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -55,20 +55,19 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa Module *oso_module = exe_symfile->GetModuleByCompUnitInfo (this); if (!oso_module) return file_range_map; - + ObjectFile *oso_objfile = oso_module->GetObjectFile(); if (!oso_objfile) return file_range_map; - + Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_MAP)); if (log) { ConstString object_name (oso_module->GetObjectName()); log->Printf("%p: SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap ('%s')", - this, + static_cast<void*>(this), oso_module->GetSpecificationDescription().c_str()); } - std::vector<SymbolFileDWARFDebugMap::CompileUnitInfo *> cu_infos; if (exe_symfile->GetCompUnitInfosForModule(oso_module, cu_infos)) @@ -78,12 +77,12 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa Symtab *exe_symtab = exe_symfile->GetObjectFile()->GetSymtab(); ModuleSP oso_module_sp (oso_objfile->GetModule()); Symtab *oso_symtab = oso_objfile->GetSymtab(); - + ///const uint32_t fun_resolve_flags = SymbolContext::Module | eSymbolContextCompUnit | eSymbolContextFunction; //SectionList *oso_sections = oso_objfile->Sections(); // Now we need to make sections that map from zero based object // file addresses to where things eneded up in the main executable. - + assert (comp_unit_info->first_symbol_index != UINT32_MAX); // End index is one past the last valid symbol index const uint32_t oso_end_idx = comp_unit_info->last_symbol_index + 1; @@ -96,12 +95,12 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa { if (exe_symbol->IsDebug() == false) continue; - + switch (exe_symbol->GetType()) { default: break; - + case eSymbolTypeCode: { // For each N_FUN, or function that we run into in the debug map @@ -112,7 +111,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa // before we parse any dwarf info so that when it goes get parsed // all section/offset addresses that get registered will resolve // correctly to the new addresses in the main executable. - + // First we find the original symbol in the .o file's symbol table Symbol *oso_fun_symbol = oso_symtab->FindFirstSymbolWithNameAndType (exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), eSymbolTypeCode, @@ -125,11 +124,11 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa exe_symbol->GetAddress().GetFileAddress(), oso_fun_symbol->GetAddress().GetFileAddress(), std::min<addr_t>(exe_symbol->GetByteSize(), oso_fun_symbol->GetByteSize())); - + } } break; - + case eSymbolTypeData: { // For each N_GSYM we remap the address for the global by making @@ -144,13 +143,12 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa // fix up these addresses further after all globals have been // parsed to span the gaps, or we can find the global variable // sizes from the DWARF info as we are parsing. - + // Next we find the non-stab entry that corresponds to the N_GSYM in the .o file Symbol *oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType (exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), eSymbolTypeData, Symtab::eDebugNo, Symtab::eVisibilityAny); - if (exe_symbol && oso_gsym_symbol && exe_symbol->ValueIsAddress() && oso_gsym_symbol->ValueIsAddress()) @@ -166,7 +164,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa } } } - + exe_symfile->FinalizeOSOFileRanges (this); // We don't need the symbols anymore for the .o files oso_objfile->ClearSymtab(); diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp index 4ab86e54bf6..70d63e9e148 100644 --- a/lldb/source/Symbol/Block.cpp +++ b/lldb/source/Symbol/Block.cpp @@ -83,9 +83,9 @@ Block::Dump(Stream *s, addr_t base_addr, int32_t depth, bool show_context) const } } - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<const void*>(this)); s->Indent(); - *s << "Block" << ((const UserID&)*this); + *s << "Block" << static_cast<const UserID&>(*this); const Block* parent_block = GetParent(); if (parent_block) { @@ -100,7 +100,7 @@ Block::Dump(Stream *s, addr_t base_addr, int32_t depth, bool show_context) const if (!m_ranges.IsEmpty()) { *s << ", ranges ="; - + size_t num_ranges = m_ranges.GetSize(); for (size_t i=0; i<num_ranges; ++i) { diff --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp index afdca97ece2..1bf35f34c3b 100644 --- a/lldb/source/Symbol/ClangASTImporter.cpp +++ b/lldb/source/Symbol/ClangASTImporter.cpp @@ -142,39 +142,36 @@ ClangASTImporter::DeportDecl (clang::ASTContext *dst_ctx, clang::Decl *decl) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + if (log) log->Printf(" [ClangASTImporter] DeportDecl called on (%sDecl*)%p from (ASTContext*)%p to (ASTContex*)%p", - decl->getDeclKindName(), - decl, - src_ctx, - dst_ctx); - + decl->getDeclKindName(), static_cast<void*>(decl), + static_cast<void*>(src_ctx), + static_cast<void*>(dst_ctx)); + MinionSP minion_sp (GetMinion (dst_ctx, src_ctx)); - + if (!minion_sp) return NULL; - + std::set<NamedDecl *> decls_to_deport; std::set<NamedDecl *> decls_already_deported; - + minion_sp->InitDeportWorkQueues(&decls_to_deport, &decls_already_deported); - + clang::Decl *result = CopyDecl(dst_ctx, src_ctx, decl); minion_sp->ExecuteDeportWorkQueues(); - + if (!result) return NULL; - + if (log) log->Printf(" [ClangASTImporter] DeportDecl deported (%sDecl*)%p to (%sDecl*)%p", - decl->getDeclKindName(), - decl, - result->getDeclKindName(), - result); - + decl->getDeclKindName(), static_cast<void*>(decl), + result->getDeclKindName(), static_cast<void*>(result)); + return result; } @@ -183,11 +180,10 @@ ClangASTImporter::CompleteDecl (clang::Decl *decl) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - if (log) + if (log) log->Printf(" [ClangASTImporter] CompleteDecl called on (%sDecl*)%p", - decl->getDeclKindName(), - decl); - + decl->getDeclKindName(), static_cast<void*>(decl)); + if (ObjCInterfaceDecl *interface_decl = dyn_cast<ObjCInterfaceDecl>(decl)) { if (!interface_decl->getDefinition()) @@ -412,9 +408,10 @@ void ClangASTImporter::ForgetDestination (clang::ASTContext *dst_ast) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + if (log) - log->Printf(" [ClangASTImporter] Forgetting destination (ASTContext*)%p", dst_ast); + log->Printf(" [ClangASTImporter] Forgetting destination (ASTContext*)%p", + static_cast<void*>(dst_ast)); m_metadata_map.erase(dst_ast); } @@ -423,17 +420,18 @@ void ClangASTImporter::ForgetSource (clang::ASTContext *dst_ast, clang::ASTContext *src_ast) { ASTContextMetadataSP md = MaybeGetContextMetadata (dst_ast); - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + if (log) - log->Printf(" [ClangASTImporter] Forgetting source->dest (ASTContext*)%p->(ASTContext*)%p", src_ast, dst_ast); - + log->Printf(" [ClangASTImporter] Forgetting source->dest (ASTContext*)%p->(ASTContext*)%p", + static_cast<void*>(src_ast), static_cast<void*>(dst_ast)); + if (!md) return; - + md->m_minions.erase(src_ast); - + for (OriginMap::iterator iter = md->m_origins.begin(); iter != md->m_origins.end(); ) @@ -572,64 +570,60 @@ clang::Decl * ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to) { ClangASTMetrics::RegisterClangImport(); - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + if (log) { lldb::user_id_t user_id; ClangASTMetadata *metadata = m_master.GetDeclMetadata(from); if (metadata) user_id = metadata->GetUserID(); - + if (NamedDecl *from_named_decl = dyn_cast<clang::NamedDecl>(from)) { std::string name_string; llvm::raw_string_ostream name_stream(name_string); from_named_decl->printName(name_stream); name_stream.flush(); - + log->Printf(" [ClangASTImporter] Imported (%sDecl*)%p, named %s (from (Decl*)%p), metadata 0x%" PRIx64, - from->getDeclKindName(), - to, - name_string.c_str(), - from, + from->getDeclKindName(), static_cast<void*>(to), + name_string.c_str(), static_cast<void*>(from), user_id); } else { log->Printf(" [ClangASTImporter] Imported (%sDecl*)%p (from (Decl*)%p), metadata 0x%" PRIx64, - from->getDeclKindName(), - to, - from, - user_id); + from->getDeclKindName(), static_cast<void*>(to), + static_cast<void*>(from), user_id); } } ASTContextMetadataSP to_context_md = m_master.GetContextMetadata(&to->getASTContext()); ASTContextMetadataSP from_context_md = m_master.MaybeGetContextMetadata(m_source_ctx); - + if (from_context_md) { OriginMap &origins = from_context_md->m_origins; - + OriginMap::iterator origin_iter = origins.find(from); - + if (origin_iter != origins.end()) { to_context_md->m_origins[to] = origin_iter->second; - + MinionSP direct_completer = m_master.GetMinion(&to->getASTContext(), origin_iter->second.ctx); - + if (direct_completer.get() != this) direct_completer->ASTImporter::Imported(origin_iter->second.decl, to); - + if (log) log->Printf(" [ClangASTImporter] Propagated origin (Decl*)%p/(ASTContext*)%p from (ASTContext*)%p to (ASTContext*)%p", - origin_iter->second.decl, - origin_iter->second.ctx, - &from->getASTContext(), - &to->getASTContext()); + static_cast<void*>(origin_iter->second.decl), + static_cast<void*>(origin_iter->second.ctx), + static_cast<void*>(&from->getASTContext()), + static_cast<void*>(&to->getASTContext())); } else { @@ -638,27 +632,27 @@ ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to) if (isa<TagDecl>(to) || isa<ObjCInterfaceDecl>(to)) { NamedDecl *to_named_decl = dyn_cast<NamedDecl>(to); - + if (!m_decls_already_deported->count(to_named_decl)) m_decls_to_deport->insert(to_named_decl); } } to_context_md->m_origins[to] = DeclOrigin(m_source_ctx, from); - + if (log) log->Printf(" [ClangASTImporter] Decl has no origin information in (ASTContext*)%p", - &from->getASTContext()); + static_cast<void*>(&from->getASTContext())); } - + if (clang::NamespaceDecl *to_namespace = dyn_cast<clang::NamespaceDecl>(to)) { clang::NamespaceDecl *from_namespace = dyn_cast<clang::NamespaceDecl>(from); - + NamespaceMetaMap &namespace_maps = from_context_md->m_namespace_maps; - + NamespaceMetaMap::iterator namespace_map_iter = namespace_maps.find(from_namespace); - + if (namespace_map_iter != namespace_maps.end()) to_context_md->m_namespace_maps[to_namespace] = namespace_map_iter->second; } @@ -666,21 +660,21 @@ ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to) else { to_context_md->m_origins[to] = DeclOrigin (m_source_ctx, from); - + if (log) log->Printf(" [ClangASTImporter] Sourced origin (Decl*)%p/(ASTContext*)%p into (ASTContext*)%p", - from, - m_source_ctx, - &to->getASTContext()); + static_cast<void*>(from), + static_cast<void*>(m_source_ctx), + static_cast<void*>(&to->getASTContext())); } - + if (TagDecl *from_tag_decl = dyn_cast<TagDecl>(from)) { TagDecl *to_tag_decl = dyn_cast<TagDecl>(to); - + to_tag_decl->setHasExternalLexicalStorage(); to_tag_decl->setMustBuildLookupTable(); - + if (log) log->Printf(" [ClangASTImporter] To is a TagDecl - attributes %s%s [%s->%s]", (to_tag_decl->hasExternalLexicalStorage() ? " Lexical" : ""), @@ -688,32 +682,32 @@ ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to) (from_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"), (to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete")); } - + if (isa<NamespaceDecl>(from)) { NamespaceDecl *to_namespace_decl = dyn_cast<NamespaceDecl>(to); - + m_master.BuildNamespaceMap(to_namespace_decl); - + to_namespace_decl->setHasExternalVisibleStorage(); } - + if (isa<ObjCInterfaceDecl>(from)) { ObjCInterfaceDecl *to_interface_decl = dyn_cast<ObjCInterfaceDecl>(to); - + to_interface_decl->setHasExternalLexicalStorage(); to_interface_decl->setHasExternalVisibleStorage(); - + /*to_interface_decl->setExternallyCompleted();*/ - + if (log) log->Printf(" [ClangASTImporter] To is an ObjCInterfaceDecl - attributes %s%s%s", (to_interface_decl->hasExternalLexicalStorage() ? " Lexical" : ""), (to_interface_decl->hasExternalVisibleStorage() ? " Visible" : ""), (to_interface_decl->hasDefinition() ? " HasDefinition" : "")); } - + return clang::ASTImporter::Imported(from, to); } diff --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp index 62ae1cc1cbe..f5ff8e8acf2 100644 --- a/lldb/source/Symbol/CompileUnit.cpp +++ b/lldb/source/Symbol/CompileUnit.cpp @@ -99,11 +99,11 @@ CompileUnit::GetDescription(Stream *s, lldb::DescriptionLevel level) const void CompileUnit::Dump(Stream *s, bool show_context) const { - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<const void*>(this)); s->Indent(); - *s << "CompileUnit" << (const UserID&)*this - << ", language = \"" << (const Language&)*this - << "\", file = '" << (const FileSpec&)*this << "'\n"; + *s << "CompileUnit" << static_cast<const UserID&>(*this) + << ", language = \"" << reinterpret_cast<const Language&>(*this) + << "\", file = '" << static_cast<const FileSpec&>(*this) << "'\n"; // m_types.Dump(s); diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp index e6d6c000bc9..85132144c88 100644 --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -354,20 +354,16 @@ Function::GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target void Function::Dump(Stream *s, bool show_context) const { - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<const void*>(this)); s->Indent(); - *s << "Function" << (const UserID&)*this; + *s << "Function" << static_cast<const UserID&>(*this); m_mangled.Dump(s); if (m_type) - { - s->Printf(", type = %p", m_type); - } + s->Printf(", type = %p", static_cast<void*>(m_type)); else if (m_type_uid != LLDB_INVALID_UID) - { s->Printf(", type_uid = 0x%8.8" PRIx64, m_type_uid); - } s->EOL(); // Dump the root object diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index c3294c94375..9c5567aed0e 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -42,7 +42,9 @@ ObjectFile::FindPlugin (const lldb::ModuleSP &module_sp, Timer scoped_timer (__PRETTY_FUNCTION__, "ObjectFile::FindPlugin (module = %s, file = %p, file_offset = 0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")", module_sp->GetFileSpec().GetPath().c_str(), - file, (uint64_t) file_offset, (uint64_t) file_size); + static_cast<const void*>(file), + static_cast<uint64_t>(file_offset), + static_cast<uint64_t>(file_size)); if (file) { FileSpec archive_file; @@ -60,10 +62,10 @@ ObjectFile::FindPlugin (const lldb::ModuleSP &module_sp, for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex(idx)) != NULL; ++idx) { std::unique_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, data_sp, data_offset, file, file_offset, file_size)); - + if (object_container_ap.get()) object_file_sp = object_container_ap->GetObjectFile(file); - + if (object_file_sp.get()) return object_file_sp; } @@ -102,10 +104,10 @@ ObjectFile::FindPlugin (const lldb::ModuleSP &module_sp, for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex(idx)) != NULL; ++idx) { std::unique_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, data_sp, data_offset, file, file_offset, file_size)); - + if (object_container_ap.get()) object_file_sp = object_container_ap->GetObjectFile(file); - + if (object_file_sp.get()) return object_file_sp; } @@ -157,15 +159,15 @@ ObjectFile::FindPlugin (const lldb::ModuleSP &module_sp, DataBufferSP &data_sp) { ObjectFileSP object_file_sp; - + if (module_sp) { Timer scoped_timer (__PRETTY_FUNCTION__, "ObjectFile::FindPlugin (module = %s, process = %p, header_addr = 0x%" PRIx64 ")", module_sp->GetFileSpec().GetPath().c_str(), - process_sp.get(), header_addr); + static_cast<void*>(process_sp.get()), header_addr); uint32_t idx; - + // Check if this is a normal object file by iterating through // all object file plugin instances. ObjectFileCreateMemoryInstance create_callback; @@ -175,8 +177,8 @@ ObjectFile::FindPlugin (const lldb::ModuleSP &module_sp, if (object_file_sp.get()) return object_file_sp; } - } + // We didn't find it, so clear our shared pointer in case it // contains anything and return an empty shared pointer object_file_sp.reset(); @@ -261,27 +263,12 @@ ObjectFile::ObjectFile (const lldb::ModuleSP &module_sp, m_data.SetData (data_sp, data_offset, length); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - { - if (m_file) - { - log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s), file = %s, file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, - this, - module_sp.get(), - module_sp->GetSpecificationDescription().c_str(), - m_file.GetPath().c_str(), - m_file_offset, - m_length); - } - else - { - log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s), file = <NULL>, file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, - this, - module_sp.get(), - module_sp->GetSpecificationDescription().c_str(), - m_file_offset, - m_length); - } - } + log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s), file = %s, file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, + static_cast<void*>(this), + static_cast<void*>(module_sp.get()), + module_sp->GetSpecificationDescription().c_str(), + m_file ? m_file.GetPath().c_str() : "<NULL>", + m_file_offset, m_length); } @@ -306,14 +293,11 @@ ObjectFile::ObjectFile (const lldb::ModuleSP &module_sp, m_data.SetData (header_data_sp, 0, header_data_sp->GetByteSize()); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - { log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s), process = %p, header_addr = 0x%" PRIx64, - this, - module_sp.get(), + static_cast<void*>(this), + static_cast<void*>(module_sp.get()), module_sp->GetSpecificationDescription().c_str(), - process_sp.get(), - m_memory_addr); - } + static_cast<void*>(process_sp.get()), m_memory_addr); } @@ -321,7 +305,8 @@ ObjectFile::~ObjectFile() { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p ObjectFile::~ObjectFile ()\n", this); + log->Printf ("%p ObjectFile::~ObjectFile ()\n", + static_cast<void*>(this)); } bool @@ -350,9 +335,12 @@ ObjectFile::GetAddressClass (addr_t file_addr) const SectionType section_type = section_sp->GetType(); switch (section_type) { - case eSectionTypeInvalid: return eAddressClassUnknown; - case eSectionTypeCode: return eAddressClassCode; - case eSectionTypeContainer: return eAddressClassUnknown; + case eSectionTypeInvalid: + return eAddressClassUnknown; + case eSectionTypeCode: + return eAddressClassCode; + case eSectionTypeContainer: + return eAddressClassUnknown; case eSectionTypeData: case eSectionTypeDataCString: case eSectionTypeDataCStringPointers: @@ -382,16 +370,18 @@ ObjectFile::GetAddressClass (addr_t file_addr) case eSectionTypeDWARFAppleNamespaces: case eSectionTypeDWARFAppleObjC: return eAddressClassDebug; - case eSectionTypeEHFrame: return eAddressClassRuntime; + case eSectionTypeEHFrame: + return eAddressClassRuntime; case eSectionTypeELFSymbolTable: case eSectionTypeELFDynamicSymbols: case eSectionTypeELFRelocationEntries: case eSectionTypeELFDynamicLinkInfo: - case eSectionTypeOther: return eAddressClassUnknown; + case eSectionTypeOther: + return eAddressClassUnknown; } } } - + const SymbolType symbol_type = symbol->GetType(); switch (symbol_type) { @@ -601,11 +591,9 @@ ObjectFile::ClearSymtab () lldb_private::Mutex::Locker locker(module_sp->GetMutex()); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - { log->Printf ("%p ObjectFile::ClearSymtab () symtab = %p", - this, - m_symtab_ap.get()); - } + static_cast<void*>(this), + static_cast<void*>(m_symtab_ap.get())); m_symtab_ap.reset(); } } diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp index b51ac5a550f..bfa560044ab 100644 --- a/lldb/source/Symbol/SymbolVendor.cpp +++ b/lldb/source/Symbol/SymbolVendor.cpp @@ -382,7 +382,7 @@ SymbolVendor::Dump(Stream *s) { bool show_context = false; - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<void*>(this)); s->Indent(); s->PutCString("SymbolVendor"); if (m_sym_file_ap.get()) diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index 073940e8a7f..b38a4506298 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -201,9 +201,9 @@ Type::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name) void Type::Dump (Stream *s, bool show_context) { - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<void*>(this)); s->Indent(); - *s << "Type" << (const UserID&)*this << ' '; + *s << "Type" << static_cast<const UserID&>(*this) << ' '; if (m_name) *s << ", name = \"" << m_name << "\""; diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp index 36fe3b1d79d..2314da512a2 100644 --- a/lldb/source/Symbol/Variable.cpp +++ b/lldb/source/Symbol/Variable.cpp @@ -93,7 +93,7 @@ Variable::GetType() void Variable::Dump(Stream *s, bool show_context) const { - s->Printf("%p: ", this); + s->Printf("%p: ", static_cast<const void*>(this)); s->Indent(); *s << "Variable" << (const UserID&)*this; diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index cefc2f0ece0..d1e5cebc685 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -261,7 +261,7 @@ Platform::Platform (bool is_host) : { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Platform::Platform()", this); + log->Printf ("%p Platform::Platform()", static_cast<void*>(this)); } //------------------------------------------------------------------ @@ -274,7 +274,7 @@ Platform::~Platform() { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Platform::~Platform()", this); + log->Printf ("%p Platform::~Platform()", static_cast<void*>(this)); } void diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 6f86a6158ae..db992dde4de 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -700,7 +700,7 @@ ProcessLaunchInfo::FileAction::AddPosixSpawnFileAction (void *_file_actions, eErrorTypePOSIX); if (log && (error.Fail() || log)) error.PutToLog(log, "posix_spawn_file_actions_addclose (action=%p, fd=%i)", - file_actions, info->m_fd); + static_cast<void*>(file_actions), info->m_fd); } break; @@ -715,7 +715,8 @@ ProcessLaunchInfo::FileAction::AddPosixSpawnFileAction (void *_file_actions, eErrorTypePOSIX); if (log && (error.Fail() || log)) error.PutToLog(log, "posix_spawn_file_actions_adddup2 (action=%p, fd=%i, dup_fd=%i)", - file_actions, info->m_fd, info->m_arg); + static_cast<void*>(file_actions), info->m_fd, + info->m_arg); } break; @@ -725,7 +726,7 @@ ProcessLaunchInfo::FileAction::AddPosixSpawnFileAction (void *_file_actions, else { int oflag = info->m_arg; - + mode_t mode = 0; if (oflag & O_CREAT) @@ -739,8 +740,9 @@ ProcessLaunchInfo::FileAction::AddPosixSpawnFileAction (void *_file_actions, eErrorTypePOSIX); if (error.Fail() || log) error.PutToLog(log, - "posix_spawn_file_actions_addopen (action=%p, fd=%i, path='%s', oflag=%i, mode=%i)", - file_actions, info->m_fd, info->m_path.c_str(), oflag, mode); + "posix_spawn_file_actions_addopen (action=%p, fd=%i, path='%s', oflag=%i, mode=%i)", + static_cast<void*>(file_actions), info->m_fd, + info->m_path.c_str(), oflag, mode); } break; } @@ -1063,7 +1065,7 @@ Process::Process(Target &target, Listener &listener) : Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Process::Process()", this); + log->Printf ("%p Process::Process()", static_cast<void*>(this)); SetEventName (eBroadcastBitStateChanged, "state-changed"); SetEventName (eBroadcastBitInterrupt, "interrupt"); @@ -1099,7 +1101,7 @@ Process::~Process() { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Process::~Process()", this); + log->Printf ("%p Process::~Process()", static_cast<void*>(this)); StopPrivateStateThread(); } @@ -1260,7 +1262,8 @@ Process::WaitForProcessToStop (const TimeValue *timeout, lldb::EventSP *event_sp Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) - log->Printf ("Process::%s (timeout = %p)", __FUNCTION__, timeout); + log->Printf ("Process::%s (timeout = %p)", __FUNCTION__, + static_cast<const void*>(timeout)); if (!wait_always && StateIsStoppedState(state, true) && @@ -1377,12 +1380,13 @@ Process::WaitForStateChangedEvents (const TimeValue *timeout, EventSP &event_sp, Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) - log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout); + log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, + static_cast<const void*>(timeout)); Listener *listener = hijack_listener; if (listener == NULL) listener = &m_listener; - + StateType state = eStateInvalid; if (listener->WaitForEventForBroadcasterWithType (timeout, this, @@ -1397,8 +1401,7 @@ Process::WaitForStateChangedEvents (const TimeValue *timeout, EventSP &event_sp, if (log) log->Printf ("Process::%s (timeout = %p, event_sp) => %s", - __FUNCTION__, - timeout, + __FUNCTION__, static_cast<const void*>(timeout), StateAsCString(state)); return state; } @@ -1437,7 +1440,8 @@ Process::WaitForStateChangedEventsPrivate (const TimeValue *timeout, EventSP &ev Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) - log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout); + log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, + static_cast<const void*>(timeout)); StateType state = eStateInvalid; if (m_private_state_listener.WaitForEventForBroadcasterWithType (timeout, @@ -1451,12 +1455,9 @@ Process::WaitForStateChangedEventsPrivate (const TimeValue *timeout, EventSP &ev // to the command-line, and that could disable the log, which would render the // log we got above invalid. if (log) - { - if (state == eStateInvalid) - log->Printf ("Process::%s (timeout = %p, event_sp) => TIMEOUT", __FUNCTION__, timeout); - else - log->Printf ("Process::%s (timeout = %p, event_sp) => %s", __FUNCTION__, timeout, StateAsCString(state)); - } + log->Printf ("Process::%s (timeout = %p, event_sp) => %s", + __FUNCTION__, static_cast<const void *>(timeout), + state == eStateInvalid ? "TIMEOUT" : StateAsCString(state)); return state; } @@ -1466,7 +1467,8 @@ Process::WaitForEventsPrivate (const TimeValue *timeout, EventSP &event_sp, bool Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) - log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout); + log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, + static_cast<const void*>(timeout)); if (control_only) return m_private_state_listener.WaitForEventForBroadcaster(timeout, &m_private_state_control_broadcaster, event_sp); @@ -3897,7 +3899,7 @@ Process::ShouldBroadcastEvent (Event *event_ptr) { if (log) log->Printf ("Process::ShouldBroadcastEvent (%p) stopped due to an interrupt, state: %s", - event_ptr, + static_cast<void*>(event_ptr), StateAsCString(state)); return_value = true; } @@ -3905,24 +3907,22 @@ Process::ShouldBroadcastEvent (Event *event_ptr) { bool was_restarted = ProcessEventData::GetRestartedFromEvent (event_ptr); bool should_resume = false; - + // It makes no sense to ask "ShouldStop" if we've already been restarted... // Asking the thread list is also not likely to go well, since we are running again. // So in that case just report the event. - + if (!was_restarted) should_resume = m_thread_list.ShouldStop (event_ptr) == false; - + if (was_restarted || should_resume || m_resume_requested) { Vote stop_vote = m_thread_list.ShouldReportStop (event_ptr); if (log) log->Printf ("Process::ShouldBroadcastEvent: should_stop: %i state: %s was_restarted: %i stop_vote: %d.", - should_resume, - StateAsCString(state), - was_restarted, - stop_vote); - + should_resume, StateAsCString(state), + was_restarted, stop_vote); + switch (stop_vote) { case eVoteYes: @@ -3933,15 +3933,17 @@ Process::ShouldBroadcastEvent (Event *event_ptr) return_value = false; break; } - + if (!was_restarted) { if (log) - log->Printf ("Process::ShouldBroadcastEvent (%p) Restarting process from state: %s", event_ptr, StateAsCString(state)); + log->Printf ("Process::ShouldBroadcastEvent (%p) Restarting process from state: %s", + static_cast<void*>(event_ptr), + StateAsCString(state)); ProcessEventData::SetRestartedInEvent(event_ptr, true); PrivateResume (); } - + } else { @@ -3952,7 +3954,7 @@ Process::ShouldBroadcastEvent (Event *event_ptr) } break; } - + // Forcing the next event delivery is a one shot deal. So reset it here. m_force_next_event_delivery = false; @@ -3962,14 +3964,13 @@ Process::ShouldBroadcastEvent (Event *event_ptr) // because the PublicState reflects the last event pulled off the queue, and there may be several // events stacked up on the queue unserviced. So the PublicState may not reflect the last broadcasted event // yet. m_last_broadcast_state gets updated here. - + if (return_value) m_last_broadcast_state = state; - + if (log) log->Printf ("Process::ShouldBroadcastEvent (%p) => new state: %s, last broadcast state: %s - %s", - event_ptr, - StateAsCString(state), + static_cast<void*>(event_ptr), StateAsCString(state), StateAsCString(m_last_broadcast_state), return_value ? "YES" : "NO"); return return_value; @@ -4235,7 +4236,8 @@ Process::RunPrivateStateThread () Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) - log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") thread starting...", __FUNCTION__, this, GetID()); + log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") thread starting...", + __FUNCTION__, static_cast<void*>(this), GetID()); bool exit_now = false; while (!exit_now) @@ -4245,7 +4247,9 @@ Process::RunPrivateStateThread () if (event_sp->BroadcasterIs(&m_private_state_control_broadcaster)) { if (log) - log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") got a control event: %d", __FUNCTION__, this, GetID(), event_sp->GetType()); + log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") got a control event: %d", + __FUNCTION__, static_cast<void*>(this), GetID(), + event_sp->GetType()); switch (event_sp->GetType()) { @@ -4261,7 +4265,7 @@ Process::RunPrivateStateThread () control_only = false; break; } - + m_private_state_control_wait.SetValue (true, eBroadcastAlways); continue; } @@ -4270,13 +4274,17 @@ Process::RunPrivateStateThread () if (m_public_state.GetValue() == eStateAttaching) { if (log) - log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") woke up with an interrupt while attaching - forwarding interrupt.", __FUNCTION__, this, GetID()); + log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") woke up with an interrupt while attaching - forwarding interrupt.", + __FUNCTION__, static_cast<void*>(this), + GetID()); BroadcastEvent (eBroadcastBitInterrupt, NULL); } else { if (log) - log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") woke up with an interrupt - Halting.", __FUNCTION__, this, GetID()); + log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") woke up with an interrupt - Halting.", + __FUNCTION__, static_cast<void*>(this), + GetID()); Halt(); } continue; @@ -4300,7 +4308,9 @@ Process::RunPrivateStateThread () internal_state == eStateDetached ) { if (log) - log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") about to exit with internal state %s...", __FUNCTION__, this, GetID(), StateAsCString(internal_state)); + log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") about to exit with internal state %s...", + __FUNCTION__, static_cast<void*>(this), GetID(), + StateAsCString(internal_state)); break; } @@ -4308,7 +4318,8 @@ Process::RunPrivateStateThread () // Verify log is still enabled before attempting to write to it... if (log) - log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") thread exiting...", __FUNCTION__, this, GetID()); + log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") thread exiting...", + __FUNCTION__, static_cast<void*>(this), GetID()); m_public_run_lock.SetStopped(); m_private_state_control_wait.SetValue (true, eBroadcastAlways); @@ -4485,7 +4496,8 @@ void Process::ProcessEventData::Dump (Stream *s) const { if (m_process_sp) - s->Printf(" process = %p (pid = %" PRIu64 "), ", m_process_sp.get(), m_process_sp->GetID()); + s->Printf(" process = %p (pid = %" PRIu64 "), ", + static_cast<void*>(m_process_sp.get()), m_process_sp->GetID()); s->Printf("state = %s", StateAsCString(GetState())); } @@ -4668,7 +4680,9 @@ Process::GetAsyncProfileData (char *buf, size_t buf_size, Error &error) { Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) - log->Printf ("Process::GetProfileData (buf = %p, size = %" PRIu64 ")", buf, (uint64_t)buf_size); + log->Printf ("Process::GetProfileData (buf = %p, size = %" PRIu64 ")", + static_cast<void*>(buf), + static_cast<uint64_t>(buf_size)); if (bytes_available > buf_size) { memcpy(buf, one_profile_data.c_str(), buf_size); @@ -4698,7 +4712,9 @@ Process::GetSTDOUT (char *buf, size_t buf_size, Error &error) { Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) - log->Printf ("Process::GetSTDOUT (buf = %p, size = %" PRIu64 ")", buf, (uint64_t)buf_size); + log->Printf ("Process::GetSTDOUT (buf = %p, size = %" PRIu64 ")", + static_cast<void*>(buf), + static_cast<uint64_t>(buf_size)); if (bytes_available > buf_size) { memcpy(buf, m_stdout_data.c_str(), buf_size); @@ -4724,7 +4740,9 @@ Process::GetSTDERR (char *buf, size_t buf_size, Error &error) { Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) - log->Printf ("Process::GetSTDERR (buf = %p, size = %" PRIu64 ")", buf, (uint64_t)buf_size); + log->Printf ("Process::GetSTDERR (buf = %p, size = %" PRIu64 ")", + static_cast<void*>(buf), + static_cast<uint64_t>(buf_size)); if (bytes_available > buf_size) { memcpy(buf, m_stderr_data.c_str(), buf_size); @@ -5010,19 +5028,19 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, Stream &errors) { ExecutionResults return_value = eExecutionSetupError; - + if (thread_plan_sp.get() == NULL) { errors.Printf("RunThreadPlan called with empty thread plan."); return eExecutionSetupError; } - + if (!thread_plan_sp->ValidatePlan(NULL)) { errors.Printf ("RunThreadPlan called with an invalid thread plan."); return eExecutionSetupError; } - + if (exe_ctx.GetProcessPtr() != this) { errors.Printf("RunThreadPlan called on wrong process."); @@ -5035,20 +5053,20 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, errors.Printf("RunThreadPlan called with invalid thread."); return eExecutionSetupError; } - + // We rely on the thread plan we are running returning "PlanCompleted" if when it successfully completes. // For that to be true the plan can't be private - since private plans suppress themselves in the // GetCompletedPlan call. - + bool orig_plan_private = thread_plan_sp->GetPrivate(); thread_plan_sp->SetPrivate(false); - + if (m_private_state.GetValue() != eStateStopped) { errors.Printf ("RunThreadPlan called while the private state was not stopped."); return eExecutionSetupError; } - + // Save the thread & frame from the exe_ctx for restoration after we run const uint32_t thread_idx_id = thread->GetIndexID(); StackFrameSP selected_frame_sp = thread->GetSelectedFrame(); @@ -5062,14 +5080,14 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, return eExecutionSetupError; } } - + StackID ctx_frame_id = selected_frame_sp->GetStackID(); // N.B. Running the target may unset the currently selected thread and frame. We don't want to do that either, // so we should arrange to reset them as well. - + lldb::ThreadSP selected_thread_sp = GetThreadList().GetSelectedThread(); - + uint32_t selected_tid; StackID selected_stack_id; if (selected_thread_sp) @@ -5095,7 +5113,6 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, // we are fielding public events here. if (log) log->Printf ("Running thread plan on private state thread, spinning up another state thread to handle the events."); - backup_private_state_thread = m_private_state_thread; @@ -5110,13 +5127,13 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, // Have to make sure our public state is stopped, since otherwise the reporting logic below doesn't work correctly. old_state = m_public_state.GetValue(); m_public_state.SetValueNoLock(eStateStopped); - + // Now spin up the private state thread: StartPrivateStateThread(true); } - + thread->QueueThreadPlan(thread_plan_sp, false); // This used to pass "true" does that make sense? - + if (options.GetDebug()) { // In this case, we aren't actually going to run, we just want to stop right away. @@ -5127,20 +5144,20 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, thread->Flush(); return eExecutionStoppedForDebug; } - + Listener listener("lldb.process.listener.run-thread-plan"); - + lldb::EventSP event_to_broadcast_sp; - + { // This process event hijacker Hijacks the Public events and its destructor makes sure that the process events get // restored on exit to the function. // // If the event needs to propagate beyond the hijacker (e.g., the process exits during execution), then the event // is put into event_to_broadcast_sp for rebroadcasting. - + ProcessEventHijacker run_thread_plan_hijacker (*this, &listener); - + if (log) { StreamString s; @@ -5150,25 +5167,25 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, thread->GetID(), s.GetData()); } - + bool got_event; lldb::EventSP event_sp; lldb::StateType stop_state = lldb::eStateInvalid; - + TimeValue* timeout_ptr = NULL; TimeValue real_timeout; - + bool before_first_timeout = true; // This is set to false the first time that we have to halt the target. bool do_resume = true; bool handle_running_event = true; const uint64_t default_one_thread_timeout_usec = 250000; - + // This is just for accounting: uint32_t num_resumes = 0; - + TimeValue one_thread_timeout = TimeValue::Now(); TimeValue final_timeout = one_thread_timeout; - + uint32_t timeout_usec = options.GetTimeoutUsec(); if (!options.GetStopOthers()) @@ -5179,7 +5196,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, else if (options.GetTryAllThreads()) { uint64_t option_one_thread_timeout = options.GetOneThreadTimeoutUsec(); - + // If the overall wait is forever, then we only need to set the one thread timeout: if (timeout_usec == 0) { @@ -5221,22 +5238,22 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, // This isn't going to work if there are unfetched events on the queue. // Are there cases where we might want to run the remaining events here, and then try to // call the function? That's probably being too tricky for our own good. - + Event *other_events = listener.PeekAtNextEvent(); if (other_events != NULL) { errors.Printf("Calling RunThreadPlan with pending events on the queue."); return eExecutionSetupError; } - + // We also need to make sure that the next event is delivered. We might be calling a function as part of // a thread plan, in which case the last delivered event could be the running event, and we don't want // event coalescing to cause us to lose OUR running event... ForceNextEventDelivery(); - + // This while loop must exit out the bottom, there's cleanup that we need to do when we are done. // So don't call return anywhere within it. - + while (1) { // We usually want to resume the process if we get to the top of the loop. @@ -5247,11 +5264,11 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, do_resume, handle_running_event, before_first_timeout); - + if (do_resume || handle_running_event) { // Do the initial resume and wait for the running event before going further. - + if (do_resume) { num_resumes++; @@ -5265,10 +5282,10 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, break; } } - + TimeValue resume_timeout = TimeValue::Now(); resume_timeout.OffsetWithMicroSeconds(500000); - + got_event = listener.WaitForEvent(&resume_timeout, event_sp); if (!got_event) { @@ -5280,13 +5297,13 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, return_value = eExecutionSetupError; break; } - + stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); if (stop_state != eStateRunning) { bool restarted = false; - + if (stop_state == eStateStopped) { restarted = Process::ProcessEventData::GetRestartedFromEvent(event_sp.get()); @@ -5299,20 +5316,20 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, do_resume, handle_running_event); } - + if (restarted) { // This is probably an overabundance of caution, I don't think I should ever get a stopped & restarted // event here. But if I do, the best thing is to Halt and then get out of here. Halt(); } - + errors.Printf("Didn't get running event after initial resume, got %s instead.", StateAsCString(stop_state)); return_value = eExecutionSetupError; break; } - + if (log) log->PutCString ("Process::RunThreadPlan(): resuming succeeded."); // We need to call the function synchronously, so spin waiting for it to return. @@ -5326,7 +5343,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, if (log) log->PutCString ("Process::RunThreadPlan(): waiting for next event."); } - + if (before_first_timeout) { if (options.GetTryAllThreads()) @@ -5346,10 +5363,10 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, else timeout_ptr = &final_timeout; } - + do_resume = true; handle_running_event = true; - + // Now wait for the process to stop again: event_sp.reset(); @@ -5366,9 +5383,9 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, log->Printf ("Process::RunThreadPlan(): about to wait forever."); } } - + got_event = listener.WaitForEvent (timeout_ptr, event_sp); - + if (got_event) { if (event_sp.get()) @@ -5388,7 +5405,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); if (log) log->Printf("Process::RunThreadPlan(): in while loop, got event: %s.", StateAsCString(stop_state)); - + switch (stop_state) { case lldb::eStateStopped: @@ -5414,17 +5431,15 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, keep_going = true; do_resume = false; handle_running_event = true; - + } else { - StopInfoSP stop_info_sp (thread_sp->GetStopInfo ()); StopReason stop_reason = eStopReasonInvalid; if (stop_info_sp) stop_reason = stop_info_sp->GetStopReason(); - - + // FIXME: We only check if the stop reason is plan complete, should we make sure that // it is OUR plan that is complete? if (stop_reason == eStopReasonPlanComplete) @@ -5475,16 +5490,16 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, default: if (log) log->Printf("Process::RunThreadPlan(): execution stopped with unexpected state: %s.", StateAsCString(stop_state)); - + if (stop_state == eStateExited) event_to_broadcast_sp = event_sp; - + errors.Printf ("Execution stopped with unexpected state.\n"); return_value = eExecutionInterrupted; break; } } - + if (keep_going) continue; else @@ -5503,7 +5518,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, // If we didn't get an event that means we've timed out... // We will interrupt the process here. Depending on what we were asked to do we will // either exit, or try with all threads running for the same timeout. - + if (log) { if (options.GetTryAllThreads()) { @@ -5522,13 +5537,13 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, "abandoning execution.", timeout_usec); } - + // It is possible that between the time we issued the Halt, and we get around to calling Halt the target // could have stopped. That's fine, Halt will figure that out and send the appropriate Stopped event. // BUT it is also possible that we stopped & restarted (e.g. hit a signal with "stop" set to false.) In // that case, we'll get the stopped & restarted event, and we should go back to waiting for the Halt's // stopped event. That's what this while loop does. - + bool back_to_top = true; uint32_t try_halt_again = 0; bool do_halt = true; @@ -5546,12 +5561,12 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, { if (log) log->PutCString ("Process::RunThreadPlan(): Halt succeeded."); - + real_timeout = TimeValue::Now(); real_timeout.OffsetWithMicroSeconds(500000); got_event = listener.WaitForEvent(&real_timeout, event_sp); - + if (got_event) { stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); @@ -5562,12 +5577,12 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, && Process::ProcessEventData::GetInterruptedFromEvent(event_sp.get())) log->PutCString (" Event was the Halt interruption event."); } - + if (stop_state == lldb::eStateStopped) { // Between the time we initiated the Halt and the time we delivered it, the process could have // already finished its job. Check that here: - + if (thread->IsThreadPlanDone (thread_plan_sp.get())) { if (log) @@ -5577,7 +5592,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, back_to_top = false; break; } - + if (Process::ProcessEventData::GetRestartedFromEvent(event_sp.get())) { if (log) @@ -5596,7 +5611,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, back_to_top = false; break; } - + if (before_first_timeout) { // Set all the other threads to run, and return to the top of the loop, which will continue; @@ -5634,14 +5649,14 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, continue; } } - + if (!back_to_top || try_halt_again > num_retries) break; else continue; } } // END WAIT LOOP - + // If we had to start up a temporary private state thread to run this thread plan, shut it down now. if (IS_VALID_LLDB_HOST_THREAD(backup_private_state_thread)) { @@ -5655,7 +5670,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, m_public_state.SetValueNoLock(old_state); } - + // Restore the thread state if we are going to discard the plan execution. There are three cases where this // could happen: // 1) The execution successfully completed @@ -5663,13 +5678,13 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, // 3) We got some other error, and discard_on_error was true bool should_unwind = (return_value == eExecutionInterrupted && options.DoesUnwindOnError()) || (return_value == eExecutionHitBreakpoint && options.DoesIgnoreBreakpoints()); - + if (return_value == eExecutionCompleted || should_unwind) { thread_plan_sp->RestoreThreadState(); } - + // Now do some processing on the results of the run: if (return_value == eExecutionInterrupted || return_value == eExecutionHitBreakpoint) { @@ -5686,7 +5701,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, StreamString ts; const char *event_explanation = NULL; - + do { if (!event_sp) @@ -5708,7 +5723,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, event_explanation = "<no event data>"; break; } - + Process *process = event_data->GetProcessSP().get(); if (!process) @@ -5716,34 +5731,34 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, event_explanation = "<no process>"; break; } - + ThreadList &thread_list = process->GetThreadList(); - + uint32_t num_threads = thread_list.GetSize(); uint32_t thread_index; - + ts.Printf("<%u threads> ", num_threads); - + for (thread_index = 0; thread_index < num_threads; ++thread_index) { Thread *thread = thread_list.GetThreadAtIndex(thread_index).get(); - + if (!thread) { ts.Printf("<?> "); continue; } - + ts.Printf("<0x%4.4" PRIx64 " ", thread->GetID()); RegisterContext *register_context = thread->GetRegisterContext().get(); - + if (register_context) ts.Printf("[ip 0x%" PRIx64 "] ", register_context->GetPC()); else ts.Printf("[ip unknown] "); - + lldb::StopInfoSP stop_info_sp = thread->GetStopInfo(); if (stop_info_sp) { @@ -5753,35 +5768,37 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, } ts.Printf(">"); } - + event_explanation = ts.GetData(); } } while (0); - + if (event_explanation) log->Printf("Process::RunThreadPlan(): execution interrupted: %s %s", s.GetData(), event_explanation); else log->Printf("Process::RunThreadPlan(): execution interrupted: %s", s.GetData()); } - + if (should_unwind) { if (log) - log->Printf ("Process::RunThreadPlan: ExecutionInterrupted - discarding thread plans up to %p.", thread_plan_sp.get()); + log->Printf ("Process::RunThreadPlan: ExecutionInterrupted - discarding thread plans up to %p.", + static_cast<void*>(thread_plan_sp.get())); thread->DiscardThreadPlansUpToPlan (thread_plan_sp); thread_plan_sp->SetPrivate (orig_plan_private); } else { if (log) - log->Printf ("Process::RunThreadPlan: ExecutionInterrupted - for plan: %p not discarding.", thread_plan_sp.get()); + log->Printf ("Process::RunThreadPlan: ExecutionInterrupted - for plan: %p not discarding.", + static_cast<void*>(thread_plan_sp.get())); } } else if (return_value == eExecutionSetupError) { if (log) log->PutCString("Process::RunThreadPlan(): execution set up error."); - + if (options.DoesUnwindOnError()) { thread->DiscardThreadPlansUpToPlan (thread_plan_sp); @@ -5815,7 +5832,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, } } } - + // Thread we ran the function in may have gone away because we ran the target // Check that it's still there, and if it is put it back in the context. Also restore the // frame in the context if it is still present. @@ -5824,10 +5841,10 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, { exe_ctx.SetFrameSP (thread->GetFrameWithStackID (ctx_frame_id)); } - + // Also restore the current process'es selected frame & thread, since this function calling may // be done behind the user's back. - + if (selected_tid != LLDB_INVALID_THREAD_ID) { if (GetThreadList().SetSelectedThreadByIndexID (selected_tid) && selected_stack_id.IsValid()) @@ -5840,16 +5857,16 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, } } } - + // If the process exited during the run of the thread plan, notify everyone. - + if (event_to_broadcast_sp) { if (log) log->PutCString("Process::RunThreadPlan(): rebroadcasting event."); BroadcastEvent(event_to_broadcast_sp); } - + return return_value; } diff --git a/lldb/source/Target/SectionLoadList.cpp b/lldb/source/Target/SectionLoadList.cpp index 82f52f9db1b..1975a868df0 100644 --- a/lldb/source/Target/SectionLoadList.cpp +++ b/lldb/source/Target/SectionLoadList.cpp @@ -81,19 +81,17 @@ SectionLoadList::SetSectionLoadAddress (const lldb::SectionSP §ion, addr_t l Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE)); ModuleSP module_sp (section->GetModule()); - + if (module_sp) { if (log) { const FileSpec &module_file_spec (module_sp->GetFileSpec()); log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16" PRIx64 ") module = %p", - __FUNCTION__, - section.get(), + __FUNCTION__, static_cast<void*>(section.get()), module_file_spec.GetPath().c_str(), - section->GetName().AsCString(), - load_addr, - module_sp.get()); + section->GetName().AsCString(), load_addr, + static_cast<void*>(module_sp.get())); } if (section->GetByteSize() == 0) @@ -155,8 +153,7 @@ SectionLoadList::SetSectionLoadAddress (const lldb::SectionSP §ion, addr_t l if (log) { log->Printf ("SectionLoadList::%s (section = %p (%s), load_addr = 0x%16.16" PRIx64 ") error: module has been deleted", - __FUNCTION__, - section.get(), + __FUNCTION__, static_cast<void*>(section.get()), section->GetName().AsCString(), load_addr); } @@ -177,14 +174,13 @@ SectionLoadList::SetSectionUnloaded (const lldb::SectionSP §ion_sp) { const FileSpec &module_file_spec (section_sp->GetModule()->GetFileSpec()); log->Printf ("SectionLoadList::%s (section = %p (%s.%s))", - __FUNCTION__, - section_sp.get(), + __FUNCTION__, static_cast<void*>(section_sp.get()), module_file_spec.GetPath().c_str(), section_sp->GetName().AsCString()); } Mutex::Locker locker(m_mutex); - + sect_to_addr_collection::iterator sta_pos = m_sect_to_addr.find(section_sp.get()); if (sta_pos != m_sect_to_addr.end()) { @@ -209,11 +205,9 @@ SectionLoadList::SetSectionUnloaded (const lldb::SectionSP §ion_sp, addr_t l { const FileSpec &module_file_spec (section_sp->GetModule()->GetFileSpec()); log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16" PRIx64 ")", - __FUNCTION__, - section_sp.get(), + __FUNCTION__, static_cast<void*>(section_sp.get()), module_file_spec.GetPath().c_str(), - section_sp->GetName().AsCString(), - load_addr); + section_sp->GetName().AsCString(), load_addr); } bool erased = false; Mutex::Locker locker(m_mutex); @@ -223,7 +217,7 @@ SectionLoadList::SetSectionUnloaded (const lldb::SectionSP §ion_sp, addr_t l erased = true; m_sect_to_addr.erase (sta_pos); } - + addr_to_sect_collection::iterator ats_pos = m_addr_to_sect.find(load_addr); if (ats_pos != m_addr_to_sect.end()) { @@ -287,7 +281,8 @@ SectionLoadList::Dump (Stream &s, Target *target) addr_to_sect_collection::const_iterator pos, end; for (pos = m_addr_to_sect.begin(), end = m_addr_to_sect.end(); pos != end; ++pos) { - s.Printf("addr = 0x%16.16" PRIx64 ", section = %p: ", pos->first, pos->second.get()); + s.Printf("addr = 0x%16.16" PRIx64 ", section = %p: ", + pos->first, static_cast<void*>(pos->second.get())); pos->second->Dump (&s, target, 0); } } diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp index 631a77bd495..d81606a4ef7 100644 --- a/lldb/source/Target/StackFrameList.cpp +++ b/lldb/source/Target/StackFrameList.cpp @@ -491,7 +491,7 @@ StackFrameList::Dump (Stream *s) for (pos = begin; pos != end; ++pos) { StackFrame *frame = (*pos).get(); - s->Printf("%p: ", frame); + s->Printf("%p: ", static_cast<void*>(frame)); if (frame) { frame->GetStackID().Dump (s); diff --git a/lldb/source/Target/StackID.cpp b/lldb/source/Target/StackID.cpp index 9e8c315d070..ca337f91440 100644 --- a/lldb/source/Target/StackID.cpp +++ b/lldb/source/Target/StackID.cpp @@ -24,11 +24,12 @@ using namespace lldb_private; void StackID::Dump (Stream *s) { - s->Printf("StackID (pc = 0x%16.16" PRIx64 ", cfa = 0x%16.16" PRIx64 ", symbol_scope = %p", (uint64_t)m_pc, (uint64_t)m_cfa, m_symbol_scope); + s->Printf("StackID (pc = 0x%16.16" PRIx64 ", cfa = 0x%16.16" PRIx64 ", symbol_scope = %p", + m_pc, m_cfa, static_cast<void*>(m_symbol_scope)); if (m_symbol_scope) { SymbolContext sc; - + m_symbol_scope->CalculateSymbolContext (&sc); if (sc.block) s->Printf(" (Block {0x%8.8" PRIx64 "})", sc.block->GetID()); diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index d56efc50f55..a3ba41a09e4 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -108,7 +108,6 @@ namespace lldb_private class StopInfoBreakpoint : public StopInfo { public: - StopInfoBreakpoint (Thread &thread, break_id_t break_id) : StopInfo (thread, break_id), m_description(), @@ -121,7 +120,7 @@ public: { StoreBPInfo(); } - + StopInfoBreakpoint (Thread &thread, break_id_t break_id, bool should_stop) : StopInfo (thread, break_id), m_description(), @@ -161,7 +160,7 @@ public: virtual ~StopInfoBreakpoint () { } - + virtual StopReason GetStopReason () const { @@ -199,7 +198,7 @@ public: } return false; } - + virtual bool DoShouldNotify (Event *event_ptr) { @@ -252,7 +251,7 @@ public: } } } - + strm.Printf("breakpoint "); bp_site_sp->GetDescription(&strm, eDescriptionLevelBrief); m_description.swap (strm.GetString()); @@ -290,7 +289,7 @@ public: strm.Printf("breakpoint site %" PRIi64 " which has been deleted - unknown address", m_value); else strm.Printf("breakpoint site %" PRIi64 " which has been deleted - was at 0x%" PRIx64, m_value, m_address); - + m_description.swap (strm.GetString()); } } @@ -307,20 +306,20 @@ protected: assert (m_should_stop_is_valid); return m_should_stop; } - + virtual void PerformAction (Event *event_ptr) { if (!m_should_perform_action) return; m_should_perform_action = false; - + ThreadSP thread_sp (m_thread_wp.lock()); if (thread_sp) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); - + if (!thread_sp->IsValid()) { // This shouldn't ever happen, but just in case, don't do more harm. @@ -332,13 +331,13 @@ protected: m_should_stop_is_valid = true; return; } - + BreakpointSiteSP bp_site_sp (thread_sp->GetProcess()->GetBreakpointSiteList().FindByID (m_value)); - + if (bp_site_sp) { size_t num_owners = bp_site_sp->GetNumberOfOwners(); - + if (num_owners == 0) { m_should_stop = true; @@ -354,7 +353,7 @@ protected: // we're going to restart, without running the rest of the callbacks. And in this case we will // end up not stopping even if another location said we should stop. But that's better than not // running all the callbacks. - + m_should_stop = false; ExecutionContext exe_ctx (thread_sp->GetStackFrameAtIndex(0)); @@ -367,7 +366,7 @@ protected: // TODO: We can keep a list of the breakpoints we've seen while running expressions in the nested // PerformAction calls that can arise when the action runs a function that hits another breakpoint, // and only stop running commands when we see the same breakpoint hit a second time. - + m_should_stop_is_valid = true; if (log) log->Printf ("StopInfoBreakpoint::PerformAction - Hit a breakpoint while running an expression," @@ -398,12 +397,12 @@ protected: "running function, skipping commands and conditions to prevent recursion."); return; } - + StoppointCallbackContext context (event_ptr, exe_ctx, false); - + // Let's copy the breakpoint locations out of the site and store them in a local list. That way if // one of the breakpoint actions changes the site, then we won't be operating on a bad list. - + BreakpointLocationCollection site_locations; for (size_t j = 0; j < num_owners; j++) site_locations.Add(bp_site_sp->GetOwnerAtIndex(j)); @@ -411,11 +410,11 @@ protected: for (size_t j = 0; j < num_owners; j++) { lldb::BreakpointLocationSP bp_loc_sp = site_locations.GetByIndex(j); - + // If another action disabled this breakpoint or its location, then don't run the actions. if (!bp_loc_sp->IsEnabled() || !bp_loc_sp->GetBreakpoint().IsEnabled()) continue; - + // The breakpoint site may have many locations associated with it, not all of them valid for // this thread. Skip the ones that aren't: if (!bp_loc_sp->ValidForThisThread(thread_sp.get())) @@ -424,18 +423,20 @@ protected: { StreamString s; bp_loc_sp->GetDescription(&s, eDescriptionLevelBrief); - log->Printf ("Breakpoint %s hit on thread 0x%llx but it was not for this thread, continuing.", s.GetData(), thread_sp->GetID()); + log->Printf ("Breakpoint %s hit on thread 0x%llx but it was not for this thread, continuing.", + s.GetData(), + static_cast<unsigned long long>(thread_sp->GetID())); } continue; } // First run the condition for the breakpoint. If that says we should stop, then we'll run // the callback for the breakpoint. If the callback says we shouldn't stop that will win. - + if (bp_loc_sp->GetConditionText() != NULL) { Error condition_error; bool condition_says_stop = bp_loc_sp->ConditionSaysStop(exe_ctx, condition_error); - + if (!condition_error.Success()) { Debugger &debugger = exe_ctx.GetTargetRef().GetDebugger(); @@ -448,7 +449,7 @@ protected: const char *err_str = condition_error.AsCString("<Unknown Error>"); if (log) log->Printf("Error evaluating condition: \"%s\"\n", err_str); - + error_sp->PutCString (err_str); error_sp->EOL(); error_sp->Flush(); @@ -459,36 +460,39 @@ protected: { StreamString s; bp_loc_sp->GetDescription(&s, eDescriptionLevelBrief); - log->Printf ("Condition evaluated for breakpoint %s on thread 0x%llx conditon_says_stop: %i.", s.GetData(), thread_sp->GetID(), condition_says_stop); + log->Printf ("Condition evaluated for breakpoint %s on thread 0x%llx conditon_says_stop: %i.", + s.GetData(), + static_cast<unsigned long long>(thread_sp->GetID()), + condition_says_stop); } if (!condition_says_stop) continue; } } - + bool callback_says_stop; - + // FIXME: For now the callbacks have to run in async mode - the first time we restart we need // to get out of there. So set it here. // When we figure out how to nest breakpoint hits then this will change. - + Debugger &debugger = thread_sp->CalculateTarget()->GetDebugger(); bool old_async = debugger.GetAsyncExecution(); debugger.SetAsyncExecution (true); - + callback_says_stop = bp_loc_sp->InvokeCallback (&context); - + debugger.SetAsyncExecution (old_async); - + if (callback_says_stop) m_should_stop = true; - + // If we are going to stop for this breakpoint, then remove the breakpoint. if (callback_says_stop && bp_loc_sp && bp_loc_sp->GetBreakpoint().IsOneShot()) { thread_sp->GetProcess()->GetTarget().RemoveBreakpointByID (bp_loc_sp->GetBreakpoint().GetID()); } - + // Also make sure that the callback hasn't continued the target. // If it did, when we'll set m_should_start to false and get out of here. if (HasTargetRunSinceMe ()) diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index e9a8189814a..bbf514dff06 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -94,12 +94,12 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::Plat SetEventName (eBroadcastBitModulesUnloaded, "modules-unloaded"); SetEventName (eBroadcastBitWatchpointChanged, "watchpoint-changed"); SetEventName (eBroadcastBitSymbolsLoaded, "symbols-loaded"); - + CheckInWithManager(); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Target::Target()", this); + log->Printf ("%p Target::Target()", static_cast<void*>(this)); if (m_arch.IsValid()) { LogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET, "Target::Target created with architecture %s (%s)", m_arch.GetArchitectureName(), m_arch.GetTriple().getTriple().c_str()); @@ -113,7 +113,7 @@ Target::~Target() { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Target::~Target()", this); + log->Printf ("%p Target::~Target()", static_cast<void*>(this)); DeleteCurrentProcess (); } diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 0f82617acf6..4543dc03678 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -295,7 +295,8 @@ Thread::Thread (Process &process, lldb::tid_t tid, bool use_invalid_index_id) : { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")", this, GetID()); + log->Printf ("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")", + static_cast<void*>(this), GetID()); CheckInWithManager(); QueueFundamentalPlan(true); @@ -306,7 +307,8 @@ Thread::~Thread() { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")", this, GetID()); + log->Printf ("%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")", + static_cast<void*>(this), GetID()); /// If you hit this assert, it means your derived class forgot to call DoDestroy in its destructor. assert (m_destroy_called); } @@ -495,7 +497,10 @@ Thread::SetStopInfo (const lldb::StopInfoSP &stop_info_sp) m_stop_info_stop_id = UINT32_MAX; Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD)); if (log) - log->Printf("%p: tid = 0x%" PRIx64 ": stop info = %s (stop_id = %u)\n", this, GetID(), stop_info_sp ? stop_info_sp->GetDescription() : "<NULL>", m_stop_info_stop_id); + log->Printf("%p: tid = 0x%" PRIx64 ": stop info = %s (stop_id = %u)\n", + static_cast<void*>(this), GetID(), + stop_info_sp ? stop_info_sp->GetDescription() : "<NULL>", + m_stop_info_stop_id); } void @@ -743,31 +748,27 @@ bool Thread::ShouldStop (Event* event_ptr) { ThreadPlan *current_plan = GetCurrentPlan(); - + bool should_stop = true; Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); - + if (GetResumeState () == eStateSuspended) { if (log) log->Printf ("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64 ", should_stop = 0 (ignore since thread was suspended)", - __FUNCTION__, - GetID (), - GetProtocolID()); + __FUNCTION__, GetID (), GetProtocolID()); return false; } - + if (GetTemporaryResumeState () == eStateSuspended) { if (log) log->Printf ("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64 ", should_stop = 0 (ignore since thread was suspended)", - __FUNCTION__, - GetID (), - GetProtocolID()); + __FUNCTION__, GetID (), GetProtocolID()); return false; } - + // Based on the current thread plan and process stop info, check if this // thread caused the process to stop. NOTE: this must take place before // the plan is moved from the current plan stack to the completed plan @@ -776,31 +777,29 @@ Thread::ShouldStop (Event* event_ptr) { if (log) log->Printf ("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64 ", pc = 0x%16.16" PRIx64 ", should_stop = 0 (ignore since no stop reason)", - __FUNCTION__, - GetID (), - GetProtocolID(), + __FUNCTION__, GetID (), GetProtocolID(), GetRegisterContext() ? GetRegisterContext()->GetPC() : LLDB_INVALID_ADDRESS); return false; } - + if (log) { log->Printf ("Thread::%s(%p) for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64 ", pc = 0x%16.16" PRIx64, - __FUNCTION__, - this, - GetID (), + __FUNCTION__, static_cast<void*>(this), GetID (), GetProtocolID (), - GetRegisterContext() ? GetRegisterContext()->GetPC() : LLDB_INVALID_ADDRESS); + GetRegisterContext() + ? GetRegisterContext()->GetPC() + : LLDB_INVALID_ADDRESS); log->Printf ("^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^"); StreamString s; s.IndentMore(); DumpThreadPlans(&s); log->Printf ("Plan stack initial state:\n%s", s.GetData()); } - + // The top most plan always gets to do the trace log... current_plan->DoTraceLog (); - + // First query the stop info's ShouldStopSynchronous. This handles "synchronous" stop reasons, for example the breakpoint // command on internal breakpoints. If a synchronous stop reason says we should not stop, then we don't have to // do any more work on this stop. @@ -843,15 +842,15 @@ Thread::ShouldStop (Event* event_ptr) if (plan_ptr->PlanExplainsStop(event_ptr)) { should_stop = plan_ptr->ShouldStop (event_ptr); - + // plan_ptr explains the stop, next check whether plan_ptr is done, if so, then we should take it // and all the plans below it off the stack. - + if (plan_ptr->MischiefManaged()) { // We're going to pop the plans up to and including the plan that explains the stop. ThreadPlan *prev_plan_ptr = GetPreviousPlan (plan_ptr); - + do { if (should_stop) @@ -868,21 +867,22 @@ Thread::ShouldStop (Event* event_ptr) } else done_processing_current_plan = true; - + break; } } } } - + if (!done_processing_current_plan) { bool over_ride_stop = current_plan->ShouldAutoContinue(event_ptr); - + if (log) - log->Printf("Plan %s explains stop, auto-continue %i.", current_plan->GetName(), over_ride_stop); - + log->Printf("Plan %s explains stop, auto-continue %i.", + current_plan->GetName(), over_ride_stop); + // We're starting from the base plan, so just let it decide; if (PlanIsBasePlan(current_plan)) { @@ -898,10 +898,11 @@ Thread::ShouldStop (Event* event_ptr) { if (PlanIsBasePlan(current_plan)) break; - + should_stop = current_plan->ShouldStop(event_ptr); if (log) - log->Printf("Plan %s should stop: %d.", current_plan->GetName(), should_stop); + log->Printf("Plan %s should stop: %d.", + current_plan->GetName(), should_stop); if (current_plan->MischiefManaged()) { if (should_stop) @@ -933,7 +934,7 @@ Thread::ShouldStop (Event* event_ptr) } } } - + if (over_ride_stop) should_stop = false; @@ -941,7 +942,7 @@ Thread::ShouldStop (Event* event_ptr) // by hitting a breakpoint during a step-over - then do some step/finish/etc operations that wind up // past the end point condition of the initial plan. We don't want to strand the original plan on the stack, // This code clears stale plans off the stack. - + if (should_stop) { ThreadPlan *plan_ptr = GetCurrentPlan(); @@ -950,16 +951,17 @@ Thread::ShouldStop (Event* event_ptr) bool stale = plan_ptr->IsPlanStale (); ThreadPlan *examined_plan = plan_ptr; plan_ptr = GetPreviousPlan (examined_plan); - + if (stale) { if (log) - log->Printf("Plan %s being discarded in cleanup, it says it is already done.", examined_plan->GetName()); + log->Printf("Plan %s being discarded in cleanup, it says it is already done.", + examined_plan->GetName()); DiscardThreadPlansUpToPlan(examined_plan); } } } - + } if (log) @@ -1036,37 +1038,33 @@ Vote Thread::ShouldReportRun (Event* event_ptr) { StateType thread_state = GetResumeState (); - + if (thread_state == eStateSuspended || thread_state == eStateInvalid) { return eVoteNoOpinion; } - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (m_completed_plan_stack.size() > 0) { // Don't use GetCompletedPlan here, since that suppresses private plans. if (log) log->Printf ("Current Plan for thread %d(%p) (0x%4.4" PRIx64 ", %s): %s being asked whether we should report run.", - GetIndexID(), - this, - GetID(), + GetIndexID(), static_cast<void*>(this), GetID(), StateAsCString(GetTemporaryResumeState()), m_completed_plan_stack.back()->GetName()); - + return m_completed_plan_stack.back()->ShouldReportRun (event_ptr); } else { if (log) log->Printf ("Current Plan for thread %d(%p) (0x%4.4" PRIx64 ", %s): %s being asked whether we should report run.", - GetIndexID(), - this, - GetID(), + GetIndexID(), static_cast<void*>(this), GetID(), StateAsCString(GetTemporaryResumeState()), GetCurrentPlan()->GetName()); - + return GetCurrentPlan()->ShouldReportRun (event_ptr); } } @@ -1089,7 +1087,7 @@ Thread::PushPlan (ThreadPlanSP &thread_plan_sp) if (!thread_plan_sp->GetThreadPlanTracer()) thread_plan_sp->SetThreadPlanTracer(m_plan_stack.back()->GetThreadPlanTracer()); m_plan_stack.push_back (thread_plan_sp); - + thread_plan_sp->DidPush(); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); @@ -1098,8 +1096,7 @@ Thread::PushPlan (ThreadPlanSP &thread_plan_sp) StreamString s; thread_plan_sp->GetDescription (&s, lldb::eDescriptionLevelFull); log->Printf("Thread::PushPlan(0x%p): \"%s\", tid = 0x%4.4" PRIx64 ".", - this, - s.GetData(), + static_cast<void*>(this), s.GetData(), thread_plan_sp->GetThread().GetID()); } } @@ -1285,15 +1282,14 @@ Thread::DiscardThreadPlansUpToPlan (ThreadPlan *up_to_plan_ptr) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) - { - log->Printf("Discarding thread plans for thread tid = 0x%4.4" PRIx64 ", up to %p", GetID(), up_to_plan_ptr); - } + log->Printf("Discarding thread plans for thread tid = 0x%4.4" PRIx64 ", up to %p", + GetID(), static_cast<void*>(up_to_plan_ptr)); int stack_size = m_plan_stack.size(); - + // If the input plan is NULL, discard all plans. Otherwise make sure this plan is in the // stack, and if so discard up to and including it. - + if (up_to_plan_ptr == NULL) { for (int i = stack_size - 1; i > 0; i--) diff --git a/lldb/source/Target/ThreadPlan.cpp b/lldb/source/Target/ThreadPlan.cpp index 65d51bd0173..2c9b7fce7c2 100644 --- a/lldb/source/Target/ThreadPlan.cpp +++ b/lldb/source/Target/ThreadPlan.cpp @@ -161,16 +161,11 @@ ThreadPlan::WillResume (StateType resume_state, bool current_plan) addr_t fp = reg_ctx->GetFP(); log->Printf("%s Thread #%u (0x%p): tid = 0x%4.4" PRIx64 ", pc = 0x%8.8" PRIx64 ", sp = 0x%8.8" PRIx64 ", fp = 0x%8.8" PRIx64 ", " "plan = '%s', state = %s, stop others = %d", - __FUNCTION__, - m_thread.GetIndexID(), - &m_thread, - m_thread.GetID(), - (uint64_t)pc, - (uint64_t)sp, - (uint64_t)fp, - m_name.c_str(), - StateAsCString(resume_state), - StopOthers()); + __FUNCTION__, m_thread.GetIndexID(), + static_cast<void*>(&m_thread), m_thread.GetID(), + static_cast<uint64_t>(pc), static_cast<uint64_t>(sp), + static_cast<uint64_t>(fp), m_name.c_str(), + StateAsCString(resume_state), StopOthers()); } } return DoWillResume (resume_state, current_plan); diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 0c019960703..0f2a0d32045 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -49,16 +49,16 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread, ProcessSP process_sp (thread.GetProcess()); if (!process_sp) return false; - + abi = process_sp->GetABI().get(); - + if (!abi) return false; - + Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP)); - + SetBreakpoints(); - + m_function_sp = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize(); // If we can't read memory at the point of the process where we are planning to put our function, we're // not going to get any further... @@ -68,17 +68,21 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread, { m_constructor_errors.Printf ("Trying to put the stack in unreadable memory at: 0x%" PRIx64 ".", m_function_sp); if (log) - log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData()); + log->Printf ("ThreadPlanCallFunction(%p): %s.", + static_cast<void*>(this), + m_constructor_errors.GetData()); return false; } - + Module *exe_module = GetTarget().GetExecutableModulePointer(); if (exe_module == NULL) { m_constructor_errors.Printf ("Can't execute code without an executable module."); if (log) - log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData()); + log->Printf ("ThreadPlanCallFunction(%p): %s.", + static_cast<void*>(this), + m_constructor_errors.GetData()); return false; } else @@ -90,23 +94,27 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread, exe_module->GetFileSpec().GetFilename().AsCString()); if (log) - log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData()); + log->Printf ("ThreadPlanCallFunction(%p): %s.", + static_cast<void*>(this), + m_constructor_errors.GetData()); return false; } - + m_start_addr = objectFile->GetEntryPointAddress(); if (!m_start_addr.IsValid()) { m_constructor_errors.Printf ("Could not find entry point address for executable module \"%s\".", exe_module->GetFileSpec().GetFilename().AsCString()); if (log) - log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData()); + log->Printf ("ThreadPlanCallFunction(%p): %s.", + static_cast<void*>(this), + m_constructor_errors.GetData()); return false; } } - + start_load_addr = m_start_addr.GetLoadAddress (&GetTarget()); - + // Checkpoint the thread state so we can restore it later. if (log && log->GetVerbose()) ReportRegisterState ("About to checkpoint thread before function call. Original register state was:"); @@ -115,11 +123,13 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread, { m_constructor_errors.Printf ("Setting up ThreadPlanCallFunction, failed to checkpoint thread state."); if (log) - log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData()); + log->Printf ("ThreadPlanCallFunction(%p): %s.", + static_cast<void*>(this), + m_constructor_errors.GetData()); return false; } function_load_addr = m_function_addr.GetLoadAddress (&GetTarget()); - + return true; } @@ -148,16 +158,16 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, lldb::addr_t function_load_addr; if (!ConstructorSetup (thread, abi, start_load_addr, function_load_addr)) return; - + if (!abi->PrepareTrivialCall(thread, m_function_sp, function_load_addr, start_load_addr, args)) return; - + ReportRegisterState ("Function call was set up. Register state was:"); - + m_valid = true; } @@ -198,15 +208,16 @@ void ThreadPlanCallFunction::DoTakedown (bool success) { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP)); - + if (!m_valid) { //Don't call DoTakedown if we were never valid to begin with. if (log) - log->Printf ("ThreadPlanCallFunction(%p): Log called on ThreadPlanCallFunction that was never valid.", this); + log->Printf ("ThreadPlanCallFunction(%p): Log called on ThreadPlanCallFunction that was never valid.", + static_cast<void*>(this)); return; } - + if (!m_takedown_done) { if (success) @@ -220,14 +231,17 @@ ThreadPlanCallFunction::DoTakedown (bool success) } } if (log) - log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called for thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n", this, m_thread.GetID(), m_valid, IsPlanComplete()); + log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called for thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n", + static_cast<void*>(this), m_thread.GetID(), m_valid, + IsPlanComplete()); m_takedown_done = true; m_stop_address = m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC(); m_real_stop_info_sp = GetPrivateStopInfo (); if (!m_thread.RestoreRegisterStateFromCheckpoint(m_stored_thread_state)) { if (log) - log->Printf("ThreadPlanCallFunction(%p): DoTakedown failed to restore register state", this); + log->Printf("ThreadPlanCallFunction(%p): DoTakedown failed to restore register state", + static_cast<void*>(this)); } SetPlanComplete(success); ClearBreakpoints(); @@ -238,7 +252,9 @@ ThreadPlanCallFunction::DoTakedown (bool success) else { if (log) - log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called as no-op for thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n", this, m_thread.GetID(), m_valid, IsPlanComplete()); + log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called as no-op for thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n", + static_cast<void*>(this), m_thread.GetID(), m_valid, + IsPlanComplete()); } } @@ -459,11 +475,12 @@ bool ThreadPlanCallFunction::MischiefManaged () { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); - + if (IsPlanComplete()) { if (log) - log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.", this); + log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.", + static_cast<void*>(this)); ThreadPlan::MischiefManaged (); return true; |