[Lldb-commits] [lldb] r251647 - Fix Clang-tidy modernize-use-nullptr warnings in some files in include/lldb/Target; other minor fixes.
Eugene Zelenko via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 29 13:12:41 PDT 2015
Author: eugenezelenko
Date: Thu Oct 29 15:12:40 2015
New Revision: 251647
URL: http://llvm.org/viewvc/llvm-project?rev=251647&view=rev
Log:
Fix Clang-tidy modernize-use-nullptr warnings in some files in include/lldb/Target; other minor fixes.
Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/Target/Thread.h
Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=251647&r1=251646&r2=251647&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Thu Oct 29 15:12:40 2015
@@ -17,7 +17,8 @@
// C++ Includes
#include <list>
-#include <iosfwd>
+#include <memory>
+#include <string>
#include <vector>
#include <unordered_set>
@@ -56,7 +57,7 @@ struct Range;
class ProcessProperties : public Properties
{
public:
- // Pass NULL for "process" if the ProcessProperties are to be the global copy
+ // Pass nullptr for "process" if the ProcessProperties are to be the global copy
ProcessProperties (lldb_private::Process *process);
~ProcessProperties() override;
@@ -107,11 +108,10 @@ public:
GetWarningsOptimization () const;
protected:
-
static void
OptionValueChangedCallback (void *baton, OptionValue *option_value);
- Process * m_process; // Can be NULL for global ProcessProperties
+ Process * m_process; // Can be nullptr for global ProcessProperties
};
typedef std::shared_ptr<ProcessProperties> ProcessPropertiesSP;
@@ -327,9 +327,7 @@ public:
const char *
GetProcessPluginName () const
{
- if (m_plugin_name.empty())
- return NULL;
- return m_plugin_name.c_str();
+ return (m_plugin_name.empty() ? nullptr : m_plugin_name.c_str());
}
void
@@ -401,7 +399,6 @@ public:
m_listener_sp = listener_sp;
}
-
Listener &
GetListenerForProcess (Debugger &debugger);
@@ -420,18 +417,15 @@ protected:
class ProcessLaunchCommandOptions : public Options
{
public:
-
ProcessLaunchCommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
}
-
- ~ProcessLaunchCommandOptions() override
- {
- }
-
+
+ ~ProcessLaunchCommandOptions() override = default;
+
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override;
@@ -539,11 +533,8 @@ protected:
class ProcessInstanceInfoList
{
public:
- ProcessInstanceInfoList () :
- m_infos()
- {
- }
-
+ ProcessInstanceInfoList() = default;
+
void
Clear()
{
@@ -565,25 +556,19 @@ public:
const char *
GetProcessNameAtIndex (size_t idx)
{
- if (idx < m_infos.size())
- return m_infos[idx].GetName();
- return NULL;
+ return ((idx < m_infos.size()) ? m_infos[idx].GetName() : nullptr);
}
size_t
GetProcessNameLengthAtIndex (size_t idx)
{
- if (idx < m_infos.size())
- return m_infos[idx].GetNameLength();
- return 0;
+ return ((idx < m_infos.size()) ? m_infos[idx].GetNameLength() : 0);
}
lldb::pid_t
GetProcessIDAtIndex (size_t idx)
{
- if (idx < m_infos.size())
- return m_infos[idx].GetProcessID();
- return 0;
+ return ((idx < m_infos.size()) ? m_infos[idx].GetProcessID() : 0);
}
bool
@@ -610,7 +595,6 @@ protected:
collection m_infos;
};
-
// This class tracks the Modification state of the process. Things that can currently modify
// the program are running the program (which will up the StopID) and writing memory (which
// will up the MemoryID.)
@@ -618,7 +602,7 @@ protected:
class ProcessModID
{
-friend bool operator== (const ProcessModID &lhs, const ProcessModID &rhs);
+ friend bool operator== (const ProcessModID &lhs, const ProcessModID &rhs);
public:
ProcessModID () :
m_stop_id (0),
@@ -644,7 +628,7 @@ public:
return *this;
}
- ~ProcessModID () {}
+ ~ProcessModID() = default;
void BumpStopID () {
m_stop_id++;
@@ -727,6 +711,7 @@ private:
uint32_t m_running_user_expression;
lldb::EventSP m_last_natural_stop_event;
};
+
inline bool operator== (const ProcessModID &lhs, const ProcessModID &rhs)
{
if (lhs.StopIDEqual (rhs)
@@ -738,11 +723,7 @@ inline bool operator== (const ProcessMod
inline bool operator!= (const ProcessModID &lhs, const ProcessModID &rhs)
{
- if (!lhs.StopIDEqual (rhs)
- || !lhs.MemoryIDEqual (rhs))
- return true;
- else
- return false;
+ return (!lhs.StopIDEqual (rhs) || !lhs.MemoryIDEqual (rhs));
}
//----------------------------------------------------------------------
@@ -765,7 +746,6 @@ class Process :
friend class ThreadList;
public:
-
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
@@ -812,7 +792,6 @@ public:
return GetStaticBroadcasterClass();
}
-
//------------------------------------------------------------------
/// A notification structure that can be used by clients to listen
/// for changes in a process's lifetime.
@@ -871,10 +850,7 @@ public:
const char *
GetRestartedReasonAtIndex(size_t idx)
{
- if (idx > m_restarted_reasons.size())
- return NULL;
- else
- return m_restarted_reasons[idx].c_str();
+ return ((idx < m_restarted_reasons.size()) ? m_restarted_reasons[idx].c_str() : nullptr);
}
bool
@@ -923,22 +899,24 @@ public:
SetUpdateStateOnRemoval (Event *event_ptr);
private:
-
void
SetUpdateStateOnRemoval()
{
m_update_state++;
}
+
void
SetRestarted (bool new_value)
{
m_restarted = new_value;
}
+
void
SetInterrupted (bool new_value)
{
m_interrupted = new_value;
}
+
void
AddRestartedReason (const char *reason)
{
@@ -951,20 +929,10 @@ public:
bool m_restarted; // For "eStateStopped" events, this is true if the target was automatically restarted.
int m_update_state;
bool m_interrupted;
- DISALLOW_COPY_AND_ASSIGN (ProcessEventData);
+ DISALLOW_COPY_AND_ASSIGN (ProcessEventData);
};
-
-#endif
-
- static void
- SettingsInitialize ();
-
- static void
- SettingsTerminate ();
-
- static const ProcessPropertiesSP &
- GetGlobalProperties();
+#endif // SWIG
//------------------------------------------------------------------
/// Construct with a shared pointer to a target, and the Process listener.
@@ -986,6 +954,15 @@ public:
//------------------------------------------------------------------
~Process() override;
+ static void
+ SettingsInitialize ();
+
+ static void
+ SettingsTerminate ();
+
+ static const ProcessPropertiesSP &
+ GetGlobalProperties();
+
//------------------------------------------------------------------
/// Find a Process plug-in that can debug \a module using the
/// currently selected architecture.
@@ -998,7 +975,7 @@ public:
/// The module shared pointer that this process will debug.
///
/// @param[in] plugin_name
- /// If NULL, select the best plug-in for the binary. If non-NULL
+ /// If nullptr, select the best plug-in for the binary. If non-nullptr
/// then look for a plugin whose PluginInfo's name matches
/// this string.
///
@@ -1010,8 +987,6 @@ public:
Listener &listener,
const FileSpec *crash_file_path);
-
-
//------------------------------------------------------------------
/// Static function that can be used with the \b host function
/// Host::StartMonitoringChildProcess ().
@@ -1022,16 +997,16 @@ public:
/// Subclasses should call Host::StartMonitoringChildProcess ()
/// with:
/// callback = Process::SetHostProcessExitStatus
- /// callback_baton = NULL
+ /// callback_baton = nullptr
/// pid = Process::GetID()
/// monitor_signals = false
//------------------------------------------------------------------
static bool
- SetProcessExitStatus (void *callback_baton, // The callback baton which should be set to NULL
- lldb::pid_t pid, // The process ID we want to monitor
- bool exited,
- int signo, // Zero for no signal
- int status); // Exit value of process if signal is zero
+ SetProcessExitStatus(void *callback_baton, // The callback baton which should be set to nullptr
+ lldb::pid_t pid, // The process ID we want to monitor
+ bool exited,
+ int signo, // Zero for no signal
+ int status); // Exit value of process if signal is zero
lldb::ByteOrder
GetByteOrder () const;
@@ -1044,6 +1019,7 @@ public:
{
return m_process_unique_id;
}
+
//------------------------------------------------------------------
/// Check if a plug-in instance can debug the file in \a module.
///
@@ -1059,7 +1035,6 @@ public:
CanDebug (lldb::TargetSP target,
bool plugin_specified_by_name) = 0;
-
//------------------------------------------------------------------
/// This object is about to be destroyed, do any necessary cleanup.
///
@@ -1068,8 +1043,7 @@ public:
//------------------------------------------------------------------
virtual void
Finalize();
-
-
+
//------------------------------------------------------------------
/// Return whether this object is valid (i.e. has not been finalized.)
///
@@ -1100,7 +1074,7 @@ public:
virtual CommandObject *
GetPluginCommandObject()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -1188,7 +1162,7 @@ public:
///
/// @return
/// Returns a pointer to the SystemRuntime plugin for this Process
- /// if one is available. Else returns NULL.
+ /// if one is available. Else returns nullptr.
//------------------------------------------------------------------
virtual SystemRuntime *
GetSystemRuntime ();
@@ -1219,7 +1193,7 @@ public:
/// @param[in] strm
/// A stream where output intended for the user
/// (if the driver has a way to display that) generated during
- /// the connection. This may be NULL if no output is needed.A
+ /// the connection. This may be nullptr if no output is needed.A
///
/// @param[in] remote_url
/// The URL format that we are connecting to.
@@ -1323,6 +1297,7 @@ public:
void
RegisterNotificationCallbacks (const Process::Notifications& callbacks);
#endif
+
//------------------------------------------------------------------
/// Unregister for process and thread notifications.
///
@@ -1343,6 +1318,7 @@ public:
bool
UnregisterNotificationCallbacks (const Process::Notifications& callbacks);
#endif
+
//==================================================================
// Built in Process Control functions
//==================================================================
@@ -1492,7 +1468,7 @@ public:
/// @param[in] strm
/// A stream where output intended for the user
/// (if the driver has a way to display that) generated during
- /// the connection. This may be NULL if no output is needed.A
+ /// the connection. This may be nullptr if no output is needed.A
///
/// @param[in] remote_url
/// The URL format that we are connecting to.
@@ -1570,7 +1546,6 @@ public:
process_arch.Clear();
}
-
//------------------------------------------------------------------
/// Called after a process re-execs itself.
///
@@ -1635,7 +1610,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after launching a process.
///
@@ -1645,8 +1619,6 @@ public:
virtual void
DidLaunch () {}
-
-
//------------------------------------------------------------------
/// Called before resuming to a process.
///
@@ -1684,7 +1656,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after resuming a process.
///
@@ -1694,7 +1665,6 @@ public:
virtual void
DidResume () {}
-
//------------------------------------------------------------------
/// Called before halting to a process.
///
@@ -1733,7 +1703,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after halting a process.
///
@@ -1773,7 +1742,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after detaching from a process.
///
@@ -1826,7 +1794,6 @@ public:
virtual bool
DestroyRequiresHalt() { return true; }
-
//------------------------------------------------------------------
/// Called after sending a signal to a process.
///
@@ -1933,7 +1900,6 @@ public:
virtual void
ModulesDidLoad (ModuleList &module_list);
-
//------------------------------------------------------------------
/// Retrieve the list of shared libraries that are loaded for this process
///
@@ -1978,61 +1944,6 @@ public:
void
PrintWarningOptimization (const SymbolContext &sc);
-protected:
-
- void
- SetState (lldb::EventSP &event_sp);
-
- lldb::StateType
- GetPrivateState ();
-
- //------------------------------------------------------------------
- /// The "private" side of resuming a process. This doesn't alter the
- /// state of m_run_lock, but just causes the process to resume.
- ///
- /// @return
- /// An Error object describing the success or failure of the resume.
- //------------------------------------------------------------------
- Error
- PrivateResume ();
-
- //------------------------------------------------------------------
- // Called internally
- //------------------------------------------------------------------
- void
- CompleteAttach ();
-
- //------------------------------------------------------------------
- /// Print a user-visible warning one time per Process
- ///
- /// A facility for printing a warning to the user once per repeat_key.
- ///
- /// warning_type is from the Process::Warnings enums.
- /// repeat_key is a pointer value that will be used to ensure that the
- /// warning message is not printed multiple times. For instance, with a
- /// warning about a function being optimized, you can pass the CompileUnit
- /// pointer to have the warning issued for only the first function in a
- /// CU, or the Function pointer to have it issued once for every function,
- /// or a Module pointer to have it issued once per Module.
- ///
- /// Classes outside Process should call a specific PrintWarning method
- /// so that the warning strings are all centralized in Process, instead of
- /// calling PrintWarning() directly.
- ///
- /// @param [in] warning_type
- /// One of the types defined in Process::Warnings.
- ///
- /// @param [in] repeat_key
- /// A pointer value used to ensure that the warning is only printed once.
- /// May be nullptr, indicating that the warning is printed unconditionally
- /// every time.
- ///
- /// @param [in] fmt
- /// printf style format string
- //------------------------------------------------------------------
- void
- PrintWarning (uint64_t warning_type, void *repeat_key, const char *fmt, ...) __attribute__((format(printf, 4, 5)));
-
public:
//------------------------------------------------------------------
/// Get the exit status for a process.
@@ -2048,13 +1959,12 @@ public:
/// Get a textual description of what the process exited.
///
/// @return
- /// The textual description of why the process exited, or NULL
+ /// The textual description of why the process exited, or nullptr
/// if there is no description available.
//------------------------------------------------------------------
const char *
GetExitDescription ();
-
virtual void
DidExit ()
{
@@ -2345,7 +2255,6 @@ public:
return 0;
}
-
//------------------------------------------------------------------
/// Write all or part of a scalar value to memory.
///
@@ -2419,7 +2328,6 @@ public:
size_t
WriteMemory (lldb::addr_t vm_addr, const void *buf, size_t size, Error &error);
-
//------------------------------------------------------------------
/// Actually allocate memory in the process.
///
@@ -2442,7 +2350,6 @@ public:
return LLDB_INVALID_ADDRESS;
}
-
//------------------------------------------------------------------
/// The public interface to allocating memory in the process.
///
@@ -2465,11 +2372,9 @@ public:
/// The address of the allocated buffer in the process, or
/// LLDB_INVALID_ADDRESS if the allocation failed.
//------------------------------------------------------------------
-
lldb::addr_t
AllocateMemory (size_t size, uint32_t permissions, Error &error);
-
//------------------------------------------------------------------
/// Resolve dynamically loaded indirect functions.
///
@@ -2483,7 +2388,6 @@ public:
/// The address of the resolved function.
/// LLDB_INVALID_ADDRESS if the resolution failed.
//------------------------------------------------------------------
-
virtual lldb::addr_t
ResolveIndirectFunction(const Address *address, Error &error);
@@ -2608,7 +2512,6 @@ public:
/// @return
/// \btrue if the memory was deallocated, \bfalse otherwise.
//------------------------------------------------------------------
-
virtual Error
DoDeallocateMemory (lldb::addr_t ptr)
{
@@ -2617,7 +2520,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// The public interface to deallocating memory in the process.
///
@@ -2631,7 +2533,6 @@ public:
/// @return
/// \btrue if the memory was deallocated, \bfalse otherwise.
//------------------------------------------------------------------
-
Error
DeallocateMemory (lldb::addr_t ptr);
@@ -2761,7 +2662,6 @@ public:
return error;
}
-
virtual Error
DisableBreakpointSite (BreakpointSite *bp_site)
{
@@ -2770,7 +2670,6 @@ public:
return error;
}
-
// This is implemented completely using the lldb::Process API. Subclasses
// don't need to implement this function unless the standard flow of
// read existing opcode, write breakpoint opcode, verify breakpoint opcode
@@ -2807,7 +2706,6 @@ public:
Error
EnableBreakpointSiteByID (lldb::user_id_t break_id);
-
// BreakpointLocations use RemoveOwnerFromBreakpointSite to remove
// themselves from the owner's list of this breakpoint sites.
void
@@ -2902,11 +2800,11 @@ public:
// is set to the event which triggered the stop. If wait_always = false,
// and the process is already stopped, this function returns immediately.
lldb::StateType
- WaitForProcessToStop (const TimeValue *timeout,
- lldb::EventSP *event_sp_ptr = NULL,
- bool wait_always = true,
- Listener *hijack_listener = NULL,
- Stream *stream = NULL);
+ WaitForProcessToStop(const TimeValue *timeout,
+ lldb::EventSP *event_sp_ptr = nullptr,
+ bool wait_always = true,
+ Listener *hijack_listener = nullptr,
+ Stream *stream = nullptr);
uint32_t
GetIOHandlerID () const
@@ -2928,9 +2826,9 @@ public:
SyncIOHandler (uint32_t iohandler_id, uint64_t timeout_msec);
lldb::StateType
- WaitForStateChangedEvents (const TimeValue *timeout,
- lldb::EventSP &event_sp,
- Listener *hijack_listener); // Pass NULL to use builtin listener
+ WaitForStateChangedEvents(const TimeValue *timeout,
+ lldb::EventSP &event_sp,
+ Listener *hijack_listener); // Pass nullptr to use builtin listener
//--------------------------------------------------------------------------------------
/// Centralize the code that handles and prints descriptions for process state changes.
@@ -2953,9 +2851,9 @@ public:
HandleProcessStateChangedEvent (const lldb::EventSP &event_sp,
Stream *stream,
bool &pop_process_io_handler);
+
Event *
PeekAtStateChangedEvents ();
-
class
ProcessEventHijacker
@@ -2966,6 +2864,7 @@ public:
{
m_process.HijackProcessEvents (listener);
}
+
~ProcessEventHijacker ()
{
m_process.RestoreProcessEvents();
@@ -2974,6 +2873,7 @@ public:
private:
Process &m_process;
};
+
friend class ProcessEventHijacker;
friend class ProcessProperties;
//------------------------------------------------------------------
@@ -3000,27 +2900,6 @@ public:
void
RestoreProcessEvents ();
-private:
- //------------------------------------------------------------------
- /// This is the part of the event handling that for a process event.
- /// It decides what to do with the event and returns true if the
- /// event needs to be propagated to the user, and false otherwise.
- /// If the event is not propagated, this call will most likely set
- /// the target to executing again.
- /// There is only one place where this call should be called, HandlePrivateEvent.
- /// Don't call it from anywhere else...
- ///
- /// @param[in] event_ptr
- /// This is the event we are handling.
- ///
- /// @return
- /// Returns \b true if the event should be reported to the
- /// user, \b false otherwise.
- //------------------------------------------------------------------
- bool
- ShouldBroadcastEvent (Event *event_ptr);
-
-public:
const lldb::ABISP &
GetABI ();
@@ -3220,8 +3099,60 @@ public:
}
protected:
+ void
+ SetState (lldb::EventSP &event_sp);
+
+ lldb::StateType
+ GetPrivateState ();
//------------------------------------------------------------------
+ /// The "private" side of resuming a process. This doesn't alter the
+ /// state of m_run_lock, but just causes the process to resume.
+ ///
+ /// @return
+ /// An Error object describing the success or failure of the resume.
+ //------------------------------------------------------------------
+ Error
+ PrivateResume ();
+
+ //------------------------------------------------------------------
+ // Called internally
+ //------------------------------------------------------------------
+ void
+ CompleteAttach ();
+
+ //------------------------------------------------------------------
+ /// Print a user-visible warning one time per Process
+ ///
+ /// A facility for printing a warning to the user once per repeat_key.
+ ///
+ /// warning_type is from the Process::Warnings enums.
+ /// repeat_key is a pointer value that will be used to ensure that the
+ /// warning message is not printed multiple times. For instance, with a
+ /// warning about a function being optimized, you can pass the CompileUnit
+ /// pointer to have the warning issued for only the first function in a
+ /// CU, or the Function pointer to have it issued once for every function,
+ /// or a Module pointer to have it issued once per Module.
+ ///
+ /// Classes outside Process should call a specific PrintWarning method
+ /// so that the warning strings are all centralized in Process, instead of
+ /// calling PrintWarning() directly.
+ ///
+ /// @param [in] warning_type
+ /// One of the types defined in Process::Warnings.
+ ///
+ /// @param [in] repeat_key
+ /// A pointer value used to ensure that the warning is only printed once.
+ /// May be nullptr, indicating that the warning is printed unconditionally
+ /// every time.
+ ///
+ /// @param [in] fmt
+ /// printf style format string
+ //------------------------------------------------------------------
+ void
+ PrintWarning (uint64_t warning_type, void *repeat_key, const char *fmt, ...) __attribute__((format(printf, 4, 5)));
+
+ //------------------------------------------------------------------
// NextEventAction provides a way to register an action on the next
// event that is delivered to this process. There is currently only
// one next event action allowed in the process at one time. If a
@@ -3248,10 +3179,8 @@ protected:
}
virtual
- ~NextEventAction()
- {
- }
-
+ ~NextEventAction() = default;
+
virtual EventActionResult PerformAction (lldb::EventSP &event_sp) = 0;
virtual void HandleBeingUnshipped () {}
virtual EventActionResult HandleBeingInterrupted () = 0;
@@ -3260,6 +3189,7 @@ protected:
{
m_process->m_resume_requested = true;
}
+
protected:
Process *m_process;
};
@@ -3278,10 +3208,8 @@ protected:
public:
AttachCompletionHandler (Process *process, uint32_t exec_count);
- ~AttachCompletionHandler() override
- {
- }
-
+ ~AttachCompletionHandler() override = default;
+
EventActionResult PerformAction(lldb::EventSP &event_sp) override;
EventActionResult HandleBeingInterrupted() override;
const char *GetExitString() override;
@@ -3501,11 +3429,27 @@ protected:
void
LoadOperatingSystemPlugin(bool flush);
-private:
+private:
//------------------------------------------------------------------
- // For Process only
+ /// This is the part of the event handling that for a process event.
+ /// It decides what to do with the event and returns true if the
+ /// event needs to be propagated to the user, and false otherwise.
+ /// If the event is not propagated, this call will most likely set
+ /// the target to executing again.
+ /// There is only one place where this call should be called, HandlePrivateEvent.
+ /// Don't call it from anywhere else...
+ ///
+ /// @param[in] event_ptr
+ /// This is the event we are handling.
+ ///
+ /// @return
+ /// Returns \b true if the event should be reported to the
+ /// user, \b false otherwise.
//------------------------------------------------------------------
+ bool
+ ShouldBroadcastEvent (Event *event_ptr);
+
void ControlPrivateStateThread (uint32_t signal);
DISALLOW_COPY_AND_ASSIGN (Process);
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=251647&r1=251646&r2=251647&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Thu Oct 29 15:12:40 2015
@@ -13,6 +13,10 @@
// C Includes
// C++ Includes
#include <list>
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
// Other libraries and framework includes
// Project includes
@@ -233,7 +237,6 @@ private:
static void DisableASLRValueChangedCallback(void *target_property_ptr, OptionValue *);
static void DisableSTDIOValueChangedCallback(void *target_property_ptr, OptionValue *);
-private:
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
@@ -299,9 +302,7 @@ public:
const char *
GetPrefix () const
{
- if (m_prefix.empty())
- return NULL;
- return m_prefix.c_str();
+ return (m_prefix.empty() ? nullptr : m_prefix.c_str());
}
void
@@ -487,10 +488,7 @@ public:
bool
InvokeCancelCallback (lldb::ExpressionEvaluationPhase phase) const
{
- if (m_cancel_callback == nullptr)
- return false;
- else
- return m_cancel_callback (phase, m_cancel_callback_baton);
+ return ((m_cancel_callback != nullptr) ? m_cancel_callback(phase, m_cancel_callback_baton) : false);
}
// Allows the expression contents to be remapped to point to the specified file and line
@@ -513,9 +511,7 @@ public:
const char *
GetPoundLineFilePath () const
{
- if (m_pound_line_file.empty())
- return NULL;
- return m_pound_line_file.c_str();
+ return (m_pound_line_file.empty() ? nullptr : m_pound_line_file.c_str());
}
uint32_t
@@ -648,6 +644,8 @@ public:
DISALLOW_COPY_AND_ASSIGN (TargetEventData);
};
+ ~Target() override;
+
static void
SettingsInitialize ();
@@ -673,8 +671,8 @@ public:
// UpdateInstanceName ();
lldb::ModuleSP
- GetSharedModule (const ModuleSpec &module_spec,
- Error *error_ptr = NULL);
+ GetSharedModule(const ModuleSpec &module_spec,
+ Error *error_ptr = nullptr);
//----------------------------------------------------------------------
// Settings accessors
@@ -683,35 +681,6 @@ public:
static const lldb::TargetPropertiesSP &
GetGlobalProperties();
-private:
- //------------------------------------------------------------------
- /// Construct with optional file and arch.
- ///
- /// This member is private. Clients must use
- /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
- /// so all targets can be tracked from the central target list.
- ///
- /// @see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
- //------------------------------------------------------------------
- Target (Debugger &debugger,
- const ArchSpec &target_arch,
- const lldb::PlatformSP &platform_sp,
- bool is_dummy_target);
-
- // Helper function.
- bool
- ProcessIsValid ();
-
- // Copy breakpoints, stop hooks and so forth from the dummy target:
- void
- PrimeFromDummyTarget(Target *dummy_target);
-
- void
- AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
-
-public:
- ~Target() override;
-
Mutex &
GetAPIMutex ()
{
@@ -723,6 +692,7 @@ public:
void
CleanupProcess ();
+
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
@@ -782,7 +752,7 @@ public:
lldb::BreakpointSP
GetBreakpointByID (lldb::break_id_t break_id);
- // Use this to create a file and line breakpoint to a given module or all module it is NULL
+ // Use this to create a file and line breakpoint to a given module or all module it is nullptr
lldb::BreakpointSP
CreateBreakpoint (const FileSpecList *containingModules,
const FileSpec &file,
@@ -814,7 +784,7 @@ public:
bool internal,
bool request_hardware);
- // Use this to create a function breakpoint by regexp in containingModule/containingSourceFiles, or all modules if it is NULL
+ // Use this to create a function breakpoint by regexp in containingModule/containingSourceFiles, or all modules if it is nullptr
// When "skip_prologue is set to eLazyBoolCalculate, we use the current target
// setting, else we use the values passed in
lldb::BreakpointSP
@@ -825,7 +795,7 @@ public:
bool internal,
bool request_hardware);
- // Use this to create a function breakpoint by name in containingModule, or all modules if it is NULL
+ // Use this to create a function breakpoint by name in containingModule, or all modules if it is nullptr
// When "skip_prologue is set to eLazyBoolCalculate, we use the current target
// setting, else we use the values passed in.
// func_name_type_mask is or'ed values from the FunctionNameType enum.
@@ -840,12 +810,12 @@ public:
bool request_hardware);
lldb::BreakpointSP
- CreateExceptionBreakpoint (enum lldb::LanguageType language,
- bool catch_bp,
- bool throw_bp,
- bool internal,
- Args *additional_args = nullptr,
- Error *additional_args_error = nullptr);
+ CreateExceptionBreakpoint(enum lldb::LanguageType language,
+ bool catch_bp,
+ bool throw_bp,
+ bool internal,
+ Args *additional_args = nullptr,
+ Error *additional_args_error = nullptr);
// This is the same as the func_name breakpoint except that you can specify a vector of names. This is cheaper
// than a regular expression breakpoint in the case where you just want to set a breakpoint on a set of names
@@ -988,26 +958,6 @@ public:
lldb::addr_t
GetBreakableLoadAddress (lldb::addr_t addr);
-protected:
- //------------------------------------------------------------------
- /// Implementing of ModuleList::Notifier.
- //------------------------------------------------------------------
-
- void
- ModuleAdded(const ModuleList& module_list, const lldb::ModuleSP& module_sp) override;
-
- void
- ModuleRemoved(const ModuleList& module_list, const lldb::ModuleSP& module_sp) override;
-
- void
- ModuleUpdated(const ModuleList& module_list,
- const lldb::ModuleSP& old_module_sp,
- const lldb::ModuleSP& new_module_sp) override;
- void
- WillClearList(const ModuleList& module_list) override;
-
-public:
-
void
ModulesDidLoad (ModuleList &module_list);
@@ -1044,7 +994,7 @@ public:
///
/// @return
/// The shared pointer to the executable module which can
- /// contains a NULL Module object if no executable has been
+ /// contains a nullptr Module object if no executable has been
/// set.
///
/// @see DynamicLoader
@@ -1088,9 +1038,9 @@ public:
SetExecutableModule (lldb::ModuleSP& module_sp, bool get_dependent_files);
bool
- LoadScriptingResources (std::list<Error>& errors,
- Stream* feedback_stream = NULL,
- bool continue_on_error = true)
+ LoadScriptingResources(std::list<Error>& errors,
+ Stream* feedback_stream = nullptr,
+ bool continue_on_error = true)
{
return m_images.LoadScriptingResourcesInTarget(this,errors,feedback_stream,continue_on_error);
}
@@ -1220,12 +1170,12 @@ public:
// 2 - if there is a valid process, try and read from its memory
// 3 - if (prefer_file_cache == false) then read from object file cache
size_t
- ReadMemory (const Address& addr,
- bool prefer_file_cache,
- void *dst,
- size_t dst_len,
- Error &error,
- lldb::addr_t *load_addr_ptr = NULL);
+ ReadMemory(const Address& addr,
+ bool prefer_file_cache,
+ void *dst,
+ size_t dst_len,
+ Error &error,
+ lldb::addr_t *load_addr_ptr = nullptr);
size_t
ReadCStringFromMemory (const Address& addr, std::string &out_str, Error &error);
@@ -1397,10 +1347,10 @@ public:
class StopHook : public UserID
{
public:
- ~StopHook ();
-
StopHook (const StopHook &rhs);
-
+
+ ~StopHook ();
+
StringList *
GetCommandPointer ()
{
@@ -1575,6 +1525,23 @@ public:
protected:
//------------------------------------------------------------------
+ /// Implementing of ModuleList::Notifier.
+ //------------------------------------------------------------------
+
+ void
+ ModuleAdded(const ModuleList& module_list, const lldb::ModuleSP& module_sp) override;
+
+ void
+ ModuleRemoved(const ModuleList& module_list, const lldb::ModuleSP& module_sp) override;
+
+ void
+ ModuleUpdated(const ModuleList& module_list,
+ const lldb::ModuleSP& old_module_sp,
+ const lldb::ModuleSP& new_module_sp) override;
+ void
+ WillClearList(const ModuleList& module_list) override;
+
+ //------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
Debugger & m_debugger;
@@ -1616,6 +1583,31 @@ protected:
void *baton);
private:
+ //------------------------------------------------------------------
+ /// Construct with optional file and arch.
+ ///
+ /// This member is private. Clients must use
+ /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
+ /// so all targets can be tracked from the central target list.
+ ///
+ /// @see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
+ //------------------------------------------------------------------
+ Target (Debugger &debugger,
+ const ArchSpec &target_arch,
+ const lldb::PlatformSP &platform_sp,
+ bool is_dummy_target);
+
+ // Helper function.
+ bool
+ ProcessIsValid ();
+
+ // Copy breakpoints, stop hooks and so forth from the dummy target:
+ void
+ PrimeFromDummyTarget(Target *dummy_target);
+
+ void
+ AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
+
DISALLOW_COPY_AND_ASSIGN (Target);
};
Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=251647&r1=251646&r2=251647&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Thu Oct 29 15:12:40 2015
@@ -10,6 +10,14 @@
#ifndef liblldb_Thread_h_
#define liblldb_Thread_h_
+// C Includes
+// C++ Includes
+#include <memory>
+#include <string>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Core/Broadcaster.h"
@@ -38,7 +46,7 @@ public:
///
/// @return
/// A pointer to a regular expression to compare against symbols,
- /// or NULL if all symbols are allowed.
+ /// or nullptr if all symbols are allowed.
///
//------------------------------------------------------------------
const RegularExpression *
@@ -137,9 +145,9 @@ public:
private:
lldb::ThreadSP m_thread_sp;
StackID m_stack_id;
- DISALLOW_COPY_AND_ASSIGN (ThreadEventData);
+
+ DISALLOW_COPY_AND_ASSIGN (ThreadEventData);
};
-
struct ThreadStateCheckpoint
{
@@ -150,15 +158,6 @@ public:
lldb::addr_t current_inlined_pc;
};
- static void
- SettingsInitialize ();
-
- static void
- SettingsTerminate ();
-
- static const ThreadPropertiesSP &
- GetGlobalProperties();
-
//------------------------------------------------------------------
/// Constructor
///
@@ -180,6 +179,15 @@ public:
~Thread() override;
+ static void
+ SettingsInitialize ();
+
+ static void
+ SettingsTerminate ();
+
+ static const ThreadPropertiesSP &
+ GetGlobalProperties();
+
lldb::ProcessSP
GetProcess() const
{
@@ -322,7 +330,7 @@ public:
virtual const char *
GetInfo ()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -350,7 +358,7 @@ public:
virtual const char *
GetName ()
{
- return NULL;
+ return nullptr;
}
virtual void
@@ -392,12 +400,12 @@ public:
///
/// @return
/// The Queue name, if the Thread subclass implements this, else
- /// NULL.
+ /// nullptr.
//------------------------------------------------------------------
virtual const char *
GetQueueName ()
{
- return NULL;
+ return nullptr;
}
virtual void
@@ -477,7 +485,7 @@ public:
ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast = false);
Error
- JumpToLine (const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings = NULL);
+ JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings = nullptr);
virtual lldb::StackFrameSP
GetFrameWithStackID (const StackID &stack_id)
@@ -499,7 +507,6 @@ public:
uint32_t
SetSelectedFrame (lldb_private::StackFrame *frame, bool broadcast = false);
-
bool
SetSelectedFrameByIndex (uint32_t frame_idx, bool broadcast = false);
@@ -606,6 +613,7 @@ public:
//------------------------------------------------------------------
virtual Error
StepOut ();
+
//------------------------------------------------------------------
/// Retrieves the per-thread data area.
/// Most OSs maintain a per-thread pointer (e.g. the FS register on
@@ -682,7 +690,7 @@ public:
/// Otherwise this plan will go on the end of the plan stack.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueFundamentalPlan (bool abort_other_plans);
@@ -701,7 +709,7 @@ public:
/// \b true if we will stop other threads while we single step this one.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepSingleInstruction (bool step_over,
@@ -737,7 +745,7 @@ public:
/// If eLazyBoolCalculate, we will consult the default set in the thread.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepOverRange (bool abort_other_plans,
@@ -781,7 +789,7 @@ public:
/// If eLazyBoolCalculate, it will consult the default set in the thread.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepInRange (bool abort_other_plans,
@@ -822,7 +830,7 @@ public:
/// If eLazyBoolCalculate, it will consult the default set in the thread.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepOut (bool abort_other_plans,
@@ -861,7 +869,7 @@ public:
/// See standard meanings for the stop & run votes in ThreadPlan.h.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepOutNoShouldStop (bool abort_other_plans,
@@ -889,7 +897,7 @@ public:
/// \b true if we will stop other threads while we single step this one.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepThrough (StackID &return_stack_id,
@@ -912,7 +920,7 @@ public:
/// \b true if we will stop other threads while we single step this one.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForRunToAddress (bool abort_other_plans,
@@ -955,15 +963,6 @@ public:
Error
UnwindInnermostExpression();
-private:
- bool
- PlanIsBasePlan (ThreadPlan *plan_ptr);
-
- void
- BroadcastSelectedFrameChange(StackID &new_frame_id);
-
-public:
-
//------------------------------------------------------------------
/// Gets the outer-most plan that was popped off the plan stack in the
/// most recent stop. Useful for printing the stop reason accurately.
@@ -1039,7 +1038,6 @@ public:
void
QueueThreadPlan (lldb::ThreadPlanSP &plan_sp, bool abort_other_plans);
-
//------------------------------------------------------------------
/// Discards the plans queued on the plan stack of the current thread. This is
/// arbitrated by the "Master" ThreadPlans, using the "OkayToDiscard" call.
@@ -1269,7 +1267,6 @@ public:
}
protected:
-
friend class ThreadPlan;
friend class ThreadList;
friend class ThreadEventData;
@@ -1321,7 +1318,6 @@ protected:
lldb::StackFrameListSP
GetStackFrameList ();
-
void
FunctionOptimizationWarning (lldb_private::StackFrame *frame);
@@ -1354,10 +1350,14 @@ protected:
private:
bool m_extended_info_fetched; // Have we tried to retrieve the m_extended_info for this thread?
StructuredData::ObjectSP m_extended_info; // The extended info for this thread
- //------------------------------------------------------------------
- // For Thread only
- //------------------------------------------------------------------
+private:
+ bool
+ PlanIsBasePlan (ThreadPlan *plan_ptr);
+
+ void
+ BroadcastSelectedFrameChange(StackID &new_frame_id);
+
DISALLOW_COPY_AND_ASSIGN (Thread);
};
More information about the lldb-commits
mailing list